Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

schedualPatient.vue 38KB

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