kumu пре 1 година
родитељ
комит
1b32ab1811

+ 25 - 9
src/components/print/recipe_A5.vue

@@ -3,6 +3,7 @@ import CLodop from '@/libs/print/CLodop';
 import {getDevice} from '@/tools/print.tool';
 import {getDevice} from '@/tools/print.tool';
 import {templateA5} from '@/components/print/template';
 import {templateA5} from '@/components/print/template';
 import {selectOrderDetail} from '@/api/prescription/prescriptionAudit';
 import {selectOrderDetail} from '@/api/prescription/prescriptionAudit';
+import {bignumber, chain, multiply} from 'mathjs';
 
 
 export default {
 export default {
   name: 'print_recipe_a5',
   name: 'print_recipe_a5',
@@ -77,11 +78,12 @@ export default {
       return selectOrderDetail({id: this.id}).then((res) => {
       return selectOrderDetail({id: this.id}).then((res) => {
         const data = res.data;
         const data = res.data;
         const sign = (index) => { try {return data.operateList[index].operater;} catch (e) {} };
         const sign = (index) => { try {return data.operateList[index].operater;} catch (e) {} };
+        const count = bignumber(data['number'] || 0);
         this.model = {
         this.model = {
           patient: {
           patient: {
             name: `${data['name']}`,
             name: `${data['name']}`,
             gender: `${data['sex']}`,
             gender: `${data['sex']}`,
-            arg: `${data['args']}岁`,
+            arg: data['args'] ? `${data['args']}岁` : '',
             birthday: `${data['patientBirthday']}`,
             birthday: `${data['patientBirthday']}`,
             phone: `${data['contactNumber']}`,
             phone: `${data['contactNumber']}`,
           },
           },
@@ -94,36 +96,42 @@ export default {
             volume: data['concentration'] && `每次${data['concentration']}`,
             volume: data['concentration'] && `每次${data['concentration']}`,
             frequency: data['frequency'],
             frequency: data['frequency'],
             frequencyTime: data['medicationTime'],
             frequencyTime: data['medicationTime'],
-            decoction: data['isBehalf'] === '1' || +data['daijianNumber'] > 0,
+            decoction: data['isBehalf'] === '1' ? '代煎' : '自煎',
 
 
             delivery: data['expressExecutor'],
             delivery: data['expressExecutor'],
-            address: [data['province'], data['city'], data['region'], data['address']].filter(Boolean).join(''),
+            address: [/*data['province'], data['city'], data['region'],*/ data['address']].filter(Boolean).join(''),
 
 
             medicineFees: data['prescriptionSum'],
             medicineFees: data['prescriptionSum'],
             decoctionFees: data['daijianCost'],
             decoctionFees: data['daijianCost'],
             deliveryFees: data['distributionCost'],
             deliveryFees: data['distributionCost'],
             totalFees: data['prescriptionTotalSum'],
             totalFees: data['prescriptionTotalSum'],
 
 
+            unitWeight: '',
+            totalWeight: '',
+
             medicines: Array.isArray(data['detailList']) ? data['detailList'].map(item => {
             medicines: Array.isArray(data['detailList']) ? data['detailList'].map(item => {
               return {
               return {
+                mark: item['locatorNum'],
                 name: item['matName'],
                 name: item['matName'],
                 dosage: item['matDose'],
                 dosage: item['matDose'],
                 unit: item['matUnitName'],
                 unit: item['matUnitName'],
                 usage: item['matUsageName'],
                 usage: item['matUsageName'],
+                total: +multiply(count, bignumber(item['matDose'] || 0)).toFixed(2),
               };
               };
             }) : [],
             }) : [],
           },
           },
           department: [data['department']].filter(Boolean).join(' '),
           department: [data['department']].filter(Boolean).join(' '),
           diagnosis: [data['disName']].filter(Boolean).join(' '),
           diagnosis: [data['disName']].filter(Boolean).join(' '),
           record: {
           record: {
-            title: `${data['yljgName']}(处方笺)`,
-            date: `${data['printTime']}`,
+            title: data['yljgName'],
+            date: data['createTime'],
             no: `${data['preNo']}`,
             no: `${data['preNo']}`,
+            bedNo: data['bedNo'],
+            recordNo: data['recordNo'] || data['recipeBh'],
+            serialNumber: data['recipeSerial'],
             category: data['preMzZy'] === '1' ? '门诊' : '住院',
             category: data['preMzZy'] === '1' ? '门诊' : '住院',
-            remark: '1、本处方当日有效;\r\n2、取药时请您当面核对;\r\n3、延长处方用量时间原由:慢性病 其他老年病 外地 其他',
+            remark: data['remark'] || [data['pharmacistsremarks']].filter(Boolean).join(','),
           },
           },
-          recordNo: data['recordNo'],
-          bedNo: data['bedNo'],
           sign: {
           sign: {
             field1: sign(1 - 1),
             field1: sign(1 - 1),
             field2: sign(2 - 1),
             field2: sign(2 - 1),
@@ -136,7 +144,15 @@ export default {
           },
           },
           field1: {1: '配药', 2: '煎药', 3: '发药', 4: '配送'}[data.state],
           field1: {1: '配药', 2: '煎药', 3: '发药', 4: '配送'}[data.state],
         };
         };
-        if (this.model.field1) this.model.field1 = `当前处方状态:${this.model.field1}`;
+
+        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;
       });
       });
     },
     },

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

@@ -87,14 +87,16 @@ export default {
             total: data['packageNumber'],
             total: data['packageNumber'],
             method: data['prescriptionusage'],
             method: data['prescriptionusage'],
             volume: `${data['packageDose']}ml`,
             volume: `${data['packageDose']}ml`,
+            delivery: data['expressExecutor'],
+            decoction: data['isBehalf'] === '1' ? '代煎' : '自煎',
           },
           },
           department: [data['department'], data['bedNo']].filter(Boolean).join(' '),
           department: [data['department'], data['bedNo']].filter(Boolean).join(' '),
           record: {
           record: {
-            title: `${data['medicalName']}(代煎中心)`,
+            title: data['medicalName'],
             date: data['createTime'],
             date: data['createTime'],
             no: data['preNo'],
             no: data['preNo'],
             category: data['preMzZy'] === '1' ? '门诊' : '住院',
             category: data['preMzZy'] === '1' ? '门诊' : '住院',
-            remark: [data['frequency'], data['medicationTime']].filter(Boolean).join(','),
+            remark: data['remark'] || [data['frequency'], data['medicationTime']].filter(Boolean).join(','),
           },
           },
         };
         };
         this.total = this.model.recipe.total;
         this.total = this.model.recipe.total;

+ 8 - 3
src/components/print/tag_80_50.vue

@@ -87,14 +87,19 @@ export default {
             count: data['number'],
             count: data['number'],
             method: data['prescriptionusage'],
             method: data['prescriptionusage'],
             decoction: data['isBehalf'] === '1' ? '是' : '否',
             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(' '),
           department: [data['department']].filter(Boolean).join(' '),
           record: {
           record: {
-            title: `${data['yljgName']}(中药房)`,
-            date: data['printTime'],
+            title: data['yljgName'],
+            date: data['createTime'],
             no: data['preNo'],
             no: data['preNo'],
+            medicalRecordNumber: data['recipeBh'],
+            serialNumber: data['recipeSerial'],
             category: data['preMzZy'] === '1' ? '门诊' : '住院',
             category: data['preMzZy'] === '1' ? '门诊' : '住院',
-            remark: [data['pharmacistsremarks']].filter(Boolean).join(','),
+            remark: data['remark'] || [data['pharmacistsremarks']].filter(Boolean).join(','),
           },
           },
         };
         };
 
 

+ 254 - 201
src/components/print/template.js

@@ -10,55 +10,81 @@ export function template60_40(model = {}, title = '') {
   this.PRINT_INITA(0, 0, width, height, title);
   this.PRINT_INITA(0, 0, width, height, title);
   // 宽度按纸张的整宽缩放
   // 宽度按纸张的整宽缩放
   this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
   this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
+  this.SET_PRINT_MODE('FULL_WIDTH_FOR_OVERFLOW', true);
+  this.SET_PRINT_MODE('FULL_HEIGHT_OVERFLOW', true);
   // 设置输出位置以纸张边缘为基点
   // 设置输出位置以纸张边缘为基点
   this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
   this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
 
 
   let x = margin, y = margin;
   let x = margin, y = margin;
   let w = 0, h = 0;
   let w = 0, h = 0;
 
 
-  w = 180;
+  this.SET_PRINT_STYLE('Alignment', 2);
+
+
+  w = 215;
   h = 20;
   h = 20;
   this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.title}}`));
   this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.title}}`));
   this.SET_PRINT_STYLEA(0, 'Bold', 1);
   this.SET_PRINT_STYLEA(0, 'Bold', 1);
-  w = 70;
-  this.ADD_PRINT_TEXT(x, width - w - margin, w, h, template(`{{record.date}}`));
-  this.SET_PRINT_STYLEA(0, 'Alignment', 3);
 
 
-  w = 180;
   y += h;
   y += h;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{patient.name}},{{patient.gender}},{{patient.birthday}}`));
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.no}}`));
+
+  y += h;
+  w = 115;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{patient.name}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
   x += w;
   x += w;
-  w = width - x - margin;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.category}}`));
-  this.SET_PRINT_STYLEA(0, 'Alignment', 3);
+  w = 30;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.count}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  x += w;
+  w = 20;
+  this.ADD_PRINT_TEXT(y, x, w, h, '帖');
+  x += w;
+  w = 30;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.total}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  x += w;
+  w = 20;
+  this.ADD_PRINT_TEXT(y, x, w, h, '包');
 
 
 
 
-  x = margin;
-  y = 50 - 4;
-  if (model.record.no) this.ADD_PRINT_BARCODE(y, x, 110, 60, '128Auto', model.record.no);
-  this.SET_PRINT_STYLEA(0, 'FontSize', 6);
+  this.SET_PRINT_STYLE('Alignment', 1);
 
 
 
 
-  x = width - 100 - margin;
-  w = 54;
-  this.SET_PRINT_STYLE('FontSize', 8);
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`剂数:{{recipe.count}}`));
-  this.ADD_PRINT_TEXT(y, width - w - margin, w, h, template(`包数:{{recipe.total}}`));
-  this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-  w = 100;
-  y += h;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`包装量:{{recipe.volume}}`));
   y += h;
   y += h;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`处方用法:{{recipe.method}}`));
-  this.SET_PRINT_STYLE('FontSize', 9);
+  x = margin;
+  w = 60;
+  this.ADD_PRINT_TEXT(y, x, w, h, '备注:');
+  this.SET_PRINT_STYLE('Alignment', 2);
+  x += w - 2;
+  w = 60;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.volume}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  x += w;
+  w = 50;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.method}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  x += w;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.decoction}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  this.SET_PRINT_STYLE('Alignment', 1);
+
 
 
-  x = 6;
-  y += h + 4;
-  w = width - margin * 2;
+  this.ADD_PRINT_TEXT(86, margin, 170, 44, template(`{{record.remark}}`));
   this.SET_PRINT_STYLEA(0, 'FontSize', 8);
   this.SET_PRINT_STYLEA(0, 'FontSize', 8);
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`科室/病区:{{department}}`));
-  y += h - 1;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`备注:{{record.remark}}`));
+  if (model.record.no) this.ADD_PRINT_BARCODE(99, 175, 46, 46, 'QRCode', model.record.no);
+
+  y = 130;
+  x = margin;
+  w = 70;
+  h = 20;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.delivery}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  x += w;
+  w = 100;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.date}}`));
+  this.SET_PRINT_STYLEA(0, 'Alignment', 2);
 }
 }
 
 
 export function template80_50(model = {}, title = '') {
 export function template80_50(model = {}, title = '') {
@@ -71,59 +97,89 @@ export function template80_50(model = {}, title = '') {
   this.PRINT_INITA(0, 0, width, height, title);
   this.PRINT_INITA(0, 0, width, height, title);
   // 宽度按纸张的整宽缩放
   // 宽度按纸张的整宽缩放
   this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
   this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
+  this.SET_PRINT_MODE('FULL_WIDTH_FOR_OVERFLOW', true);
+  this.SET_PRINT_MODE('FULL_HEIGHT_OVERFLOW', true);
   // 设置输出位置以纸张边缘为基点
   // 设置输出位置以纸张边缘为基点
   this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
   this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
 
 
   let x = margin, y = margin;
   let x = margin, y = margin;
   let w = 0, h = 0;
   let w = 0, h = 0;
 
 
-  y -= 2;
-  w = width - margin * 2;
-  h = 30;
+  w = 290;
+  h = 20;
   this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.title}}`));
   this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.title}}`));
   this.SET_PRINT_STYLEA(0, 'Bold', 1);
   this.SET_PRINT_STYLEA(0, 'Bold', 1);
-  this.SET_PRINT_STYLEA(0, 'Alignment', 2);
-
-  w = 70;
-  h = 20;
-  y = 40;
-  x = width - w - margin;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.category}}`));
-  this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-  w = x - margin;
-  this.ADD_PRINT_TEXT(y, margin, w, h, template(`{{patient.name}},{{patient.gender}},{{patient.birthday}}`));
 
 
-  x = margin;
   y += h;
   y += h;
-  if (model.record.no) this.ADD_PRINT_BARCODE(y, x, 145, 60, '128Auto', model.record.no);
-  this.SET_PRINT_STYLEA(0, 'FontSize', 6);
-
-  this.SET_PRINT_STYLE('FontSize', 8);
-  w = 130;
-  x = width - w - margin;
-  y += 4;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`手机号:{{patient.phone}}`));
+  w = 196;
+  this.ADD_PRINT_TEXT(y, x, w, h, '中药煎药取药凭证');
   y += h;
   y += h;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`处方用法:{{recipe.method}}`));
+  w = 50;
+
+  this.ADD_PRINT_TEXT(y, x, w, h, '病历号');
+  x += w - 1;
+  w = 100;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.medicalRecordNumber}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  x += w - 3;
+  w = 50;
+  this.ADD_PRINT_TEXT(y, x, w, h, '处方号');
+  x += w - 6;
+  w = 94 + 6;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{record.no}}`));
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+
   y += h;
   y += h;
-  w = 55;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`剂数:{{recipe.count}}`));
+  x = margin;
+  w = 50;
+  this.ADD_PRINT_TEXT(y, x, w, h, '姓名:');
   x += w;
   x += w;
-  this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`是否代煎:{{recipe.decoction}}`));
-  this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-  this.SET_PRINT_STYLE('FontSize', 9);
+  w = 146 + 6;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{patient.name}}`));
+  this.SET_PRINT_STYLEA(0, 'FontSize', 12);
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  x += w;
+  w = 44;
+  this.ADD_PRINT_TEXT(y, x, w, h, '贴数');
+  this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+  x += w;
+  this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.count}}`));
+  this.SET_PRINT_STYLEA(0, 'FontSize', 12);
+  this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
 
 
-  x = margin;
   y += h;
   y += h;
-  w = width - margin * 2;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`科室/病房:{{department}}`));
-  y += h;
-  h += 6;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`药师备注:{{record.remark}}`));
+  x = margin;
+  h = 44;
+  this.ADD_PRINT_TEXT(y, x, 230, h, template(`地址:{{recipe.address}}`));
+
+
   y += h;
   y += h;
+  x = margin;
   h = 20;
   h = 20;
-  this.ADD_PRINT_TEXT(y, x, w, h, template(`打印时间:{{record.date}}`));
+  w = 50;
+  this.ADD_PRINT_TEXT(y, x, w, h, '取药:');
+  x += w;
+  this.ADD_PRINT_TEXT(y, x, 130, h, template(`{{department}}`));
+  this.SET_PRINT_STYLEA(0, 'FontSize', 10);
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+  y += h;
+  x = margin;
+  this.ADD_PRINT_TEXT(y, x, 180, h, template(`{{record.remark}}`));
+  this.SET_PRINT_STYLEA(0, 'FontSize', 8);
+  y += h - 4;
+  x = margin;
+  this.ADD_PRINT_TEXT(y, x, 180, h, template(`{{recipe.method}}`));
+  this.SET_PRINT_STYLEA(0, 'FontSize', 10);
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+
+
+  this.ADD_PRINT_TEXT(98, 236, 60, 20, template(`{{recipe.delivery}}`));
+  this.SET_PRINT_STYLEA(0, 'FontSize', 12);
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+  this.SET_PRINT_STYLEA(0, 'Bold', 1);
+
+  if (model.record.no) this.ADD_PRINT_BARCODE(133, 189, 107, 50, '128Auto', model.record.no);
 }
 }
 
 
 /**
 /**
@@ -135,13 +191,14 @@ export function template80_50(model = {}, title = '') {
 export function templateA5(model = {}, title = '') {
 export function templateA5(model = {}, title = '') {
   const template = renderTemplate.bind(this, model);
   const template = renderTemplate.bind(this, model);
 
 
+  const size = 40;
   const width = 559;
   const width = 559;
   const height = 794;
   const height = 794;
   const margin = 12;
   const margin = 12;
 
 
   this.PRINT_INITA(0, 0, width, height, title);
   this.PRINT_INITA(0, 0, width, height, title);
   // 宽度按纸张的整宽缩放
   // 宽度按纸张的整宽缩放
-  this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Height');
+  this.SET_PRINT_MODE('PRINT_PAGE_PERCENT', 'Full-Width');
   // 设置输出位置以纸张边缘为基点
   // 设置输出位置以纸张边缘为基点
   this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
   this.SET_PRINT_MODE('POS_BASEON_PAPER', true);
 
 
@@ -149,77 +206,82 @@ export function templateA5(model = {}, title = '') {
     let result = [];
     let result = [];
     for (let i = 0; i < array.length; i += size) {result.push(array.slice(i, i + size));}
     for (let i = 0; i < array.length; i += size) {result.push(array.slice(i, i + size));}
     return result;
     return result;
-  })(model.recipe['medicines']);
+  })(model.recipe['medicines'], size);
   if (!chunks.length) chunks.push([]);
   if (!chunks.length) chunks.push([]);
   const single = chunks.length === 1;
   const single = chunks.length === 1;
 
 
   for (const chunk of chunks) {
   for (const chunk of chunks) {
+    let x = margin, y = margin;
+    let w = 0, h = 0, offset = 0;
     // 绘制头部
     // 绘制头部
-    this.ADD_PRINT_TEXT(margin, margin, 310, 30, template(`{{record.title}}`));
-    this.SET_PRINT_STYLEA(0, 'FontSize', 16);
+    this.ADD_PRINT_TEXT(y, x, 310, 26, template(`{{record.title}}`));
+    this.SET_PRINT_STYLEA(0, 'FontSize', 12);
+    this.SET_PRINT_STYLEA(0, 'Bold', 1);
+
+    y = 37;
+    this.ADD_PRINT_TEXT(y, 117, 100, 20, template(`{{recipe.type}}`));
     this.SET_PRINT_STYLEA(0, 'Alignment', 2);
     this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+
+    this.ADD_PRINT_TEXT(y, 12, 100, 20, template(`{{recipe.decoction}}`));
+    this.SET_PRINT_STYLEA(0, 'FontSize', 12);
     this.SET_PRINT_STYLEA(0, 'Bold', 1);
     this.SET_PRINT_STYLEA(0, 'Bold', 1);
-    this.ADD_PRINT_TEXT(47, 12, 310, 20, template(`{{recipe.type}}`));
+    this.ADD_PRINT_TEXT(y, 222, 100, 20, template(`{{record.serialNumber}}`));
     this.SET_PRINT_STYLEA(0, 'Alignment', 2);
     this.SET_PRINT_STYLEA(0, 'Alignment', 2);
-    if (model.record.no) this.ADD_PRINT_BARCODE(12, 331, 216, 60, '128Auto', model.record.no);
+    this.SET_PRINT_STYLEA(0, 'Bold', 1);
 
 
-    // 绘制顶部信息
-    let x = 0, y = 80, h = 20;
-    let rows = [
-      [
-        {left: margin, width: 138, height: 20, text: template(`姓名:{{patient.name}}`)},
-        {width: 60, height: 20, text: template(`性别:{{patient.gender}}`)},
-        {width: 80, height: 20, text: template(`年龄:{{patient.age}}`)},
-        {width: 120, height: 20, text: template(`电话:{{patient.phone}}`)},
-      ],
-      [
-        {left: margin, width: 198, height: 20, text: template(`就诊科室:{{department}}`)},
-        {width: 80, height: 20, text: template(`床号:{{bedNo}}`)},
-        {width: 120, height: 20, text: template(`病历号:{{recordNo}}`)},
-      ],
-      [
-        {left: margin, width: 350, height: 20, text: template(`临床诊断:{{diagnosis}}`)},
-        {leftOffset: 2, width: 350, height: 20, text: template(`开方时间:{{recipe.date}}`)},
-      ],
-      [
-        {left: margin, width: 400, height: 20, text: template(`联系地址:{{recipe.address}}`)},
-        {
-          leftOffset: 2, width: 134, height: 20, text: template(`{{recipe.delivery}}`), style: {
-            Alignment: 3,
-          },
-        },
-      ],
-    ];
-    rows.forEach((row, r) => {
-      row.forEach((col, c) => {
-        if (col.top != null) y = col.top;
-        else if (r && c === 0) { y += (h + 2); }
-
-        if (col.left != null) x = col.left;
-        else if (c) {x += row[c - 1].width + (col.leftOffset || 0);}
-
-        this.ADD_PRINT_TEXT(y, x, col.width, col.height, col.text);
-        for (const [prop, value] of Object.entries(col.style || {})) {
-          this.SET_PRINT_STYLEA(0, prop, value);
-        }
-      });
-    });
+    if (model.record.no) this.ADD_PRINT_BARCODE(12, 331, 216, 50, '128Auto', model.record.no);
 
 
-    this.ADD_PRINT_TEXT(80, 410, 128, 42, template(`{{field1}}`));
+    // 绘制顶部信息
+    y = 66;
+    h = 20;
+    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, 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);
+    this.SET_PRINT_STYLEA(0, 'Bold', 1);
+    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.SET_PRINT_STYLEA(0, 'Alignment', 3);
+    y += h + offset;
+    h = 34;
+    this.ADD_PRINT_TEXT(y, 12, 418, h, template(`地址:{{recipe.address}}`));
+    this.ADD_PRINT_TEXT(y, 430, 120, h, template(`电话:{{patient.phone}}`));
+    this.SET_PRINT_STYLEA(0, 'Alignment', 3);
+    y += h;
+    this.ADD_PRINT_TEXT(y, 12, 418, h, template(`临床诊断:{{diagnosis}}`));
+    this.ADD_PRINT_TEXT(y, 430, 120, h, template(`{{recipe.delivery}}`));
+    this.SET_PRINT_STYLEA(0, 'FontSize', 12);
+    this.SET_PRINT_STYLEA(0, 'Bold', 1);
     this.SET_PRINT_STYLEA(0, 'Alignment', 3);
     this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-    this.SET_PRINT_STYLEA(0, 'Italic', 1);
-    this.SET_PRINT_STYLEA(0, 'Underline', 1);
-
 
 
     // 分割线
     // 分割线
     this.ADD_PRINT_SHAPE(4, 178, 12, 535, 1, 0, 1, '#000000');
     this.ADD_PRINT_SHAPE(4, 178, 12, 535, 1, 0, 1, '#000000');
-    // RP
-    this.ADD_PRINT_TEXT(192, 12, 50, 30, 'Rp:');
-    this.SET_PRINT_STYLEA(0, 'FontSize', 16);
+
+    y = 188;
+    this.ADD_PRINT_TEXT(y, 48, 120, 20, '药品名');
+    this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+    this.SET_PRINT_STYLEA(0, 'Bold', 1);
+    this.ADD_PRINT_TEXT(y, 168, 50, 20, '单帖量');
+    this.SET_PRINT_STYLEA(0, 'Alignment', 3);
+    this.SET_PRINT_STYLEA(0, 'Bold', 1);
+    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);
     this.SET_PRINT_STYLEA(0, 'Bold', 1);
 
 
     // 绘制药品
     // 绘制药品
-    y = 230 - 20 - 2;
     chunk.forEach((medicine, i) => {
     chunk.forEach((medicine, i) => {
       const template = renderTemplate.bind(this, medicine);
       const template = renderTemplate.bind(this, medicine);
       if (i % 2) {
       if (i % 2) {
@@ -236,70 +298,56 @@ export function templateA5(model = {}, title = '') {
       x += 50 + 2;
       x += 50 + 2;
       this.ADD_PRINT_TEXT(y, x, 48, 16, template(`{{usage}}`));
       this.ADD_PRINT_TEXT(y, x, 48, 16, template(`{{usage}}`));
       this.SET_PRINT_STYLEA(0, 'FontSize', 6);
       this.SET_PRINT_STYLEA(0, 'FontSize', 6);
+      this.SET_PRINT_STYLEA(0, 'Alignment', 2);
     });
     });
 
 
-    // 绘制处方信息
-    y = Math.max(560, y);
-    y += 20 + 8 * 2;
-    this.SET_PRINT_STYLE('Alignment', 2);
-    this.ADD_PRINT_TEXT(y, margin, 111, 20, template(`剂数:{{recipe.count}} ${model.recipe.decoction ? '(代煎)' : ''}`));
-    this.ADD_PRINT_TEXT(y, 120, 100, 20, template(`{{recipe.category}} ${model.recipe.method ? '({{recipe.method}})' : ''}`));
-    this.ADD_PRINT_TEXT(y, 229, 100, 20, template(`{{recipe.volume}}`));
-    this.ADD_PRINT_TEXT(y, 339, 100, 20, template(`{{recipe.frequency}}`));
-    this.ADD_PRINT_TEXT(y, 448, 100, 20, template(`{{recipe.frequencyTime}}`));
-    this.ADD_PRINT_SHAPE(4, 619, 12, 535, 1, 0, 1, '#000000');
-
-    // 绘制矩形
-    this.ADD_PRINT_RECT(620 + 12, 12, 240, 70, 0, 1);
-    // 第一横行线
-    this.ADD_PRINT_SHAPE(4, 654, 12, 240, 1, 0, 1, '#000000');
-    // 第二横行线
-    this.ADD_PRINT_SHAPE(4, 679, 12, 240, 1, 0, 1, '#000000');
-    // 第二行 竖线
-    this.ADD_PRINT_SHAPE(4, 655, 132, 1, 24, 0, 1, '#000000');
-    this.ADD_PRINT_TEXT(637, 13, 238, 12, template(`药品金额:¥{{recipe.medicineFees}}`));
-    this.ADD_PRINT_TEXT(661, 13, 118, 12, template(`煎药费:¥{{recipe.decoctionFees}}`));
-    this.ADD_PRINT_TEXT(661, 133, 118, 12, template(`配送费:¥{{recipe.deliveryFees}}`));
-    this.ADD_PRINT_TEXT(685, 13, 238, 12, template(`总金额:¥{{recipe.totalFees}}`));
-    this.SET_PRINT_STYLE('Alignment', 1);
-    this.SET_PRINT_STYLE('FontSize', 8);
-
-    y = 620 + 12 + 4;
-    rows = [
-      [
-        {left: 266, text: template(`开方:{{sign.field1}}`)},
-        {left: 408, text: template(`审核:{{sign.field2}}`)},
-      ],
-      [
-        {left: 266, text: template(`调配:{{sign.field3}}`)},
-        {left: 408, text: template(`复核:{{sign.field4}}`)},
-      ],
-      [
-        {left: 266, text: template(`浸泡:{{sign.field5}}`)},
-        {left: 408, text: template(`煎煮:{{sign.field6}}`)},
-      ],
-      [
-        {left: 266, text: template(`打包:{{sign.field7}}`)},
-        {left: 408, text: template(`发药:{{sign.field8}}`)},
-      ],
-    ];
-    for (const row of rows) {
-      for (const col of row) {
-        this.ADD_PRINT_TEXT(y, col.left, 140, 16, col.text);
-        this.ADD_PRINT_TEXT(y, col.left, 140, 16, col.text);
-      }
-      y += 16 + 2;
-    }
-    this.SET_PRINT_STYLE('FontSize', 9);
-    this.ADD_PRINT_SHAPE(4, 714, 12, 535, 1, 0, 1, '#000000');
-
-    if (model.record.remark) {
-      this.ADD_PRINT_TEXT(725, 12, 40, 16, '注:');
-      this.SET_PRINT_STYLEA(0, 'Bold', 1);
-      this.SET_PRINT_STYLEA(0, 'Vorient', 1);
-      this.ADD_PRINT_TEXT(725, 48, 500, 55, template(`{{record.remark}}`));
-      this.SET_PRINT_STYLEA(0, 'Vorient', 1);
-    }
+    y += 20 + 2 + 12;
+
+    this.ADD_PRINT_TEXT(y, 12, 536, 40, template(`备注:{{record.remark}}`));
+
+    y += 40;
+    x = margin;
+    h = 20;
+    w = 130;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`用法:{{recipe.method}}`));
+    this.ADD_PRINT_TEXT(y, width - margin - w, w, 40, template(`{{recipe.volume}}`));
+    this.SET_PRINT_STYLEA(0, 'FontSize', 12);
+    this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+    this.SET_PRINT_STYLEA(0, 'Bold', 1);
+
+    y += h;
+    x = margin;
+    h = 20;
+    w = 130;
+    offset = 5;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`金额:{{recipe.totalFees}} 元`));
+    x += w + offset;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`共 {{recipe.count}} 剂`));
+    this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+    x += w + offset;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`煎 {{recipe.count}} 剂`));
+    this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+
+    y += h;
+    x = margin;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`医生:{{sign.field1}}`));
+    x += w + offset;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`单剂重量:{{recipe.unitWeight}}`));
+    this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+    x += w + offset;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`总重量:{{recipe.totalWeight}}`));
+    this.SET_PRINT_STYLEA(0, 'Alignment', 2);
+
+    y += h;
+    x = margin;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`审方人:{{sign.field2}}`));
+    x += w + offset;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`配药人:{{sign.field3}}`));
+    x += w + offset;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`复核人:{{sign.field4}}`));
+    x += w + offset;
+    this.ADD_PRINT_TEXT(y, x, w, h, template(`煎药人:{{sign.field6}}`));
+
 
 
     if (!single) this.NEWPAGEA();
     if (!single) this.NEWPAGEA();
   }
   }
@@ -327,7 +375,7 @@ export function template72(model, title) {
   let x = margin, y = margin;
   let x = margin, y = margin;
   let w = 0, h = 0;
   let w = 0, h = 0;
 
 
-  w = 70;
+  w = 60;
   h = 20;
   h = 20;
   this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.delivery}}`));
   this.ADD_PRINT_TEXT(y, x, w, h, template(`{{recipe.delivery}}`));
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
@@ -335,7 +383,7 @@ export function template72(model, title) {
   x += w;
   x += w;
   h = 30;
   h = 30;
   this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`{{record.title}}`));
   this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`{{record.title}}`));
-  this.SET_PRINT_STYLEA(0, 'FontSize', 16);
+  this.SET_PRINT_STYLEA(0, 'FontSize', 12);
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
   this.SET_PRINT_STYLEA(0, 'Bold', 1);
   this.SET_PRINT_STYLEA(0, 'Bold', 1);
   x = margin;
   x = margin;
@@ -368,15 +416,17 @@ export function template72(model, title) {
   if (model.record.no) this.ADD_PRINT_BARCODE(y, x, h, h, 'QRCode', model.record.no);
   if (model.record.no) this.ADD_PRINT_BARCODE(y, x, h, h, 'QRCode', model.record.no);
 
 
   x = 94;
   x = 94;
-  h = 45 * 2;
+  h = 45;
   this.ADD_PRINT_TEXT(y, x, 178, h, template(`备注:{{record.remark}}`));
   this.ADD_PRINT_TEXT(y, x, 178, h, template(`备注:{{record.remark}}`));
+  y += h;
+  this.ADD_PRINT_TEXT(y, x, 178, h, template(`另包:`));
 
 
   x = margin;
   x = margin;
   y += h;
   y += h;
 
 
   w = 72;
   w = 72;
   h = 20;
   h = 20;
-  this.ADD_PRINT_TEXT(y, x, w, h, `药味:${model.recipe.medicines.length}}`);
+  this.ADD_PRINT_TEXT(y, x, w, h, `药味:${model.recipe.medicines.length}`);
   x += w;
   x += w;
   w = 100;
   w = 100;
   this.ADD_PRINT_TEXT(y, x, w, h, template(`帖重:{{recipe.unitWeight}}`));
   this.ADD_PRINT_TEXT(y, x, w, h, template(`帖重:{{recipe.unitWeight}}`));
@@ -390,38 +440,41 @@ export function template72(model, title) {
   w = 100;
   w = 100;
   this.ADD_PRINT_TEXT(y, x, w, h, template(`开单:{{doctor}}`));
   this.ADD_PRINT_TEXT(y, x, w, h, template(`开单:{{doctor}}`));
   x += w;
   x += w;
-  this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`共 {{recipe.count}}帖 {{recipe.total}}包`));
+  this.ADD_PRINT_TEXT(y, x, width - x - margin, h, template(`共 {{recipe.count}}  {{recipe.total}} 包`));
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
 
 
-  x = margin;
   y += h;
   y += h;
+  this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
+  x = margin;
+  y += 8;
   w = 178;
   w = 178;
   h = 20;
   h = 20;
   this.ADD_PRINT_TEXT(y, x, w, h, [
   this.ADD_PRINT_TEXT(y, x, w, h, [
-    template(`{{recipe.volume}}`),
     template(`{{recipe.frequency}}`),
     template(`{{recipe.frequency}}`),
     template(`{{recipe.frequencyTime}}`),
     template(`{{recipe.frequencyTime}}`),
   ].filter(Boolean).join(','));
   ].filter(Boolean).join(','));
-
   w = 100;
   w = 100;
-  this.ADD_PRINT_TEXT(y, width - w - margin, w, h, '装量:  ML');
+  this.ADD_PRINT_TEXT(y, width - w - margin, w, h, template(`装量:{{recipe.volume}} ML`));
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
 
 
-  this.ADD_PRINT_SHAPE(4, 255, 0, 278, 1, 0, 1, '#000000');
-  this.ADD_PRINT_TEXT(265, 0, 60, 20, '库位号');
+  y += h - 2;
+  this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
+  y += 10;
+  this.ADD_PRINT_TEXT(y, 0, 60, 20, '斗号');
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
-  this.ADD_PRINT_TEXT(265, 53, 86, 20, '药品名');
+  this.ADD_PRINT_TEXT(y, 53, 86, 20, '品名');
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
   this.SET_PRINT_STYLEA(0, 'Alignment', 2);
-  this.ADD_PRINT_TEXT(265, 136, 36, 20, '单帖');
+  this.ADD_PRINT_TEXT(y, 136, 36, 20, '单帖');
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-  this.ADD_PRINT_TEXT(265, 166, 36, 20, '总量');
+  this.ADD_PRINT_TEXT(y, 166, 36, 20, '总量');
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-  this.ADD_PRINT_TEXT(265, 196, 36, 20, '单位');
+  this.ADD_PRINT_TEXT(y, 196, 36, 20, '单位');
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-  this.ADD_PRINT_TEXT(265, 228, 44, 20, '特煎');
+  this.ADD_PRINT_TEXT(y, 228, 44, 20, '特煎');
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
   this.SET_PRINT_STYLEA(0, 'Alignment', 3);
-  this.ADD_PRINT_SHAPE(4, 285, 0, 278, 1, 0, 1, '#000000');
-  y = 285 + 12;
+  y += 20;
+  this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
+  y = 285 + h;
 
 
   this.SET_PRINT_STYLE('FontSize', 8);
   this.SET_PRINT_STYLE('FontSize', 8);
   model.recipe.medicines.forEach((medicine, i) => {
   model.recipe.medicines.forEach((medicine, i) => {
@@ -446,7 +499,7 @@ export function template72(model, title) {
     y += h + 2;
     y += h + 2;
   });
   });
   this.SET_PRINT_STYLE('FontSize', 9);
   this.SET_PRINT_STYLE('FontSize', 9);
-  y += 12;
+  // y += 2;
   this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
   this.ADD_PRINT_SHAPE(4, y, 0, 278, 1, 0, 1, '#000000');
 
 
 }
 }

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

@@ -93,7 +93,7 @@ export default {
             total: data['packageNumber'],
             total: data['packageNumber'],
             category: data['dosageForm'],
             category: data['dosageForm'],
             method: data['prescriptionusage'],
             method: data['prescriptionusage'],
-            volume: data['concentration'] && `每次${data['concentration']}`,
+            volume: data['concentration'] && `${data['concentration']}`,
             frequency: data['frequency'],
             frequency: data['frequency'],
             frequencyTime: data['medicationTime'],
             frequencyTime: data['medicationTime'],
             decoction: (data['isBehalf'] === '1' || +data['daijianNumber'] > 0) ? '代煎' : '自煎',
             decoction: (data['isBehalf'] === '1' || +data['daijianNumber'] > 0) ? '代煎' : '自煎',