Jelajahi Sumber

新增医嘱分组

xiaochan 2 minggu lalu
induk
melakukan
2648eb04d0

+ 17 - 2
src/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng.ts

@@ -529,8 +529,23 @@ export function yzDataToTree(
   option = {
     key: "actOrderNo",
     parentNo: "parentNo",
+    parentIcon: "┌",
+    childIcon: "└",
   }
 ): YzType[] {
+  if (!option?.parentIcon) {
+    option.parentIcon = "┌";
+  }
+  if (!option?.childIcon) {
+    option.childIcon = "└";
+  }
+  if (!option?.key) {
+    option.key = "actOrderNo";
+  }
+  if (!option?.parentNo) {
+    option.parentNo = "parentNo";
+  }
+
   if (data.length === 0) {
     return [];
   }
@@ -568,7 +583,7 @@ export function yzDataToTree(
       noParent.delete(key);
       const parent = tempMap.get(item[option.parentNo]);
       if (parent) {
-        parent.orderGroup = "┌";
+        parent.orderGroup = option.parentIcon;
         parent.children = parent.children || [];
         parent.children.push(item);
       }
@@ -593,7 +608,7 @@ export function yzDataToTree(
       item.children = XEUtils.orderBy(item.children, [
         [option.key, OrderBy.asc],
       ]);
-      item.children[item.children.length - 1].orderGroup = "└";
+      item.children[item.children.length - 1].orderGroup = option.childIcon;
       // 把 item 的 children 节点全部添加到 list数组
       list.push(...item.children);
       // 在把 children 清空

+ 54 - 7
src/views/medical-advice/execute-item/PrintExecuteItem.vue

@@ -99,11 +99,11 @@
         <el-radio value="1">小执行单</el-radio>
       </el-radio-group>
       <el-button icon="Search" type="primary" @click="queryInfo"
-        >查询</el-button
-      >
+        >查询
+      </el-button>
       <el-button icon="Printer" type="success" @click="printInfo"
-        >打印</el-button
-      >
+        >打印
+      </el-button>
     </header>
     <div class="layout_main">
       <el-scrollbar
@@ -148,6 +148,7 @@
               </tr>
               <tr>
                 <th style="width: 10%; height: 27px">医嘱名称</th>
+                <th></th>
                 <th>剂量</th>
                 <th>总量</th>
                 <th>给药方式</th>
@@ -177,6 +178,9 @@
                 <td v-if="item.showFlag == 1" style="width: 20%">
                   {{ item.orderName }}
                 </td>
+                <td v-if="item.showFlag == 1" style="width: 2%; color: red">
+                  {{ item.orderGroup }}
+                </td>
                 <td v-if="item.showFlag == 1" style="width: 8%">
                   {{ item.dose ? item.dose : "" }}
                 </td>
@@ -239,6 +243,7 @@
                 <th style="height: 27px; border-left: 1px solid black">
                   医嘱名称
                 </th>
+                <th></th>
                 <th>剂量</th>
                 <th>给药方式</th>
                 <th>频率</th>
@@ -271,6 +276,9 @@
                 >
                   {{ item.orderName }}
                 </td>
+                <td v-if="item.showFlag == 1" style="width: 2%; color: red">
+                  {{ item.orderGroup }}
+                </td>
                 <td v-if="item.showFlag == 1" style="width: 10%">
                   {{ item.dose ? item.dose : "" }}
                 </td>
@@ -343,7 +351,7 @@
   </el-dialog>
 </template>
 
-<script setup lang="ts" name="PrintExecuteItem">
+<script setup lang="ts">
 import { computed, onMounted, ref } from "vue";
 import { getFormatDatetime, getDiffDays } from "@/utils/date";
 import { getAllWards } from "@/api/zhu-yuan-yi-sheng/resident-doctor";
@@ -352,10 +360,12 @@ import {
   queryExecuteItem,
   updateExecuteItemPrintFlag,
 } from "@/api/medical-advice/excute-item";
-import ItemClass from "@/components/medical-advice/ItemClass";
+import ItemClass from "@/components/medical-advice/ItemClass.vue";
 import { getLodop, initLodop } from "@/utils/c-lodop";
 import { getWindowSize } from "@/utils/window-size";
 import { findSelfBuysName } from "@/data/yz-selfbuy";
+import XEUtils from "xe-utils";
+import { yzDataToTree } from "@/views/hospitalization/zhu-yuan-yi-sheng/public-js/zhu-yuan-yi-sheng";
 
 const queryParam = ref({
   wardCode: "",
@@ -424,11 +434,48 @@ function reverseArray(arr) {
   return newArr;
 }
 
+type PatientInfo = {
+  actOrderNo: string;
+  parentNo: string | null;
+  occTime: string;
+  inpatientNo: string;
+};
+
+function handleSort(value: PatientInfo[]) {
+  const currentPatientInfo: {
+    [key: string]: {
+      info: PatientInfo;
+      list: PatientInfo[];
+    };
+  } = {};
+  XEUtils.arrayEach(value, (item, index) => {
+    item.inpatientNo = item.inpatientNo.trim();
+    if (item.actOrderNo == null) {
+      currentPatientInfo["zy" + item.inpatientNo] = {
+        info: item,
+        list: [],
+      };
+    } else {
+      currentPatientInfo["zy" + item.inpatientNo].list.push(item);
+    }
+  });
+  const tmp = [];
+
+  for (let key in currentPatientInfo) {
+    const item = currentPatientInfo[key];
+    const data = yzDataToTree(item.list, { childIcon: "┛", parentIcon: "┓" });
+    tmp.push(item.info);
+    tmp.push(...data);
+  }
+  return tmp;
+}
+
 const itemClassRef = ref(null);
 const resData = ref([]);
 const queryInfo = () => {
   queryExecuteItem(queryParam.value).then((res: any) => {
-    resData.value = res;
+    resData.value = handleSort(res);
+    console.log(resData.value);
   });
 };