Sfoglia il codice sorgente

打印调整 & 处方审核

kumu 1 anno fa
parent
commit
b7df40b018

+ 79 - 1
src/api/prescription/prescriptionAudit.js

@@ -1,4 +1,5 @@
 import request from '@/utils/request'
+import {bignumber, multiply} from 'mathjs';
 
 // 查询处方待审核列表
 export function listPrescriptionAudit(query) {
@@ -11,13 +12,90 @@ export function listPrescriptionAudit(query) {
 
 // 查询处方待审核详情
 export function selectOrderDetail(query) {
-  console.log('selectOrderDetail', query)
   return request({
     url: '/yfc-admin/prescription/prescriptionCore/selectOrderDetail',
     method: 'post',
     params: query
   })
 }
+export function selectOrderDetail2(query) {
+  return request({
+    url: '/yfc-admin/prescription/prescriptionCore/selectOrderDetail',
+    method: 'post',
+    params: query
+  }).then(res => {
+    const data = res.data;
+    const sign = (index) => { try {return data.operateList[index].operater;} catch (e) {} };
+    const count = bignumber(data['number'] || 0);
+    return {
+      patient: {
+        name: data['name'],
+        gender: data['sex'],
+        age: data['age'] ? `${data['age']}岁` : '',
+        birthday: `${data['patientBirthday']}`,
+        phone: `${data['contactNumber']}`,
+      },
+      recipe: {
+        date: `${data['prescriptionTime']}`,
+        type: {1: '中药处方', 2: '中药制剂'}[data.type] || '',
+        count: data['number'],
+        total: data['packageNumber'],
+        category: data['dosageForm'],
+        method: data['prescriptionusage'],
+        volume: data['concentration'] && `每次${data['concentration']}`,
+        totalVolume: data['packageDose'],
+        frequency: data['frequency'],
+        frequencyTime: data['medicationTime'],
+        decoction: data['isBehalf'] === '1' ? '代煎' : '自煎',
+
+        delivery: data['expressExecutor'],
+        address: [/*data['province'], data['city'], data['region'],*/ data['address']].filter(Boolean).join(''),
+
+        medicineFees: data['prescriptionSum'],
+        decoctionFees: data['daijianCost'],
+        deliveryFees: data['distributionCost'],
+        totalFees: data['prescriptionTotalSum'],
+
+        unitWeight: '',
+        totalWeight: '',
+
+        medicines: Array.isArray(data['detailList']) ? data['detailList'].map(item => {
+          return {
+            mark: item['locatorNum'],
+            name: item['matName'],
+            dosage: item['matDose'],
+            unit: item['matUnitName'],
+            usage: item['matUsageName'],
+            total: +multiply(count, bignumber(item['matDose'] || 0)).toFixed(2),
+          };
+        }) : [],
+      },
+      department: [data['department']].filter(Boolean).join(' '),
+      diagnosis: [data['disName']].filter(Boolean).join(' '),
+      record: {
+        title: data['yljgName'],
+        date: data['prescriptionTime'],
+        no: `${data['preNo']}`,
+        bedNo: data['bedNo'],
+        recordNo: data['recipientCode'],
+        serialNumber: data['recipeSerial'],
+        category: data['preMzZy'] === '1' ? '门诊' : '住院',
+        remark: data['remark'] || [data['pharmacistsremarks']].filter(Boolean).join(','),
+      },
+      sign: {
+        /* 开方专用 */ field1: data['doctor'] || sign(1 - 1),
+        /* 审核专用 */ field2: data['checkBy'] || sign(2 - 1),
+        /* 调配专用 */ field3: sign(3 - 1),
+        /* 复核专用 */ field4: sign(4 - 1),
+        /* 浸泡专用 */ field5: sign(5 - 1),
+        /* 煎煮专用 */ field6: sign(6 - 1),
+        /* 打包专用 */ field7: sign(7 - 1),
+        /* 发药专用 */ field8: sign(8 - 1),
+      },
+      field1: {1: '配药', 2: '煎药', 3: '发药', 4: '配送'}[data.state],
+    }
+  })
+}
 
 export function getExpressRecordParams(data) {
   return request({

+ 1 - 1
src/components/print/express_75.vue

@@ -27,7 +27,7 @@ export default {
     },
   },
   mounted() {
-    this.print(true);
+    // this.print(true);
   },
   methods: {
     async print(preview = false) {

+ 11 - 81
src/components/print/recipe_A5.vue

@@ -2,7 +2,7 @@
 import CLodop from '@/libs/print/CLodop';
 import {getDevice} from '@/tools/print.tool';
 import {templateA5} from '@/components/print/template';
-import {selectOrderDetail} from '@/api/prescription/prescriptionAudit';
+import {selectOrderDetail, selectOrderDetail2} from '@/api/prescription/prescriptionAudit';
 import {bignumber, chain, multiply} from 'mathjs';
 
 export default {
@@ -30,7 +30,7 @@ export default {
     },
   },
   mounted() {
-    this.print(true);
+    // this.print(true);
   },
   methods: {
     async print(preview = false) {
@@ -74,87 +74,17 @@ export default {
 
     async getModel() {
       if (this.model) return this.model;
+      this.model = await selectOrderDetail2({id: this.id});
 
-      return selectOrderDetail({id: this.id}).then((res) => {
-        const data = res.data;
-        const sign = (index) => { try {return data.operateList[index].operater;} catch (e) {} };
-        const count = bignumber(data['number'] || 0);
-        this.model = {
-          patient: {
-            name: `${data['name']}`,
-            gender: `${data['sex']}`,
-            arg: data['args'] ? `${data['args']}岁` : '',
-            birthday: `${data['patientBirthday']}`,
-            phone: `${data['contactNumber']}`,
-          },
-          recipe: {
-            date: `${data['prescriptionTime']}`,
-            type: {1: '中药处方', 2: '中药制剂'}[data.type] || '',
-            count: data['number'],
-            category: data['dosageForm'],
-            method: data['prescriptionusage'],
-            volume: data['concentration'] && `每次${data['concentration']}`,
-            frequency: data['frequency'],
-            frequencyTime: data['medicationTime'],
-            decoction: data['isBehalf'] === '1' ? '代煎' : '自煎',
-
-            delivery: data['expressExecutor'],
-            address: [/*data['province'], data['city'], data['region'],*/ data['address']].filter(Boolean).join(''),
-
-            medicineFees: data['prescriptionSum'],
-            decoctionFees: data['daijianCost'],
-            deliveryFees: data['distributionCost'],
-            totalFees: data['prescriptionTotalSum'],
-
-            unitWeight: '',
-            totalWeight: '',
-
-            medicines: Array.isArray(data['detailList']) ? data['detailList'].map(item => {
-              return {
-                mark: item['locatorNum'],
-                name: item['matName'],
-                dosage: item['matDose'],
-                unit: item['matUnitName'],
-                usage: item['matUsageName'],
-                total: +multiply(count, bignumber(item['matDose'] || 0)).toFixed(2),
-              };
-            }) : [],
-          },
-          department: [data['department']].filter(Boolean).join(' '),
-          diagnosis: [data['disName']].filter(Boolean).join(' '),
-          record: {
-            title: data['yljgName'],
-            date: data['createTime'],
-            no: `${data['preNo']}`,
-            bedNo: data['bedNo'],
-            recordNo: data['recordNo'] || data['recipeBh'],
-            serialNumber: data['recipeSerial'],
-            category: data['preMzZy'] === '1' ? '门诊' : '住院',
-            remark: data['remark'] || [data['pharmacistsremarks']].filter(Boolean).join(','),
-          },
-          sign: {
-            field1: sign(1 - 1),
-            field2: sign(2 - 1),
-            field3: sign(3 - 1),
-            field4: sign(4 - 1),
-            field5: sign(5 - 1),
-            field6: sign(6 - 1),
-            field7: sign(7 - 1),
-            field8: sign(8 - 1),
-          },
-          field1: {1: '配药', 2: '煎药', 3: '发药', 4: '配送'}[data.state],
-        };
-
-        let unitWeight = chain(bignumber(0));
-        for (const medicine of this.model.recipe.medicines) {
-          unitWeight = unitWeight.add(bignumber(medicine.dosage));
-        }
-
-        this.model.recipe.unitWeight = +unitWeight.valueOf().toFixed(2);
-        this.model.recipe.totalWeight = +unitWeight.multiply(count).valueOf().toFixed(2);
+      const count = bignumber(this.model.recipe.count || 0);
+      let unitWeight = chain(bignumber(0));
+      for (const medicine of this.model.recipe.medicines) {
+        unitWeight = unitWeight.add(bignumber(medicine.dosage));
+      }
+      this.model.recipe.unitWeight = +unitWeight.valueOf().toFixed(2);
+      this.model.recipe.totalWeight = +unitWeight.multiply(count).valueOf().toFixed(2);
 
-        return this.model;
-      });
+      return this.model;
     },
   },
 };

+ 3 - 2
src/components/print/tag_60_40.vue

@@ -8,6 +8,7 @@ export default {
   name: 'print_tag_60_40',
   props: {
     id: {type: [String, Number], required: true},
+    init: {type: Boolean, default: false},
   },
   data() {
     return {
@@ -29,7 +30,7 @@ export default {
     },
   },
   mounted() {
-    this.print(true);
+    if (this.$props.init) this.print(true);
   },
   methods: {
     async print(preview = false) {
@@ -86,7 +87,7 @@ export default {
             count: data['number'],
             total: data['packageNumber'],
             method: data['prescriptionusage'],
-            volume: `${data['packageDose']}ml`,
+            volume: data['packageDose'] ? `${data['packageDose']}ml` : '',
             delivery: data['expressExecutor'],
             decoction: data['isBehalf'] === '1' ? '代煎' : '自煎',
           },

+ 4 - 34
src/components/print/tag_80_50.vue

@@ -2,7 +2,7 @@
 import CLodop from '@/libs/print/CLodop';
 import {getDevice} from '@/tools/print.tool';
 import {template80_50} from '@/components/print/template';
-import {selectOrderDetail} from '@/api/prescription/prescriptionAudit';
+import {selectOrderDetail2} from '@/api/prescription/prescriptionAudit';
 
 export default {
   name: 'print_tag_80_50',
@@ -29,7 +29,7 @@ export default {
     },
   },
   mounted() {
-    this.print(true);
+    // this.print(true);
   },
   methods: {
     async print(preview = false) {
@@ -73,38 +73,8 @@ export default {
 
     async getModel() {
       if (this.model) return this.model;
-
-      return selectOrderDetail({id: this.id}).then((res) => {
-        const data = res.data;
-        this.model = {
-          patient: {
-            name: data['name'],
-            gender: data['sex'],
-            birthday: data['patientBirthday'],
-            phone: data['contactNumber'],
-          },
-          recipe: {
-            count: data['number'],
-            method: data['prescriptionusage'],
-            decoction: data['isBehalf'] === '1' ? '是' : '否',
-
-            delivery: data['expressExecutor'],
-            address: [data['province'], data['city'], data['region'], data['address']].filter(Boolean).join(''),
-          },
-          department: [data['department']].filter(Boolean).join(' '),
-          record: {
-            title: data['yljgName'],
-            date: data['createTime'],
-            no: data['preNo'],
-            medicalRecordNumber: data['recipeBh'],
-            serialNumber: data['recipeSerial'],
-            category: data['preMzZy'] === '1' ? '门诊' : '住院',
-            remark: data['remark'] || [data['pharmacistsremarks']].filter(Boolean).join(','),
-          },
-        };
-
-        return this.model;
-      });
+      this.model = await selectOrderDetail2({id: this.id});
+      return this.model;
     },
   },
 };

+ 14 - 12
src/components/print/template.js

@@ -237,7 +237,7 @@ export function templateA5(model = {}, title = '') {
     offset = 2;
     this.ADD_PRINT_TEXT(y, 12, 45, h, '姓名:');
     this.ADD_PRINT_TEXT(y, 151, 60, h, template(`性别:{{patient.gender}}`));
-    this.ADD_PRINT_TEXT(y, 211, 80, h, template(`年龄:{{patient.arg}}`));
+    this.ADD_PRINT_TEXT(y, 211, 80, h, template(`年龄:{{patient.age}}`));
     this.ADD_PRINT_TEXT(y, 291, 100, h, template(`床号:{{record.bedNo}}`));
     this.ADD_PRINT_TEXT(y - 6, 56, 96, h + 6, template(`{{patient.name}}`));
     this.SET_PRINT_STYLEA(0, 'FontSize', 12);
@@ -245,7 +245,7 @@ export function templateA5(model = {}, title = '') {
     y += h + offset;
     this.ADD_PRINT_TEXT(y, 12, 200, h, template(`科室:{{department}}`));
     this.ADD_PRINT_TEXT(y, 211, 150, h, template(`病历号:{{record.recordNo}}`));
-    this.ADD_PRINT_TEXT(y, 370, 175, h, template(`开方日期:{{record.date}}`));
+    this.ADD_PRINT_TEXT(y, 360, 185, h, template(`开方日期:{{record.date}}`));
     this.SET_PRINT_STYLEA(0, 'Alignment', 3);
     y += h + offset;
     h = 34;
@@ -272,14 +272,16 @@ export function templateA5(model = {}, title = '') {
     this.ADD_PRINT_TEXT(y, 220, 48, 20, '用法');
     this.SET_PRINT_STYLEA(0, 'Alignment', 2);
     this.SET_PRINT_STYLEA(0, 'Bold', 1);
-    this.ADD_PRINT_TEXT(y, 291, 120, 20, '药品名');
-    this.SET_PRINT_STYLEA(0, 'Alignment', 2);
-    this.SET_PRINT_STYLEA(0, 'Bold', 1);
-    this.ADD_PRINT_TEXT(y, 411, 50, 20, '单贴量');
-    this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-    this.SET_PRINT_STYLEA(0, 'Bold', 1);
-    this.ADD_PRINT_TEXT(y, 463, 48, 20, '用法');
-    this.SET_PRINT_STYLEA(0, 'Bold', 1);
+    if (chunk.length > 1) {
+      this.ADD_PRINT_TEXT(y, 291, 120, 20, '药品名');
+      this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+      this.SET_PRINT_STYLEA(0, 'Bold', 1);
+      this.ADD_PRINT_TEXT(y, 411, 50, 20, '单贴量');
+      this.SET_PRINT_STYLEA(0, 'Alignment', 3);
+      this.SET_PRINT_STYLEA(0, 'Bold', 1);
+      this.ADD_PRINT_TEXT(y, 463, 48, 20, '用法');
+      this.SET_PRINT_STYLEA(0, 'Bold', 1);
+    }
 
     // 绘制药品
     chunk.forEach((medicine, i) => {
@@ -303,7 +305,7 @@ export function templateA5(model = {}, title = '') {
 
     y += 20 + 2 + 12;
 
-    this.ADD_PRINT_TEXT(y, 12, 536, 40, template(`备注:{{record.remark}}`));
+    this.ADD_PRINT_TEXT(y, 12, 536, 40, template(`{{record.remark}}`));
 
     y += 40;
     x = margin;
@@ -454,7 +456,7 @@ export function template72(model, title) {
     template(`{{recipe.frequencyTime}}`),
   ].filter(Boolean).join(','));
   w = 100;
-  this.ADD_PRINT_TEXT(y, width - w - margin, w, h, template(`装量:{{recipe.volume}} ML`));
+  this.ADD_PRINT_TEXT(y, width - w - margin, w, h, template(`装量:{{recipe.totalVolume}} ML`));
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
 
   y += h - 2;

+ 11 - 65
src/components/print/ticket_72.vue

@@ -2,7 +2,7 @@
 import CLodop from '@/libs/print/CLodop';
 import {getDevice} from '@/tools/print.tool';
 import {template72} from '@/components/print/template';
-import {selectOrderDetail} from '@/api/prescription/prescriptionAudit';
+import {selectOrderDetail, selectOrderDetail2} from '@/api/prescription/prescriptionAudit';
 import {bignumber, chain, multiply} from 'mathjs';
 
 export default {
@@ -30,7 +30,7 @@ export default {
     },
   },
   mounted() {
-    this.print(true);
+    // this.print(true);
   },
   methods: {
     async print(preview = false) {
@@ -74,71 +74,17 @@ export default {
 
     async getModel() {
       if (this.model) return this.model;
+      this.model = await selectOrderDetail2({id: this.id});
 
-      return selectOrderDetail({id: this.id}).then((res) => {
-        const data = res.data;
-        const count = bignumber(data['number'] || 0);
-        this.model = {
-          patient: {
-            name: `${data['name']}`,
-            gender: `${data['sex']}`,
-            arg: `${data['args']}岁`,
-            birthday: `${data['patientBirthday']}`,
-            phone: `${data['contactNumber']}`,
-          },
-          recipe: {
-            date: `${data['prescriptionTime']}`,
-            type: {1: '中药处方', 2: '中药制剂'}[data.type] || '',
-            count: data['number'],
-            total: data['packageNumber'],
-            category: data['dosageForm'],
-            method: data['prescriptionusage'],
-            volume: data['concentration'] && `${data['concentration']}`,
-            frequency: data['frequency'],
-            frequencyTime: data['medicationTime'],
-            decoction: (data['isBehalf'] === '1' || +data['daijianNumber'] > 0) ? '代煎' : '自煎',
-
-            delivery: data['expressExecutor'],
-            address: [data['province'], data['city'], data['region'], data['address']].filter(Boolean).join(''),
-
-            unitWeight: '',
-            totalWeight: '',
-
-            medicines: Array.isArray(data['detailList']) ? data['detailList'].map(item => {
-              return {
-                mark: item['locatorNum'],
-                name: item['matName'],
-                dosage: item['matDose'],
-                unit: item['matUnitName'],
-                usage: item['matUsageName'],
-                total: +multiply(count, bignumber(item['matDose'] || 0)).toFixed(2),
-              };
-            }) : [],
-          },
-          doctor: data['doctor'],
-          department: [data['department']].filter(Boolean).join(' '),
-          diagnosis: [data['disName']].filter(Boolean).join(' '),
-          record: {
-            title: `${data['yljgName']}`,
-            date: data['printTime'],
-            no: data['preNo'],
-            category: data['preMzZy'] === '1' ? '门诊' : '住院',
-            remark: [data['pharmacistsremarks']].filter(Boolean).join(','),
-          },
-          recordNo: data['recordNo'],
-          bedNo: data['bedNo'],
-        };
-
-        let unitWeight = chain(bignumber(0));
-        for (const medicine of this.model.recipe.medicines) {
-          unitWeight = unitWeight.add(bignumber(medicine.dosage));
-        }
-
-        this.model.recipe.unitWeight = +unitWeight.valueOf().toFixed(2);
-        this.model.recipe.totalWeight = +unitWeight.multiply(count).valueOf().toFixed(2);
+      const count = bignumber(this.model.recipe.count || 0);
+      let unitWeight = chain(bignumber(0));
+      for (const medicine of this.model.recipe.medicines) {
+        unitWeight = unitWeight.add(bignumber(medicine.dosage));
+      }
+      this.model.recipe.unitWeight = +unitWeight.valueOf().toFixed(2);
+      this.model.recipe.totalWeight = +unitWeight.multiply(count).valueOf().toFixed(2);
 
-        return this.model;
-      });
+      return this.model;
     },
   },
 };

+ 1 - 1
src/views/decoct/recipe/index.vue

@@ -181,7 +181,7 @@
                append-to-body center
                :before-close="handleCloseOption"
                @closed="showPrintContent=false">
-      <print v-if="showPrintContent" :id="id" @close="showPrint = false; $event && getList()"></print>
+      <print v-if="showPrintContent" :id="id" init @close="showPrint = false; $event && getList()"></print>
     </el-dialog>
   </div>
 </template>

+ 5 - 2
src/views/pda/dispatch/printContainer.vue

@@ -18,6 +18,9 @@ export default {
     style() { return {height: `${this.height}px`}; },
   },
   watch: {},
+  mounted() {
+    this.select(0);
+  },
   methods: {
     async print() {
       const keys = Object.keys(this.$refs).filter(key => key.startsWith('print'));
@@ -54,10 +57,10 @@ export default {
     <el-button class="pin" type="primary" @click="print">组合打印</el-button>
     <el-tabs tab-position="left" :style="style" @tab-click="select($event.index)">
       <el-tab-pane v-if="loadExpress" label="顺丰面单">
-        <print_express_75 ref="print3" :id="id" :style="style" @click="$event && update()"></print_express_75>
+        <print_express_75 ref="print0" :id="id" :style="style" @click="$event && update()"></print_express_75>
       </el-tab-pane>
       <el-tab-pane label="标签">
-        <Print_tag_60_40 ref="print0" :id="id" @click="$event && update(0)"></Print_tag_60_40>
+        <Print_tag_60_40 ref="print1" :id="id" @click="$event && update(0)"></Print_tag_60_40>
       </el-tab-pane>
     </el-tabs>
   </div>

+ 8 - 6
src/views/rescription/prescriptionCore/edit.vue

@@ -149,7 +149,7 @@ export default {
       this.loading = true;
       try {
         const {medicines, ...model} = await getPrescriptionCore2(this.$props.id);
-        this.medicines = medicines;
+        this.medicines = medicines.map(medicine => Object.assign(medicine, {subtotalMoney: this.calculationMedicinePrice(medicine)}));
         this.model = transformNestedObjectToFlat(model);
       } catch (e) {
         this.cancel();
@@ -158,12 +158,14 @@ export default {
       this.appendMedicine();
       const pharmacies = Array.isArray(this.pharmacyList) ? this.pharmacyList : [];
       this.showPharmacy = pharmacies.length > 1 || !this.model.yfId;
+
+      if (!this.model.tackleTime) this.model.tackleTime = dayjs().startOf('minute').format('YYYY-MM-DD HH:mm:ss');
     },
     formReset() {
       const pharmacies = Array.isArray(this.pharmacyList) ? this.pharmacyList : [];
       this.model = {
         yfId: window.localStorage.getItem('pharmacyId') || (pharmacies.length ? pharmacies[0].id : ''),
-        /* 01 受理时间 */ tackleTime: dayjs().startOf('day').format('YYYY-MM-DD'),
+        /* 01 受理时间 */ tackleTime: dayjs().startOf('minute').format('YYYY-MM-DD HH:mm:ss'),
         /* 02 处方序号 */ recipeSerial: '',
         /* 03 处方编号 */ recipeBh: '',
         /* 04 患者姓名 */ name: '',
@@ -252,9 +254,9 @@ export default {
         [model.province = '', model.city = '', model.region = ''] = this.model.location;
         delete model['location'];
 
-        if (model.steep == null) model.steep = {};
-        if (model.decoct == null) model.decoct = {};
-        if (model.pack == null) model.pack = {};
+        if (model.steep == null) model.steep = null;
+        if (model.decoct == null) model.decoct = null;
+        if (model.pack == null) model.pack = null;
 
         this.saving = true;
         if (this.isCheck) await check2(model);
@@ -373,7 +375,7 @@ export default {
             </el-col>
             <el-col :span="8">
               <el-form-item label="受理时间" prop="tackleTime">
-                <el-date-picker v-model="model.tackleTime" type="date" value-format="yyyy-MM-dd"
+                <el-date-picker v-model="model.tackleTime" type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
                                 placeholder="请选择受理时间"></el-date-picker>
               </el-form-item>
             </el-col>

+ 3 - 0
src/views/rescription/prescriptionCore/printContainer.vue

@@ -20,6 +20,9 @@ export default {
     style() { return {height: `${this.height}px`}; },
   },
   watch: {},
+  mounted() {
+    this.select(0);
+  },
   methods: {
     async print() {
       const keys = Object.keys(this.$refs).filter(key => key.startsWith('print'));