123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191 |
- <template>
- <div ref="headerRef">
- <div v-show="!isDualScreen">
- <emr-select-pat :pat-info="patientInfo" @selected="selected"/>
- 住院号:
- <el-input v-model="query.patNo" style="width: 120px"/>
- 次数 ({{ query.times }}) :
- <emr-leave-hospital-patient @rowClick="disPatients"/>
- <el-button @click="allPatientsInTheHospital">全院患者</el-button>
- <el-button @click="patientListDrawer = !patientListDrawer">患者列表</el-button>
- 出院天数:{{ dischargeDays }}
- <span style="color: red">出院七天后就无法编辑患者病历</span>
- </div>
- </div>
- <div v-if="show">
- <div ref="divRef">
- <huan-zhe-xin-xi v-show="!isDualScreen"
- :huan-zhe-xin-xi="patientInfo"
- @isShow="patientInfoIsShow"/>
- </div>
- <emr-main
- ref="emrMainRef"
- :huan-zhe-xin-xi="patientInfo"
- :max-height="maxHeight"
- :is-dual-screen="isDualScreen"/>
- </div>
- <emr-patient-list @rowClick="listRowClick" v-model="patientListDrawer"/>
- </template>
- <script setup name='Home'>
- import EmrMain from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/EmrMain";
- import {getDisPatient, getPatientInfo} from "@/api/inpatient/patient";
- import router from "@/router";
- import HuanZheXinXi from "@/components/zhu-yuan-yi-sheng/HuanZheXinXi";
- import {BizException, ExceptionEnum} from "@/utils/BizException";
- import {getDischargeTimes, isDisReqEdit} from "@/api/zhu-yuan-yi-sheng/emr-patient";
- import {getServerDateApi} from "@/api/public-api";
- import {subtractTime} from "@/utils/date";
- import {
- emrConfig,
- query,
- resolveRoute
- } from "@/views/hospitalization/zhu-yuan-yi-sheng/electronic-medical-record/emr-init";
- import EmrPatientList from "@/components/zhu-yuan-yi-sheng/emr/EmrPatientList.vue";
- import EmrLeaveHospitalPatient from "@/components/zhu-yuan-yi-sheng/emr/EmrLeaveHospitalPatient.vue";
- import EmrSelectPat from "@/components/zhu-yuan-yi-sheng/EmrSelectPat.vue";
- import sleep from "@/utils/sleep";
- const divRef = ref(null)
- const headerRef = ref(null)
- const emrMainRef = ref(null)
- // 最大高度
- let maxHeight = $ref()
- // 是否显示页面
- let show = $ref(false)
- // 获取患者信息
- let patientInfo = $ref({})
- // 距离今天的出院天数
- let dischargeDays = $ref(0)
- // 患者列表 list
- let patientListDrawer = $ref(false)
- // 是否是双屏
- let isDualScreen = $ref(false)
- const selected = ({inpatientNo, admissTimes}) => {
- query.value.patNo = inpatientNo
- query.value.times = admissTimes
- query.value.maxTimes = admissTimes
- allPatientsInTheHospital()
- }
- // 点击查询出院患者
- const disPatients = async () => {
- if (query.value.times === 0 || !query.value.patNo) {
- BizException(ExceptionEnum.MESSAGE_ERROR, '请输入住院号,住院次数不能为 0 ')
- }
- query.value.state = 2
- let te = JSON.stringify(query.value)
- await router.push({
- name: 'emrEditor',
- query: {
- pat: window.btoa(te)
- }
- })
- await routerFunc()
- }
- // 解析路由数据
- const routerFunc = async () => {
- show = false
- if (router.currentRoute.value.query.pat) {
- resolveRoute(router.currentRoute.value.query.pat)
- if (query.value.state !== 2) {
- patientInfo = await getPatientInfo(query.value.patNo);
- }
- if (query.value.state === 1) {
- await queryActPatient()
- } else if (query.value.state === 2) {
- await queryDisPatient()
- } else if (query.value.state === 3) {
- await queryAllPatients(true)
- } else if (query.value.state === 4) {
- await queryAllPatients(false)
- }
- await nextTick()
- } else {
- show = false
- }
- }
- // 查询在院患者数据
- const queryActPatient = async () => {
- show = true
- }
- // 查询出院患者信息
- const queryDisPatient = async () => {
- patientInfo = await getDisPatient(query.value.patNo, query.value.times)
- dischargeDays = subtractTime(await getServerDateApi(), patientInfo.disDate)
- // 如果患者的出院时间大于 7 天就只能看病历和打印病历了
- emrConfig.value.editor = dischargeDays <= 7;
- // 如果超过了七天就去查看是否有申请编辑
- if (!emrConfig.value.editor) {
- emrConfig.value.editor = await isDisReqEdit(query.value.patNo + '_' + query.value.times)
- }
- show = true;
- }
- // 点击全院患者数据
- const allPatientsInTheHospital = async () => {
- if (!query.value.patNo) {
- BizException(ExceptionEnum.MESSAGE_ERROR, '请输入住院号。 ')
- }
- query.value.state = 3
- let te = JSON.stringify(query.value)
- await router.push({
- name: 'emrEditor',
- query: {
- pat: window.btoa(te)
- }
- })
- await routerFunc()
- }
- const queryAllPatients = async (flag) => {
- query.value.times = patientInfo.admissTimes
- query.value.maxTimes = patientInfo.admissTimes
- show = true
- emrConfig.value.editor = flag
- }
- const listRowClick = async (val) => {
- let temp = {
- patNo: val.inpatientNo,
- times: val.admissTimes,
- maxTimes: val.admissTimes,
- state: 4
- }
- let te = JSON.stringify(temp)
- await router.push({
- name: 'emrEditor',
- query: {
- pat: window.btoa(te)
- }
- })
- await routerFunc()
- }
- const patientInfoIsShow = (flag, height) => {
- maxHeight = window.innerHeight - height - 24
- }
- onMounted(async () => {
- await nextTick()
- await routerFunc()
- //向父项目传值
- window.parent.postMessage("电子病历加载完成。", "*");
- window.dualScreenMode = () => {
- isDualScreen = true
- emrMainRef.value.closeBothSides()
- }
- })
- </script>
- <style scoped lang="scss">
- </style>
|