Commit bba2421e by wong.peiyi

消耗确认添加部门、医生和跟台员

parent 4e96620a
......@@ -152,7 +152,7 @@ export function setSubdetailOption(data) {
}
}
// 设置当前费用明细
// 设置当前费用明细
export function setCharDetailsOption(data) {
return {
type: SET_CHARGE_DETAILS_OPTION,
......@@ -171,6 +171,10 @@ export const uploadEquipImg = async (global_domain_config, params) => {
return await UploadRequest(global_domain_config, getUrlParams('/dingding/upload_media', { access_token }), formData)
}
export const reqOrgDepartments = async (global_domain_config, params) => {
return await GetRequest(global_domain_config, getUrlParams('/sale/sale_relationship/search', params))
}
// 提交数据
export function requestEquipSumbit({access_token, ...params}) {
return (dispatch, getState) => {
......@@ -226,4 +230,4 @@ export function setEquipInitData() {
return {
type: EQUIP_INIT_DATA
}
}
\ No newline at end of file
}
......@@ -9,14 +9,15 @@ import { dedupQuoteArray, show, formatStrForDate, cloneObject } from '../../util
import DateModel from '../common/DateModel';
import DialogModel from '../common/DialogModel';
import ZoomPictureModel from '../common/ZoomPictureModel';
import { requestEquipOrganizations, requestEquipSurgeryHospital, requestEquipOrderInfo, uploadEquipImg, setSubdetailOption, setCharDetailsOption, requestEquipSumbit, setEquipInitData, reqEquipSurgeryHospital, reqEquipOrderInfo, requestListDataSuccess, reqEquipOrganizations, requestEquipDetails } from '../../action/EquipAction';
import { requestEquipOrganizations, requestEquipSurgeryHospital, requestEquipOrderInfo, uploadEquipImg, setSubdetailOption, setCharDetailsOption, requestEquipSumbit, setEquipInitData, reqEquipSurgeryHospital, reqEquipOrderInfo, requestListDataSuccess, reqEquipOrganizations, requestEquipDetails, reqOrgDepartments } from '../../action/EquipAction';
import { EQUIP_CONSU_LIST_DOING, EQUIP_CONSU_LIST_SUCCESS, EQUIP_CONSU_LIST_FAILURE, LOGIN_NO, EQUIP_SUBMIT_DOING, EQUIP_SUBMIT_SUCCESS, EQUIP_SUBMIT_FAILURE } from '../../base/ActionTypes';
import moment from 'moment';
import ImagePicker from 'react-native-image-picker';
import { exitLoginStatus } from '../../action/LoginAction';
import { exitLoginStatus, requestSysProfile } from '../../action/LoginAction';
import LodingModel from '../common/LodingModel';
import { OBS_MOBILE_EQU_CON_DISPLAY_PRICE } from '../../base/BaseConstants';
import PageListArrow from '../common/listDataComponent/PageListArrow';
import * as R from 'ramda';
class EquipConsuPage extends Component {
constructor(props) {
......@@ -114,7 +115,25 @@ class EquipConsuPage extends Component {
value: '',
isAddImage: true, // 添加图片
uploadImgArr: [] // 上传后的路径
}
},
{
"id": "15",
title: '部门',
name: '请选择',
value: ''
},
{
"id": "16",
title: '医生',
value: ''
},
{
"id": "17",
title: '跟台员',
name: '请选择',
value: ''
},
],
subInitListOption: [], // 提交成功后,初始化当前数据
submitOption: { // 提交的信息
......@@ -159,11 +178,19 @@ class EquipConsuPage extends Component {
localPhoOption: [ // 添加的图片
],
isShowImage: false,
currShowImgIndex: 0
currShowImgIndex: 0,
sysValues: {
OBS_MOBILE_CONSU_DEPARTMENT_DISPLAY: 0,
OBS_MOBILE_CONSU_DOCTOR_DISPLAY: 0,
OBS_MOBILE_CONSU_FOLLOW_DISPLAY: 0
},
localDoctors: [],
localFollowers: []
}
}
componentDidMount() {
this.getSysProfileValue()
this.getSellerName()
this.initSetOptsValue()
this.getOrganizationData()
......@@ -275,6 +302,33 @@ class EquipConsuPage extends Component {
}
}
/**
* 获取系统配置
*/
getSysProfileValue() {
let { global_domain_config, token} = this.props
const {sysValues} = this.state
const getSysProfile = async (code) => {
const params = {
access_token: token,
profile_code: code
}
let res = await requestSysProfile(global_domain_config, params)
console.log('sysRes:==', res)
if(res && res.error_code === 0){
const value = res.data.profile_value
sysValues[code] = isNaN(value) ? value : Number(value)
this.setState({ sysValues }, () => {
console.log(sysValues)
})
}
}
R.compose(R.map(getSysProfile), R.keys)(sysValues)
}
// 修改正在加载
changeSubLoding(loading, loadTit) {
this.setState({
......@@ -284,13 +338,13 @@ class EquipConsuPage extends Component {
}
// 清空当前项以下的选择器值,以及耗材明细
clearInitNameAndValue(curIndex) {
clearInitNameAndValue(curIndex, endIndex = 4) {
let { listOptionData, localOtherObj } = this.state
let { props } = this
let that = this
this.setState({
listOptionData: listOptionData.map((item, index) => {
if(index > curIndex && index < 4 ) {
if(index > curIndex && index < endIndex ) {
item.name = localOtherObj.name
item.value = localOtherObj.value
if(listOptionData[1].value && item.title == '客户名称') {
......@@ -315,7 +369,7 @@ class EquipConsuPage extends Component {
// 判断是否都有值,修改提交按钮的颜色
changeCanSub(isSubCheck) {
let { listOptionData } = this.state
let { listOptionData, sysValues } = this.state
let tempStatus = false
let tempTit = ''
for(let chIndex in listOptionData) {
......@@ -339,6 +393,18 @@ class EquipConsuPage extends Component {
tempTit = `“${listOptionData[chIndex].title}”未添加`
tempStatus = true
break
} else if ( sysValues.OBS_MOBILE_CONSU_DEPARTMENT_DISPLAY == 3 && chIndex == 15 && !listOptionData[15].value) {
tempTit = `“${listOptionData[chIndex].title}”未选择`
tempStatus = true
break
} else if (sysValues.OBS_MOBILE_CONSU_FOLLOW_DISPLAY == 3 && chIndex == 17 && !listOptionData[17].value) {
tempTit = `“${listOptionData[chIndex].title}”未选择`
tempStatus = true
break
} else if (sysValues.OBS_MOBILE_CONSU_DOCTOR_DISPLAY == 3 && chIndex == 16 && !listOptionData[16].value) {
tempTit = `“${listOptionData[chIndex].title}”未输入`
tempStatus = true
break
}
}
this.setState({
......@@ -351,7 +417,7 @@ class EquipConsuPage extends Component {
// 选择器弹窗回调函数
handleCallBack(item, itemTitle) {
let { listOptionData} = this.state
let { listOptionData, sysValues} = this.state
let that = this
this.setState({
currentItem: item,
......@@ -363,13 +429,20 @@ class EquipConsuPage extends Component {
chItem.value = item.value
if(itemTitle === '组织') {
that.clearInitNameAndValue(1)
that.clearInitNameAndValue(14, 18)
that.getDepartmentsByOrg(item.value)
}
if (itemTitle === '部门') {
that.clearInitNameAndValue(16, 18)
}
if(itemTitle === '客户名称') {
that.clearInitNameAndValue(2)
that.clearInitNameAndValue(15, 18)
}
if(itemTitle === '订单信息') {
that.clearInitNameAndValue(3)
that.getCurOrderDetail()
that.autoSetDoctorAndFollower()
}
}
return chItem
......@@ -416,15 +489,29 @@ class EquipConsuPage extends Component {
equipOrderOption.forEach(item => {
let obj = {}
let collect_number = item.collect_number ? item.collect_number : '空'
let surgery_name = item.surgery_name ? item.surgery_name : ''
let surgery_name = item.surgery_name ? item.surgery_name : ''
let create_time = item.create_time ? moment(item.create_time).format("YYYY-MM-DD") : '空'
let tempName = `${collect_number}-${surgery_name}-${create_time}`
let tempName = `${collect_number}-${surgery_name}-${item.doctor_name ? (item.doctor_name + '-') : ''}${create_time}`
obj.name = tempName,
obj.value = item.collect_number
resultArr.push(obj)
})
tempOption = [...resultArr]
const doctors = R.map(R.applySpec({
collect_number: R.prop('collect_number'),
doctor_name: R.prop('doctor_name'),
}))(equipOrderOption)
const followers = R.map(R.applySpec({
collect_number: R.prop('collect_number'),
surgery_follower_code: R.prop('surgery_follower_code'),
surgery_follower_name: R.prop('surgery_follower_name'),
}))(equipOrderOption)
this.setState({
localDoctors: doctors,
localFollowers: followers
})
}
this.setState({
listCurrentOption: [...tempOption]
......@@ -466,6 +553,53 @@ class EquipConsuPage extends Component {
props.requestEquipOrganizations(params)
})
}
/**
* 部门和跟台员点击
* @param {*} curData
* @param {*} objName
* @param {*} itemName
* @param {*} itemVal
* @returns
*/
handItemClickCheck(curData, objName, itemName, itemVal) {
if (!this.judgeOrgIsNull()) return
const {listOptionData, departments} = this.state
let options = this.state[objName]
if (objName === 'localFollowers' && !this.judgeCustomerIsNull() && !this.judgeOrderInfoIsNull()) return
if (objName === 'localFollowers') {
const code = listOptionData[15].value
const dep = R.find(R.propEq('department_code', code))(departments)
const followers = R.propOr([], 'surgery_follower_list')(dep)
options = R.compose(
R.map(R.head),
R.values,
R.groupBy(R.prop('surgery_follower_code')),
R.concat(followers)
)(options)
}
const listOptions = R.map(R.applySpec({
name: R.prop(itemName),
value: R.prop(itemVal)
}))(options)
this.setState({
currentTitle: curData.title,
currentItem: {
name: curData.name,
value: curData.value
},
showTypePop: true,
listCurrentOption: listOptions
}, () => {
this.changeCanSub()
})
}
async getOrganizationData() {
let { state, props } = this
let params = {
......@@ -490,6 +624,7 @@ class EquipConsuPage extends Component {
listOptionData
}, () => {
that.organizationGetCustomerData()
that.getDepartmentsByOrg(listOptionData[1].value)
})
}
} else if (orgResult.error_code == 41006) {
......@@ -501,6 +636,44 @@ class EquipConsuPage extends Component {
}
}
/**
* 根据组织获取部门等信息, 其他信息在部门下面
* @param {*} org_code
*/
async getDepartmentsByOrg(org_code) {
const {token, global_domain_config, userInfo} = this.props
const params = {
access_token: token,
org_code,
seller_code: userInfo.user_name,
scope_flag: 'Y'
}
try {
const res = await reqOrgDepartments(global_domain_config, params)
console.log('deparments: ', res)
let departments = res.data.relationships
this.setState({ departments })
const {listOptionData, sysValues} = this.state
const noop = () => {}
// 部门只有一个时直接设置
R.cond([
[R.equals(0), () => setTimeout(() => show('当前组织没有部门信息'), 4000)],
[R.equals(1), () => {
const dep = R.head(departments)
listOptionData[15].name = dep.department_name
listOptionData[15].value = dep.department_code
this.setState({ listOptionData })
}],
[R.T, noop]
])(R.length(departments))
} catch (error) {
console.log(error)
}
}
// 客户名称 点击
handleCustomerCheck(curData) {
let that = this
......@@ -610,17 +783,36 @@ class EquipConsuPage extends Component {
show(`当前${listOptionData[3].title}为空`)
return
}
// 保存医生和跟台员信息
const doctors = R.map(R.applySpec({
collect_number: R.prop('collect_number'),
doctor_name: R.prop('doctor_name'),
}))(surgery_collect_headers)
const followers = R.map(R.applySpec({
collect_number: R.prop('collect_number'),
surgery_follower_code: R.prop('surgery_follower_code'),
surgery_follower_name: R.prop('surgery_follower_name'),
}))(surgery_collect_headers)
this.setState({
localDoctors: doctors,
localFollowers: followers
})
if(surgery_collect_headers.length === 1) {
let doctor_name = surgery_collect_headers[0].doctor_name ? surgery_collect_headers[0].doctor_name + '-' : ''
let collect_number = surgery_collect_headers[0].collect_number ? surgery_collect_headers[0].collect_number : '空'
let surgery_name = surgery_collect_headers[0].surgery_name ? surgery_collect_headers[0].surgery_name : '空'
let create_time = surgery_collect_headers[0].create_time ? moment(surgery_collect_headers[0].create_time).format("YYYY-MM-DD") : '空'
let tempName = `${collect_number}-${surgery_name}-${create_time}`
let tempName = `${collect_number}-${surgery_name}-${doctor_name}${create_time}`
listOptionData[3].name = tempName
listOptionData[3].value = surgery_collect_headers[0].collect_number
that.setState({
listOptionData
}, () => {
that.getCurOrderDetail()
this.autoSetDoctorAndFollower()
})
}
} else if(cusResult.error_code == 41006) {
......@@ -632,6 +824,23 @@ class EquipConsuPage extends Component {
}
}
/**
* 自动填充医生和跟台员
*/
autoSetDoctorAndFollower() {
const {listOptionData, localDoctors, localFollowers} = this.state
let collect_number = listOptionData[3].value
const doctor = R.find(R.propEq('collect_number', collect_number))(localDoctors)
listOptionData[16].value = doctor && doctor.doctor_name
const follower = R.find(R.propEq('collect_number', collect_number))(localFollowers)
if (follower) {
listOptionData[17].value = follower.surgery_follower_code
listOptionData[17].name = follower.surgery_follower_name
}
this.setState({listOptionData})
}
// 获取当前订单的消耗明细
async getCurOrderDetail() {
let {listOptionData} = this.state
......@@ -705,6 +914,20 @@ class EquipConsuPage extends Component {
})
}
/**
* 医生输入
* @param {*} text
* @param {*} curData
*/
handleDoctorInput(text, curData) {
let {listOptionData} = this.state
listOptionData[16] = R.compose(
R.assoc('value', text),
R.find(R.propEq('title', curData.title))
)(listOptionData)
this.setState({ listOptionData }, () => this.changeCanSub())
}
// 患者姓名 输入
handlePatNameInput(text, curData) {
let { listOptionData } = this.state
......@@ -984,6 +1207,8 @@ class EquipConsuPage extends Component {
this.changeCanSub(true)
let { state, props } = this
const { sysValues } = state
// 可提交 并且 不处于正在提交中
if(state.canSubFlag && !state.isSubLoding) {
let tempSubOption = state.submitOption
......@@ -998,6 +1223,12 @@ class EquipConsuPage extends Component {
// tempSubOption.settled_flag = state.listOptionData[10].isRedio
tempSubOption.remark = state.listOptionData[11].value
tempSubOption.lines = state.listOptionData[12].subOption
// 部门等信息
sysValues.OBS_MOBILE_CONSU_DEPARTMENT_DISPLAY > 0 && (tempSubOption.department_code = state.listOptionData[15].value)
sysValues.OBS_MOBILE_CONSU_DOCTOR_DISPLAY > 0 && (tempSubOption.doctor_name = state.listOptionData[16].value)
sysValues.OBS_MOBILE_CONSU_FOLLOW_DISPLAY > 0 && (tempSubOption.surgery_follower_code = state.listOptionData[17].value)
if(state.listOptionData[13].subOption && state.listOptionData[13].subOption.length > 0){
tempSubOption.fee_lines = []
state.listOptionData[13].subOption.forEach(item => {
......@@ -1042,6 +1273,11 @@ class EquipConsuPage extends Component {
return this.showTipFirstSelect(3)
}
// 判断订单信息是否为空
judgeDepartmentIsNull() {
return this.showTipFirstSelect(15)
}
// 提示请先选择
showTipFirstSelect(ind) {
let { listOptionData } = this.state
......@@ -1095,7 +1331,7 @@ class EquipConsuPage extends Component {
// 返回备注以上的元素
renderListItem() {
let { listOptionData, dateModelPop } = this.state
let { listOptionData, dateModelPop, sysValues } = this.state
return(
<View style={styles.list_cont}>
<PageListArrow
......@@ -1115,6 +1351,19 @@ class EquipConsuPage extends Component {
listCallBack={() => this.handleOrganizationCheck(listOptionData[1])}
listHasArrow={true}
/>
{
sysValues.OBS_MOBILE_CONSU_DEPARTMENT_DISPLAY > 0 && (
<PageListArrow
listActOpa={.8}
listHasAster={true}
listItem={listOptionData[15]}
listName={'name'}
listTitle={'title'}
listCallBack={() => this.handItemClickCheck(listOptionData[15], 'departments', 'department_name', 'department_code')}
listHasArrow={true}
/>
)
}
<PageListArrow
listActOpa={.8}
listHasAster={true}
......@@ -1133,6 +1382,19 @@ class EquipConsuPage extends Component {
listCallBack={() => this.handleOrderInfoCheck(listOptionData[3])}
listHasArrow={true}
/>
{
sysValues.OBS_MOBILE_CONSU_FOLLOW_DISPLAY > 0 && (
<PageListArrow
listActOpa={.8}
listHasAster={true}
listItem={listOptionData[17]}
listName={'name'}
listTitle={'title'}
listCallBack={() => this.handItemClickCheck(listOptionData[17], 'localFollowers', 'surgery_follower_name', 'surgery_follower_code')}
listHasArrow={true}
/>
)
}
<PageListArrow
listActOpa={.8}
listHasAster={true}
......@@ -1142,6 +1404,21 @@ class EquipConsuPage extends Component {
listCallBack={() => this.handleEquipDateCheck(listOptionData[4])}
listHasArrow={true}
/>
{
sysValues.OBS_MOBILE_CONSU_DOCTOR_DISPLAY > 0 && (
<PageListArrow
listActOpa={.8}
listHasAster={true}
listItem={listOptionData[16]}
listDefaValue={'value'}
listTitle={'title'}
listInputPlace={`请输入${listOptionData[16].title}`}
inputCallBack={(text) => this.handleDoctorInput(text, listOptionData[16])}
isTitInputStyle={true}
listCellStyle={styles.list_cell_box}
/>
)
}
<PageListArrow
listActOpa={.8}
listHasAster={true}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment