Sfoglia il codice sorgente

完成诊断触发检验检查的申请

xiaochan 3 giorni fa
parent
commit
fe589f4b1a

+ 16 - 0
src/api/dictionary/diagnoseToJyJcReq.ts

@@ -112,3 +112,19 @@ export function delTemplate(id) {
     params: { id },
   });
 }
+
+export function selectByDiagnose(codes: any) {
+  return requestV2({
+    url: "/diagnoseJyJcReqTemplate/selectByDiagnose",
+    method: "post",
+    data: codes,
+  });
+}
+
+export function createPatientJyJcReq(data: { data: DiagnoseReqTemplate[] }) {
+  return requestV2({
+    url: "/diagnoseJyJcReqTemplate/createPatientJyJcReq",
+    method: "post",
+    data,
+  });
+}

+ 1 - 1
src/auto-imports.d.ts

@@ -65,6 +65,6 @@ declare global {
 // for type re-export
 declare global {
   // @ts-ignore
-  export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
+  export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
   import('vue')
 }

+ 4 - 10
src/components/cy/combo-grid/src/CyComboGrid.vue

@@ -261,16 +261,10 @@ defineExpose({
               max-height="250px"
             >
               <vxe-column
-                field="value"
-                title="编码"
-                width="125"
-                max-width="125"
-              />
-              <vxe-column
-                field="label"
-                title="名称"
-                width="135"
-                max-width="135"
+                v-for="item in props.leftTableHeader"
+                :title="item.name || item.title"
+                :field="item.code || item.field"
+                :min-width="item.width"
               />
             </vxe-table>
           </div>

+ 19 - 8
src/components/cy/combo-grid/src/CyComboGridProps.ts

@@ -133,14 +133,12 @@ const CyComboGridProps = {
     type: Array,
     default: null,
   },
-  leftTable: {
-    type: Object as PropType<
-      { valueWidth: string | number; labelWidth: string | number }[]
-    >,
-    default: {
-      valueWidth: "80",
-      labelWidth: "120",
-    },
+  leftTableHeader: {
+    type: Array as PropType<TableHeader[]>,
+    default: () => [
+      { code: "value", name: "编码", width: "125px" },
+      { code: "label", name: "名称", width: "135px" },
+    ],
   },
   showTableHeader: {
     type: Boolean,
@@ -156,3 +154,16 @@ const CyComboGridProps = {
 };
 
 export default CyComboGridProps;
+
+export type CyComboGridEmits = {
+  (e: "update:modelValue", value: any): void;
+  (e: "focus", value: any): void;
+  (e: "blur", value: any): void;
+  (e: "update:data", value: any): void;
+  (e: "visible-change", value: boolean): void;
+  (e: "rowClick", value: any): void;
+  (e: "clear"): void;
+  (e: "focus"): void;
+
+  (e: "change", value: any): void;
+};

+ 363 - 0
src/components/simple-jyjc-req/SimpleJyJcReq.vue

@@ -0,0 +1,363 @@
+<script setup lang="tsx">
+// 检验检查申请
+import { useCompShallowRef } from "@/utils/useCompRef";
+import { ElTable } from "element-plus";
+import {
+  createPatientJyJcReq,
+  getTemplateContentById,
+} from "@/api/dictionary/diagnoseToJyJcReq";
+import SystemDeptSelect from "@/components/system/dept-select/SystemDeptSelect.vue";
+import JcPartSelect from "@/components/system/JcPartSelect.vue";
+import JySampleSelect from "@/components/system/jy-sample/JySampleSelect.vue";
+import { xcMessage } from "@/utils/xiaochan-element-plus";
+import CyTabs from "@/components/cy/tabs/src/CyTabs";
+import CyTabPane from "@/components/cy/tabs/src/CyTabPane.vue";
+import DiagNoseIcdCodeNew from "@/components/system/DiagNoseIcdCodeNew.vue";
+import type { CodeNameArray } from "@/ts-type/Code";
+import { copyStrFunc } from "@/utils/public";
+import PrintCheckList from "@/components/zhu-yuan-yi-sheng/jian-cha-shen-qing/da-ying/PrintCheckList.vue";
+import { CyMessageBox } from "@/utils/cy-message-box";
+
+const props = withDefaults(
+  defineProps<{
+    patNo: string;
+    times: number;
+    // 检验检查模板列表
+    templateList: CodeNameArray;
+    // 诊断列表
+    diagnoseList: CodeNameArray;
+    emrBusinessList?: {
+      [key: string]: {
+        value?: string | CodeNameArray;
+      };
+    };
+  }>(),
+  {
+    emrBusinessList: {},
+  }
+);
+
+const jcTable = useCompShallowRef(ElTable);
+const jyTable = useCompShallowRef(ElTable);
+const printRef = useCompShallowRef(PrintCheckList);
+const searchBusiness = ref("");
+
+const tmpEmrBusinessList = computed(() => {
+  const tmp = {};
+  for (let key in props.emrBusinessList) {
+    if (key.includes(searchBusiness.value)) {
+      tmp[key] = props.emrBusinessList[key];
+    }
+  }
+  return tmp;
+});
+
+const tmpPrefabrication = computed(() => {
+  return props.diagnoseList.map(item => {
+    return {
+      label: item.name,
+      value: item.code,
+    };
+  });
+});
+
+const store = reactive({
+  // 病史摘要
+  reqComment: "",
+  // 体征信息
+  reqTzComment: "",
+  // 相关辅检结果
+  reqOtherResult: "",
+  // 临床诊断
+  diagCode: "",
+  diagName: "",
+});
+
+const tabValue = ref("jc");
+
+function handleRowClick(row, tableRef: InstanceType<typeof ElTable>) {
+  tableRef.toggleRowSelection(row);
+}
+
+const tableData = reactive({
+  jc: [],
+  jy: [],
+});
+
+const DefaultTableColumns = (_props, { slots, ...val }) => {
+  return [
+    <el-table-column type="selection" />,
+    <el-table-column prop="zyOrderCode" label="编码" width="50" />,
+    <el-table-column prop="orderName" label="名称" />,
+    <el-table-column label="执行科室" width="220">
+      {{
+        default(scope) {
+          return (
+            <SystemDeptSelect
+              v-model={scope.row}
+              value="execDept"
+              label="execName"
+            />
+          );
+        },
+      }}
+    </el-table-column>,
+    <el-table-column label="标本/部位" width="90">
+      {{
+        default(scope) {
+          return slots?.default?.(scope);
+        },
+      }}
+    </el-table-column>,
+  ];
+};
+
+function handleQueryTemplateById(row) {
+  getTemplateContentById(row.code).then(res => {
+    if (res.reqTemplates.length === 0) {
+      return;
+    }
+    const tmp = {
+      jc: [],
+      jy: [],
+    };
+    res.reqTemplates.forEach(item => {
+      if (item.reqType === 3) {
+        tmp.jc.push(item);
+      } else {
+        tmp.jy.push(item);
+      }
+    });
+
+    tableData.jc = tmp.jc;
+    tableData.jy = tmp.jy;
+  });
+}
+
+function handleSave(value: "jc" | "jy") {
+  const tmp = {
+    patNo: props.patNo,
+    times: props.times,
+    data: [],
+    reqType: "3",
+    ...store,
+  };
+  const jcData = jcTable.value.getSelectionRows();
+  const jyData = jyTable.value.getSelectionRows();
+
+  if (value === "jc") {
+    tmp.reqType = "3";
+    tmp.data.push(...jcData);
+  }
+
+  if (value === "jy") {
+    tmp.reqType = "2";
+    tmp.data.push(...jyData);
+  }
+
+  if (tmp.data.length == 0) {
+    xcMessage.error("请选择项目");
+    return;
+  }
+
+  createPatientJyJcReq(tmp).then(async res => {
+    if (tmp.reqType === "3") {
+      await CyMessageBox.confirm({
+        message: "是否打印检查申请单,您也可以稍后再检查申请中批量打印",
+      });
+      printRef.value.print(res);
+    }
+  });
+}
+
+onMounted(() => {
+  store.diagCode = props.diagnoseList[0].code;
+  store.diagName = props.diagnoseList[0].name;
+  if (props.templateList.length === 1) {
+    handleQueryTemplateById(props.templateList[0]);
+  }
+});
+</script>
+
+<template>
+  <div class="layout-horizontal layout_container simple_jyjc_req">
+    <PrintCheckList ref="printRef" />
+    <aside style="width: 220px; height: 100%" class="layout_container">
+      <el-table
+        :data="props.templateList"
+        @row-click="handleQueryTemplateById"
+        style="height: 30%"
+      >
+        <el-table-column prop="name" label="模板名称" />
+      </el-table>
+      <div
+        style="flex: 1; overflow: auto; margin-top: 5px"
+        class="layout_container"
+      >
+        <header>
+          <el-input placeholder="搜索数据源" v-model="searchBusiness" />
+        </header>
+        <div class="layout_main">
+          <template v-for="(value, key) in tmpEmrBusinessList">
+            <div
+              v-if="typeof value.value === 'string'"
+              class="simple_jyjc_req-copy__content"
+            >
+              <div class="simple_jyjc_req-copy__header">
+                {{ key }}
+                <el-button
+                  type="primary"
+                  link
+                  @click="
+                    () => {
+                      copyStrFunc(value.value);
+                    }
+                  "
+                  >复制
+                </el-button>
+              </div>
+              <div class="simple_jyjc_req-copy__text">
+                {{ value.value }}
+              </div>
+            </div>
+          </template>
+        </div>
+      </div>
+    </aside>
+    <div class="layout_main layout_container">
+      <header>
+        <el-form label-position="right">
+          <el-row :gutter="4" style="margin: 0; padding: 0">
+            <el-col :span="12">
+              <el-form-item label="当前诊断" prop="diagCode">
+                <DiagNoseIcdCodeNew
+                  placement="bottom"
+                  v-model="store"
+                  :left-table-header="[
+                    { code: 'label', name: '名称', width: '150px' },
+                  ]"
+                  :prefabrication-options="tmpPrefabrication"
+                  style="width: 100%"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="病史摘要" prop="reqComment">
+                <el-input
+                  style="width: 100%"
+                  v-model="store.reqComment"
+                  :rows="2"
+                  maxlength="125"
+                  show-word-limit
+                  type="textarea"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="体征信息" prop="reqTzComment">
+                <el-input
+                  style="width: 100%"
+                  v-model="store.reqTzComment"
+                  :rows="2"
+                  maxlength="125"
+                  show-word-limit
+                  type="textarea"
+                />
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="辅检结果" prop="reqOtherResult">
+                <el-input
+                  style="width: 100%"
+                  v-model="store.reqOtherResult"
+                  :rows="2"
+                  maxlength="125"
+                  show-word-limit
+                  type="textarea"
+                />
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </header>
+      <div class="layout_main">
+        <cy-tabs type="idea" v-model="tabValue">
+          <cy-tab-pane name="jc" label="检查">
+            <div class="layout_container">
+              <header>
+                <el-button type="primary" @click="handleSave('jc')"
+                  >保存检查
+                </el-button>
+              </header>
+              <el-table
+                ref="jcTable"
+                height="100%"
+                :data="tableData.jc"
+                @row-click="val => handleRowClick(val, jcTable)"
+              >
+                <DefaultTableColumns>
+                  <template #default="scope">
+                    <JcPartSelect
+                      v-model="scope.row"
+                      value="partOrSample"
+                      label="partOrSampleName"
+                      style="width: 100%"
+                      :code-type="scope.row.classes"
+                    />
+                  </template>
+                </DefaultTableColumns>
+              </el-table>
+            </div>
+          </cy-tab-pane>
+          <cy-tab-pane name="jy" label="检验">
+            <div class="layout_container">
+              <header>
+                <el-button type="primary" @click="handleSave('jy')"
+                  >保存检验
+                </el-button>
+              </header>
+              <el-table
+                ref="jyTable"
+                height="100%"
+                :data="tableData.jy"
+                @row-click="val => handleRowClick(val, jyTable)"
+              >
+                <DefaultTableColumns>
+                  <template #default="scope">
+                    <JySampleSelect
+                      v-model="scope.row"
+                      value="partOrSample"
+                      label="partOrSampleName"
+                      style="width: 100%"
+                    />
+                  </template>
+                </DefaultTableColumns>
+              </el-table>
+            </div>
+          </cy-tab-pane>
+        </cy-tabs>
+      </div>
+    </div>
+  </div>
+</template>
+
+<style lang="scss">
+.simple_jyjc_req {
+  .simple_jyjc_req-copy__content {
+    border: 1px solid var(--el-border-color);
+    padding: 5px;
+    margin: 8px 0;
+  }
+
+  .simple_jyjc_req-copy__header {
+    display: flex;
+    justify-content: space-between;
+    padding-bottom: 5px;
+    border-bottom: 1px solid var(--el-border-color);
+  }
+
+  .simple_jyjc_req-copy__text {
+    padding: 5px;
+  }
+}
+</style>

+ 60 - 0
src/components/simple-jyjc-req/checkDiagnoseToJyJc.ts

@@ -0,0 +1,60 @@
+import { selectByDiagnose } from "@/api/dictionary/diagnoseToJyJcReq";
+import { useDialog } from "@/components/cy/CyDialog/index";
+import SimpleJyJcReq from "@/components/simple-jyjc-req/SimpleJyJcReq.vue";
+import { CodeNameArray } from "@/ts-type/Code";
+import { CyMessageBox } from "@/utils/cy-message-box";
+import XEUtils from "xe-utils";
+
+export async function checkDiagnoseToJyJc({
+  patNo,
+  times,
+  diagnoseList,
+  emrBusinessList,
+}: {
+  patNo: string;
+  times: number;
+  diagnoseList: { code: string; name: string }[];
+  emrBusinessList: {
+    [key: string]: {
+      value?: string | CodeNameArray;
+    };
+  };
+}) {
+  if (diagnoseList?.length === 0) {
+    return;
+  }
+  const diagnoses = diagnoseList.map(item => item.code);
+
+  const rst = await selectByDiagnose({ diagnoses, patNo, times }).catch(() => {
+    return [];
+  });
+
+  if (rst.length === 0) {
+    return;
+  }
+
+  return CyMessageBox.confirm({
+    message: "当前患者的诊断有建议的检查检验项目可以做,是否开具",
+    title: "提示",
+    // @ts-ignore
+    type: "success",
+  })
+    .then(() => {
+      useDialog(SimpleJyJcReq, {
+        dialogProps: {
+          fullscreen: true,
+          title: "检验检查申请",
+          showClose: true,
+        },
+        showFooter: false,
+        params: {
+          patNo,
+          times,
+          templateList: rst,
+          diagnoseList,
+          emrBusinessList,
+        },
+      });
+    })
+    .catch(XEUtils.noop);
+}

+ 26 - 0
src/components/system/DiagNoseIcdCodeNew.vue

@@ -0,0 +1,26 @@
+<script setup lang="ts">
+import CyComboGrid from "@/components/cy/combo-grid/src/CyComboGrid.vue";
+import CyComboGridProps, {
+  type CyComboGridEmits,
+} from "@/components/cy/combo-grid/src/CyComboGridProps";
+import { diagnosisInOurHospital } from "@/api/zhu-yuan-yi-sheng/jian-yan-jian-cha-shen-qing";
+
+const props = defineProps({ ...CyComboGridProps });
+defineEmits<CyComboGridEmits>();
+
+const selectRef = shallowRef();
+
+defineExpose({
+  selectRef,
+});
+</script>
+
+<template>
+  <CyComboGrid
+    ref="selectRef"
+    v-bind="props"
+    :remote-method="diagnosisInOurHospital"
+    value="diagCode"
+    label="diagName"
+  />
+</template>

+ 10 - 1
src/components/zhu-yuan-yi-sheng/emr/auxiliary-tools/EmrInspect.vue

@@ -14,6 +14,11 @@
         <CyVxeTable>
           <vxe-column title="日期" field="checkTime" width="135" />
           <vxe-column title="名称" field="orderName" width="220" />
+          <vxe-column title="查看" width="90">
+            <template #default="{ row }">
+              <el-button @click.stop.prevent="openWindow(row)">查看</el-button>
+            </template>
+          </vxe-column>
         </CyVxeTable>
       </CyFlex>
     </template>
@@ -51,7 +56,7 @@
       </el-form-item>
       <el-form-item label="">
         <div style="text-align: right; width: 100%">
-          <el-button type="primary" @click="copyClick"> 复制 </el-button>
+          <el-button type="primary" @click="copyClick"> 复制</el-button>
           <el-button type="warning" @click="copyAndPasteClick">
             复制并粘贴
           </el-button>
@@ -110,6 +115,10 @@ const rowData = ref<JcType>({
 
 const admissTimes = ref<number>(props.times ?? 0);
 
+function openWindow(row) {
+  window.open(row.reportUrl, "_blank");
+}
+
 const { CyVxeTable, querySearch } = useVxeTable<JcType>({
   keyField: "patientUid",
   mountedQuery: true,

+ 2 - 0
src/ts-type/Code.d.ts

@@ -0,0 +1,2 @@
+export type CodeName = { code: string; name: string };
+export type CodeNameArray = CodeName[];

+ 10 - 0
src/utils/cy-use/usePrintLodop.ts

@@ -0,0 +1,10 @@
+export default function usePrintLodop() {
+  const DefaultTemplate = defineComponent({
+    name: "printByLodopTemplate",
+    setup(props, { slots }) {
+      return () => slots?.default?.();
+    },
+  });
+
+  return [DefaultTemplate];
+}

+ 3 - 0
src/utils/cy-use/useVuePrint.tsx

@@ -1,5 +1,6 @@
 import { listNotBlank, stringIsBlank } from "@/utils/blank-utils";
 import { uuid } from "@/utils/getUuid";
+import { VxePrintInstance } from "vxe-pc-ui";
 
 /**
  * 如果使用了 useTable 的话,建议不要使用全局的 table 样式污染
@@ -42,6 +43,8 @@ export function useVuePrint(
     ...printOjb
   } = options;
 
+  const printRef = ref<VxePrintInstance>();
+
   if (listNotBlank(printOjb.extraCss)) {
     let tmpExtraCss = "";
     printOjb.extraCss.forEach(item => {

+ 47 - 30
src/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/EmrMain.vue

@@ -183,6 +183,7 @@ import * as socket from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-me
 import env from "@/utils/setting";
 import { useDialog } from "@/components/cy/CyDialog/index";
 import WhySocketConnect from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/components/WhySocketConnect.vue";
+import { checkDiagnoseToJyJc } from "@/components/simple-jyjc-req/checkDiagnoseToJyJc";
 
 const EmrFirstPageOfMedicalRecord = defineAsyncComponent(
   () =>
@@ -650,42 +651,57 @@ const clickSaveData = async () => {
     message: "是否保存病历",
     type: "success",
     title: "提示",
-  }).then(async () => {
-    data.name = emrStore.store.templateName;
-    data.emrDocumentId = await analysisIframeSrcSearch();
-    const newDate = await getServerDateApi();
-    const document = editor!.getDocument();
+  })
+    .then(async () => {
+      data.name = emrStore.store.templateName;
+      data.emrDocumentId = await analysisIframeSrcSearch();
+      const newDate = await getServerDateApi();
+      const document = editor!.getDocument();
 
-    document.properties.categoryCode = data.emrCategoryCode;
-    document.properties.patientId = data.patNo + "_" + data.times;
-    document._id = data.emrDocumentId;
-    data.documentData = document;
+      document.properties.categoryCode = data.emrCategoryCode;
+      document.properties.patientId = data.patNo + "_" + data.times;
+      document._id = data.emrDocumentId;
+      data.documentData = document;
 
-    if (document.properties.creator) {
-      document.properties.modifier = userInfo.name;
-      document.properties.modifierId = userInfo.code;
-      document.properties.modifyTime = newDate;
-    } else {
-      document.properties.creator = userInfo.name;
-      document.properties.creatorId = userInfo.code;
-      document.properties.createTime = newDate;
-    }
+      if (document.properties.creator) {
+        document.properties.modifier = userInfo.name;
+        document.properties.modifierId = userInfo.code;
+        document.properties.modifyTime = newDate;
+      } else {
+        document.properties.creator = userInfo.name;
+        document.properties.creatorId = userInfo.code;
+        document.properties.createTime = newDate;
+      }
 
-    insertEmrData(data)
-      .then(res => {
-        replaceDataElement(res);
-        saveSuccessFunc();
-      })
-      .catch(error => {
-        // 提取数据元失败,但病历已保存。不影响业务所以是保存成功的,虽然报错了
-        if (error.code === 7002) {
-          getOutline();
+      insertEmrData(data)
+        .then(res => {
+          replaceDataElement(res);
           saveSuccessFunc();
-        }
-      });
-  });
+        })
+        .catch(error => {
+          // 提取数据元失败,但病历已保存。不影响业务所以是保存成功的,虽然报错了
+          if (error.code === 7002) {
+            getOutline();
+            saveSuccessFunc();
+          }
+        });
+    })
+    .catch(() => {
+      openJyJcTemplate();
+    });
 };
 
+function openJyJcTemplate() {
+  const value = getBusiness(editor);
+
+  checkDiagnoseToJyJc({
+    patNo: patientInfo.value.inpatientNo,
+    times: patientInfo.value.admissTimes,
+    diagnoseList: value?.["入院诊断"]?.value,
+    emrBusinessList: value,
+  });
+}
+
 async function saveSuccessFunc() {
   emrStore.store.isEditorChange = false;
   await emrSidebarRef.value!.queryData();
@@ -694,6 +710,7 @@ async function saveSuccessFunc() {
     const id = getId();
     emptyEditor();
     emrMitt.emit("loadByDocumentId", id);
+    openJyJcTemplate();
   }
   xcMessage.success("保存成功");
 }