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

schedualPatient.vue 38KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  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' :selected_date="selected_date" 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('res333adasda3333333',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. this.queueConfig = res.data.queueConfig
  393. if(res.data.fisrtQueueInfo != null){
  394. if(timeType == 1){
  395. fisrtQueueInfo = res.data.fisrtQueueInfo.morning
  396. if(fisrtQueueInfo.create_time){
  397. fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  398. }
  399. }else if(timeType == 2){
  400. fisrtQueueInfo = res.data.fisrtQueueInfo.afternoon
  401. if(fisrtQueueInfo.create_time){
  402. fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  403. }
  404. }
  405. }
  406. this.fisrtQueueInfo = fisrtQueueInfo
  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. this.zone_selected = 0
  559. this.schedule_type_selected = 0
  560. this.patientStateVal = 0
  561. this.treatStateVal = 0
  562. this.search_keyword = this.search_input = ''
  563. // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  564. // zone: this.zone_selected,
  565. // schedule_type: this.schedule_type_selected,
  566. // schedule_date: this.selected_date,
  567. // })
  568. this.selected_date = index
  569. this.$store.dispatch('SetSelectedDate', { selected_date: index })
  570. this.requestDialysisSchedules()
  571. },
  572. searchAction: function() {
  573. this.search_keyword = this.search_input
  574. this.schedule_type_selected = 0
  575. this.zone_selected = 0
  576. this.treatStateVal = 0
  577. this.patientStateVal = 0
  578. if(this.search_input != ''){
  579. this.allPatient = this.filtedSchedules
  580. }else{
  581. this.getData()
  582. }
  583. },
  584. getInitData: function() {
  585. getDialysisRecordInitData().then(rs => {
  586. var resp = rs.data
  587. if (resp.state == 1) {
  588. var zones = resp.data.zones
  589. var arr = []
  590. for(let i=0;i<zones.length;i++){
  591. if(zones[i].status == 1){
  592. arr.push(zones[i])
  593. }
  594. }
  595. console.log("zone2w233323232wid",zones)
  596. var schedules = resp.data.schedules
  597. var zone_options = [{ id: 0, text: '全部分区' }]
  598. for (let z_i = 0; z_i < arr.length; z_i++) {
  599. const zone = arr[z_i]
  600. zone_options.push({ id: zone.id, text: zone.name })
  601. }
  602. this.zone_options = zone_options
  603. // this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  604. this.requestDialysisSchedules()
  605. } else {
  606. this.$message.error(resp.msg)
  607. }
  608. })
  609. },
  610. requestDialysisSchedules: function() {
  611. var ymd = parseTime(this.selected_date, '{y}-{m}-{d}')
  612. getDialysisSchedules(ymd).then(rs => {
  613. var resp = rs.data
  614. if (resp.state == 1) {
  615. var schedules = resp.data.schedules
  616. console.log("透析详情页面",schedules)
  617. this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  618. this.allPatient = this.filtedSchedules
  619. this.getData()
  620. } else {
  621. this.$message.error(resp.msg)
  622. }
  623. })
  624. },
  625. processedDialysisSchedules: function(schedules, zone_options) {
  626. var zoneMap = {}
  627. var scheduleMap = {}
  628. for (let z_i = 0; z_i < zone_options.length; z_i++) {
  629. const zone = zone_options[z_i]
  630. if (zone.id == 0) {
  631. continue
  632. }
  633. scheduleMap[zone.id] = []
  634. }
  635. for (let index = 0; index < schedules.length; index++) {
  636. const schedule = schedules[index]
  637. scheduleMap[schedule.device_number.zone.id].push(schedule)
  638. }
  639. var zone_schedules = []
  640. for (let index = 0; index < zone_options.length; index++) {
  641. const zone = zone_options[index]
  642. if (zone.id == 0) {
  643. continue
  644. }
  645. var schedules = scheduleMap[zone.id]
  646. zone_schedules.push({ zone_id: zone.id, zone_name: zone.text, schedules: schedules })
  647. }
  648. return zone_schedules
  649. },
  650. //
  651. handleStateChange: function(index) {
  652. this.patientStateVal = index
  653. this.$store.dispatch('SetPatientStateSelected', { patient_state_selected: index })
  654. this.search_keyword = this.search_input = ''
  655. this.getData()
  656. },
  657. handleTreatChange: function(index) {
  658. this.treatStateVal = index
  659. this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
  660. this.search_keyword = this.search_input = ''
  661. this.getData()
  662. },
  663. handletimeType: function(index) {
  664. this.schedule_type_selected = index
  665. this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
  666. this.search_keyword = this.search_input = ''
  667. this.getData()
  668. },
  669. //分区
  670. handleZoneChange: function(index) {
  671. this.zone_selected = index
  672. this.$store.dispatch('SetZoneSelected', { zone_selected: index })
  673. this.search_keyword = this.search_input = ''
  674. this.getData()
  675. },
  676. getData(){
  677. let newobj = {
  678. cmd: "queue/join",
  679. data: {type:3,page:0,size:0},
  680. };
  681. this.websocketSend(newobj)
  682. let patientArr = []
  683. patientArr = JSON.parse(JSON.stringify(this.zone_schedules))
  684. // for (let i = 0; i < patientArr.length; i++) {
  685. // for (let j = 0; j < patientArr[i].schedules.length; j++) {
  686. // if (patientArr[i].schedules.length > 0 && patientArr[i].schedules[j].dialysis_order != null) {
  687. // // 删除元素后改变i的值
  688. // console.log("候诊区",patientArr[i].schedules[j])
  689. // patientArr[i].schedules.splice(j--, 1);
  690. // }
  691. // }
  692. // }
  693. let arr1 = []
  694. if(this.patientStateVal == 0){
  695. arr1 = patientArr
  696. }else if(this.patientStateVal == 1){
  697. let arr = []
  698. arr = patientArr
  699. for (let i = 0; i <arr.length; i++) {
  700. for (let j = 0; j < arr[i].schedules.length; j++) {
  701. 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 == ''))) {
  702. // 删除元素后改变i的值
  703. arr[i].schedules.splice(j--, 1);
  704. }
  705. }
  706. }
  707. console.log("执行1",arr)
  708. arr1 = arr
  709. }else if(this.patientStateVal == 2){
  710. let arr = []
  711. arr = patientArr
  712. for (let i = 0; i < arr.length; i++) {
  713. for (let j = 0; j < arr[i].schedules.length; j++) {
  714. 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))) {
  715. // 删除元素后改变i的值
  716. console.log('几次')
  717. arr[i].schedules.splice(j--, 1);
  718. }
  719. }
  720. }
  721. console.log("执行2",arr)
  722. arr1 = arr
  723. }else if(this.patientStateVal == 3){
  724. let arr = []
  725. arr = patientArr
  726. for (let i = 0; i <arr.length; i++) {
  727. for (let j = 0; j < arr[i].schedules.length; j++) {
  728. 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))) {
  729. // 删除元素后改变i的值
  730. arr[i].schedules.splice(j--, 1);
  731. }
  732. }
  733. }
  734. console.log("执行1",arr)
  735. arr1 = arr
  736. }else if(this.patientStateVal == 4){
  737. let arr = []
  738. arr = patientArr
  739. for (let i = 0; i < arr.length; i++) {
  740. for (let j = 0; j < arr[i].schedules.length; j++) {
  741. 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))) {
  742. // 删除元素后改变i的值
  743. arr[i].schedules.splice(j--, 1);
  744. }
  745. }
  746. }
  747. console.log("执行2",arr)
  748. arr1 = arr
  749. }
  750. let arr2 = []
  751. if(this.treatStateVal == 0){
  752. arr2 = JSON.parse(JSON.stringify(arr1))
  753. }else if(this.treatStateVal == 1){
  754. let arr = []
  755. arr = JSON.parse(JSON.stringify(arr1))
  756. for (let i = 0; i < arr.length; i++) {
  757. for (let j = 0; j < arr[i].schedules.length; j++) {
  758. 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)) {
  759. // 删除元素后改变i的值
  760. arr[i].schedules.splice(j--, 1);
  761. }
  762. }
  763. }
  764. arr2 = arr
  765. }else if(this.treatStateVal == 2){
  766. let arr = []
  767. arr = JSON.parse(JSON.stringify(arr1))
  768. for (let i = 0; i < arr.length; i++) {
  769. for (let j = 0; j < arr[i].schedules.length; j++) {
  770. if (arr[i].schedules.length > 0 && arr[i].schedules[j].treatment_summary != null && arr[i].schedules[j].treatment_summary.dialysis_summary != '') {
  771. // 删除元素后改变i的值
  772. arr[i].schedules.splice(j--, 1);
  773. }
  774. }
  775. }
  776. arr2 = arr
  777. }else if(this.treatStateVal == 3){
  778. let arr = []
  779. arr = JSON.parse(JSON.stringify(arr1))
  780. for (let i = 0; i < arr.length; i++) {
  781. for (let j = 0; j < arr[i].schedules.length; j++) {
  782. if(arr[i].schedules[j].doctor_advice.length == 0){
  783. arr[i].schedules.splice(j--, 1)
  784. }
  785. if(arr[i].schedules && arr[i].schedules[j] && arr[i].schedules[j].doctor_advice){
  786. let sign = 0
  787. arr[i].schedules[j].doctor_advice.map(item => {
  788. if(item.check_state == 1){
  789. sign++
  790. }
  791. })
  792. if(sign == arr[i].schedules[j].doctor_advice.length && arr[i].schedules[j].doctor_advice.length > 0){
  793. arr[i].schedules.splice(j--, 1)
  794. }
  795. }
  796. }
  797. }
  798. arr2 = arr
  799. }
  800. let arr3 = []
  801. if(this.schedule_type_selected == 0){
  802. arr3 = JSON.parse(JSON.stringify(arr2))
  803. }else{
  804. let arr = []
  805. arr = JSON.parse(JSON.stringify(arr2))
  806. for (let i = 0; i < arr.length; i++) {
  807. for (let j = 0; j < arr[i].schedules.length; j++) {
  808. if (this.schedule_type_selected != arr[i].schedules[j].schedule_type) {
  809. // 删除元素后改变i的值
  810. arr[i].schedules.splice(j--, 1);
  811. }
  812. }
  813. }
  814. arr3 = arr
  815. }
  816. let arr4 = []
  817. if(this.zone_selected == 0){
  818. arr4 = JSON.parse(JSON.stringify(arr3))
  819. }else{
  820. let arr = []
  821. arr = JSON.parse(JSON.stringify(arr3))
  822. for (let i = 0; i < arr.length; i++) {
  823. if (this.zone_selected != arr[i].zone_id) {
  824. // 删除元素后改变i的值
  825. arr.splice(i--, 1);
  826. }
  827. }
  828. arr4 = arr
  829. }
  830. if(this.patientStateVal == 1){
  831. arr4.map((item,index) => {
  832. if(index != 0){
  833. arr4[0].schedules.push(...arr4[index].schedules)
  834. arr4[index].schedules = []
  835. }
  836. })
  837. arr4[0].schedules.map(item => {
  838. item.created_time = item.assessment_before_dislysis.created_time
  839. })
  840. arr4[0].schedules.sort(this.compare('created_time'))
  841. this.allPatient = arr4
  842. console.log("arr4",arr4)
  843. }else{
  844. this.allPatient = arr4
  845. }
  846. // let arr5 = JSON.parse(JSON.stringify(this.allPatient))
  847. // if(this.callVal == 1){
  848. // let arr = []
  849. // arr = JSON.parse(JSON.stringify(arr5))
  850. // for (let i = 0; i < arr.length; i++) {
  851. // for (let j = 0; j < arr[i].schedules.length; j++) {
  852. // // console.log(this.waitingCalled)
  853. // let a = []
  854. // this.waitingCalled.map(item => {
  855. // a.push(parseInt(item.patient_id))
  856. // })
  857. // console.log(6666666666,a)
  858. // console.log(2222,arr[i].schedules[j].patient_id)
  859. // if (a.indexOf(arr[i].schedules[j].patient_id) == -1) {
  860. // // 删除元素后改变i的值
  861. // console.log('下标值',a.indexOf(arr[i].schedules[j].patient_id))
  862. // arr[i].schedules.splice(j--, 1);
  863. // }
  864. // }
  865. // }
  866. // console.log('arr111111111111',arr)
  867. // }else if(this.callVal == 2) {
  868. // let arr = []
  869. // arr = JSON.parse(JSON.stringify(arr5))
  870. // for (let i = 0; i < arr.length; i++) {
  871. // for (let j = 0; j < arr[i].schedules.length; j++) {
  872. // // console.log(this.waitingCalled)
  873. // let a = []
  874. // this.called.map(item => {
  875. // a.push(parseInt(item.patient_id))
  876. // })
  877. // console.log(6666666666,a)
  878. // console.log(2222,arr[i].schedules[j].patient_id)
  879. // if (a.indexOf(arr[i].schedules[j].patient_id) == -1) {
  880. // // 删除元素后改变i的值
  881. // console.log('下标值',a.indexOf(arr[i].schedules[j].patient_id))
  882. // arr[i].schedules.splice(j--, 1);
  883. // }
  884. // }
  885. // }
  886. // console.log('arr222222222',arr)
  887. // }
  888. },
  889. compare(property){
  890. return function(a,b){
  891. var value1 = a[property];
  892. var value2 = b[property];
  893. return value1 - value2;
  894. }
  895. }
  896. }
  897. }
  898. </script>
  899. <style rel="stylesheet/scss" lang="scss" scoped>
  900. .app-container {
  901. // margin: 20px;
  902. font-size: 15px;
  903. .filter-container {
  904. padding-bottom: 5px;
  905. }
  906. .search-component {
  907. width: 500px;
  908. .searchBox {
  909. width: 300px;
  910. height: 36px;
  911. line-height: 36px;
  912. padding-left: 15px;
  913. border: 1px #dcdfe6 solid;
  914. border-right: none;
  915. outline: none;
  916. float: left;
  917. border-radius: 6px 0 0 6px;
  918. font-size: 14px;
  919. color: #333;
  920. background: #fff;
  921. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  922. }
  923. .searchBtn {
  924. background-color: #409eff;
  925. color: #fff;
  926. font-size: 15px;
  927. text-align: center;
  928. height: 36px;
  929. line-height: 36px;
  930. float: left;
  931. outline: none;
  932. width: 70px;
  933. border: none;
  934. border-radius: 0 6px 6px 0;
  935. font-family: "Microsoft Yahei";
  936. cursor: pointer;
  937. }
  938. }
  939. .amount {
  940. font-weight: normal;
  941. padding: 10px 0 0 0;
  942. color: #606266;
  943. font-size: 14px;
  944. span {
  945. color: #ef2525;
  946. font-family: "Arial";
  947. padding: 0 2px;
  948. }
  949. }
  950. }
  951. .PatientArea{
  952. .list{
  953. .title{
  954. font-size: 16px;
  955. color: #34495e;
  956. height:50px ;
  957. line-height: 50px;
  958. font-weight: bold;
  959. }
  960. }
  961. }
  962. .smallWidth{
  963. width:88%;
  964. }
  965. .nowCalling{
  966. height: 313px;
  967. border: 1px solid #e5e5ee;
  968. // flex: 1;
  969. width: 12%;
  970. text-align: center;
  971. .nowCallingTitle{
  972. font-size: 20px;
  973. font-weight: 600;
  974. margin-top: 20px;
  975. text-align: center;
  976. }
  977. .nowCallingName{
  978. color: #338AFB;
  979. font-size: 18px;
  980. margin-top: 10px;
  981. font-weight: 600;
  982. }
  983. .nowCallingTime{
  984. font-size: 16px;
  985. margin-top: 30px;
  986. }
  987. }
  988. </style>