|
@@ -1,20 +1,27 @@
|
|
|
<script setup lang="ts">
|
|
|
import router from '@/router'
|
|
|
-import {onMounted, ref} from "vue";
|
|
|
+import {onActivated, onMounted, ref} from "vue";
|
|
|
import {
|
|
|
useEmrInit,
|
|
|
UseEmrInitReturn
|
|
|
} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/emr-init-v2";
|
|
|
+import {getMzEmrModel,queryMzEmrTree,queryMzPatientInfo,saveMzEmrModel} from "@/api/mz-emr/mz-emr";
|
|
|
import {EditType} from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-editor/edit";
|
|
|
import {userInfoStore} from "@/utils/store-public";
|
|
|
+import {ElMessageBox, ElTree,ElMessage} from 'element-plus'
|
|
|
+import {watch } from 'vue'
|
|
|
+import {stringIsBlank, stringNotBlank} from "@/utils/blank-utils";
|
|
|
+import {getServerDateApi, getUuid} from "@/api/public-api";
|
|
|
|
|
|
|
|
|
let patNo: {
|
|
|
times: number;
|
|
|
- patNo: string
|
|
|
+ patientId: string;
|
|
|
+ userIdCode: string;
|
|
|
} = {
|
|
|
times: 2,
|
|
|
- patNo: '123123'
|
|
|
+ patientId: '',
|
|
|
+ userIdCode:'',
|
|
|
}
|
|
|
|
|
|
export interface Property {
|
|
@@ -33,6 +40,7 @@ export interface Version {
|
|
|
}
|
|
|
|
|
|
export interface emrTemplateType {
|
|
|
+ documentId?: string,
|
|
|
parent?: string;
|
|
|
code?: string;
|
|
|
versions?: Version[];
|
|
@@ -44,174 +52,7 @@ export interface emrTemplateType {
|
|
|
labels?: string[];
|
|
|
}
|
|
|
|
|
|
-const emrTemplateData: emrTemplateType[] = [
|
|
|
- {
|
|
|
- "parent": "7db106c0416511ee8f5be9d1647a689f",
|
|
|
- "code": "mzczdzbl",
|
|
|
- "versions": [
|
|
|
- {
|
|
|
- "name": "v1.0.20",
|
|
|
- "properties": {
|
|
|
- "editorVersion": "v5.1.183",
|
|
|
- "creator": "root",
|
|
|
- "modifyTime": "2023-09-08 11:58:14",
|
|
|
- "createTime": "2023-08-23 11:54:35",
|
|
|
- "modifier": "root",
|
|
|
- "reviewer": "root",
|
|
|
- "reviewTime": "2023-09-13 15:31:03"
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- "sortNumber": 1,
|
|
|
- "name": "门诊初诊电子病历",
|
|
|
- "description": "",
|
|
|
- "_id": "40e2be70416811ee9b9fcbee7239e0bc",
|
|
|
- "type": "category",
|
|
|
- "labels": [
|
|
|
- ""
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "parent": "7db106c0416511ee8f5be9d1647a689f",
|
|
|
- "code": "mzfzdzbl",
|
|
|
- "versions": [
|
|
|
- {
|
|
|
- "name": "v1.0.12",
|
|
|
- "properties": {
|
|
|
- "editorVersion": "v5.1.183",
|
|
|
- "creator": "root",
|
|
|
- "modifyTime": "2023-09-08 11:58:28",
|
|
|
- "createTime": "2023-09-01 16:50:41",
|
|
|
- "modifier": "root",
|
|
|
- "reviewer": "root",
|
|
|
- "reviewTime": "2023-09-13 15:31:03"
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- "sortNumber": 2,
|
|
|
- "name": "门诊复诊电子病历",
|
|
|
- "description": "",
|
|
|
- "_id": "a0f289b048a411ee9403cb9efee3eba7",
|
|
|
- "type": "category",
|
|
|
- "labels": [
|
|
|
- ""
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "parent": "7db106c0416511ee8f5be9d1647a689f",
|
|
|
- "code": "mzczdzbl",
|
|
|
- "versions": [
|
|
|
- {
|
|
|
- "name": "v1.0.22",
|
|
|
- "properties": {
|
|
|
- "editorVersion": "v5.1.183",
|
|
|
- "creator": "root",
|
|
|
- "modifyTime": "2023-09-10 17:30:44",
|
|
|
- "createTime": "2023-09-01 17:14:01",
|
|
|
- "modifier": "root",
|
|
|
- "reviewer": "root",
|
|
|
- "reviewTime": "2023-09-13 15:31:03"
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- "sortNumber": 3,
|
|
|
- "name": "急诊电子病历",
|
|
|
- "description": "",
|
|
|
- "_id": "e3af514048a711ee9403cb9efee3eba7",
|
|
|
- "type": "category",
|
|
|
- "labels": [
|
|
|
- ""
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "parent": "7db106c0416511ee8f5be9d1647a689f",
|
|
|
- "code": "mzczdzbl",
|
|
|
- "versions": [
|
|
|
- {
|
|
|
- "name": "v1.0.14",
|
|
|
- "properties": {
|
|
|
- "editorVersion": "v5.1.183",
|
|
|
- "creator": "root",
|
|
|
- "modifyTime": "2023-09-08 11:58:55",
|
|
|
- "createTime": "2023-09-01 17:18:56",
|
|
|
- "modifier": "root",
|
|
|
- "reviewer": "root",
|
|
|
- "reviewTime": "2023-09-13 15:31:03"
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- "sortNumber": 4,
|
|
|
- "name": "急诊留观电子病历",
|
|
|
- "description": "",
|
|
|
- "_id": "93026f6048a811ee9403cb9efee3eba7",
|
|
|
- "type": "category",
|
|
|
- "labels": [
|
|
|
- ""
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "parent": "7db106c0416511ee8f5be9d1647a689f",
|
|
|
- "code": "siwangjilu",
|
|
|
- "versions": [
|
|
|
- {
|
|
|
- "name": "v1.0.9",
|
|
|
- "properties": {
|
|
|
- "editorVersion": "v5.1.183",
|
|
|
- "creator": "root",
|
|
|
- "modifyTime": "2023-09-08 11:59:05",
|
|
|
- "createTime": "2023-09-05 16:59:25",
|
|
|
- "modifier": "root",
|
|
|
- "reviewer": "root",
|
|
|
- "reviewTime": "2023-09-13 15:31:03"
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- "sortNumber": 5,
|
|
|
- "name": "门/急诊死亡记录",
|
|
|
- "description": "",
|
|
|
- "_id": "7fe70e704bca11eeae7e71cf27500b2b",
|
|
|
- "type": "category",
|
|
|
- "labels": [
|
|
|
- ""
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "parent": "7db106c0416511ee8f5be9d1647a689f",
|
|
|
- "code": "e04052d04c8411ee8640a3b67e337659",
|
|
|
- "versions": [],
|
|
|
- "children": [
|
|
|
- {
|
|
|
- "parent": "e7014c004c8411ee8640a3b67e337659",
|
|
|
- "code": "fab373c04fba11ee806c15315b8f18b0",
|
|
|
- "versions": [
|
|
|
- {
|
|
|
- "name": "v1.0.0",
|
|
|
- "properties": {
|
|
|
- "editorVersion": "v5.1.183",
|
|
|
- "creator": "root",
|
|
|
- "createTime": "2023-09-10 17:18:28",
|
|
|
- "reviewer": "root",
|
|
|
- "reviewTime": "2023-09-13 15:31:03"
|
|
|
- }
|
|
|
- }
|
|
|
- ],
|
|
|
- "sortNumber": 2,
|
|
|
- "name": "片段1",
|
|
|
- "_id": "fccfeb204fba11ee806c15315b8f18b0",
|
|
|
- "type": "category",
|
|
|
- "labels": []
|
|
|
- }
|
|
|
- ],
|
|
|
- "sortNumber": 6,
|
|
|
- "name": "门/急诊病历片段",
|
|
|
- "description": "",
|
|
|
- "_id": "e7014c004c8411ee8640a3b67e337659",
|
|
|
- "type": "group-category",
|
|
|
- "labels": [
|
|
|
- ""
|
|
|
- ]
|
|
|
- }
|
|
|
-]
|
|
|
+const emrTemplateData = ref<emrTemplateType[]>()
|
|
|
|
|
|
|
|
|
const emrDivRef = ref<HTMLDivElement>()
|
|
@@ -219,16 +60,101 @@ let editor: UseEmrInitReturn;
|
|
|
|
|
|
|
|
|
const rowClick = (row: emrTemplateType) => {
|
|
|
- editor.loadAndSetDocument({
|
|
|
- categoryId: row._id,
|
|
|
- categoryCode: row.code,
|
|
|
+ editor.editor.setEditorMode('free')
|
|
|
+ categoryCode.value =row.code
|
|
|
+ mzEmrName.value =row.name
|
|
|
+ parent.value =row.parent
|
|
|
+ if (typeFlag.value == 0) {
|
|
|
+ editor.loadAndSetDocument({
|
|
|
+ categoryId: row._id,
|
|
|
+ categoryCode: row.code,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ editor.loadAndSetDocument({
|
|
|
+ documentId: row.documentId
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+const categoryCode = ref<string>('')
|
|
|
+const mzEmrName = ref<string>('')
|
|
|
+const parent = ref<string>('')
|
|
|
+
|
|
|
+const saveData = ()=>{
|
|
|
+ console.log('typeFlag.value',typeFlag.value)
|
|
|
+ if(typeFlag.value == 1 || typeFlag.value==3 ){
|
|
|
+ return ElMessage.error('住院或历史记录不能保存')
|
|
|
+ }
|
|
|
+ ElMessageBox.confirm('请确认是否保存', {
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ confirmButtonText: '确定',
|
|
|
})
|
|
|
+ .then(() => {
|
|
|
+ clickSaveData()
|
|
|
+ })
|
|
|
+ .catch(() => {
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
-function saveDocument() {
|
|
|
- console.log(editor.editor.getDocument());
|
|
|
+const clickSaveData = async () => {
|
|
|
+ // 解析 id
|
|
|
+ let id = await analysisIframeSrcSearch()
|
|
|
+ let data: any = {
|
|
|
+ name: mzEmrName.value,
|
|
|
+ emrDocumentId: id,
|
|
|
+ emrCategoryCode: categoryCode.value,
|
|
|
+ patNo: mzEmrPatientVo.value.patientId,
|
|
|
+ times: mzEmrPatientVo.value.times,
|
|
|
+ emrName: mzEmrName.value,
|
|
|
+ parent: parent.value,
|
|
|
+ userIdCode: mzEmrPatientVo.value.userIdCode,
|
|
|
+ documentData: null
|
|
|
+ }
|
|
|
+ let newDate = await getServerDateApi();
|
|
|
+ const document = editor.editor.getDocument();
|
|
|
+
|
|
|
+ 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 = mzEmrPatientVo.value.userIdCode
|
|
|
+ document.properties.modifierId = mzEmrPatientVo.value.userName
|
|
|
+ document.properties.modifyTime = newDate
|
|
|
+ } else {
|
|
|
+ document.properties.creator = mzEmrPatientVo.value.userIdCode
|
|
|
+ document.properties.creatorId = mzEmrPatientVo.value.userName
|
|
|
+ document.properties.createTime = newDate
|
|
|
+ }
|
|
|
+
|
|
|
+ saveMzEmrModel(data).then((res:any)=>{
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+const analysisIframeSrcSearch = async () => {
|
|
|
+ let id = getId()
|
|
|
+ let temp
|
|
|
+ if (stringIsBlank(id)) {
|
|
|
+ // 这个是 唯一 id 调用服务的雪花算法
|
|
|
+ temp = await getUuid()
|
|
|
+ } else {
|
|
|
+ temp = id
|
|
|
+ }
|
|
|
+ return temp
|
|
|
+}
|
|
|
+
|
|
|
+const getId = () => {
|
|
|
+ if (editor) {
|
|
|
+ return editor.editor.documentData._id
|
|
|
+ }
|
|
|
+ return null
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
const appContext = () => {
|
|
|
return {
|
|
|
endpoints: {
|
|
@@ -247,11 +173,12 @@ const appContext = () => {
|
|
|
}
|
|
|
},
|
|
|
data: {
|
|
|
- '患者姓名': '张三',
|
|
|
- '性别名称': '男',
|
|
|
- '患者年龄': 20,
|
|
|
- '门/急诊号': '123123',
|
|
|
- '接诊科室门诊': '眼科',
|
|
|
+ '患者姓名': mzEmrPatientVo.value.name,
|
|
|
+ '性别名称': mzEmrPatientVo.value.sex,
|
|
|
+ '患者年龄': mzEmrPatientVo.value.age,
|
|
|
+ '门/急诊号': mzEmrPatientVo.value.patientId,
|
|
|
+ '接诊科室门诊': mzEmrPatientVo.value.deptName,
|
|
|
+ '编辑者':[{code:mzEmrPatientVo.value.userIdCode,name:mzEmrPatientVo.value.userName}]
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -264,26 +191,177 @@ const handlePrint = () => {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
-onMounted(() => {
|
|
|
- patNo = JSON.parse(window.atob(router.currentRoute.value.params.patientId))
|
|
|
|
|
|
+const mzEmrPatientVo = ref<object>({
|
|
|
+ patientId:'',
|
|
|
+ times:null,
|
|
|
+ userIdCode:'',
|
|
|
+ userName:'',
|
|
|
+ deptCode:'',
|
|
|
+ deptName:'',
|
|
|
+ name:'',
|
|
|
+ sex:'',
|
|
|
+ age:null,
|
|
|
+ type:null,
|
|
|
+})
|
|
|
+onMounted(() => {
|
|
|
+ patNo = JSON.parse(window.atob(router.currentRoute.value.params.patientInfo))
|
|
|
+ queryMzPatientInfo(patNo).then((res:any)=>{
|
|
|
+ mzEmrPatientVo.value=res
|
|
|
+ })
|
|
|
useEmrInit(emrDivRef.value, {
|
|
|
appContext: appContext
|
|
|
}).then(res => {
|
|
|
editor = res
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+const treeData=ref<Tree[]>()
|
|
|
+const typeFlag = ref<number>()
|
|
|
+
|
|
|
+const queryMzEmdrData=(type)=>{
|
|
|
+ typeFlag.value = type
|
|
|
+ if(type==0 || type==2){
|
|
|
+ modelFlag.value = true;
|
|
|
+ }else {
|
|
|
+ modelFlag.value = false;
|
|
|
+ }
|
|
|
+ if(type == 0){
|
|
|
+ getMzEmrModel().then((res:any)=>{
|
|
|
+ let tem = []
|
|
|
+ if(res){
|
|
|
+ for (let i = 0; i <res.length ; i++) {
|
|
|
+ if(res[i].parent !=null){
|
|
|
+ tem.push(res[i])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ emrTemplateData.value = tem
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ mzEmrPatientVo.value['type'] = type
|
|
|
+ queryMzEmrTree(mzEmrPatientVo.value).then((res:any)=>{
|
|
|
+ if(type==2){
|
|
|
+ let tempData = []
|
|
|
+ if(res){
|
|
|
+ for (let i = 0; i < res.length; i++) {
|
|
|
+ let te = {
|
|
|
+ _id:'',
|
|
|
+ categoryCode:'',
|
|
|
+ documentId:'',
|
|
|
+ name:'',
|
|
|
+ cade:'',
|
|
|
+ parent:'',
|
|
|
+ }
|
|
|
+ te.cade = res[i].emrCategoryCode
|
|
|
+ te.parent = res[i].parent
|
|
|
+ te.categoryCode = res[i].emrCategoryCode
|
|
|
+ te.documentId = res[i].emrDocumentId
|
|
|
+ te.name = res[i].name
|
|
|
+ tempData.push(te)
|
|
|
+ }
|
|
|
+ emrTemplateData.value = tempData
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ treeData.value = res
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+interface Tree {
|
|
|
+ [key: string]: any
|
|
|
+}
|
|
|
+
|
|
|
+const filterText = ref('')
|
|
|
+const treeRef = ref<InstanceType<typeof ElTree>>()
|
|
|
+
|
|
|
+const defaultProps = {
|
|
|
+ children: 'children',
|
|
|
+ label: 'name',
|
|
|
+}
|
|
|
+
|
|
|
+watch(filterText, (val) => {
|
|
|
+ treeRef.value!.filter(val)
|
|
|
+})
|
|
|
+
|
|
|
+const filterNode = (value: string, data: Tree) => {
|
|
|
+ if (!value) return true
|
|
|
+ return data.name.includes(value)
|
|
|
+}
|
|
|
+
|
|
|
+const handleNodeClick=(node, object, event)=>{
|
|
|
+ editor.editor.setEditorMode('readonly')
|
|
|
+ console.log("node",node)
|
|
|
+ editor.loadAndSetDocument({
|
|
|
+ documentId: node.emrDocumentId
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+const modelFlag= ref<boolean>(false)
|
|
|
+
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
<el-container>
|
|
|
- <el-aside style="width: 200px">
|
|
|
- <el-button @click="handlePrint">
|
|
|
- 打印
|
|
|
- </el-button>
|
|
|
- <el-table :data="emrTemplateData" @row-click="rowClick">
|
|
|
- <el-table-column label="名称" prop="name"></el-table-column>
|
|
|
- </el-table>
|
|
|
+ <el-aside style="width: 400px;padding: 20px;">
|
|
|
+ <div>
|
|
|
+ <el-descriptions :column="4" border style="width:100%;" >
|
|
|
+ <el-descriptions-item label="门诊号">
|
|
|
+ {{mzEmrPatientVo.patientId}}
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="姓名">
|
|
|
+ {{mzEmrPatientVo.name}}
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="性别">
|
|
|
+ {{mzEmrPatientVo.sex}}
|
|
|
+ </el-descriptions-item>
|
|
|
+ <el-descriptions-item label="年龄">
|
|
|
+ {{mzEmrPatientVo.age+'岁'}}
|
|
|
+ </el-descriptions-item>
|
|
|
+ </el-descriptions>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <div>
|
|
|
+ <div style="width: 100%;text-align: right">
|
|
|
+ <el-button type="success" @click="saveData">保存</el-button>
|
|
|
+ <el-button icon="Printer" type="success" @click="handlePrint"> 打印</el-button>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-button-group class="ml-4">
|
|
|
+ <el-button @click="queryMzEmdrData(0)"> 门诊模板 </el-button>
|
|
|
+ <el-button @click="queryMzEmdrData(1)"> 住院</el-button>
|
|
|
+ <el-button @click="queryMzEmdrData(2)"> 当前</el-button>
|
|
|
+ <el-button @click="queryMzEmdrData(3)"> 历史</el-button>
|
|
|
+ </el-button-group>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div>
|
|
|
+ <el-table :data="emrTemplateData" v-show="modelFlag" style="width: 210px" @row-click="rowClick">
|
|
|
+ <el-table-column label="名称" prop="name"></el-table-column>
|
|
|
+ </el-table>
|
|
|
+ <el-input v-model="filterText" v-show="!modelFlag" placeholder="搜索" style="width: 210px" />
|
|
|
+ <el-tree v-show="!modelFlag" style="width: 210px"
|
|
|
+ ref="treeRef"
|
|
|
+ class="filter-tree"
|
|
|
+ :data="treeData"
|
|
|
+ :props="defaultProps"
|
|
|
+ @node-click="handleNodeClick"
|
|
|
+ node-key="id"
|
|
|
+ highlight-current
|
|
|
+ default-expand-all
|
|
|
+ :filter-node-method="filterNode"
|
|
|
+ />
|
|
|
+
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</el-aside>
|
|
|
<el-main style="width: 100% ; height: 100%">
|
|
|
<div ref="emrDivRef" style="width: 100% ; height: 100%">
|