瀏覽代碼

瓶贴根据频率决定打印数量

zengfanwei 1 周之前
父節點
當前提交
a3ff409ddc
共有 1 個文件被更改,包括 65 次插入18 次删除
  1. 65 18
      src/views/hospitalization/nurse-module/PrintInfusionCard.vue

+ 65 - 18
src/views/hospitalization/nurse-module/PrintInfusionCard.vue

@@ -54,6 +54,14 @@
           <el-option value="BOTTLE_CARD" label="瓶贴"></el-option>
         </el-select>
       </span>
+      <!-- <span class="ml12" v-if="queryParams.cardType === 'BOTTLE_CARD'">
+        瓶贴类型:
+        <el-select v-model="queryParams.bottleCardType" style="width: 76px">
+          <el-option :value="2" label="输液"></el-option>
+          <el-option :value="7" label="注射"></el-option>
+          <el-option value="BOTTLE_CARD" label="雾化"></el-option>
+        </el-select>
+      </span> -->
       <el-divider direction="vertical"></el-divider>
       <el-button type="primary" icon="Search" @click="executeQuery">检索</el-button>
       <el-button type="primary" icon="Printer" @click="execPrint">打印</el-button>
@@ -78,19 +86,14 @@
             </bottle-card>
           </div>
         </div>
-        <!-- <div class="print-hiden-area" style="margin: 0px 12px">
-          <div class="print-bottle-card-area" style="display: flex;margin: 0px;">
-            <div v-for="(item, index) in printPatientBottleInfos" :id="item.patInfo.patNo + '-' + index"
-              style="width: 240px;margin-right: 10px;">
-              <bottle-card :drugs="item.bottleCardDrugs" :pat-info="item.patInfo" :yz-date="queryParams.executeDate"
-                :bottle-group="item.bottleGroup" style="margin-bottom: 10px;">
-              </bottle-card>
-            </div>
-            <div v-if="printPatientBottleInfos.length != 0 && printPatientBottleInfos.length % 2 != 0"
-              style="width: 230px;">
-            </div>
+        <div class="print-hiden-area" style="margin: 0px 12px">
+          <div v-for="(item, index) in printPatientBottleInfos" :id="item.patInfo.patNo + '-' + index + '_print'"
+            style="width: 230px;display: inline-block;margin-right: 20px">
+            <bottle-card :drugs="item.bottleCardDrugs" :pat-info="item.patInfo" :yz-date="queryParams.executeDate"
+              :bottle-group="item.bottleGroup" style="margin-bottom: 10px;">
+            </bottle-card>
           </div>
-        </div> -->
+        </div>
       </div>
     </template>
   </page-layer>
@@ -158,8 +161,11 @@ const handleEndBedChange = (bed) => {
   queryParams.sortNoEnd = bed.sortNo
 }
 
-const handleTypeChange = () => {
+const handleTypeChange = (val) => {
+  // console.log("val",val)
   patientInfusionInfos.value = []
+  queryParams.bottleCardType = val == "INFUSION_CARD" ? "" : 2
+  // console.log("queryParams",queryParams)
 }
 
 const datePickChange = () => {
@@ -197,7 +203,6 @@ const executeQuery = () => {
       // for (let i = 0; i < 2; i++) {
       //  patientInfusionInfos.value = [...patientInfusionInfos.value, ...res]
       // }
-
       // printPatientBottleInfos.value = res
       printDate.value = getDatetime()
     })
@@ -206,6 +211,48 @@ const executeQuery = () => {
   })
 }
 
+const frequencyOptions = [
+  {
+    //每天两次
+    arr: ['Bid', 'Q12H', 'Q12H/单日', 'Q12H/双日', 'bod'
+    ],
+    add: 1
+  },
+  {
+    //每天三次
+    arr: ['Tid', 'Tod'],
+    add: 2
+  },
+  {
+    //每天四次
+    arr: ['Qid'],
+    add: 3
+  },
+]
+
+const handlePrintByFrequency = () => {
+  let result = [...printPatientBottleInfos.value]
+  printPatientBottleInfos.value.forEach(item => {
+    let frequency = item.bottleCardDrugs[0].frequCode
+    let add = 0;
+    for (let i = 0; i < frequencyOptions.length; i++) {
+      if (frequencyOptions[i].arr.includes(frequency)) {
+        add = frequencyOptions[i].add
+        break;
+      }
+    }
+    if (add > 0) {
+      let index = result.findIndex(citem => citem.bottleCardDrugs[0].actOrderNo === item.bottleCardDrugs[0].actOrderNo);
+      for (let i = 0; i < add; i++) {
+        let target = { ...item }
+        target.patInfo.patNo = target.patInfo.patNo + '_' + i
+        result.splice(index, 0, target);
+      }
+    }
+  })
+  return result
+}
+
 const execPrint = () => {
   const type = queryParams.cardType === 'INFUSION_CARD' ? '输液卡' : '瓶贴卡'
   if (patientInfusionInfos.value.length === 0) {
@@ -281,6 +328,7 @@ const execPrint = () => {
     updatePrintState()
   } else {
     printPatientBottleInfos.value = [...patientInfusionInfos.value]
+    printPatientBottleInfos.value = handlePrintByFrequency()
     // console.log("patientInfusionInfos",patientInfusionInfos.value)
     // console.log("printPatientBottleInfos",printPatientBottleInfos.value)
     nextTick(() => {
@@ -298,8 +346,8 @@ const execPrint = () => {
       let currentRowElements = []; // 当前行的元素
       let currentRowMaxHeight = 0; // 当前行最高元素高度(px)
 
-      patientInfusionInfos.value.forEach((item, index) => {
-        const printTarget = document.getElementById(`${item.patInfo.patNo}-${index}`);
+      printPatientBottleInfos.value.forEach((item, index) => {
+        const printTarget = document.getElementById(`${item.patInfo.patNo}-${index}_print`);
         if (!printTarget) return;
 
         // 获取当前元素高度(px)
@@ -366,7 +414,7 @@ const execPrint = () => {
       }
 
       LODOP.PREVIEW();
-
+      printPatientBottleInfos.value = []
       // LODOP.PRINT_INIT('infusionCard')
       // LODOP.SET_PRINT_PAGESIZE(1, '210mm', '297mm', '')
       // let printHTML = "";
@@ -432,7 +480,6 @@ const execPrint = () => {
       // // LODOP.ADD_PRINT_HTML('0mm', '0mm', '210mm', '297mm', printFinal)
       // // LODOP.SET_PRINT_STYLE('ItemType', 3)
       // LODOP.PREVIEW();
-      printPatientBottleInfos.value = []
       updatePrintState()
     });
   }