From 64aaf44b6b2948631ebd0d9840d51e5e31ae5479 Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期五, 25 七月 2025 01:44:25 +0800
Subject: [PATCH] Merge branch 'ID1825-床旁副屏改版' into test

---
 src/views/mobile/bedsideAuxiliaryScreen/components/DoctorAdvice/index.vue |  184 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 184 insertions(+), 0 deletions(-)

diff --git a/src/views/mobile/bedsideAuxiliaryScreen/components/DoctorAdvice/index.vue b/src/views/mobile/bedsideAuxiliaryScreen/components/DoctorAdvice/index.vue
new file mode 100644
index 0000000..a193436
--- /dev/null
+++ b/src/views/mobile/bedsideAuxiliaryScreen/components/DoctorAdvice/index.vue
@@ -0,0 +1,184 @@
+<template>
+  <div class="doctor_advice_container" :style="{ height: height }">
+    <div class="doctor_advice_list">
+      <div
+        v-for="(item, index) in drugOrders"
+        :key="index"
+        class="doctor_advice_item"
+      >
+        <div class="doctor_advice_item_name">{{ item.name }}</div>
+        <template v-if="item?.children && item.children.length > 0">
+          <div
+            v-for="(child, childIndex) in item.children"
+            :key="childIndex"
+            class="doctor_advice_item_sub"
+          >
+            <img :src="trunImgSrc" alt="" />
+            <span>{{ child }}</span>
+          </div>
+        </template>
+      </div>
+    </div>
+  </div>
+</template>
+
+<script lang="ts">
+import { PropType, computed } from "vue";
+import type { Order } from "./type"
+import trunImgSrc from "@/assets/turn.png";
+
+export default {
+  name: "DoctorAdvice",
+  props: {
+    // 容器的高度
+    height: {
+      type: String,
+      default: '100%',
+      required: false,
+    },
+    // 医嘱列表
+    list: {
+      type: Array as PropType<Order[]>,
+      default: () => [],
+    },
+  },
+  setup(props) {
+    const drugOrders = computed(() => {
+      // 格式化主医嘱数据(浅拷贝)
+      const formatList = props.list
+        .filter((e) => e.orderIsSub !== 1)
+        .map((e) => ({ ...e }));
+
+      // 处理子医嘱并挂载到对应主医嘱上
+      props.list.forEach((e) => {
+        if (e.orderIsSub === 1) {
+          const i = formatList.findIndex((v) => v.code === e.orderMainCode);
+          if (i !== -1) {
+            if (!formatList[i].subDrugOrders) {
+              formatList[i].subDrugOrders = [];
+            }
+            formatList[i].subDrugOrders.push(e);
+          }
+        }
+      });
+
+      // 构建显示用的 name 和子医嘱 children
+      return formatList.map((order) => {
+        let name = "";
+
+        if (order.orderNameInfo) {
+          name = order.orderNameInfo.itemName || "";
+          const drugSpec = order.orderNameInfo.feeDrugInfo?.drugSpec;
+          if (drugSpec) {
+            name += ` (${drugSpec})`;
+          }
+        }
+
+        if (order.orderUsage && order.orderUsage !== 0) {
+          name += ` ${order.orderUsage}${
+            order.orderNameInfo?.feeDrugInfo?.drugUnitName || ""
+          }`;
+        }
+
+        if (order.orderCount) {
+          name += ` ${order.orderCount}`;
+          const pkgUnit = order.orderNameInfo?.feeDrugInfo?.drugPackageUnitName;
+          if (pkgUnit) {
+            name += pkgUnit;
+          }
+        }
+
+        if (order.orderFromInfo?.dictText) {
+          name += ` ${order.orderFromInfo.dictText}`;
+        }
+
+        if (order.orderFreqInfo?.dictText) {
+          name += ` ${order.orderFreqInfo.dictText}`;
+        }
+
+        const children: string[] = [];
+
+        if (order.subDrugOrders?.length) {
+          order.subDrugOrders.forEach((child: any) => {
+            let subName = child.orderNameInfo?.itemName || "";
+
+            const childSpec = child.orderNameInfo?.feeDrugInfo?.drugSpec;
+            if (childSpec) {
+              subName += ` (${childSpec})`;
+            }
+
+            if (child.orderUsage) {
+              const unit = child.orderNameInfo?.feeDrugInfo?.drugUnitName || "";
+              subName += ` ${child.orderUsage}${unit}`;
+            }
+
+            if (child.orderCount) {
+              const pkgUnit =
+                child.orderNameInfo?.feeDrugInfo?.drugPackageUnitName;
+              if (pkgUnit) {
+                subName += ` ${child.orderCount}${pkgUnit}`;
+              }
+            }
+
+            children.push(subName);
+          });
+        }
+
+        return {
+          name,
+          children,
+        };
+      });
+    });
+
+    return {
+      drugOrders,
+      trunImgSrc,
+    };
+  },
+};
+</script>
+
+<style scoped>
+.doctor_advice_container {
+  box-sizing: border-box;
+}
+.doctor_advice_container .doctor_advice_list {
+  box-sizing: border-box;
+  height: 100%;
+  background: #ffffff;
+  overflow: hidden;
+  overflow-y: auto;
+}
+.doctor_advice_container .doctor_advice_item {
+  box-sizing: border-box;
+  border-bottom: 1px solid #e6e5e5;
+}
+.doctor_advice_container .doctor_advice_item:last-child {
+  /* box-sizing: border-box;
+  border-bottom: none; */
+}
+.doctor_advice_container .doctor_advice_item .doctor_advice_item_name {
+  box-sizing: border-box;
+  font-weight: 400;
+  font-size: 5px;
+  color: #333333;
+  line-height: 12px;
+  text-align: left;
+  font-style: normal;
+}
+.doctor_advice_container .doctor_advice_item_sub {
+  padding-left: 1px;
+  font-weight: 400;
+  font-size: 5px;
+  color: #777777;
+  line-height: 12px;
+  text-align: left;
+  font-style: normal;
+}
+.doctor_advice_container .doctor_advice_item_sub img {
+  width: 7px;
+  height: 7px;
+  margin-right: 2px;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.8.0