diff --git a/src/components/patientRegister/PatientRegisterEdit.vue b/src/components/patientRegister/PatientRegisterEdit.vue index d233136..31b4ccb 100644 --- a/src/components/patientRegister/PatientRegisterEdit.vue +++ b/src/components/patientRegister/PatientRegisterEdit.vue @@ -899,7 +899,7 @@ export default { }; }, - async created() { + created() { //获取用户当前页面的权限 let userPriv = window.sessionStorage.getItem('userPriv') if (userPriv) this.pagePriv.privs = deepCopy(getPagePriv(this.pagePriv.routeUrlorPageName)) @@ -929,7 +929,7 @@ export default { this.formInit = deepCopy(this.form) // 初始化字典数据 - await this.dictInit() + this.dictInit() }, //挂载完成 @@ -982,17 +982,16 @@ export default { btnTest() { // console.log('form', this.form) }, + //数据初始化 - async dictInit() { - try { - let sysParmId = "patient_register_occ_check_id" - let sysParm = await postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId }) - if (sysParm.code > -1) { - this.patient_register_occ_check_id = sysParm.data - } - } catch (error) { - console.log('sysParmId:patient_register_occ_check_id', error) - } + dictInit() { + + let sysParmId = "patient_register_occ_check_id" + postapi('/api/app/SysParmValue/GetSysParmValueBySysParmId', { sysParmId }) + .then(res => { + if (res.code > -1) this.patient_register_occ_check_id = res.data + }) + //性别(仅档案用) getapi("/api/app/sex").then((res) => { @@ -1203,63 +1202,77 @@ export default { }, // 获取登记信息 初始form表单数据 - async initFormData(patientRegisterId) { - this.peisid = window.sessionStorage.getItem('peisid'); - let customerOrgId, customerOrgName, customerOrgParentId - if (this.patientRegister.query.customerOrgId) { - customerOrgParentId = this.patientRegister.query.CustomerOrgParentId - customerOrgId = this.patientRegister.query.customerOrgId - customerOrgName = this.patientRegister.query.customerOrgName - } else { - customerOrgParentId = this.form.customerOrgParentId - customerOrgId = this.form.customerOrgId - customerOrgName = this.form.customerOrgName - } - this.preCustomerOrgId = this.patientRegister.query.customerOrgId - if (!patientRegisterId) { //添加 - this.peoplePhoto = '' // 清掉照片 - this.form = Object.assign({}, this.form, this.formInit) - this.form.registerCheckAsbitems = [] - this.form.medicalCenterId = this.peisid; //体检中收 - this.form.customerOrgId = customerOrgId //体检单位 - this.form.customerOrgParentId = customerOrgParentId //体检父单位 - this.form.customerOrgName = customerOrgName - this.handleFormData() - this.completeFlag = '0' - } else { - // let res = await getapi(`/api/app/patient-register/${patientRegisterId}`) - postapi('/api/app/patientregister/getinfoorpatient', { patientRegisterId }).then(res => { - if (res.code > -1) { - // this.form = res.data 这种方式,会造成 checkbox 值变化不响应,故取消 - this.form = Object.assign({}, this.form, res.data) - this.completeFlag = this.form.completeFlag - this.handleFormData() - } - }) - } + initFormData(patientRegisterId) { + return new Promise((resolve, reject) => { + this.peisid = window.sessionStorage.getItem('peisid'); + let customerOrgId, customerOrgName, customerOrgParentId + if (this.patientRegister.query.customerOrgId) { + customerOrgParentId = this.patientRegister.query.CustomerOrgParentId + customerOrgId = this.patientRegister.query.customerOrgId + customerOrgName = this.patientRegister.query.customerOrgName + } else { + customerOrgParentId = this.form.customerOrgParentId + customerOrgId = this.form.customerOrgId + customerOrgName = this.form.customerOrgName + } + this.preCustomerOrgId = this.patientRegister.query.customerOrgId + if (!patientRegisterId) { //添加 + this.peoplePhoto = '' // 清掉照片 + this.form = Object.assign({}, this.form, this.formInit) + this.form.registerCheckAsbitems = [] + this.form.medicalCenterId = this.peisid; //体检中收 + this.form.customerOrgId = customerOrgId //体检单位 + this.form.customerOrgParentId = customerOrgParentId //体检父单位 + this.form.customerOrgName = customerOrgName + this.completeFlag = '0' + this.handleFormData().then(() => { + resolve() + }) + + } else { + // let res = await getapi(`/api/app/patient-register/${patientRegisterId}`) + postapi('/api/app/patientregister/getinfoorpatient', { patientRegisterId }) + .then(res => { + if (res.code > -1) { + // this.form = res.data 这种方式,会造成 checkbox 值变化不响应,故取消 + this.form = Object.assign({}, this.form, res.data) + this.completeFlag = this.form.completeFlag + this.handleFormData().then(() => resolve()) + } + }) + .catch(() => resolve()) + } + }) }, handleFormData() { - // 判断是否职业健康检查 - this.changeMedicalTypeId(this.form.medicalTypeId) - if (this.form.isPatientOccupationalDisease == 'Y') { - this.getOccDiseaseData() - } - - // 处理照片 - this.getPeoplePhoto(this.form.photo) + return new Promise((resolve, reject) => { + // 判断是否职业健康检查 + this.changeMedicalTypeId(this.form.medicalTypeId) + if (this.form.isPatientOccupationalDisease == 'Y') { + this.getOccDiseaseData() + } - // this.dataTransOpts.refresh.register_check_asbitem.D++ //触发所选组合项目刷新 (取消这种触发,减少交互) - this.dataTransOpts.tableM.register_check_asbitem = this.form.registerCheckAsbitems - this.dataTransOpts.tableM.register_check_asbitem.forEach(e => { - e.standTotal = e.amount * e.standardPrice - e.total = e.amount * e.chargePrice - }); + // 处理照片 + this.getPeoplePhoto(this.form.photo) - // 单位/个人 的分组与套餐处理 - this.changeCustomerOrgId(this.form.customerOrgId) + // this.dataTransOpts.refresh.register_check_asbitem.D++ //触发所选组合项目刷新 (取消这种触发,减少交互) + this.dataTransOpts.tableM.register_check_asbitem = this.form.registerCheckAsbitems + this.dataTransOpts.tableM.register_check_asbitem.forEach(e => { + e.standTotal = e.amount * e.standardPrice + e.total = e.amount * e.chargePrice + }); - this.dataTransOpts.refresh.register_check_asbitem.OnlyRefreshAsbitem++ + // 单位/个人 的分组与套餐处理 + this.changeCustomerOrgId(this.form.customerOrgId) + .then(() => { + // 刷新明细项目(已登记) + this.dataTransOpts.refresh.register_check_asbitem.OnlyRefreshAsbitem++ + }) + .finally(() => { + resolve() + }) + }) }, @@ -1279,100 +1292,125 @@ export default { } }, - //选择单位 - async changeCustomerOrgId(v) { - console.log('changeCustomerOrgId', v, this.form.customerOrgParentId) - let customerOrgId = "", customerOrgParentId = "" - if (Array.isArray(v) && v.length > 0) { - customerOrgId = v[v.length - 1] - customerOrgParentId = v[0] - } else { - customerOrgId = v // 后台顶级单位ID未获取正确(再获取一次) - customerOrgParentId = await this.getParentCustomerOrgId(customerOrgId) - // let pids = getTreePids(this.patientRegister.customerOrgTreeAll, "treeChildren", "parentId", "id", customerOrgId) - // if (Array.isArray(pids) && pids.length > 0) { - // if (pids.length == 1) { - // customerOrgParentId = customerOrgId - // } else { - // customerOrgParentId = pids[1] - // } - // } - } - this.preCustomerOrgId = customerOrgId - - - if (customerOrgParentId) { - if (customerOrgParentId == this.dict.personOrgId) { - // 个人体检则 固定单位体检次数 - this.form.customerOrgRegisterId = "00000000-0000-0000-0000-000000000001" + //选择单位,并返回顶级单位 + changeCustomerOrgId(v) { + // 始终返回 reslove ,主要用于流程控制 + return new Promise((resolve, reject) => { + console.log('changeCustomerOrgId', v, this.form.customerOrgParentId) + let customerOrgId = "", customerOrgParentId = "" + if (Array.isArray(v) && v.length > 0) { + customerOrgId = v[v.length - 1] } else { - // 获取体检次数字典库 - this.getCustomerOrgRegisterList(customerOrgParentId) + customerOrgId = v // 后台顶级单位ID未获取正确(再获取一次) } + // 保留之前预选的单位 if (!this.preCustomerOrgId) + this.preCustomerOrgId = customerOrgId - // 需要触发 修改 分组/套餐 顶级ID 没有变时,不改变套餐与分组 - if (customerOrgParentId != this.form.customerOrgParentId) { - this.form.customerOrgGroupId = null - this.form.medicalPackageId = null - // 清除套餐分组标识 - this.dataTransOpts.tableM.register_check_asbitem.forEach(e => { - e.isBelongGroupPackage = 'N' - }); + this.getParentCustomerOrgId(v) + .then(res => { + if (res) { + customerOrgParentId = res + // 获取并设置体检次数(个人的固定 "00000000-0000-0000-0000-000000000001" ),单位刷新分组字典 + this.getCustomerOrgRegisterList(customerOrgParentId) + .then(() => { + // 需要触发 修改 分组/套餐 顶级ID 没有变时,不改变套餐与分组 + if (customerOrgParentId != this.form.customerOrgParentId) { + this.form.customerOrgGroupId = null + this.form.medicalPackageId = null + // 清除套餐分组标识 + this.dataTransOpts.tableM.register_check_asbitem.forEach(e => { + e.isBelongGroupPackage = 'N' + }); - if (customerOrgParentId == this.dict.personOrgId) { - this.patientRegister.customerOrgGroup = [] - } + // 如果是个人,则清除分组字典 + if (customerOrgParentId == this.dict.personOrgId) { + this.patientRegister.customerOrgGroup = [] + } - if (this.form.customerOrgParentId == this.dict.personOrgId) { - this.changeMedicalPackageId() - } else { - this.changeCustomerOrgGroupId() - } - } - } + if (this.form.customerOrgParentId == this.dict.personOrgId) { + this.changeMedicalPackageId() + } else { + this.changeCustomerOrgGroupId() + } + } + return resolve(customerOrgParentId) + }) + } else { + resolve(customerOrgParentId) + } + }) + .catch(() => { + resolve(customerOrgParentId) + }) + }) }, // 获取顶级单位ID - async getParentCustomerOrgId(customerOrgId) { - let customerOrgParentId = null - if (!customerOrgId) return customerOrgParentId - if (typeof customerOrgId == 'string') { - try { - let res = await getapi(`/api/app/customer-org/parent/${customerOrgId}`) - if (res.code != -1) customerOrgParentId = res.data - } catch (error) { - // console.log('获取顶级单位ID出错:', error) + getParentCustomerOrgId(v) { + return new Promise((resolve, reject) => { + let customerOrgParentId = null + if (Array.isArray(v) && v.length > 1) { + customerOrgParentId = v[0] + return resolve(customerOrgParentId) + } else { + let customerOrgId = v + if (Array.isArray(v) && v.length == 1) customerOrgId = v[0] + if (!customerOrgId) return resolve(customerOrgParentId) + if (typeof customerOrgId == 'string') { + getapi(`/api/app/customer-org/parent/${customerOrgId}`) + .then(res => { + if (res.code > -1) customerOrgParentId = res.data + }) + .finally(() => { + return resolve(customerOrgParentId) + }) + } else if (customerOrgId.length > 0) { + customerOrgParentId = customerOrgId[0] + return resolve(customerOrgParentId) + } } - } else if (customerOrgId.length > 0) { - customerOrgParentId = customerOrgId[0] - } - return customerOrgParentId + }) }, - //获取单位体检次数 + //获取并设置体检次数(个人的固定 "00000000-0000-0000-0000-000000000001" ),单位刷新分组字典 getCustomerOrgRegisterList(customerOrgParentId) { - //获取单位体检次数信息 - getapi(`/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${customerOrgParentId}`) - .then(res => { - if (res.code > - 1) { - // console.log('获取单位体检次数', this.form.customerOrgRegisterId, res.data) - this.customerOrgRegisterList = res.data - - if (!this.form.customerOrgRegisterId || this.form.customerOrgRegisterId == "00000000-0000-0000-0000-000000000001") { - let customerOrgRegisterList = arrayFilter(res.data, 'isComplete', 'N') //不显示已完成的体检次数 - if (customerOrgRegisterList.length > 0) { - this.form.customerOrgRegisterId = customerOrgRegisterList[customerOrgRegisterList.length - 1].id + return new Promise((resolve, reject) => { + if (customerOrgParentId == this.dict.personOrgId) { + // 个人体检则 固定单位体检次数 + this.form.customerOrgRegisterId = "00000000-0000-0000-0000-000000000001" + return resolve() + } else { + //获取单位体检次数信息 + getapi(`/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${customerOrgParentId}`) + .then(res => { + if (res.code > - 1) { + // console.log('获取单位体检次数', this.form.customerOrgRegisterId, res.data) + this.customerOrgRegisterList = res.data + + if (!this.form.customerOrgRegisterId || this.form.customerOrgRegisterId == "00000000-0000-0000-0000-000000000001") { + let customerOrgRegisterList = arrayFilter(res.data, 'isComplete', 'N') //不显示已完成的体检次数 + if (customerOrgRegisterList.length > 0) { + this.form.customerOrgRegisterId = customerOrgRegisterList[customerOrgRegisterList.length - 1].id + } + } + // /api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${this.form.customerOrgRegisterId} + this.patientRegister.customerOrgGroup = [] + if (this.form.customerOrgRegisterId && this.form.customerOrgRegisterId != '00000000-0000-0000-0000-000000000001') { + //获取单位分组 + postapi('/api/app/CustomerOrgGroup/GetListForPatentRegisterByFilter', { customerOrgRegisterId: this.form.customerOrgRegisterId }) + .then(res2 => { + if (res2 && res2.code != -1) { + this.patientRegister.customerOrgGroup = res2.data; + } + }) + } return } - } - // /api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${this.form.customerOrgRegisterId} - this.patientRegister.customerOrgGroup = [] - if (this.form.customerOrgRegisterId && this.form.customerOrgRegisterId != '00000000-0000-0000-0000-000000000001') return postapi('/api/app/CustomerOrgGroup/GetListForPatentRegisterByFilter', { customerOrgRegisterId: this.form.customerOrgRegisterId }) //获取单位分组 - } - }).then(res => { - if (res && res.code != -1) { - this.patientRegister.customerOrgGroup = res.data; - } - }) + }) + .finally(() => { + resolve() + }) + } + }) }, //读取身份证信息 @@ -1904,7 +1942,7 @@ export default { }); this.form.poisonIds = poisonIds resolve('') - }else{ + } else { reject(res.message) } }) @@ -2837,7 +2875,7 @@ export default { }, // 关闭预约窗口--人寿 (团检、个人都可以) - async close_dialogWin_WebBookingMzak() { + close_dialogWin_WebBookingMzak() { // console.log('this.dataTransOpts.tableS.appoint_patient_register',this.dataTransOpts.tableS.appoint_patient_register) // console.log('this.dataTransOpts.tableM.appoint_register_asbitem',this.dataTransOpts.tableM.appoint_register_asbitem) // 没有选中网上预约记录,直接返回,不做任何处理 @@ -2848,90 +2886,88 @@ export default { // this.preCustomerOrgId = this.dict.personOrgId this.patientRegister.query.customerOrgId = appoint_patient_register.customerOrgId this.patientRegister.query.CustomerOrgParentId = appoint_patient_register.customerOrgId - this.form.customerOrgId = [appoint_patient_register.customerOrgId] //单位编号 默认个人 - let customerOrgParentId = await this.getParentCustomerOrgId(appoint_patient_register.customerOrgId) - this.form.customerOrgParentId = customerOrgParentId - + this.form.customerOrgId = [appoint_patient_register.customerOrgId] //单位编号 默认个人 + let customerOrgParentId = '' + this.getParentCustomerOrgId(appoint_patient_register.customerOrgId) + .then(res => { + customerOrgParentId = res + this.form.customerOrgParentId = customerOrgParentId + return this.initFormData(this.dataTransOpts.tableS.patient_register.id) + }) + .then(() => { + // this.form.customerOrgName = customerOrgParentId + // "appointPatientRegisterId": "string", + // "personId": "string", + // "personName": "string", + // "idNo": "string", + // "sexId": "string", + // "sexName": "string", + // "maritalStatusId": "string", + // "maritalStatusName": "string", + // "customerOrgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "customerOrgName": "string", + // "childCustomerOrgName": "string", + // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "customerOrgGroupName": "string", + // "medicalPackageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "medicalPackageName": "string", + // "completeFlag": "string", + // "appointDate": "2024-06-09T11:46:34.962Z", + // "remark": "string", + // "medicalCenterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "customerOrgRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "pregnantFlag": "string", + // "pregnantFlagName": "string", + // "height": 0, + // "weight": 0 + delete appoint_patient_register.medicalCenterId + Object.assign(this.form, appoint_patient_register, + { + patientName: appoint_patient_register.personName, + completeFlag: '1', + } + ) + + // 人寿接口,甲方需求:岗位数据导入人员类别 + // personnelTypeId --> positionName + // dict.personnelType" :key="item.id" :label="item.displayName" + let lfind = arrayExistObj(this.dict.personnelType, 'displayName', appoint_patient_register.positionName) + if (lfind > -1) this.form.personnelTypeId = this.dict.personnelType[lfind].id + + + console.log('this.form', JSON.stringify(this.form)) + // 明细必填项 + // "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "asbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", + // "standardPrice": 0, + // "chargePrice": 0, + // "payTypeFlag": "string", + // "isCharge": "string", + // "amount": 0 + + // 预约明细数据 + // "appointRegisterAsbitemId": "00000000-0000-0000-0000-000000000000", + // "asbitemId": "3a126b34-f6f0-56a1-e899-a092874acde7", + // "asbitemName": "腹部平片(立位)", + // "itemTypeId": "3a126ac6-2fbf-ca50-82a4-73dcc5a5028b", + // "itemTypeName": "放射科", + // "appointPatientRegisterId": "3a12ebf4-565a-dbc4-4f2d-d72cd3050cab", + // "standardPrice": 45.00, + // "chargePrice": 30.50, + // "payTypeFlag": "\u0000", + // "isCharge": "N", + // "amount": 1, + // "isInMedicalPackage": "N", + // "itemTypeDisplayOrder": 28, + // "displayOrder": 1 + this.dataTransOpts.tableM.register_check_asbitem = deepCopy(this.dataTransOpts.tableM.appoint_register_asbitem) + + // 触发分组 项目 + if (this.form.customerOrgGroupId) this.changeCustomerOrgGroupId() - await this.initFormData(this.dataTransOpts.tableS.patient_register.id) - this.form.customerOrgName = customerOrgParentId - // "appointPatientRegisterId": "string", - // "personId": "string", - // "personName": "string", - // "idNo": "string", - // "sexId": "string", - // "sexName": "string", - // "maritalStatusId": "string", - // "maritalStatusName": "string", - // "customerOrgId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "customerOrgName": "string", - // "childCustomerOrgName": "string", - // "customerOrgGroupId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "customerOrgGroupName": "string", - // "medicalPackageId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "medicalPackageName": "string", - // "completeFlag": "string", - // "appointDate": "2024-06-09T11:46:34.962Z", - // "remark": "string", - // "medicalCenterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "customerOrgRegisterId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "pregnantFlag": "string", - // "pregnantFlagName": "string", - // "height": 0, - // "weight": 0 - delete appoint_patient_register.medicalCenterId - Object.assign(this.form, appoint_patient_register, - { - patientName: appoint_patient_register.personName, - completeFlag: '1', - } - ) - - // 人寿接口,甲方需求:岗位数据导入人员类别 - // personnelTypeId --> positionName - // dict.personnelType" :key="item.id" :label="item.displayName" - let lfind = arrayExistObj(this.dict.personnelType,'displayName',appoint_patient_register.positionName) - if(lfind > -1) this.form.personnelTypeId = this.dict.personnelType[lfind].id - - - console.log('this.form', JSON.stringify(this.form)) - // 明细必填项 - // "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "asbitemId": "3fa85f64-5717-4562-b3fc-2c963f66afa6", - // "standardPrice": 0, - // "chargePrice": 0, - // "payTypeFlag": "string", - // "isCharge": "string", - // "amount": 0 - - // 预约明细数据 - // "appointRegisterAsbitemId": "00000000-0000-0000-0000-000000000000", - // "asbitemId": "3a126b34-f6f0-56a1-e899-a092874acde7", - // "asbitemName": "腹部平片(立位)", - // "itemTypeId": "3a126ac6-2fbf-ca50-82a4-73dcc5a5028b", - // "itemTypeName": "放射科", - // "appointPatientRegisterId": "3a12ebf4-565a-dbc4-4f2d-d72cd3050cab", - // "standardPrice": 45.00, - // "chargePrice": 30.50, - // "payTypeFlag": "\u0000", - // "isCharge": "N", - // "amount": 1, - // "isInMedicalPackage": "N", - // "itemTypeDisplayOrder": 28, - // "displayOrder": 1 - this.dataTransOpts.tableM.register_check_asbitem = deepCopy(this.dataTransOpts.tableM.appoint_register_asbitem) - - // 触发分组 项目 - if (this.form.customerOrgGroupId) this.changeCustomerOrgGroupId() - - this.changeIdNo() // 触发身份证查询档案号 - - // - setTimeout(() => { - this.form.customerOrgGroupId = appoint_patient_register.customerOrgGroupId - }, 500); - + this.changeIdNo() // 触发身份证查询档案号 + }) },