| 
					
				 | 
			
			
				@@ -17,7 +17,8 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <el-table-column label="操作"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       <template #default="{row}"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-button type="danger" @click="deleteQualityControl(row.id)">删除</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        <el-button type="warning">修改</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-button type="warning" @click="clickModifyButton(row)">修改</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        <el-button type="primary" @click="newlyAdded">新增</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-table-column> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </xc-table> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -49,25 +50,12 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <el-tree-select 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             style="width: 100%" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             class="tree-select" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            v-model="value" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            v-model="ruleForm.medicalRecordCode" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             :data="emrTree" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            @clear="" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            @remove-tag="removeTag" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             multiple 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            @node-click="nodeClick" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             :props="defaultProps" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             check-strictly 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             :render-after-expand="false"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          <template #default="{data}"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            <div style="display: flex;justify-content: space-between;align-items: center"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              <div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                {{ data.name }} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              <div v-if="data.children && data.children.length > 0"> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                <el-button text @click.stop="selectAll(data.children)">全选</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-              </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            </div> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-          </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         </el-tree-select> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				       </el-form-item> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -87,9 +75,11 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </el-form> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     <template #footer> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <el-button>取消</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      <el-button @click="confirm">确认</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-button @click="cancel">取消</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-button v-if="ruleForm.id == null" @click="confirm">确认</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+      <el-button v-else @click="modify">修改</el-button> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     </template> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   </xc-dialog-v2> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 </template> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -98,6 +88,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import XcTable from "@/components/xiao-chan/xc-table/XcTable.vue"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import {nextTick, onMounted, Ref, ref} from "vue"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import XcDialogV2 from "@/components/xiao-chan/dialog/XcDialogV2.vue"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   getEmrTree, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } from "@/api/zhu-yuan-yi-sheng/emr-patient"; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -105,7 +96,9 @@ import { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   addRule, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   getAvailableObjects, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   getRuleList, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  switchQualityControl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  switchQualityControl, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  deleteRuleById, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  modifyQualityControl 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } from '@/api/zhu-yuan-yi-sheng/emr-control-rule' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import {ElMessageBox} from "element-plus"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -117,18 +110,13 @@ const ruleDataElement: Ref<Array<any>> = ref([]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const defaultProps = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   children: 'children', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   label: 'name', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  value: '_id', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  disabled: (data) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    return data.children && data.children.length > 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  value: 'code', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 interface ruleFormClass { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  medicalRecord: Map<string, any>, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  // 病历编码 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  id: string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   medicalRecordCode: Array<string>, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   type: number, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  data: any, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   offOrOnRule: number 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   promptStatement: string 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: string 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -137,83 +125,50 @@ interface ruleFormClass { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const ruleForm: Ref<ruleFormClass> = ref({ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  id: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   type: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  medicalRecord: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  medicalRecordCode: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  data: {}, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  medicalRecordCode: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   offOrOnRule: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  promptStatement: '超过了 24 小时无法创建', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  promptStatement: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   name: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   sql: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   prescription: 24 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * 全选 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * @param list 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-const selectAll = (list) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  list.forEach(data => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    ruleForm.value.medicalRecord[data._id] = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      code: data.code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      name: data.name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    if (value.value.indexOf(data._id) === -1) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      value.value.push(data._id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * 编码点击 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * @param data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-const nodeClick = (data) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if (data.children) return 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  if (ruleForm.value.medicalRecord[data._id]) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    uncheck(data._id) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    ruleForm.value.medicalRecord[data._id] = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      code: data.code, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-      name: data.name 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * 移除标签 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * @param data 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-const removeTag = (data) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  uncheck(data) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-/** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * 删除数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- * @param value 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-const uncheck = (value) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  delete ruleForm.value.medicalRecord[value] 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const selectRef = ref(null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const selectChange = async () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   await nextTick() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-const confirm = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  let temp = new Set() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  for (let key in ruleForm.value.medicalRecord) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    temp.add(ruleForm.value.medicalRecord[key].code) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const cancel = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ruleForm.value = <ruleFormClass>{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    id: null, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    type: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    medicalRecordCode: [], 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    offOrOnRule: 1, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    promptStatement: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    name: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    sql: '', 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    prescription: 24 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  ruleForm.value.medicalRecordCode = Array.from(temp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  dialog.value = false 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const confirm = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ruleForm.value.type = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   addRule(ruleForm.value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  console.log(ruleForm.value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-const value: Ref<Array<string>> = ref([]) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const modify = async () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  await modifyQualityControl(ruleForm.value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  cancel() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  await queryRule() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const newlyAdded = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  cancel() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  dialog.value = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 const onOff = async (id, val) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   await switchQualityControl(id, val) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -223,22 +178,29 @@ const deleteQualityControl = (val) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   ElMessageBox.confirm('是否要删除该质控!', '提示', { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     type: 'warning' 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }).then((res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log(val) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    deleteRuleById(val) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }).catch((e) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-onMounted(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  getEmrTree('hosp').then((res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    emrTree.value = res.all[0].children 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-  }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const clickModifyButton = (val) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  ruleForm.value = val 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  dialog.value = true 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+const queryRule = () => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   getRuleList().then((res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    console.log(res) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     data.value = res 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+onMounted(() => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  getEmrTree('hosp').then((res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    emrTree.value = res.all[0].children 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    console.log(emrTree.value) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+  queryRule() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				   getAvailableObjects().then((res) => { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ruleDataElement.value = res 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     console.log(res) 
			 |