schedualPatient.vue 38KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs='crumbs'></bread-crumb>
  5. </div>
  6. <div class="app-container">
  7. <!-- <div class="cell clearfix">
  8. <label class="title"><span class="name">病人查询</span> : </label>
  9. <el-input size="small" style="width: 280px;" v-model.trim="search_input" class="filter-item"/>
  10. <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="searchAction">搜索</el-button>
  11. </div> -->
  12. <!-- <div class="cell clearfix">
  13. <label class="title"><span class="name">日期查询</span> : </label>
  14. <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>
  15. </div>
  16. <div class="cell clearfix">
  17. <label class="title"><span class="name">排班班次</span> : </label>
  18. <div class="time ">
  19. <ul class="">
  20. <li v-for="option in schedule_type_options" :key="option.value" @click="handletimeType(option.value)" :class="schedule_type_selected == option.value ? 'active' : ''" >{{option.text}}
  21. </li>
  22. </ul>
  23. </div>
  24. </div>
  25. <div class="cell clearfix">
  26. <label class="title"><span class="name">分区</span> : </label>
  27. <div class="time ">
  28. <ul class="">
  29. <li v-for="option in zone_options" :key="option.id" :class="option.id == zone_selected ? 'active' : ''" @click='handleZoneChange(option.id)'>{{ option.text }}
  30. </li>
  31. </ul>
  32. </div>
  33. </div> -->
  34. <div class="cell clearfix">
  35. <label class="title"><span class="name">患者状态</span> : </label>
  36. <div class="time ">
  37. <ul class="">
  38. <li v-for="option in patient_state" :key="option.value" @click="handleStateChange(option.value)" :class="patientStateVal == option.value ? 'active' : ''" >{{option.label}}
  39. </li>
  40. </ul>
  41. </div>
  42. <!-- <label class="title"><span class="name">叫号状态</span> : </label>
  43. <div class="time ">
  44. <ul class="">
  45. <li v-for="option in call_state" :key="option.value" @click="handleCallChange(option.value)" :class="callVal == option.value ? 'active' : ''" >{{option.label}}
  46. </li>
  47. </ul>
  48. </div> -->
  49. </div>
  50. <div class="cell clearfix">
  51. <label class="title"><span class="name">治疗状态</span> : </label>
  52. <div class="time ">
  53. <ul class="">
  54. <li v-for="option in treat_state" :key="option.value" @click="handleTreatChange(option.value)" :class="treatStateVal == option.value ? 'active' : ''" >{{option.label}}
  55. </li>
  56. </ul>
  57. </div>
  58. </div>
  59. <div class="cell clearfix" style="margin-bottom:10px;">
  60. <label class="title"><span class="name">其他查询</span> : </label>
  61. <el-select v-model="schedule_type_selected" placeholder="班次" style="margin-right:10px;" @change="handletimeType">
  62. <el-option
  63. v-for="item in schedule_type_options"
  64. :key="item.value"
  65. :label="item.text"
  66. :value="item.value">
  67. </el-option>
  68. </el-select>
  69. <el-select v-model="zone_selected" placeholder="分区" style="margin-right:10px;" @change="handleZoneChange">
  70. <el-option
  71. v-for="item in zone_options"
  72. :key="item.id"
  73. :label="item.text"
  74. :value="item.id">
  75. </el-option>
  76. </el-select>
  77. <label class="title"><span class="name">日期查询</span> : </label>
  78. <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>
  79. <el-input size="small" style="width: 180px;" @keyup.enter.native='searchAction' v-model.trim="search_input" class="filter-item"/>
  80. <el-button size="small" class="filter-item" type="primary" icon="el-icon-search" @click="searchAction">搜索</el-button>
  81. </div>
  82. <div style="display:flex;justify-content: space-between;">
  83. <div :class="queueConfig.txglsyxs != 1 ? 'PatientArea' : 'PatientArea smallWidth'">
  84. <div v-for="zone_schedule in allPatient" :key="zone_schedule.zone_id" class="list clearfix">
  85. <!-- <h3 style="width:40px;" class="title">{{zone_schedule.zone_name}}</h3> -->
  86. <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>
  87. <patient-box :schedules="zone_schedule.schedules" :patientStateVal='patientStateVal' style="flex:1"></patient-box>
  88. </div>
  89. <div class="NoData" v-show="filtedSchedules.length == 0">
  90. <img src="@/assets/img/data.jpg" alt="">
  91. </div>
  92. </div>
  93. <div class="nowCalling" v-if="queueConfig.txglsyxs == 1">
  94. <p class="nowCallingTitle">当前叫号</p>
  95. <p class="nowCallingName">{{ fisrtQueueInfo ? fisrtQueueInfo.patient_name : '' }}</p>
  96. <p class="nowCallingTime">签到时间:{{ fisrtQueueInfo ? fisrtQueueInfo.create_time : '' }}</p>
  97. <el-button type="primary" @click="call(fisrtQueueInfo && fisrtQueueInfo.patient_id ? fisrtQueueInfo.patient_id : '')" style="margin-left:0;margin: 30px 0 20px 0;">&ensp;叫号&ensp;</el-button>
  98. <!-- <el-button style="margin: 0px 0 20px 0;" @click="pass(fisrtQueueInfo.patient_id)">&ensp;过号&ensp;</el-button> -->
  99. <el-button style="margin:0 auto;" @click="next(fisrtQueueInfo && fisrtQueueInfo.patient_id ? fisrtQueueInfo.patient_id : '')">下一位</el-button>
  100. </div>
  101. </div>
  102. </div>
  103. </div>
  104. </template>
  105. <script>
  106. const moment = require('moment')
  107. import axios from 'axios'
  108. import PatientBox from './PatientBox'
  109. import { getDialysisRecordInitData, getDialysisSchedules } from '@/api/dialysis_record'
  110. import { parseTime } from '@/utils'
  111. import BreadCrumb from '@/xt_pages/components/bread-crumb'
  112. export default {
  113. name: 'Patient',
  114. components: {
  115. PatientBox,
  116. BreadCrumb
  117. },
  118. data() {
  119. return {
  120. crumbs: [
  121. { path: false, name: '透析管理' },
  122. { path: 'dialysis/dialysisrecord', name: '透析记录' }
  123. ],
  124. selected_date: new Date(), // this.$store.getters.app.dialysis_area.schedule_date,
  125. schedule_type_selected: 0, // this.$store.getters.app.dialysis_area.schedule_type_select_index,
  126. schedule_type_options: [
  127. { value: 0, text: '全部班' },
  128. { value: 1, text: '上午' },
  129. { value: 2, text: '下午' },
  130. { value: 3, text: '晚上' }
  131. ],
  132. zone_selected: 0, // this.$store.getters.app.dialysis_area.zone_select_index,
  133. zone_options: [
  134. { id: 0, text: '全部分区' }
  135. ],
  136. zone_schedules: [],
  137. date_picker_options: {
  138. shortcuts: [
  139. {
  140. text: '今天',
  141. onClick(picker) {
  142. picker.$emit('pick', new Date())
  143. }
  144. },
  145. {
  146. text: '昨天',
  147. onClick(picker) {
  148. const date = new Date()
  149. date.setTime(date.getTime() - 3600 * 1000 * 24)
  150. picker.$emit('pick', date)
  151. }
  152. },
  153. {
  154. text: '一周前',
  155. onClick(picker) {
  156. const date = new Date()
  157. date.setTime(date.getTime() - 3600 * 1000 * 24 * 7)
  158. picker.$emit('pick', date)
  159. }
  160. }
  161. ]
  162. },
  163. // search_input 和 search_keyword,使输入关键字时不会经常刷新 filtedSchedules
  164. search_keyword: '', // 确定用于搜索的关键字
  165. search_input: '', // 输入中的关键字
  166. //
  167. patient_state:[
  168. {value: 0,label: '全部'},
  169. {value: 1,label: '已签到'},
  170. {value: 2,label: '未签到'},
  171. {value: 3,label: '已上机'},
  172. {value: 4,label: '已下机'},
  173. ],
  174. patientStateVal: 0,
  175. treat_state:[
  176. {value: 0,label: '全部'},
  177. {value: 1,label: '待开处方'},
  178. {value: 2,label: '待开小结'},
  179. {value: 3,label: '待医嘱核对'},
  180. ],
  181. treatStateVal: 0,
  182. allPatient:[],
  183. //叫号
  184. waitingCalled:[],
  185. called:[],
  186. fisrtQueueInfo:{},
  187. call_state:[
  188. {value: 0,label: '全部'},
  189. {value: 1,label: '待叫号'},
  190. {value: 2,label: '已叫号'},
  191. ],
  192. callVal: 0,
  193. timers:null,
  194. queueConfig:{}
  195. }
  196. },
  197. computed: {
  198. websocket() {
  199. return this.$store.state.user.websocket;
  200. },
  201. filtedSchedules: function() {
  202. var search_keyword = this.search_keyword
  203. if (search_keyword.length > 0) {
  204. var schedules = []
  205. for (let o_i = 0; o_i < this.zone_schedules.length; o_i++) {
  206. const scheduleInfo = this.zone_schedules[o_i]
  207. var originSchedules = scheduleInfo.schedules
  208. if (originSchedules.length == 0) {
  209. continue
  210. }
  211. var filtedSchedules = []
  212. for (let s_i = 0; s_i < originSchedules.length; s_i++) {
  213. const schedule = originSchedules[s_i]
  214. if (schedule.patient.name.indexOf(search_keyword) != -1) {
  215. filtedSchedules.push(schedule)
  216. // break
  217. }
  218. }
  219. if (filtedSchedules.length > 0) {
  220. schedules.push({ zone_id: scheduleInfo.zone_id, zone_name: scheduleInfo.zone_name, schedules: filtedSchedules })
  221. }
  222. }
  223. return schedules
  224. }
  225. var zone_selected = this.zone_selected
  226. var timetype_selected = this.schedule_type_selected
  227. if ((zone_selected == 0 && timetype_selected == 0) || this.zone_options.length <= 1) {
  228. var schedules = []
  229. for (let index = 0; index < this.zone_schedules.length; index++) {
  230. const scheduleInfo = this.zone_schedules[index]
  231. if (scheduleInfo.schedules.length != 0) {
  232. schedules.push(scheduleInfo)
  233. }
  234. }
  235. return schedules
  236. }
  237. var schedules = []
  238. for (let o_i = 0; o_i < this.zone_schedules.length; o_i++) {
  239. const scheduleInfo = this.zone_schedules[o_i]
  240. if (zone_selected == scheduleInfo.zone_id && timetype_selected == 0) {
  241. if (scheduleInfo.schedules.length == 0) {
  242. return []
  243. } else {
  244. return [scheduleInfo]
  245. }
  246. }
  247. var originSchedules = scheduleInfo.schedules
  248. if (originSchedules.length == 0) {
  249. continue
  250. }
  251. var filtedSchedules = []
  252. for (let s_i = 0; s_i < originSchedules.length; s_i++) {
  253. const schedule = originSchedules[s_i]
  254. if (zone_selected != 0) {
  255. if (zone_selected == schedule.device_number.zone.id) {
  256. if (timetype_selected == 0 || schedule.schedule_type == timetype_selected) {
  257. filtedSchedules.push(schedule)
  258. }
  259. }
  260. } else {
  261. if (timetype_selected == 0 || schedule.schedule_type == timetype_selected) {
  262. filtedSchedules.push(schedule)
  263. }
  264. }
  265. }
  266. if (filtedSchedules.length > 0) {
  267. schedules.push({ zone_id: scheduleInfo.zone_id, zone_name: scheduleInfo.zone_name, schedules: filtedSchedules })
  268. }
  269. }
  270. return schedules
  271. }
  272. },
  273. created() {
  274. if(sessionStorage.getItem('signInKey') != null){
  275. setTimeout(() => {
  276. if(sessionStorage.getItem('signInKey') == 1){
  277. this.$router.replace({ path: '/signIn' })
  278. }
  279. },1000)
  280. }else if(sessionStorage.getItem('lineUpKey') != null){
  281. setTimeout(() => {
  282. if(sessionStorage.getItem('lineUpKey') == 1){
  283. this.$router.replace({ path: '/lineUp' })
  284. }
  285. },1000)
  286. }
  287. var schedule_type_selected = this.$store.getters.schedule_type_selected
  288. var zone_selected = this.$store.getters.zone_selected
  289. var patient_state_selected = this.$store.getters.patient_state_selected
  290. var treat_state_selected = this.$store.getters.treat_state_selected
  291. var selected_date = this.$store.getters.selected_date
  292. if (schedule_type_selected) {
  293. this.schedule_type_selected = schedule_type_selected.schedule_type_selected
  294. }
  295. if (zone_selected) {
  296. this.zone_selected = zone_selected.zone_selected
  297. }
  298. if (patient_state_selected) {
  299. this.patientStateVal = patient_state_selected.patient_state_selected
  300. }
  301. if (treat_state_selected) {
  302. this.treatStateVal = treat_state_selected.treat_state_selected
  303. }
  304. if(selected_date.selected_date){
  305. this.selected_date = selected_date.selected_date
  306. }
  307. this.initData = {
  308. cmd: "queue/join",
  309. data: {type:3,page:0,size:0},
  310. };
  311. this.websocketSend(this.initData)
  312. this.getInitData()
  313. },
  314. beforeMount() {
  315. if (this.websocket) {
  316. if (this.websocket.readyState == 1) {
  317. console.log('执行1')
  318. this.websocketMess();
  319. } else {
  320. setTimeout(() => {
  321. console.log('执行2')
  322. this.websocketMess();
  323. }, 1000);
  324. }
  325. } else {
  326. setTimeout(() => {
  327. if (this.websocket) {
  328. console.log('执行3')
  329. this.websocketMess();
  330. } else {
  331. setTimeout(() => {
  332. console.log('执行4')
  333. this.websocketMess();
  334. }, 1000);
  335. }
  336. }, 1000);
  337. }
  338. },
  339. mounted() {
  340. const timer = setInterval(() => {
  341. // this.getInitData();
  342. this.requestDialysisSchedules()
  343. }, 1000 * 60)
  344. // 通过$once来监听定时器,在beforeDestroy钩子可以被清除。
  345. this.$once('hook:beforeDestroy', () => {
  346. clearInterval(timer)
  347. })
  348. let obj = {
  349. cmd: "queue/join",
  350. data: {type:3,page:0,size:0},
  351. };
  352. this.websocketSend(obj)
  353. },
  354. beforeDestroy(){
  355. let unObj = {
  356. cmd: "queue/unjoin",
  357. data: {type:3},
  358. };
  359. this.websocketSend(unObj)
  360. },
  361. methods: {
  362. websocketSend(data) {
  363. try {
  364. this.websocket.send(JSON.stringify(data))
  365. } catch (error) {
  366. this.showError = true;
  367. this.showIndex = 4;
  368. this.errorInfo = "网络异常,请稍后退出重试!";
  369. }
  370. },
  371. websocketMess() {
  372. console.log('执行',this.websocket)
  373. this.websocket.onmessage = e => {
  374. let res = JSON.parse(e.data);
  375. // let res = re.data;
  376. console.log('res3333333333',res)
  377. if(res.channel == 'queue/join'){
  378. let timeType = null
  379. if(this.schedule_type_selected == 1){
  380. timeType = 1
  381. }else if(this.schedule_type_selected == 2){
  382. timeType = 2
  383. }else{
  384. if(new Date().getHours() < 10){
  385. timeType = 1
  386. }else if(new Date().getHours() >= 10){
  387. timeType = 2
  388. }
  389. }
  390. let fisrtQueueInfo = []
  391. this.newFisrtQueueInfo = res.data.fisrtQueueInfo
  392. if(res.data.fisrtQueueInfo != null){
  393. if(timeType == 1){
  394. fisrtQueueInfo = res.data.fisrtQueueInfo.morning
  395. if(fisrtQueueInfo.create_time){
  396. fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  397. }
  398. }else if(timeType == 2){
  399. fisrtQueueInfo = res.data.fisrtQueueInfo.afternoon
  400. if(fisrtQueueInfo.create_time){
  401. fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  402. }
  403. }
  404. }
  405. this.fisrtQueueInfo = fisrtQueueInfo
  406. this.queueConfig = res.data.queueConfig
  407. // this.fisrtQueueInfo = res.data.fisrtQueueInfo
  408. let arr = res.data.patientQueueList.data
  409. let waitingCalledArr = []
  410. let calledArr = []
  411. arr.map(item => {
  412. if(item.status == 1){
  413. // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  414. waitingCalledArr.push(item)
  415. }else if(item.status == 2){
  416. // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  417. calledArr.push(item)
  418. }
  419. })
  420. console.log('waitingCalledArr待叫号',waitingCalledArr)
  421. console.log('waitingCalledArr以较好',calledArr)
  422. this.waitingCalled = waitingCalledArr
  423. this.called = calledArr
  424. }else if(res.channel == 'allQueueList'){
  425. let arr = res.data.queue_list.data
  426. let waitingCalledArr = []
  427. let calledArr = []
  428. arr.map(item => {
  429. if(item.status == 1){
  430. // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  431. waitingCalledArr.push(item)
  432. }else if(item.status == 2){
  433. // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  434. calledArr.push(item)
  435. }
  436. })
  437. this.waitingCalled = waitingCalledArr
  438. this.called = calledArr
  439. }else if(res.channel == 'patientCallInfo'){
  440. res.data.patientInfo.create_time = moment(res.data.patientInfo.create_time * 1000).format('HH:mm')
  441. this.fisrtQueueInfo = res.data.patientInfo
  442. }else if(res.channel == 'fisrtQueueInfo'){
  443. if(this.schedule_type_selected == 1){
  444. timeType = 1
  445. }else if(this.schedule_type_selected == 2){
  446. timeType = 2
  447. }else{
  448. if(new Date().getHours() < 10){
  449. timeType = 1
  450. }else if(new Date().getHours() >= 10){
  451. timeType = 2
  452. }
  453. }
  454. let fisrtQueueInfo = []
  455. this.newFisrtQueueInfo = res.data.patientInfo
  456. if(res.data.patientInfo != null){
  457. if(timeType == 1){
  458. fisrtQueueInfo = res.data.patientInfo.morning
  459. if(fisrtQueueInfo.create_time){
  460. fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  461. }
  462. }else if(timeType == 2){
  463. fisrtQueueInfo = res.data.patientInfo.afternoon
  464. if(fisrtQueueInfo.create_time){
  465. fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  466. }
  467. }
  468. }
  469. this.fisrtQueueInfo = fisrtQueueInfo
  470. }
  471. }
  472. },
  473. call(patient_id){
  474. if(patient_id == undefined || patient_id == ""){
  475. this.$message.error('已经是最后一位了');
  476. return
  477. }
  478. console.log('patient_id',patient_id)
  479. let org_id = parseInt(sessionStorage.getItem("org_id"));
  480. let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
  481. axios.get('/api/index/callpatient?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
  482. console.log(res)
  483. // let patientArr = res.data.queue_list.data
  484. // this.patientArr = patientArr
  485. // this.$emit('child-event',this.patientArr)
  486. if(res.data.code == 200){
  487. this.$message({
  488. message: res.data.msg,
  489. type: 'success'
  490. });
  491. }
  492. })
  493. },
  494. next(patient_id){
  495. if(patient_id == undefined || patient_id == ""){
  496. this.$message.error('已经是最后一位了');
  497. return
  498. }
  499. let schedule_type = null
  500. if(this.schedule_type_selected == 0){
  501. if(new Date().getHours() < 11){
  502. schedule_type = 1
  503. }else {
  504. schedule_type = 2
  505. }
  506. }else if(this.schedule_type_selected == 1){
  507. schedule_type = 1
  508. }else if(this.schedule_type_selected == 2){
  509. schedule_type = 2
  510. }
  511. console.log('patient_id',patient_id)
  512. let org_id = parseInt(sessionStorage.getItem("org_id"));
  513. let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
  514. 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 => {
  515. console.log(res)
  516. // let patientArr = res.data.queue_list.data
  517. // this.patientArr = patientArr
  518. // this.$emit('child-event',this.patientArr)
  519. if(res.data.data.patientInfo == null){
  520. this.$message.error('已经是最后一位了');
  521. return
  522. }
  523. if(res.data.code == 200){
  524. this.$message({
  525. message: res.data.msg,
  526. type: 'success'
  527. });
  528. }
  529. })
  530. },
  531. handleCallChange: function(index) {
  532. this.callVal = index
  533. // this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
  534. this.search_keyword = this.search_input = ''
  535. this.getData()
  536. },
  537. // handletimeType: function(index) {
  538. // this.schedule_type_selected = index
  539. // this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
  540. // this.search_keyword = this.search_input = ''
  541. // // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  542. // // zone: this.zone_selected,
  543. // // schedule_type: this.schedule_type_selected,
  544. // // schedule_date: this.selected_date,
  545. // // })
  546. // },
  547. // handleZoneChange: function(index) {
  548. // this.zone_selected = index
  549. // this.$store.dispatch('SetZoneSelected', { zone_selected: index })
  550. // this.search_keyword = this.search_input = ''
  551. // // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  552. // // zone: this.zone_selected,
  553. // // schedule_type: this.schedule_type_selected,
  554. // // schedule_date: this.selected_date,
  555. // // })
  556. // },
  557. handleScheduleDateChange: function(index) {
  558. console.log("askdjlkas",index)
  559. this.zone_selected = 0
  560. this.schedule_type_selected = 0
  561. this.patientStateVal = 0
  562. this.treatStateVal = 0
  563. this.search_keyword = this.search_input = ''
  564. // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  565. // zone: this.zone_selected,
  566. // schedule_type: this.schedule_type_selected,
  567. // schedule_date: this.selected_date,
  568. // })
  569. this.selected_date = index
  570. this.$store.dispatch('SetSelectedDate', { selected_date: index })
  571. this.requestDialysisSchedules()
  572. },
  573. searchAction: function() {
  574. this.search_keyword = this.search_input
  575. this.schedule_type_selected = 0
  576. this.zone_selected = 0
  577. this.treatStateVal = 0
  578. this.patientStateVal = 0
  579. if(this.search_input != ''){
  580. this.allPatient = this.filtedSchedules
  581. }else{
  582. this.getData()
  583. }
  584. },
  585. getInitData: function() {
  586. getDialysisRecordInitData().then(rs => {
  587. var resp = rs.data
  588. if (resp.state == 1) {
  589. var zones = resp.data.zones
  590. var schedules = resp.data.schedules
  591. var zone_options = [{ id: 0, text: '全部分区' }]
  592. for (let z_i = 0; z_i < zones.length; z_i++) {
  593. const zone = zones[z_i]
  594. zone_options.push({ id: zone.id, text: zone.name })
  595. }
  596. this.zone_options = zone_options
  597. // this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  598. this.requestDialysisSchedules()
  599. console.log(1111111111111,this.zone_schedules)
  600. } else {
  601. this.$message.error(resp.msg)
  602. }
  603. })
  604. },
  605. requestDialysisSchedules: function() {
  606. var ymd = parseTime(this.selected_date, '{y}-{m}-{d}')
  607. getDialysisSchedules(ymd).then(rs => {
  608. var resp = rs.data
  609. if (resp.state == 1) {
  610. var schedules = resp.data.schedules
  611. this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  612. this.allPatient = this.filtedSchedules
  613. this.getData()
  614. } else {
  615. this.$message.error(resp.msg)
  616. }
  617. })
  618. },
  619. processedDialysisSchedules: function(schedules, zone_options) {
  620. var zoneMap = {}
  621. var scheduleMap = {}
  622. for (let z_i = 0; z_i < zone_options.length; z_i++) {
  623. const zone = zone_options[z_i]
  624. if (zone.id == 0) {
  625. continue
  626. }
  627. scheduleMap[zone.id] = []
  628. }
  629. for (let index = 0; index < schedules.length; index++) {
  630. const schedule = schedules[index]
  631. scheduleMap[schedule.device_number.zone.id].push(schedule)
  632. }
  633. var zone_schedules = []
  634. for (let index = 0; index < zone_options.length; index++) {
  635. const zone = zone_options[index]
  636. if (zone.id == 0) {
  637. continue
  638. }
  639. var schedules = scheduleMap[zone.id]
  640. zone_schedules.push({ zone_id: zone.id, zone_name: zone.text, schedules: schedules })
  641. }
  642. return zone_schedules
  643. },
  644. //
  645. handleStateChange: function(index) {
  646. this.patientStateVal = index
  647. this.$store.dispatch('SetPatientStateSelected', { patient_state_selected: index })
  648. this.search_keyword = this.search_input = ''
  649. this.getData()
  650. },
  651. handleTreatChange: function(index) {
  652. this.treatStateVal = index
  653. this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
  654. this.search_keyword = this.search_input = ''
  655. this.getData()
  656. },
  657. handletimeType: function(index) {
  658. this.schedule_type_selected = index
  659. this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
  660. this.search_keyword = this.search_input = ''
  661. this.getData()
  662. },
  663. //分区
  664. handleZoneChange: function(index) {
  665. this.zone_selected = index
  666. this.$store.dispatch('SetZoneSelected', { zone_selected: index })
  667. this.search_keyword = this.search_input = ''
  668. this.getData()
  669. },
  670. getData(){
  671. let newobj = {
  672. cmd: "queue/join",
  673. data: {type:3,page:0,size:0},
  674. };
  675. this.websocketSend(newobj)
  676. let patientArr = []
  677. patientArr = JSON.parse(JSON.stringify(this.zone_schedules))
  678. // for (let i = 0; i < patientArr.length; i++) {
  679. // for (let j = 0; j < patientArr[i].schedules.length; j++) {
  680. // if (patientArr[i].schedules.length > 0 && patientArr[i].schedules[j].dialysis_order != null) {
  681. // // 删除元素后改变i的值
  682. // console.log("候诊区",patientArr[i].schedules[j])
  683. // patientArr[i].schedules.splice(j--, 1);
  684. // }
  685. // }
  686. // }
  687. let arr1 = []
  688. if(this.patientStateVal == 0){
  689. arr1 = patientArr
  690. }else if(this.patientStateVal == 1){
  691. let arr = []
  692. arr = patientArr
  693. for (let i = 0; i <arr.length; i++) {
  694. for (let j = 0; j < arr[i].schedules.length; j++) {
  695. 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 == ''))) {
  696. // 删除元素后改变i的值
  697. arr[i].schedules.splice(j--, 1);
  698. }
  699. }
  700. }
  701. console.log("执行1",arr)
  702. arr1 = arr
  703. }else if(this.patientStateVal == 2){
  704. let arr = []
  705. arr = patientArr
  706. for (let i = 0; i < arr.length; i++) {
  707. for (let j = 0; j < arr[i].schedules.length; j++) {
  708. 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))) {
  709. // 删除元素后改变i的值
  710. console.log('几次')
  711. arr[i].schedules.splice(j--, 1);
  712. }
  713. }
  714. }
  715. console.log("执行2",arr)
  716. arr1 = arr
  717. }else if(this.patientStateVal == 3){
  718. let arr = []
  719. arr = patientArr
  720. for (let i = 0; i <arr.length; i++) {
  721. for (let j = 0; j < arr[i].schedules.length; j++) {
  722. 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))) {
  723. // 删除元素后改变i的值
  724. arr[i].schedules.splice(j--, 1);
  725. }
  726. }
  727. }
  728. console.log("执行1",arr)
  729. arr1 = arr
  730. }else if(this.patientStateVal == 4){
  731. let arr = []
  732. arr = patientArr
  733. for (let i = 0; i < arr.length; i++) {
  734. for (let j = 0; j < arr[i].schedules.length; j++) {
  735. 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))) {
  736. // 删除元素后改变i的值
  737. arr[i].schedules.splice(j--, 1);
  738. }
  739. }
  740. }
  741. console.log("执行2",arr)
  742. arr1 = arr
  743. }
  744. let arr2 = []
  745. if(this.treatStateVal == 0){
  746. arr2 = JSON.parse(JSON.stringify(arr1))
  747. }else if(this.treatStateVal == 1){
  748. let arr = []
  749. arr = JSON.parse(JSON.stringify(arr1))
  750. for (let i = 0; i < arr.length; i++) {
  751. for (let j = 0; j < arr[i].schedules.length; j++) {
  752. 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)) {
  753. // 删除元素后改变i的值
  754. arr[i].schedules.splice(j--, 1);
  755. }
  756. }
  757. }
  758. arr2 = arr
  759. }else if(this.treatStateVal == 2){
  760. let arr = []
  761. arr = JSON.parse(JSON.stringify(arr1))
  762. for (let i = 0; i < arr.length; i++) {
  763. for (let j = 0; j < arr[i].schedules.length; j++) {
  764. if (arr[i].schedules.length > 0 && arr[i].schedules[j].treatment_summary != null && arr[i].schedules[j].treatment_summary.dialysis_summary != '') {
  765. // 删除元素后改变i的值
  766. arr[i].schedules.splice(j--, 1);
  767. }
  768. }
  769. }
  770. arr2 = arr
  771. }else if(this.treatStateVal == 3){
  772. let arr = []
  773. arr = JSON.parse(JSON.stringify(arr1))
  774. for (let i = 0; i < arr.length; i++) {
  775. for (let j = 0; j < arr[i].schedules.length; j++) {
  776. if(arr[i].schedules[j].doctor_advice.length == 0){
  777. arr[i].schedules.splice(j--, 1)
  778. }
  779. if(arr[i].schedules && arr[i].schedules[j] && arr[i].schedules[j].doctor_advice){
  780. let sign = 0
  781. arr[i].schedules[j].doctor_advice.map(item => {
  782. if(item.check_state == 1){
  783. sign++
  784. }
  785. })
  786. if(sign == arr[i].schedules[j].doctor_advice.length && arr[i].schedules[j].doctor_advice.length > 0){
  787. arr[i].schedules.splice(j--, 1)
  788. }
  789. }
  790. }
  791. }
  792. arr2 = arr
  793. }
  794. let arr3 = []
  795. if(this.schedule_type_selected == 0){
  796. arr3 = JSON.parse(JSON.stringify(arr2))
  797. }else{
  798. let arr = []
  799. arr = JSON.parse(JSON.stringify(arr2))
  800. for (let i = 0; i < arr.length; i++) {
  801. for (let j = 0; j < arr[i].schedules.length; j++) {
  802. if (this.schedule_type_selected != arr[i].schedules[j].schedule_type) {
  803. // 删除元素后改变i的值
  804. arr[i].schedules.splice(j--, 1);
  805. }
  806. }
  807. }
  808. arr3 = arr
  809. }
  810. let arr4 = []
  811. if(this.zone_selected == 0){
  812. arr4 = JSON.parse(JSON.stringify(arr3))
  813. }else{
  814. let arr = []
  815. arr = JSON.parse(JSON.stringify(arr3))
  816. for (let i = 0; i < arr.length; i++) {
  817. if (this.zone_selected != arr[i].zone_id) {
  818. // 删除元素后改变i的值
  819. arr.splice(i--, 1);
  820. }
  821. }
  822. arr4 = arr
  823. }
  824. if(this.patientStateVal == 1){
  825. arr4.map((item,index) => {
  826. if(index != 0){
  827. arr4[0].schedules.push(...arr4[index].schedules)
  828. arr4[index].schedules = []
  829. }
  830. })
  831. arr4[0].schedules.map(item => {
  832. item.created_time = item.assessment_before_dislysis.created_time
  833. })
  834. arr4[0].schedules.sort(this.compare('created_time'))
  835. this.allPatient = arr4
  836. console.log("arr4",arr4)
  837. }else{
  838. this.allPatient = arr4
  839. }
  840. // let arr5 = JSON.parse(JSON.stringify(this.allPatient))
  841. // if(this.callVal == 1){
  842. // let arr = []
  843. // arr = JSON.parse(JSON.stringify(arr5))
  844. // for (let i = 0; i < arr.length; i++) {
  845. // for (let j = 0; j < arr[i].schedules.length; j++) {
  846. // // console.log(this.waitingCalled)
  847. // let a = []
  848. // this.waitingCalled.map(item => {
  849. // a.push(parseInt(item.patient_id))
  850. // })
  851. // console.log(6666666666,a)
  852. // console.log(2222,arr[i].schedules[j].patient_id)
  853. // if (a.indexOf(arr[i].schedules[j].patient_id) == -1) {
  854. // // 删除元素后改变i的值
  855. // console.log('下标值',a.indexOf(arr[i].schedules[j].patient_id))
  856. // arr[i].schedules.splice(j--, 1);
  857. // }
  858. // }
  859. // }
  860. // console.log('arr111111111111',arr)
  861. // }else if(this.callVal == 2) {
  862. // let arr = []
  863. // arr = JSON.parse(JSON.stringify(arr5))
  864. // for (let i = 0; i < arr.length; i++) {
  865. // for (let j = 0; j < arr[i].schedules.length; j++) {
  866. // // console.log(this.waitingCalled)
  867. // let a = []
  868. // this.called.map(item => {
  869. // a.push(parseInt(item.patient_id))
  870. // })
  871. // console.log(6666666666,a)
  872. // console.log(2222,arr[i].schedules[j].patient_id)
  873. // if (a.indexOf(arr[i].schedules[j].patient_id) == -1) {
  874. // // 删除元素后改变i的值
  875. // console.log('下标值',a.indexOf(arr[i].schedules[j].patient_id))
  876. // arr[i].schedules.splice(j--, 1);
  877. // }
  878. // }
  879. // }
  880. // console.log('arr222222222',arr)
  881. // }
  882. },
  883. compare(property){
  884. return function(a,b){
  885. var value1 = a[property];
  886. var value2 = b[property];
  887. return value1 - value2;
  888. }
  889. }
  890. }
  891. }
  892. </script>
  893. <style rel="stylesheet/scss" lang="scss" scoped>
  894. .app-container {
  895. // margin: 20px;
  896. font-size: 15px;
  897. .filter-container {
  898. padding-bottom: 5px;
  899. }
  900. .search-component {
  901. width: 500px;
  902. .searchBox {
  903. width: 300px;
  904. height: 36px;
  905. line-height: 36px;
  906. padding-left: 15px;
  907. border: 1px #dcdfe6 solid;
  908. border-right: none;
  909. outline: none;
  910. float: left;
  911. border-radius: 6px 0 0 6px;
  912. font-size: 14px;
  913. color: #333;
  914. background: #fff;
  915. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  916. }
  917. .searchBtn {
  918. background-color: #409eff;
  919. color: #fff;
  920. font-size: 15px;
  921. text-align: center;
  922. height: 36px;
  923. line-height: 36px;
  924. float: left;
  925. outline: none;
  926. width: 70px;
  927. border: none;
  928. border-radius: 0 6px 6px 0;
  929. font-family: "Microsoft Yahei";
  930. cursor: pointer;
  931. }
  932. }
  933. .amount {
  934. font-weight: normal;
  935. padding: 10px 0 0 0;
  936. color: #606266;
  937. font-size: 14px;
  938. span {
  939. color: #ef2525;
  940. font-family: "Arial";
  941. padding: 0 2px;
  942. }
  943. }
  944. }
  945. .PatientArea{
  946. .list{
  947. .title{
  948. font-size: 16px;
  949. color: #34495e;
  950. height:50px ;
  951. line-height: 50px;
  952. font-weight: bold;
  953. }
  954. }
  955. }
  956. .smallWidth{
  957. width:88%;
  958. }
  959. .nowCalling{
  960. height: 313px;
  961. border: 1px solid #e5e5ee;
  962. // flex: 1;
  963. width: 12%;
  964. text-align: center;
  965. .nowCallingTitle{
  966. font-size: 20px;
  967. font-weight: 600;
  968. margin-top: 20px;
  969. text-align: center;
  970. }
  971. .nowCallingName{
  972. color: #338AFB;
  973. font-size: 18px;
  974. margin-top: 10px;
  975. font-weight: 600;
  976. }
  977. .nowCallingTime{
  978. font-size: 16px;
  979. margin-top: 30px;
  980. }
  981. }
  982. </style>