1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036 |
- <template>
- <!-- 透析记录首页 -->
- <div class="main-contain">
- <div class="position">
- <bread-crumb :crumbs='crumbs'></bread-crumb>
- </div>
- <div class="app-container">
- <!-- <div class="cell clearfix">
- <label class="title"><span class="name">病人查询</span> : </label>
- <el-input size="small" style="width: 280px;" v-model.trim="search_input" class="filter-item"/>
- <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="searchAction">搜索</el-button>
- </div> -->
- <!-- <div class="cell clearfix">
- <label class="title"><span class="name">日期查询</span> : </label>
- <el-date-picker v-model="selected_date" prefix-icon="el-icon-date" @change="handleScheduleDateChange" :editable="false" :clearable="false" style="width: 196px;" type="date" placeholder="选择日期时间" align="right" ></el-date-picker>
- </div>
- <div class="cell clearfix">
- <label class="title"><span class="name">排班班次</span> : </label>
- <div class="time ">
- <ul class="">
- <li v-for="option in schedule_type_options" :key="option.value" @click="handletimeType(option.value)" :class="schedule_type_selected == option.value ? 'active' : ''" >{{option.text}}
- </li>
- </ul>
- </div>
- </div>
- <div class="cell clearfix">
- <label class="title"><span class="name">分区</span> : </label>
- <div class="time ">
- <ul class="">
- <li v-for="option in zone_options" :key="option.id" :class="option.id == zone_selected ? 'active' : ''" @click='handleZoneChange(option.id)'>{{ option.text }}
- </li>
- </ul>
- </div>
- </div> -->
- <div class="cell clearfix">
- <label class="title"><span class="name">患者状态</span> : </label>
- <div class="time ">
- <ul class="">
- <li v-for="option in patient_state" :key="option.value" @click="handleStateChange(option.value)" :class="patientStateVal == option.value ? 'active' : ''" >{{option.label}}
- </li>
- </ul>
- </div>
- <!-- <label class="title"><span class="name">叫号状态</span> : </label>
- <div class="time ">
- <ul class="">
- <li v-for="option in call_state" :key="option.value" @click="handleCallChange(option.value)" :class="callVal == option.value ? 'active' : ''" >{{option.label}}
- </li>
- </ul>
- </div> -->
- </div>
- <div class="cell clearfix">
- <label class="title"><span class="name">治疗状态</span> : </label>
- <div class="time ">
- <ul class="">
- <li v-for="option in treat_state" :key="option.value" @click="handleTreatChange(option.value)" :class="treatStateVal == option.value ? 'active' : ''" >{{option.label}}
- </li>
- </ul>
- </div>
- </div>
- <div class="cell clearfix" style="margin-bottom:10px;">
- <label class="title"><span class="name">其他查询</span> : </label>
- <el-select v-model="schedule_type_selected" placeholder="班次" style="margin-right:10px;" @change="handletimeType">
- <el-option
- v-for="item in schedule_type_options"
- :key="item.value"
- :label="item.text"
- :value="item.value">
- </el-option>
- </el-select>
- <el-select v-model="zone_selected" placeholder="分区" style="margin-right:10px;" @change="handleZoneChange">
- <el-option
- v-for="item in zone_options"
- :key="item.id"
- :label="item.text"
- :value="item.id">
- </el-option>
- </el-select>
- <label class="title"><span class="name">日期查询</span> : </label>
- <el-date-picker v-model="selected_date" prefix-icon="el-icon-date" @change="handleScheduleDateChange" :editable="false" :clearable="false" style="width: 196px;margin-right:10px;" type="date" placeholder="选择日期时间" align="right" ></el-date-picker>
- <el-input size="small" style="width: 180px;" @keyup.enter.native='searchAction' v-model.trim="search_input" class="filter-item"/>
- <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="searchAction">搜索</el-button>
- </div>
-
- <div style="display:flex;justify-content: space-between;">
- <div :class="queueConfig.txglsyxs != 1 ? 'PatientArea' : 'PatientArea smallWidth'">
- <div v-for="zone_schedule in allPatient" :key="zone_schedule.zone_id" class="list clearfix">
- <!-- <h3 style="width:40px;" class="title">{{zone_schedule.zone_name}}</h3> -->
- <div v-if="zone_schedule.schedules.length > 0 && patientStateVal != 1" style="font-size:16px;font-weight: bold;color: #34495e;margin-right:10px;line-height:30px;">{{zone_schedule.zone_name}}</div>
- <patient-box :schedules="zone_schedule.schedules" :patientStateVal='patientStateVal' :selected_date="selected_date" style="flex:1"></patient-box>
- </div>
-
- <div class="NoData" v-show="filtedSchedules.length == 0">
- <img src="@/assets/img/data.jpg" alt="">
- </div>
- </div>
- <div class="nowCalling" v-if="queueConfig.txglsyxs == 1">
- <p class="nowCallingTitle">当前叫号</p>
- <p class="nowCallingName">{{ fisrtQueueInfo ? fisrtQueueInfo.patient_name : '' }}</p>
- <p class="nowCallingTime">签到时间:{{ fisrtQueueInfo ? fisrtQueueInfo.create_time : '' }}</p>
- <el-button type="primary" @click="call(fisrtQueueInfo && fisrtQueueInfo.patient_id ? fisrtQueueInfo.patient_id : '')" style="margin-left:0;margin: 30px 0 20px 0;"> 叫号 </el-button>
- <!-- <el-button style="margin: 0px 0 20px 0;" @click="pass(fisrtQueueInfo.patient_id)"> 过号 </el-button> -->
- <el-button style="margin:0 auto;" @click="next(fisrtQueueInfo && fisrtQueueInfo.patient_id ? fisrtQueueInfo.patient_id : '')">下一位</el-button>
- </div>
- </div>
- </div>
- </div>
- </template>
-
- <script>
- const moment = require('moment')
- import axios from 'axios'
- import PatientBox from './PatientBox'
- import { getDialysisRecordInitData, getDialysisSchedules } from '@/api/dialysis_record'
- import { parseTime } from '@/utils'
- import BreadCrumb from '@/xt_pages/components/bread-crumb'
-
- export default {
- name: 'Patient',
- components: {
- PatientBox,
- BreadCrumb
- },
- data() {
- return {
- crumbs: [
- { path: false, name: '透析管理' },
- { path: 'dialysis/dialysisrecord', name: '透析记录' }
- ],
- selected_date: new Date(), // this.$store.getters.app.dialysis_area.schedule_date,
- schedule_type_selected: 0, // this.$store.getters.app.dialysis_area.schedule_type_select_index,
- schedule_type_options: [
- { value: 0, text: '全部班' },
- { value: 1, text: '上午' },
- { value: 2, text: '下午' },
- { value: 3, text: '晚上' }
- ],
- zone_selected: 0, // this.$store.getters.app.dialysis_area.zone_select_index,
- zone_options: [
- { id: 0, text: '全部分区' }
- ],
- zone_schedules: [],
-
- date_picker_options: {
- shortcuts: [
- {
- text: '今天',
- onClick(picker) {
- picker.$emit('pick', new Date())
- }
- },
- {
- text: '昨天',
- onClick(picker) {
- const date = new Date()
- date.setTime(date.getTime() - 3600 * 1000 * 24)
- picker.$emit('pick', date)
- }
- },
- {
- text: '一周前',
- onClick(picker) {
- const date = new Date()
- date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
- picker.$emit('pick', date)
- }
- }
- ]
- },
-
- // search_input 和 search_keyword,使输入关键字时不会经常刷新 filtedSchedules
- search_keyword: '', // 确定用于搜索的关键字
- search_input: '', // 输入中的关键字
-
- //
- patient_state:[
- {value: 0,label: '全部'},
- {value: 1,label: '已签到'},
- {value: 2,label: '未签到'},
- {value: 3,label: '已上机'},
- {value: 4,label: '已下机'},
- ],
- patientStateVal: 0,
- treat_state:[
- {value: 0,label: '全部'},
- {value: 1,label: '待开处方'},
- {value: 2,label: '待开小结'},
- {value: 3,label: '待医嘱核对'},
- ],
- treatStateVal: 0,
- allPatient:[],
-
- //叫号
- waitingCalled:[],
- called:[],
- fisrtQueueInfo:{},
- call_state:[
- {value: 0,label: '全部'},
- {value: 1,label: '待叫号'},
- {value: 2,label: '已叫号'},
- ],
- callVal: 0,
- timers:null,
- queueConfig:{}
- }
- },
- computed: {
- websocket() {
- return this.$store.state.user.websocket;
- },
- filtedSchedules: function() {
- var search_keyword = this.search_keyword
- if (search_keyword.length > 0) {
- var schedules = []
- for (let o_i = 0; o_i < this.zone_schedules.length; o_i++) {
- const scheduleInfo = this.zone_schedules[o_i]
- var originSchedules = scheduleInfo.schedules
- if (originSchedules.length == 0) {
- continue
- }
- var filtedSchedules = []
- for (let s_i = 0; s_i < originSchedules.length; s_i++) {
- const schedule = originSchedules[s_i]
- console.log("schedule.patient",schedule.patient)
- if(schedule.patient!=null){
- if ((schedule.patient.name.indexOf(search_keyword) != -1) || (schedule.patient.first_letter.indexOf(search_keyword) != -1)) {
- filtedSchedules.push(schedule)
- // break
- }
- }
-
- }
- if (filtedSchedules.length > 0) {
- schedules.push({ zone_id: scheduleInfo.zone_id, zone_name: scheduleInfo.zone_name, schedules: filtedSchedules })
- }
- }
- return schedules
- }
-
- var zone_selected = this.zone_selected
- var timetype_selected = this.schedule_type_selected
- if ((zone_selected == 0 && timetype_selected == 0) || this.zone_options.length <= 1) {
- var schedules = []
- for (let index = 0; index < this.zone_schedules.length; index++) {
- const scheduleInfo = this.zone_schedules[index]
- if (scheduleInfo.schedules.length != 0) {
- schedules.push(scheduleInfo)
- }
- }
- return schedules
- }
-
- var schedules = []
- for (let o_i = 0; o_i < this.zone_schedules.length; o_i++) {
- const scheduleInfo = this.zone_schedules[o_i]
- if (zone_selected == scheduleInfo.zone_id && timetype_selected == 0) {
- if (scheduleInfo.schedules.length == 0) {
- return []
- } else {
- return [scheduleInfo]
- }
- }
- var originSchedules = scheduleInfo.schedules
- if (originSchedules.length == 0) {
- continue
- }
- var filtedSchedules = []
- for (let s_i = 0; s_i < originSchedules.length; s_i++) {
- const schedule = originSchedules[s_i]
- if (zone_selected != 0) {
- if (zone_selected == schedule.device_number.zone.id) {
- if (timetype_selected == 0 || schedule.schedule_type == timetype_selected) {
- filtedSchedules.push(schedule)
- }
- }
- } else {
- if (timetype_selected == 0 || schedule.schedule_type == timetype_selected) {
- filtedSchedules.push(schedule)
- }
- }
- }
- if (filtedSchedules.length > 0) {
- schedules.push({ zone_id: scheduleInfo.zone_id, zone_name: scheduleInfo.zone_name, schedules: filtedSchedules })
- }
- }
- return schedules
- }
- },
- created() {
- if(sessionStorage.getItem('signInKey') != null){
- setTimeout(() => {
- if(sessionStorage.getItem('signInKey') == 1){
- this.$router.replace({ path: '/signIn' })
- }
- },1000)
- }else if(sessionStorage.getItem('lineUpKey') != null){
- setTimeout(() => {
- if(sessionStorage.getItem('lineUpKey') == 1){
- this.$router.replace({ path: '/lineUp' })
- }
- },1000)
- }
- var schedule_type_selected = this.$store.getters.schedule_type_selected
- var zone_selected = this.$store.getters.zone_selected
- var patient_state_selected = this.$store.getters.patient_state_selected
- var treat_state_selected = this.$store.getters.treat_state_selected
- var selected_date = this.$store.getters.selected_date
-
- if (schedule_type_selected) {
- this.schedule_type_selected = schedule_type_selected.schedule_type_selected
- }
- if (zone_selected) {
- this.zone_selected = zone_selected.zone_selected
- }
- if (patient_state_selected) {
- this.patientStateVal = patient_state_selected.patient_state_selected
- }
- if (treat_state_selected) {
- this.treatStateVal = treat_state_selected.treat_state_selected
- }
- if(selected_date.selected_date){
- this.selected_date = selected_date.selected_date
- }
- this.initData = {
- cmd: "queue/join",
- data: {type:3,page:0,size:0},
- };
- this.websocketSend(this.initData)
-
-
- this.getInitData()
-
-
-
- },
- beforeMount() {
- if (this.websocket) {
- if (this.websocket.readyState == 1) {
- console.log('执行1')
- this.websocketMess();
- } else {
- setTimeout(() => {
- console.log('执行2')
- this.websocketMess();
- }, 1000);
- }
- } else {
- setTimeout(() => {
- if (this.websocket) {
- console.log('执行3')
- this.websocketMess();
- } else {
- setTimeout(() => {
- console.log('执行4')
- this.websocketMess();
- }, 1000);
- }
- }, 1000);
- }
- },
- mounted() {
- const timer = setInterval(() => {
- // this.getInitData();
- this.requestDialysisSchedules()
- }, 1000 * 60)
- // 通过$once来监听定时器,在beforeDestroy钩子可以被清除。
- this.$once('hook:beforeDestroy', () => {
- clearInterval(timer)
- })
-
- let obj = {
- cmd: "queue/join",
- data: {type:3,page:0,size:0},
- };
- this.websocketSend(obj)
- },
- beforeDestroy(){
-
- let unObj = {
- cmd: "queue/unjoin",
- data: {type:3},
- };
- this.websocketSend(unObj)
- },
- methods: {
- websocketSend(data) {
- try {
- this.websocket.send(JSON.stringify(data))
-
- } catch (error) {
- this.showError = true;
- this.showIndex = 4;
- this.errorInfo = "网络异常,请稍后退出重试!";
- }
- },
- websocketMess() {
- console.log('执行',this.websocket)
- this.websocket.onmessage = e => {
- let res = JSON.parse(e.data);
- // let res = re.data;
- console.log('res333adasda3333333',res)
- if(res.channel == 'queue/join'){
- let timeType = null
- if(this.schedule_type_selected == 1){
- timeType = 1
- }else if(this.schedule_type_selected == 2){
- timeType = 2
- }else{
- if(new Date().getHours() < 10){
- timeType = 1
- }else if(new Date().getHours() >= 10){
- timeType = 2
- }
- }
- let fisrtQueueInfo = []
- this.newFisrtQueueInfo = res.data.fisrtQueueInfo
- this.queueConfig = res.data.queueConfig
- if(res.data.fisrtQueueInfo != null){
- if(timeType == 1){
- fisrtQueueInfo = res.data.fisrtQueueInfo.morning
- if(fisrtQueueInfo.create_time){
- fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
- }
- }else if(timeType == 2){
- fisrtQueueInfo = res.data.fisrtQueueInfo.afternoon
- if(fisrtQueueInfo.create_time){
- fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
- }
- }
- }
- this.fisrtQueueInfo = fisrtQueueInfo
-
- // this.fisrtQueueInfo = res.data.fisrtQueueInfo
- let arr = res.data.patientQueueList.data
- let waitingCalledArr = []
- let calledArr = []
- arr.map(item => {
- if(item.status == 1){
- // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
- waitingCalledArr.push(item)
- }else if(item.status == 2){
- // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
- calledArr.push(item)
- }
- })
- console.log('waitingCalledArr待叫号',waitingCalledArr)
- console.log('waitingCalledArr以较好',calledArr)
- this.waitingCalled = waitingCalledArr
- this.called = calledArr
- }else if(res.channel == 'allQueueList'){
- let arr = res.data.queue_list.data
- let waitingCalledArr = []
- let calledArr = []
- arr.map(item => {
- if(item.status == 1){
- // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
- waitingCalledArr.push(item)
- }else if(item.status == 2){
- // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
- calledArr.push(item)
- }
- })
- this.waitingCalled = waitingCalledArr
- this.called = calledArr
- }else if(res.channel == 'patientCallInfo'){
- res.data.patientInfo.create_time = moment(res.data.patientInfo.create_time * 1000).format('HH:mm')
- this.fisrtQueueInfo = res.data.patientInfo
- }else if(res.channel == 'fisrtQueueInfo'){
- if(this.schedule_type_selected == 1){
- timeType = 1
- }else if(this.schedule_type_selected == 2){
- timeType = 2
- }else{
- if(new Date().getHours() < 10){
- timeType = 1
- }else if(new Date().getHours() >= 10){
- timeType = 2
- }
- }
- let fisrtQueueInfo = []
- this.newFisrtQueueInfo = res.data.patientInfo
- if(res.data.patientInfo != null){
- if(timeType == 1){
- fisrtQueueInfo = res.data.patientInfo.morning
- if(fisrtQueueInfo.create_time){
- fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
- }
- }else if(timeType == 2){
- fisrtQueueInfo = res.data.patientInfo.afternoon
- if(fisrtQueueInfo.create_time){
- fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
- }
- }
- }
- this.fisrtQueueInfo = fisrtQueueInfo
- }
- }
- },
- call(patient_id){
- if(patient_id == undefined || patient_id == ""){
- this.$message.error('已经是最后一位了');
- return
- }
- console.log('patient_id',patient_id)
- let org_id = parseInt(sessionStorage.getItem("org_id"));
- let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
- axios.get('/api/index/callpatient?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
- console.log(res)
- // let patientArr = res.data.queue_list.data
- // this.patientArr = patientArr
- // this.$emit('child-event',this.patientArr)
- if(res.data.code == 200){
- this.$message({
- message: res.data.msg,
- type: 'success'
- });
- }
- })
- },
- next(patient_id){
- if(patient_id == undefined || patient_id == ""){
- this.$message.error('已经是最后一位了');
- return
- }
- let schedule_type = null
- if(this.schedule_type_selected == 0){
- if(new Date().getHours() < 11){
- schedule_type = 1
- }else {
- schedule_type = 2
- }
- }else if(this.schedule_type_selected == 1){
- schedule_type = 1
- }else if(this.schedule_type_selected == 2){
- schedule_type = 2
- }
-
- console.log('patient_id',patient_id)
- let org_id = parseInt(sessionStorage.getItem("org_id"));
- let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
- axios.get('/api/index/nextcall?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id + '&schedule_type=' + schedule_type).then(res => {
- console.log(res)
- // let patientArr = res.data.queue_list.data
- // this.patientArr = patientArr
- // this.$emit('child-event',this.patientArr)
- if(res.data.data.patientInfo == null){
- this.$message.error('已经是最后一位了');
- return
- }
- if(res.data.code == 200){
- this.$message({
- message: res.data.msg,
- type: 'success'
- });
- }
-
- })
- },
- handleCallChange: function(index) {
- this.callVal = index
- // this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
- this.search_keyword = this.search_input = ''
- this.getData()
- },
- // handletimeType: function(index) {
- // this.schedule_type_selected = index
- // this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
- // this.search_keyword = this.search_input = ''
- // // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
- // // zone: this.zone_selected,
- // // schedule_type: this.schedule_type_selected,
- // // schedule_date: this.selected_date,
- // // })
- // },
- // handleZoneChange: function(index) {
- // this.zone_selected = index
- // this.$store.dispatch('SetZoneSelected', { zone_selected: index })
- // this.search_keyword = this.search_input = ''
- // // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
- // // zone: this.zone_selected,
- // // schedule_type: this.schedule_type_selected,
- // // schedule_date: this.selected_date,
- // // })
- // },
- handleScheduleDateChange: function(index) {
- this.zone_selected = 0
- this.schedule_type_selected = 0
- this.patientStateVal = 0
- this.treatStateVal = 0
- this.search_keyword = this.search_input = ''
- // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
- // zone: this.zone_selected,
- // schedule_type: this.schedule_type_selected,
- // schedule_date: this.selected_date,
- // })
- this.selected_date = index
- this.$store.dispatch('SetSelectedDate', { selected_date: index })
- this.requestDialysisSchedules()
- },
- searchAction: function() {
- this.search_keyword = this.search_input
- this.schedule_type_selected = 0
- this.zone_selected = 0
- this.treatStateVal = 0
- this.patientStateVal = 0
- if(this.search_input != ''){
- this.allPatient = this.filtedSchedules
- }else{
- this.getData()
- }
-
- },
- getInitData: function() {
- getDialysisRecordInitData().then(rs => {
- var resp = rs.data
- if (resp.state == 1) {
- var zones = resp.data.zones
- var arr = []
- for(let i=0;i<zones.length;i++){
- if(zones[i].status == 1){
- arr.push(zones[i])
- }
- }
- console.log("zone2w233323232wid",zones)
- var schedules = resp.data.schedules
- var zone_options = [{ id: 0, text: '全部分区' }]
- for (let z_i = 0; z_i < arr.length; z_i++) {
- const zone = arr[z_i]
- zone_options.push({ id: zone.id, text: zone.name })
- }
- this.zone_options = zone_options
- // this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
- this.requestDialysisSchedules()
-
- } else {
- this.$message.error(resp.msg)
- }
- })
- },
- requestDialysisSchedules: function() {
- var ymd = parseTime(this.selected_date, '{y}-{m}-{d}')
- getDialysisSchedules(ymd).then(rs => {
- var resp = rs.data
- if (resp.state == 1) {
- var schedules = resp.data.schedules
- console.log("透析详情页面",schedules)
- this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
- this.allPatient = this.filtedSchedules
- this.getData()
- } else {
- this.$message.error(resp.msg)
- }
- })
- },
- processedDialysisSchedules: function(schedules, zone_options) {
- var zoneMap = {}
- var scheduleMap = {}
- for (let z_i = 0; z_i < zone_options.length; z_i++) {
- const zone = zone_options[z_i]
- if (zone.id == 0) {
- continue
- }
- scheduleMap[zone.id] = []
- }
- for (let index = 0; index < schedules.length; index++) {
- const schedule = schedules[index]
- scheduleMap[schedule.device_number.zone.id].push(schedule)
- }
- var zone_schedules = []
- for (let index = 0; index < zone_options.length; index++) {
- const zone = zone_options[index]
- if (zone.id == 0) {
- continue
- }
- var schedules = scheduleMap[zone.id]
- zone_schedules.push({ zone_id: zone.id, zone_name: zone.text, schedules: schedules })
- }
- return zone_schedules
- },
-
- //
- handleStateChange: function(index) {
- this.patientStateVal = index
- this.$store.dispatch('SetPatientStateSelected', { patient_state_selected: index })
- this.search_keyword = this.search_input = ''
- this.getData()
- },
- handleTreatChange: function(index) {
- this.treatStateVal = index
- this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
- this.search_keyword = this.search_input = ''
- this.getData()
- },
- handletimeType: function(index) {
- this.schedule_type_selected = index
- this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
- this.search_keyword = this.search_input = ''
- this.getData()
- },
- //分区
- handleZoneChange: function(index) {
- this.zone_selected = index
- this.$store.dispatch('SetZoneSelected', { zone_selected: index })
- this.search_keyword = this.search_input = ''
- this.getData()
- },
- getData(){
- let newobj = {
- cmd: "queue/join",
- data: {type:3,page:0,size:0},
- };
- this.websocketSend(newobj)
-
- let patientArr = []
- patientArr = JSON.parse(JSON.stringify(this.zone_schedules))
- // for (let i = 0; i < patientArr.length; i++) {
-
- // for (let j = 0; j < patientArr[i].schedules.length; j++) {
- // if (patientArr[i].schedules.length > 0 && patientArr[i].schedules[j].dialysis_order != null) {
- // // 删除元素后改变i的值
-
- // console.log("候诊区",patientArr[i].schedules[j])
- // patientArr[i].schedules.splice(j--, 1);
- // }
- // }
- // }
- let arr1 = []
- if(this.patientStateVal == 0){
- arr1 = patientArr
- }else if(this.patientStateVal == 1){
- let arr = []
- arr = patientArr
- for (let i = 0; i <arr.length; i++) {
- for (let j = 0; j < arr[i].schedules.length; j++) {
- if (arr[i].schedules.length > 0 && (arr[i].schedules[j].assessment_before_dislysis == null || (arr[i].schedules[j].assessment_before_dislysis.weight_before == '' && arr[i].schedules[j].assessment_before_dislysis.diastolic_blood_pressure == '' && arr[i].schedules[j].assessment_before_dislysis.systolic_blood_pressure == ''))) {
- // 删除元素后改变i的值
- arr[i].schedules.splice(j--, 1);
- }
- }
- }
- console.log("执行1",arr)
- arr1 = arr
- }else if(this.patientStateVal == 2){
- let arr = []
- arr = patientArr
- for (let i = 0; i < arr.length; i++) {
- for (let j = 0; j < arr[i].schedules.length; j++) {
- if (arr[i].schedules.length > 0 && (arr[i].schedules[j].assessment_before_dislysis != null && (arr[i].schedules[j].assessment_before_dislysis.weight_before != 0 || arr[i].schedules[j].assessment_before_dislysis.diastolic_blood_pressure != 0 || arr[i].schedules[j].assessment_before_dislysis.systolic_blood_pressure != 0))) {
- // 删除元素后改变i的值
- console.log('几次')
- arr[i].schedules.splice(j--, 1);
- }
- }
- }
- console.log("执行2",arr)
- arr1 = arr
- }else if(this.patientStateVal == 3){
- let arr = []
- arr = patientArr
- for (let i = 0; i <arr.length; i++) {
- for (let j = 0; j < arr[i].schedules.length; j++) {
- if (arr[i].schedules.length > 0 && (arr[i].schedules[j].dialysis_order == null || (arr[i].schedules[j].dialysis_order != null && arr[i].schedules[j].dialysis_order.stage != 1))) {
- // 删除元素后改变i的值
- arr[i].schedules.splice(j--, 1);
- }
- }
- }
- console.log("执行1",arr)
- arr1 = arr
- }else if(this.patientStateVal == 4){
- let arr = []
- arr = patientArr
- for (let i = 0; i < arr.length; i++) {
- for (let j = 0; j < arr[i].schedules.length; j++) {
- if (arr[i].schedules.length > 0 && (arr[i].schedules[j].dialysis_order == null || (arr[i].schedules[j].dialysis_order != null && arr[i].schedules[j].dialysis_order.stage != 2))) {
- // 删除元素后改变i的值
- arr[i].schedules.splice(j--, 1);
- }
- }
- }
- console.log("执行2",arr)
- arr1 = arr
- }
-
- let arr2 = []
- if(this.treatStateVal == 0){
- arr2 = JSON.parse(JSON.stringify(arr1))
- }else if(this.treatStateVal == 1){
- let arr = []
- arr = JSON.parse(JSON.stringify(arr1))
- for (let i = 0; i < arr.length; i++) {
- for (let j = 0; j < arr[i].schedules.length; j++) {
- if (arr[i].schedules.length > 0 && (arr[i].schedules[j].prescription != null || arr[i].schedules[j].prescription != null ? arr[i].schedules[j].prescription.creater != 0 : false)) {
- // 删除元素后改变i的值
- arr[i].schedules.splice(j--, 1);
- }
- }
- }
- arr2 = arr
- }else if(this.treatStateVal == 2){
- let arr = []
- arr = JSON.parse(JSON.stringify(arr1))
- for (let i = 0; i < arr.length; i++) {
- for (let j = 0; j < arr[i].schedules.length; j++) {
- if (arr[i].schedules.length > 0 && arr[i].schedules[j].treatment_summary != null && arr[i].schedules[j].treatment_summary.dialysis_summary != '') {
- // 删除元素后改变i的值
- arr[i].schedules.splice(j--, 1);
- }
- }
- }
- arr2 = arr
- }else if(this.treatStateVal == 3){
- let arr = []
- arr = JSON.parse(JSON.stringify(arr1))
- for (let i = 0; i < arr.length; i++) {
- for (let j = 0; j < arr[i].schedules.length; j++) {
- if(arr[i].schedules[j].doctor_advice.length == 0){
- arr[i].schedules.splice(j--, 1)
- }
- if(arr[i].schedules && arr[i].schedules[j] && arr[i].schedules[j].doctor_advice){
- let sign = 0
- arr[i].schedules[j].doctor_advice.map(item => {
- if(item.check_state == 1){
- sign++
- }
- })
- if(sign == arr[i].schedules[j].doctor_advice.length && arr[i].schedules[j].doctor_advice.length > 0){
- arr[i].schedules.splice(j--, 1)
- }
- }
- }
- }
- arr2 = arr
- }
-
-
- let arr3 = []
- if(this.schedule_type_selected == 0){
- arr3 = JSON.parse(JSON.stringify(arr2))
- }else{
- let arr = []
- arr = JSON.parse(JSON.stringify(arr2))
- for (let i = 0; i < arr.length; i++) {
- for (let j = 0; j < arr[i].schedules.length; j++) {
- if (this.schedule_type_selected != arr[i].schedules[j].schedule_type) {
- // 删除元素后改变i的值
- arr[i].schedules.splice(j--, 1);
- }
- }
- }
- arr3 = arr
- }
-
-
- let arr4 = []
- if(this.zone_selected == 0){
- arr4 = JSON.parse(JSON.stringify(arr3))
- }else{
- let arr = []
- arr = JSON.parse(JSON.stringify(arr3))
- for (let i = 0; i < arr.length; i++) {
- if (this.zone_selected != arr[i].zone_id) {
- // 删除元素后改变i的值
- arr.splice(i--, 1);
- }
- }
- arr4 = arr
- }
-
-
- if(this.patientStateVal == 1){
- arr4.map((item,index) => {
- if(index != 0){
- arr4[0].schedules.push(...arr4[index].schedules)
- arr4[index].schedules = []
- }
- })
- arr4[0].schedules.map(item => {
- item.created_time = item.assessment_before_dislysis.created_time
- })
- arr4[0].schedules.sort(this.compare('created_time'))
- this.allPatient = arr4
- console.log("arr4",arr4)
- }else{
- this.allPatient = arr4
- }
- // let arr5 = JSON.parse(JSON.stringify(this.allPatient))
-
-
- // if(this.callVal == 1){
- // let arr = []
- // arr = JSON.parse(JSON.stringify(arr5))
- // for (let i = 0; i < arr.length; i++) {
- // for (let j = 0; j < arr[i].schedules.length; j++) {
- // // console.log(this.waitingCalled)
- // let a = []
- // this.waitingCalled.map(item => {
- // a.push(parseInt(item.patient_id))
- // })
- // console.log(6666666666,a)
- // console.log(2222,arr[i].schedules[j].patient_id)
- // if (a.indexOf(arr[i].schedules[j].patient_id) == -1) {
- // // 删除元素后改变i的值
- // console.log('下标值',a.indexOf(arr[i].schedules[j].patient_id))
- // arr[i].schedules.splice(j--, 1);
- // }
- // }
- // }
- // console.log('arr111111111111',arr)
- // }else if(this.callVal == 2) {
- // let arr = []
- // arr = JSON.parse(JSON.stringify(arr5))
- // for (let i = 0; i < arr.length; i++) {
- // for (let j = 0; j < arr[i].schedules.length; j++) {
- // // console.log(this.waitingCalled)
- // let a = []
- // this.called.map(item => {
- // a.push(parseInt(item.patient_id))
- // })
- // console.log(6666666666,a)
- // console.log(2222,arr[i].schedules[j].patient_id)
- // if (a.indexOf(arr[i].schedules[j].patient_id) == -1) {
- // // 删除元素后改变i的值
- // console.log('下标值',a.indexOf(arr[i].schedules[j].patient_id))
- // arr[i].schedules.splice(j--, 1);
- // }
- // }
- // }
- // console.log('arr222222222',arr)
- // }
-
-
- },
- compare(property){
- return function(a,b){
- var value1 = a[property];
- var value2 = b[property];
- return value1 - value2;
- }
- }
- }
- }
- </script>
-
- <style rel="stylesheet/scss" lang="scss" scoped>
- .app-container {
- // margin: 20px;
- font-size: 15px;
- .filter-container {
- padding-bottom: 5px;
- }
- .search-component {
- width: 500px;
- .searchBox {
- width: 300px;
- height: 36px;
- line-height: 36px;
- padding-left: 15px;
- border: 1px #dcdfe6 solid;
- border-right: none;
- outline: none;
- float: left;
- border-radius: 6px 0 0 6px;
- font-size: 14px;
- color: #333;
- background: #fff;
- box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
- }
- .searchBtn {
- background-color: #409eff;
- color: #fff;
- font-size: 15px;
- text-align: center;
- height: 36px;
- line-height: 36px;
- float: left;
- outline: none;
- width: 70px;
- border: none;
- border-radius: 0 6px 6px 0;
- font-family: "Microsoft Yahei";
- cursor: pointer;
- }
- }
-
- .amount {
- font-weight: normal;
- padding: 10px 0 0 0;
- color: #606266;
- font-size: 14px;
- span {
- color: #ef2525;
- font-family: "Arial";
- padding: 0 2px;
- }
- }
- }
- .PatientArea{
- .list{
- .title{
- font-size: 16px;
- color: #34495e;
- height:50px ;
- line-height: 50px;
- font-weight: bold;
- }
- }
- }
- .smallWidth{
- width:88%;
- }
- .nowCalling{
- height: 313px;
- border: 1px solid #e5e5ee;
- // flex: 1;
- width: 12%;
- text-align: center;
- .nowCallingTitle{
- font-size: 20px;
- font-weight: 600;
- margin-top: 20px;
- text-align: center;
- }
- .nowCallingName{
- color: #338AFB;
- font-size: 18px;
- margin-top: 10px;
- font-weight: 600;
- }
- .nowCallingTime{
- font-size: 16px;
- margin-top: 30px;
- }
- }
- </style>
-
|