From f0e5593014b579ad61595276140fd5f4bd24fd0c Mon Sep 17 00:00:00 2001 From: pengjun <158915633@qq.com> Date: Thu, 6 Jun 2024 20:14:50 +0800 Subject: [PATCH] dj --- .../patientRegister/PatientRegisterEdit.vue | 424 ++++++++++-------- 1 file changed, 233 insertions(+), 191 deletions(-) diff --git a/src/components/patientRegister/PatientRegisterEdit.vue b/src/components/patientRegister/PatientRegisterEdit.vue index 61d7d58..16e441c 100644 --- a/src/components/patientRegister/PatientRegisterEdit.vue +++ b/src/components/patientRegister/PatientRegisterEdit.vue @@ -397,7 +397,8 @@ + :filter-method="filterMethodPoison" value-key="id" multiple + :disabled="form.completeFlag == '3' ? true : false"> @@ -1606,8 +1607,8 @@ export default { if (this.form.maritalStatusId == '9') return "职业健康检查 婚姻不允许填未知!" if (this.form.sexId == 'U') return "职业健康检查 性别不允许填未知!" if (!this.form.ocCheckTypeId) return "职业健康检查必须填写 检查类别!" - if (!this.form.jobType) return "职业健康检查必须填写 工种!" - if (this.form.poisonIds == null || this.form.poisonIds.length == 0) return "职业健康检查必须填写 接害因素!" + if (!this.form.jobType) return "职业健康检查必须填写 工种!" + if (this.form.poisonIds == null || this.form.poisonIds.length == 0) return "职业健康检查必须填写 接害因素!" return err }, @@ -1694,20 +1695,16 @@ export default { cancelButtonText: "否", type: "warning", }) - .then(async () => { - try { - - await this.labelPrint(false) // 先打条码,这样指引单上才有条码数据 - - if (this.LocalConfig.patientRegister.printGuideLabel.indexOf('guide') > -1) await this.guidePrint('0001', false) - } catch (error) { - // this.$message.info({ showClose: true, message: error }); - console.log(error) - } + .then(() => { + return this.labelPrint(false) + }) + .then(res => { + return this.guidePrint('0001', false) }) .catch((err) => { if (err != "cancel") { console.log(err) + this.$message.error({ showClose: true, message: err }) } }) .finally(() => { @@ -1717,7 +1714,7 @@ export default { } } } - ); + ); }); }, @@ -1943,83 +1940,81 @@ export default { }, // 打印指引单(isPreview) - async guidePrint(ReportCode, isPreview) { - if (!this.form.id) { - this.$message.info({ showClose: true, message: "人员信息尚未保存,不可执行此操作!" }); - return; - } - if (this.form.completeFlag == '0') { - this.$message.info({ showClose: true, message: "预登记人员,不可执行此操作!" }); - return; - } - if (!this.$peisAPI) { - this.$message.info({ showClose: true, message: "此功能,需要在壳客户端才可运行!" }) - return - } - - let token = window.sessionStorage.getItem('token'); - let user = window.sessionStorage.getItem('user'); - let toOutShell = { - ReportCode, token, - isBuildImage: 'N', - IsUploadPdf: 'N', - preViewCanPrint: 'N', - BusinessCode: this.form.id, - Parameters: [ - { Name: 'printer', Value: user }, - { Name: 'hisLog', Value: 'pic/hisLog.jpg' }, - { Name: 'pageFooter', Value: 'pic/peisQrCode.jpg' }, - ], - }; - console.log('this.$peisAPI.print', JSON.stringify(toOutShell)) - this.printing = true - if (isPreview) { - /* - postapi(`/api/app/printreport/getpatientregisterguidereport?PatientRegisterId=${this.form.id}`) - .then((res) => { - if (res.code != -1) { - toOutShell.ReportTable = res.data; - // console.log('JSON.stringify(toOutShell)', JSON.stringify(toOutShell)); - return this.$peisAPI.printPre(JSON.stringify(toOutShell)); - } - }) - .catch(err => { - this.$message.warning({ showClose: true, message: err}); - }); - */ - try { - let lres = await this.$peisAPI.printPre(JSON.stringify(toOutShell)) - if (JSON.parse(lres).code < 0) { - this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); - } - } catch (error) { - this.$message.warning({ showClose: true, message: `${error}` }); + guidePrint(ReportCode, isPreview) { + return new Promise((resolve, reject) => { + if (!this.form.id) { + reject("人员信息尚未保存,不可执行此操作!") } - } else { - try { - let lres = await this.$peisAPI.print(JSON.stringify(toOutShell)) - if (JSON.parse(lres).code < 0) { - this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); - this.printing = false - return - } - postapi('/api/app/patientregister/updatepatientregisterguideprinttimesmany', [this.form.id]).then(res => { - if (res && res.code > -1) { - let lfind = arrayExistObj(this.patientRegister.prList, 'id', this.form.id) - if (lfind > -1) { - if (this.patientRegister.prList[lfind].guidePrintTimes) { - this.patientRegister.prList[lfind].guidePrintTimes = Number(this.patientRegister.prList[lfind].guidePrintTimes) + 1; - } else { - this.patientRegister.prList[lfind].guidePrintTimes = 1; + if (this.form.completeFlag == '0') { + reject("预登记人员,不可执行此操作!") + } + if (!this.$peisAPI) { + reject("此功能,需要在壳客户端才可运行!") + } + + let token = window.sessionStorage.getItem('token'); + let user = window.sessionStorage.getItem('user'); + let toOutShell = { + ReportCode, token, + isBuildImage: 'N', + IsUploadPdf: 'N', + preViewCanPrint: 'N', + BusinessCode: this.form.id, + Parameters: [ + { Name: 'printer', Value: user }, + { Name: 'hisLog', Value: 'pic/hisLog.jpg' }, + { Name: 'pageFooter', Value: 'pic/peisQrCode.jpg' }, + ], + }; + console.log('this.$peisAPI.print', JSON.stringify(toOutShell)) + this.printing = true + if (isPreview) { + this.$peisAPI.printPre(JSON.stringify(toOutShell)) + .then(res => { + if (JSON.parse(res).code < 0) { + reject(JSON.parse(res).message) + } else { + resolve(res) + } + }) + .catch(err => { + reject(err) + }) + .finally(() => { + this.printing = false + }) + } else { + this.$peisAPI.print(JSON.stringify(toOutShell)) + .then(res => { + if (JSON.parse(res).code < 0) { + reject(JSON.parse(res).message) + } else { + return postapi('/api/app/patientregister/updatepatientregisterguideprinttimesmany', [this.form.id]) + } + }) + .then(res => { + if (res && res.code > -1) { + let lfind = arrayExistObj(this.patientRegister.prList, 'id', this.form.id) + if (lfind > -1) { + if (this.patientRegister.prList[lfind].guidePrintTimes) { + this.patientRegister.prList[lfind].guidePrintTimes = Number(this.patientRegister.prList[lfind].guidePrintTimes) + 1; + } else { + this.patientRegister.prList[lfind].guidePrintTimes = 1; + } } + resolve(res) + } else { + reject("更新指引单打印错误") } - } - }) - } catch (error) { - this.$message.warning({ showClose: true, message: `${error}` }); + }) + .catch(err => { + reject(err) + }) + .finally(() => { + this.printing = false + }) } - } - this.printing = false + }) }, //检验申请 @@ -2032,7 +2027,7 @@ export default { this.$message.info({ showClose: true, message: "人员信息尚未保存,不可执行此操作!"}); return; } - + try { res = await postapi(`/api/app/lisrequest/setlisrequest?PatientRegisterId=${this.form.id}`); // console.log(`/api/app/lisrequest/setlisrequest?PatientRegisterId=${this.form.id}`, res) @@ -2043,14 +2038,14 @@ export default { // this.$message.info("发送检验申请成功!"); isPrintLisRequest = true; } - + //重复申请,重打 if (res.code == -1 && res.message.indexOf('已申请') > -1) { isPrintLisRequest = true; } - + if (!isPrintLisRequest) return; - + try { await this.$confirm("是否打印检验申请单?", "提示", { confirmButtonText: "是", @@ -2069,119 +2064,166 @@ export default { }, //条码打印(lis + pacs) - async labelPrint(isPreview) { - if (!this.form.id) { - this.$message.info({ showClose: true, message: "人员信息尚未保存,不可执行此操作!" }); - return; - } - if (this.form.completeFlag == '0') { - this.$message.info({ showClose: true, message: "预登记人员,不可执行此操作!" }); - return; - } - if (!this.$peisAPI) { - this.$message.info({ showClose: true, message: "此功能,需要在壳客户端才可运行!" }) - return - } - let token = window.sessionStorage.getItem('token'); - let user = window.sessionStorage.getItem('user'); - let toOutShell = { - token, // ReportCode, - IsMoreLabel: 'Y', - isBuildImage: 'N', - IsUploadPdf: 'N', - BusinessCode: this.form.id, - Parameters: [ - { Name: 'printer', Value: user }, - { Name: 'hisLog', Value: 'pic/hisLog.jpg' }, - ], - }; - - this.printing = true - try { - // lis条码打印 - if (this.LocalConfig.patientRegister.printGuideLabel.indexOf('lis') > -1) await this.lisPrint('0002', isPreview, toOutShell) - - // pacs条码打印 - if (this.LocalConfig.patientRegister.printGuideLabel.indexOf('pacs') > -1) await this.pacsPrint('0004', isPreview, toOutShell) - - } catch (error) { - console.log(error) - } - - this.printing = false + labelPrint(isPreview) { + return new Promise((resolve, reject) => { + if (!this.form.id) { + reject("人员信息尚未保存,不可执行此操作!"); + } + if (this.form.completeFlag == '0') { + reject("预登记人员,不可执行此操作!"); + } + if (!this.$peisAPI) { + reject("此功能,需要在壳客户端才可运行!"); + } + let token = window.sessionStorage.getItem('token'); + let user = window.sessionStorage.getItem('user'); + let toOutShell = { + token, // ReportCode, + IsMoreLabel: 'Y', + isBuildImage: 'N', + IsUploadPdf: 'N', + BusinessCode: this.form.id, + Parameters: [ + { Name: 'printer', Value: user }, + { Name: 'hisLog', Value: 'pic/hisLog.jpg' }, + ], + }; + + this.printing = true + if (this.LocalConfig.patientRegister.printGuideLabel.indexOf('lis') > -1 && this.LocalConfig.patientRegister.printGuideLabel.indexOf('pacs') > -1) { + this.lisPrint('0002', isPreview, toOutShell) + .then(res => { + return this.pacsPrint('0004', isPreview, toOutShell) + }) + .then(res => { + resolve(res) + }) + .catch(err => { + reject(err) + }) + .finally(() => { + this.printing = false + }) + } else if (this.LocalConfig.patientRegister.printGuideLabel.indexOf('lis') > -1) { + this.lisPrint('0002', isPreview, toOutShell) + .then(res => { + resolve(res) + }) + .catch(err => { + reject(err) + }) + .finally(() => { + this.printing = false + }) + } else if (this.LocalConfig.patientRegister.printGuideLabel.indexOf('pacs') > -1) { + this.pacsPrint('0004', isPreview, toOutShell) + .then(res => { + resolve(res) + }) + .catch(err => { + reject(err) + }) + .finally(() => { + this.printing = false + }) + } else { + this.printing = false + resolve("success") + } + }) }, // lis条码打印 - async lisPrint(ReportCode, isPreview, toOutShell) { - toOutShell.ReportCode = ReportCode - console.log('this.$peisAPI.print', JSON.stringify(toOutShell)) - if (isPreview) { - try { - let lres = await this.$peisAPI.printPre(JSON.stringify(toOutShell)) - if (JSON.parse(lres).code < 0) { - this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); - } - } catch (error) { - this.$message.warning({ showClose: true, message: `${error}` }); - } - } else { - try { - let lres = await this.$peisAPI.print(JSON.stringify(toOutShell)) - if (JSON.parse(lres).code < 0) { - this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); - return - } - postapi('/api/app/lisrequest/updatelisrequestisprint', { operateType: 1, patientRegisterId: this.form.id }) + lisPrint(ReportCode, isPreview, toOutShell) { + return new Promise((resolve, reject) => { + toOutShell.ReportCode = ReportCode + console.log('this.$peisAPI.print', JSON.stringify(toOutShell)) + + if (isPreview) { + this.$peisAPI.printPre(JSON.stringify(toOutShell)) + .then(res => { + if (JSON.parse(res).code < 0) { + // this.$message.warning({ showClose: true, message: JSON.parse(lres).message }); + reject(JSON.parse(res).message) + } else { + resolve(res) + } + }) + .catch(err => { + reject(err) + }) + } else { + this.$peisAPI.print(JSON.stringify(toOutShell)) + .then(res => { + if (JSON.parse(res).code < 0) { + reject(JSON.parse(res).message) + } else { + return postapi('/api/app/lisrequest/updatelisrequestisprint', { operateType: 1, patientRegisterId: this.form.id }) + } + }) .then(res => { if (res && res.code < 0) { - this.$message.error({ showClose: true, message: `更新条码打印状态失败,原因:${res.message}` }); + reject(res.message) + } else { + resolve(res) } }) - } catch (error) { - this.$message.warning({ showClose: true, message: error }); + .catch(err => { + reject(err) + }) } - } + }) }, //pacs条码打印 pacsPrint(ReportCode, isPreview, toOutShell) { - toOutShell.ReportCode = ReportCode - console.log('this.$peisAPI.print', JSON.stringify(toOutShell)) - if (isPreview) { - this.$peisAPI.printPre(JSON.stringify(toOutShell)) - .then(res => { - if (JSON.parse(res).code < 0) { - this.$message.warning({ showClose: true, message: JSON.parse(res).message }); - } - }) - .catch((err) => { - // console.log('打印pacs条码错误', err) - this.$message.warning({ showClose: true, message: `${err}` }); - }); - } else { - - this.$peisAPI.print(JSON.stringify(toOutShell)) - .then(res => { - if (JSON.parse(res).code < 0) { - this.$message.warning({ showClose: true, message: JSON.parse(res).message }); - } else { - return postapi("/api/app/lisrequest/updatelisrequestisprint", { - operateType: 1, - patientRegisterId: this.form.id, - }); - } - }) - .then(res => { - if (res && res.code < 0) { - this.$message.error({ showClose: true, message: `${res.message}` }); - } - }) - .catch((err) => { - // console.log('打印pacs条码错误', err) - this.$message.error({ showClose: true, message: `${err}` }); - }); - } + return new Promise((resolve, reject) => { + toOutShell.ReportCode = ReportCode + console.log('this.$peisAPI.print', JSON.stringify(toOutShell)) + if (isPreview) { + this.$peisAPI.printPre(JSON.stringify(toOutShell)) + .then(res => { + if (JSON.parse(res).code < 0) { + // this.$message.warning({ showClose: true, message: JSON.parse(res).message }); + reject(JSON.parse(res).message) + } else { + resolve(res) + } + }) + .catch((err) => { + // console.log('打印pacs条码错误', err) + this.$message.warning({ showClose: true, message: `${err}` }); + reject(err) + }); + } else { + this.$peisAPI.print(JSON.stringify(toOutShell)) + .then(res => { + if (JSON.parse(res).code < 0) { + // this.$message.warning({ showClose: true, message: JSON.parse(res).message }); + reject(JSON.parse(res).message) + } else { + return postapi("/api/app/lisrequest/updatelisrequestisprint", { + operateType: 1, + patientRegisterId: this.form.id, + }); + } + }) + .then(res => { + if (res && res.code < 0) { + // this.$message.error({ showClose: true, message: `${res.message}` }); + reject(res.message) + } else { + resolve(res) + } + }) + .catch((err) => { + // console.log('打印pacs条码错误', err) + // this.$message.error({ showClose: true, message: `${err}` }); + reject(err) + }); + } + }); }, //补打条码