瀏覽代碼

手术与收费编码可以多对多匹配

lighter 2 年之前
父節點
當前提交
f8c412f7f0
共有 1 個文件被更改,包括 54 次插入14 次删除
  1. 54 14
      src/views/dictionary/HisWjwMatch.vue

+ 54 - 14
src/views/dictionary/HisWjwMatch.vue

@@ -23,7 +23,7 @@
             <el-table-column prop="name" label="名称"></el-table-column>
             <el-table-column label="状态" width="100">
               <template #default="scope">
-                <span v-html="makeMatchStatus(scope.row.wjwCode)"></span>
+                <span v-html="makeMatchStatus(scope.row.wjwCode, scope.row.chargeCode)"></span>
               </template>
             </el-table-column>
           </el-table>
@@ -44,10 +44,17 @@
             </div>
             <div class="wjw">
               <div>{{ wjwMatchTextNote }}:</div>
-              <div class="code">{{ hisWjwMatchEntity.wjwCode }}</div>
+              <div v-if="hisWjwMatchEntity.label === 'surgery_chargeCode'">
+                <div v-for="(item,index) in hisWjwMatchEntity.chargeCode" :key="index" style="display: flex; align-items: center; padding: 2px 0">
+                  <div :title="hisWjwMatchEntity.chargeName[index]" style="margin-right: 4px">{{ item }}</div>
+                  <div><el-button type="danger" icon="Delete" plain title="删除" circle @click="deleteMatchItem(index)"></el-button></div>
+                </div>
+              </div>
+              <div v-else class="code">{{ hisWjwMatchEntity.wjwCode }}</div>
             </div>
-            <el-button v-if="currentHisRow.wjwCode" icon="Close" type="danger" @click="revokeMatch">撤销匹配</el-button>
-            <el-button v-else icon="Check" type="success" @click="executeMatch" :disabled="manageMatchState">匹配
+            <el-button v-if="currentHisRow.wjwCode || (currentHisRow.chargeCode && currentHisRow.chargeCode.length > 0)" icon="Close" type="danger" @click="revokeMatch">撤销匹配</el-button>
+            <div style="margin-top: 4px"></div>
+            <el-button v-if="!currentHisRow.wjwCode" icon="Check" type="success" @click="executeMatch" :disabled="manageMatchState">匹配
             </el-button>
           </div>
         </div>
@@ -104,6 +111,8 @@ let currentHisRow = $ref({})
 const hisWjwMatchEntity = reactive({
   code: null,
   wjwCode: null,
+  chargeCode: [],
+  chargeName: [],
   label: 'department',
 })
 
@@ -148,18 +157,22 @@ const fetchDataByLabel = () => {
     hisList = res.hisList
     wjwList = res.wjwList
     currentHisRow = {}
-    currentSimilaratyKey = null
+    currentSimilarityKey = null
     hisWjwMatchEntity.code = null
     hisWjwMatchEntity.wjwCode = null
+    hisWjwMatchEntity.chargeCode = []
+    hisWjwMatchEntity.chargeName = []
   })
 }
 
-let currentSimilaratyKey = $ref(null)
+let currentSimilarityKey = $ref(null)
 const handleClickHisRow = (row) => {
   if (row.code !== currentHisRow.code) {
     hisWjwMatchEntity.wjwCode = null
-    currentHisRow = row
+    hisWjwMatchEntity.chargeCode = []
+    hisWjwMatchEntity.chargeName = []
     hisWjwMatchEntity.code = row.code
+    currentHisRow = row
     if (row.wjwCode) {
       hisWjwMatchEntity.wjwCode = row.wjwCode
       for (let i = 0; i < wjwList.length; i++) {
@@ -169,12 +182,15 @@ const handleClickHisRow = (row) => {
           break
         }
       }
+    } else if (row.chargeCode) {
+      hisWjwMatchEntity.chargeCode = row.chargeCode
+      hisWjwMatchEntity.chargeName = row.chargeName
     } else {
       if (hisWjwMatchEntity.label === 'department' || hisWjwMatchEntity.label === 'anaesthesia') {
         wjwInput = row.name.length > 3 ? row.name.substring(0, 2) : row.name.substring(0, 1)
       } else if (hisWjwMatchEntity.label === 'diagnose' || hisWjwMatchEntity.label === 'surgery') {
-        if (row.code !== currentSimilaratyKey) {
-          currentSimilaratyKey = row.code
+        if (row.code !== currentSimilarityKey) {
+          currentSimilarityKey = row.code
           const key = '%' + row.code.split('.')[0].replace('*', '') + '%'
           fetchSimilarities(hisWjwMatchEntity.label, row.name, key).then((res) => {
             wjwList = res
@@ -186,29 +202,43 @@ const handleClickHisRow = (row) => {
 }
 
 const handleClickWjwRow = (row) => {
-  hisWjwMatchEntity.wjwCode = row.code
-  hisWjwMatchEntity.wjwName = row.name
+  if (hisWjwMatchEntity.label === 'surgery_chargeCode') {
+    hisWjwMatchEntity.chargeCode.push(row.code)
+    hisWjwMatchEntity.chargeName.push(row.name)
+  } else {
+    hisWjwMatchEntity.wjwCode = row.code
+    hisWjwMatchEntity.wjwName = row.name
+  }
+}
+
+const deleteMatchItem = (index) => {
+  hisWjwMatchEntity.chargeCode.splice(index, 1)
+  hisWjwMatchEntity.chargeName.splice(index, 1)
 }
 
-const makeMatchStatus = (wjwCode) => {
-  return null === wjwCode ? '<span style="color:red">未匹配</span>' : '<span style="color:green">已匹配</span>'
+const makeMatchStatus = (wjwCode, chargeCode) => {
+  return (wjwCode || (chargeCode && chargeCode.length > 0)) ? '<span style="color:green">已匹配</span>' : '<span style="color:red">未匹配</span>'
 }
 
 const manageMatchState = computed(() => {
-  return hisWjwMatchEntity.code === null || hisWjwMatchEntity.wjwCode === null
+  return hisWjwMatchEntity.wjwCode === null && hisWjwMatchEntity.chargeCode.length === 0
 })
 
 const executeMatch = () => {
   if (hisWjwMatchEntity.label === 'department' || hisWjwMatchEntity.label === 'anaesthesia') {
     hisWjwMatchEntity.targetCodeColumn = 'wjw_code'
+    hisWjwMatchEntity.targetNameColumn = null
   } else if (hisWjwMatchEntity.label === 'surgery_chargeCode') {
     hisWjwMatchEntity.targetCodeColumn = 'charge_code'
+    hisWjwMatchEntity.targetNameColumn = 'charge_name'
   }else {
     hisWjwMatchEntity.targetCodeColumn = 'yb_code'
     hisWjwMatchEntity.targetNameColumn = 'yb_name'
   }
   executeMatchAction(hisWjwMatchEntity).then((res) => {
     currentHisRow.wjwCode = hisWjwMatchEntity.wjwCode
+    currentHisRow.chargeCode = hisWjwMatchEntity.chargeCode
+    currentHisRow.chargeName = hisWjwMatchEntity.chargeName
     ElMessage({
       message: res,
       type: 'success',
@@ -223,14 +253,20 @@ const revokeMatch = () => {
   hisWjwMatchEntity.wjwName = null
   if (hisWjwMatchEntity.label === 'department' || hisWjwMatchEntity.label === 'anaesthesia') {
     hisWjwMatchEntity.targetCodeColumn = 'wjw_code'
+    hisWjwMatchEntity.targetNameColumn = null
   } else if (hisWjwMatchEntity.label === 'surgery_chargeCode') {
+    hisWjwMatchEntity.chargeCode = []
+    hisWjwMatchEntity.chargeName = []
     hisWjwMatchEntity.targetCodeColumn = 'charge_code'
+    hisWjwMatchEntity.targetNameColumn = 'charge_name'
   } else {
     hisWjwMatchEntity.targetCodeColumn = 'yb_code'
     hisWjwMatchEntity.targetNameColumn = 'yb_name'
   }
   executeMatchAction(hisWjwMatchEntity).then((res) => {
     currentHisRow.wjwCode = null
+    currentHisRow.chargeCode = []
+    currentHisRow.chargeName = []
     wjwTableRef.setCurrentRow(null)
     ElMessage({
       message: res,
@@ -268,6 +304,10 @@ onMounted(() => {
   .code {
     font-weight: bold;
     font-size: 14px;
+    padding: 2px 0;
+    &:hover {
+      border: 1px solid green;
+    }
   }
 }