Browse Source

promise

master
pengjun 5 months ago
parent
commit
601e7632aa
  1. 492
      src/components/patientRegister/PatientRegisterEdit.vue

492
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() //
})
},

Loading…
Cancel
Save