schedualPatient.vue 36KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979
  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('signIn') != null){
  275. setTimeout(() => {
  276. this.$router.replace({ path: '/signIn' })
  277. },1000)
  278. }
  279. var schedule_type_selected = this.$store.getters.schedule_type_selected
  280. var zone_selected = this.$store.getters.zone_selected
  281. var patient_state_selected = this.$store.getters.patient_state_selected
  282. var treat_state_selected = this.$store.getters.treat_state_selected
  283. var selected_date = this.$store.getters.selected_date
  284. if (schedule_type_selected) {
  285. this.schedule_type_selected = schedule_type_selected.schedule_type_selected
  286. }
  287. if (zone_selected) {
  288. this.zone_selected = zone_selected.zone_selected
  289. }
  290. if (patient_state_selected) {
  291. this.patientStateVal = patient_state_selected.patient_state_selected
  292. }
  293. if (treat_state_selected) {
  294. this.treatStateVal = treat_state_selected.treat_state_selected
  295. }
  296. if(selected_date.selected_date){
  297. this.selected_date = selected_date.selected_date
  298. }
  299. this.initData = {
  300. cmd: "queue/join",
  301. data: {type:3,page:0,size:0},
  302. };
  303. this.websocketSend(this.initData)
  304. this.getInitData()
  305. },
  306. beforeMount() {
  307. if (this.websocket) {
  308. if (this.websocket.readyState == 1) {
  309. console.log('执行1')
  310. this.websocketMess();
  311. } else {
  312. setTimeout(() => {
  313. console.log('执行2')
  314. this.websocketMess();
  315. }, 1000);
  316. }
  317. } else {
  318. setTimeout(() => {
  319. if (this.websocket) {
  320. console.log('执行3')
  321. this.websocketMess();
  322. } else {
  323. setTimeout(() => {
  324. console.log('执行4')
  325. this.websocketMess();
  326. }, 1000);
  327. }
  328. }, 1000);
  329. }
  330. },
  331. mounted() {
  332. const timer = setInterval(() => {
  333. // this.getInitData();
  334. this.requestDialysisSchedules()
  335. }, 1000 * 30)
  336. // 通过$once来监听定时器,在beforeDestroy钩子可以被清除。
  337. this.$once('hook:beforeDestroy', () => {
  338. clearInterval(timer)
  339. })
  340. let obj = {
  341. cmd: "queue/join",
  342. data: {type:3,page:0,size:0},
  343. };
  344. this.websocketSend(obj)
  345. },
  346. beforeDestroy(){
  347. let unObj = {
  348. cmd: "queue/unjoin",
  349. data: {type:3},
  350. };
  351. this.websocketSend(unObj)
  352. },
  353. methods: {
  354. websocketSend(data) {
  355. try {
  356. this.websocket.send(JSON.stringify(data))
  357. } catch (error) {
  358. this.showError = true;
  359. this.showIndex = 4;
  360. this.errorInfo = "网络异常,请稍后退出重试!";
  361. }
  362. },
  363. websocketMess() {
  364. console.log('执行',this.websocket)
  365. this.websocket.onmessage = e => {
  366. let res = JSON.parse(e.data);
  367. // let res = re.data;
  368. console.log('res3333333333',res)
  369. if(res.channel == 'queue/join'){
  370. let timeType = null
  371. if(new Date().getHours() < 11){
  372. timeType = 1
  373. }else if(new Date().getHours() >= 11){
  374. timeType = 2
  375. }
  376. let fisrtQueueInfo = []
  377. this.newFisrtQueueInfo = res.data.fisrtQueueInfo
  378. if(res.data.fisrtQueueInfo != null){
  379. if(timeType == 1){
  380. fisrtQueueInfo = res.data.fisrtQueueInfo.morning
  381. if(fisrtQueueInfo.create_time){
  382. fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  383. }
  384. }else if(timeType == 2){
  385. fisrtQueueInfo = res.data.fisrtQueueInfo.afternoon
  386. if(fisrtQueueInfo.create_time){
  387. fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  388. }
  389. }
  390. }
  391. this.fisrtQueueInfo = fisrtQueueInfo
  392. this.queueConfig = res.data.queueConfig
  393. // this.fisrtQueueInfo = res.data.fisrtQueueInfo
  394. let arr = res.data.patientQueueList.data
  395. let waitingCalledArr = []
  396. let calledArr = []
  397. arr.map(item => {
  398. if(item.status == 1){
  399. // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  400. waitingCalledArr.push(item)
  401. }else if(item.status == 2){
  402. // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  403. calledArr.push(item)
  404. }
  405. })
  406. console.log('waitingCalledArr待叫号',waitingCalledArr)
  407. console.log('waitingCalledArr以较好',calledArr)
  408. this.waitingCalled = waitingCalledArr
  409. this.called = calledArr
  410. }else if(res.channel == 'allQueueList'){
  411. let arr = res.data.queue_list.data
  412. let waitingCalledArr = []
  413. let calledArr = []
  414. arr.map(item => {
  415. if(item.status == 1){
  416. // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  417. waitingCalledArr.push(item)
  418. }else if(item.status == 2){
  419. // item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  420. calledArr.push(item)
  421. }
  422. })
  423. this.waitingCalled = waitingCalledArr
  424. this.called = calledArr
  425. }else if(res.channel == 'patientCallInfo'){
  426. res.data.patientInfo.create_time = moment(res.data.patientInfo.create_time * 1000).format('HH:mm')
  427. this.fisrtQueueInfo = res.data.patientInfo
  428. }
  429. }
  430. },
  431. call(patient_id){
  432. if(patient_id == undefined || patient_id == ""){
  433. this.$message.error('已经是最后一位了');
  434. return
  435. }
  436. console.log('patient_id',patient_id)
  437. let org_id = parseInt(sessionStorage.getItem("org_id"));
  438. let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
  439. axios.get('/api/index/callpatient?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
  440. console.log(res)
  441. // let patientArr = res.data.queue_list.data
  442. // this.patientArr = patientArr
  443. // this.$emit('child-event',this.patientArr)
  444. if(res.data.code == 200){
  445. this.$message({
  446. message: res.data.msg,
  447. type: 'success'
  448. });
  449. }
  450. })
  451. },
  452. next(patient_id){
  453. if(patient_id == undefined || patient_id == ""){
  454. this.$message.error('已经是最后一位了');
  455. return
  456. }
  457. let schedule_type = null
  458. if(this.schedule_type_selected == 0){
  459. if(new Date().getHours() < 11){
  460. schedule_type = 1
  461. }else {
  462. schedule_type = 2
  463. }
  464. }else if(this.schedule_type_selected == 1){
  465. schedule_type = 1
  466. }else if(this.schedule_type_selected == 2){
  467. schedule_type = 2
  468. }
  469. console.log('patient_id',patient_id)
  470. let org_id = parseInt(sessionStorage.getItem("org_id"));
  471. let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
  472. 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 => {
  473. console.log(res)
  474. // let patientArr = res.data.queue_list.data
  475. // this.patientArr = patientArr
  476. // this.$emit('child-event',this.patientArr)
  477. if(res.data.data.patientInfo == null){
  478. this.$message.error('已经是最后一位了');
  479. return
  480. }
  481. if(res.data.code == 200){
  482. this.$message({
  483. message: res.data.msg,
  484. type: 'success'
  485. });
  486. }
  487. })
  488. },
  489. handleCallChange: function(index) {
  490. this.callVal = index
  491. // this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
  492. this.search_keyword = this.search_input = ''
  493. this.getData()
  494. },
  495. // handletimeType: function(index) {
  496. // this.schedule_type_selected = index
  497. // this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
  498. // this.search_keyword = this.search_input = ''
  499. // // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  500. // // zone: this.zone_selected,
  501. // // schedule_type: this.schedule_type_selected,
  502. // // schedule_date: this.selected_date,
  503. // // })
  504. // },
  505. // handleZoneChange: function(index) {
  506. // this.zone_selected = index
  507. // this.$store.dispatch('SetZoneSelected', { zone_selected: index })
  508. // this.search_keyword = this.search_input = ''
  509. // // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  510. // // zone: this.zone_selected,
  511. // // schedule_type: this.schedule_type_selected,
  512. // // schedule_date: this.selected_date,
  513. // // })
  514. // },
  515. handleScheduleDateChange: function(index) {
  516. console.log("askdjlkas",index)
  517. this.zone_selected = 0
  518. this.schedule_type_selected = 0
  519. this.patientStateVal = 0
  520. this.treatStateVal = 0
  521. this.search_keyword = this.search_input = ''
  522. // this.$store.dispatch("SaveDialysisAreaSelectIndexs", {
  523. // zone: this.zone_selected,
  524. // schedule_type: this.schedule_type_selected,
  525. // schedule_date: this.selected_date,
  526. // })
  527. this.selected_date = index
  528. this.$store.dispatch('SetSelectedDate', { selected_date: index })
  529. this.requestDialysisSchedules()
  530. },
  531. searchAction: function() {
  532. this.search_keyword = this.search_input
  533. this.schedule_type_selected = 0
  534. this.zone_selected = 0
  535. this.treatStateVal = 0
  536. this.patientStateVal = 0
  537. if(this.search_input != ''){
  538. this.allPatient = this.filtedSchedules
  539. }else{
  540. this.getData()
  541. }
  542. },
  543. getInitData: function() {
  544. getDialysisRecordInitData().then(rs => {
  545. var resp = rs.data
  546. if (resp.state == 1) {
  547. var zones = resp.data.zones
  548. var schedules = resp.data.schedules
  549. var zone_options = [{ id: 0, text: '全部分区' }]
  550. for (let z_i = 0; z_i < zones.length; z_i++) {
  551. const zone = zones[z_i]
  552. zone_options.push({ id: zone.id, text: zone.name })
  553. }
  554. this.zone_options = zone_options
  555. // this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  556. this.requestDialysisSchedules()
  557. console.log(1111111111111,this.zone_schedules)
  558. } else {
  559. this.$message.error(resp.msg)
  560. }
  561. })
  562. },
  563. requestDialysisSchedules: function() {
  564. var ymd = parseTime(this.selected_date, '{y}-{m}-{d}')
  565. getDialysisSchedules(ymd).then(rs => {
  566. var resp = rs.data
  567. if (resp.state == 1) {
  568. var schedules = resp.data.schedules
  569. this.zone_schedules = this.processedDialysisSchedules(schedules, this.zone_options)
  570. this.allPatient = this.filtedSchedules
  571. this.getData()
  572. } else {
  573. this.$message.error(resp.msg)
  574. }
  575. })
  576. },
  577. processedDialysisSchedules: function(schedules, zone_options) {
  578. var zoneMap = {}
  579. var scheduleMap = {}
  580. for (let z_i = 0; z_i < zone_options.length; z_i++) {
  581. const zone = zone_options[z_i]
  582. if (zone.id == 0) {
  583. continue
  584. }
  585. scheduleMap[zone.id] = []
  586. }
  587. for (let index = 0; index < schedules.length; index++) {
  588. const schedule = schedules[index]
  589. scheduleMap[schedule.device_number.zone.id].push(schedule)
  590. }
  591. var zone_schedules = []
  592. for (let index = 0; index < zone_options.length; index++) {
  593. const zone = zone_options[index]
  594. if (zone.id == 0) {
  595. continue
  596. }
  597. var schedules = scheduleMap[zone.id]
  598. zone_schedules.push({ zone_id: zone.id, zone_name: zone.text, schedules: schedules })
  599. }
  600. return zone_schedules
  601. },
  602. //
  603. handleStateChange: function(index) {
  604. this.patientStateVal = index
  605. this.$store.dispatch('SetPatientStateSelected', { patient_state_selected: index })
  606. this.search_keyword = this.search_input = ''
  607. this.getData()
  608. },
  609. handleTreatChange: function(index) {
  610. this.treatStateVal = index
  611. this.$store.dispatch('SetTreatStateSelected', { treat_state_selected: index })
  612. this.search_keyword = this.search_input = ''
  613. this.getData()
  614. },
  615. handletimeType: function(index) {
  616. this.schedule_type_selected = index
  617. this.$store.dispatch('SetScheduleTypeSelected', { schedule_type_selected: index })
  618. this.search_keyword = this.search_input = ''
  619. this.getData()
  620. },
  621. //分区
  622. handleZoneChange: function(index) {
  623. this.zone_selected = index
  624. this.$store.dispatch('SetZoneSelected', { zone_selected: index })
  625. this.search_keyword = this.search_input = ''
  626. this.getData()
  627. },
  628. getData(){
  629. let newobj = {
  630. cmd: "queue/join",
  631. data: {type:3,page:0,size:0},
  632. };
  633. this.websocketSend(newobj)
  634. let patientArr = []
  635. patientArr = JSON.parse(JSON.stringify(this.zone_schedules))
  636. // for (let i = 0; i < patientArr.length; i++) {
  637. // for (let j = 0; j < patientArr[i].schedules.length; j++) {
  638. // if (patientArr[i].schedules.length > 0 && patientArr[i].schedules[j].dialysis_order != null) {
  639. // // 删除元素后改变i的值
  640. // console.log("候诊区",patientArr[i].schedules[j])
  641. // patientArr[i].schedules.splice(j--, 1);
  642. // }
  643. // }
  644. // }
  645. let arr1 = []
  646. if(this.patientStateVal == 0){
  647. arr1 = patientArr
  648. }else if(this.patientStateVal == 1){
  649. let arr = []
  650. arr = patientArr
  651. for (let i = 0; i <arr.length; i++) {
  652. for (let j = 0; j < arr[i].schedules.length; j++) {
  653. 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 == ''))) {
  654. // 删除元素后改变i的值
  655. arr[i].schedules.splice(j--, 1);
  656. }
  657. }
  658. }
  659. console.log("执行1",arr)
  660. arr1 = arr
  661. }else if(this.patientStateVal == 2){
  662. let arr = []
  663. arr = patientArr
  664. for (let i = 0; i < arr.length; i++) {
  665. for (let j = 0; j < arr[i].schedules.length; j++) {
  666. 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))) {
  667. // 删除元素后改变i的值
  668. console.log('几次')
  669. arr[i].schedules.splice(j--, 1);
  670. }
  671. }
  672. }
  673. console.log("执行2",arr)
  674. arr1 = arr
  675. }else if(this.patientStateVal == 3){
  676. let arr = []
  677. arr = patientArr
  678. for (let i = 0; i <arr.length; i++) {
  679. for (let j = 0; j < arr[i].schedules.length; j++) {
  680. 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))) {
  681. // 删除元素后改变i的值
  682. arr[i].schedules.splice(j--, 1);
  683. }
  684. }
  685. }
  686. console.log("执行1",arr)
  687. arr1 = arr
  688. }else if(this.patientStateVal == 4){
  689. let arr = []
  690. arr = patientArr
  691. for (let i = 0; i < arr.length; i++) {
  692. for (let j = 0; j < arr[i].schedules.length; j++) {
  693. 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))) {
  694. // 删除元素后改变i的值
  695. arr[i].schedules.splice(j--, 1);
  696. }
  697. }
  698. }
  699. console.log("执行2",arr)
  700. arr1 = arr
  701. }
  702. let arr2 = []
  703. if(this.treatStateVal == 0){
  704. arr2 = JSON.parse(JSON.stringify(arr1))
  705. }else if(this.treatStateVal == 1){
  706. let arr = []
  707. arr = JSON.parse(JSON.stringify(arr1))
  708. for (let i = 0; i < arr.length; i++) {
  709. for (let j = 0; j < arr[i].schedules.length; j++) {
  710. 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)) {
  711. // 删除元素后改变i的值
  712. arr[i].schedules.splice(j--, 1);
  713. }
  714. }
  715. }
  716. arr2 = arr
  717. }else if(this.treatStateVal == 2){
  718. let arr = []
  719. arr = JSON.parse(JSON.stringify(arr1))
  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].treatment_summary != null && arr[i].schedules[j].treatment_summary.dialysis_summary != '') {
  723. // 删除元素后改变i的值
  724. arr[i].schedules.splice(j--, 1);
  725. }
  726. }
  727. }
  728. arr2 = arr
  729. }else if(this.treatStateVal == 3){
  730. let arr = []
  731. arr = JSON.parse(JSON.stringify(arr1))
  732. for (let i = 0; i < arr.length; i++) {
  733. for (let j = 0; j < arr[i].schedules.length; j++) {
  734. if(arr[i].schedules[j].doctor_advice.length == 0){
  735. arr[i].schedules.splice(j--, 1)
  736. }
  737. if(arr[i].schedules && arr[i].schedules[j] && arr[i].schedules[j].doctor_advice){
  738. let sign = 0
  739. arr[i].schedules[j].doctor_advice.map(item => {
  740. if(item.check_state == 1){
  741. sign++
  742. }
  743. })
  744. if(sign == arr[i].schedules[j].doctor_advice.length && arr[i].schedules[j].doctor_advice.length > 0){
  745. arr[i].schedules.splice(j--, 1)
  746. }
  747. }
  748. }
  749. }
  750. arr2 = arr
  751. }
  752. let arr3 = []
  753. if(this.schedule_type_selected == 0){
  754. arr3 = JSON.parse(JSON.stringify(arr2))
  755. }else{
  756. let arr = []
  757. arr = JSON.parse(JSON.stringify(arr2))
  758. for (let i = 0; i < arr.length; i++) {
  759. for (let j = 0; j < arr[i].schedules.length; j++) {
  760. if (this.schedule_type_selected != arr[i].schedules[j].schedule_type) {
  761. // 删除元素后改变i的值
  762. arr[i].schedules.splice(j--, 1);
  763. }
  764. }
  765. }
  766. arr3 = arr
  767. }
  768. let arr4 = []
  769. if(this.zone_selected == 0){
  770. arr4 = JSON.parse(JSON.stringify(arr3))
  771. }else{
  772. let arr = []
  773. arr = JSON.parse(JSON.stringify(arr3))
  774. for (let i = 0; i < arr.length; i++) {
  775. if (this.zone_selected != arr[i].zone_id) {
  776. // 删除元素后改变i的值
  777. arr.splice(i--, 1);
  778. }
  779. }
  780. arr4 = arr
  781. }
  782. if(this.patientStateVal == 1){
  783. arr4.map((item,index) => {
  784. if(index != 0){
  785. arr4[0].schedules.push(...arr4[index].schedules)
  786. arr4[index].schedules = []
  787. }
  788. })
  789. arr4[0].schedules.map(item => {
  790. item.created_time = item.assessment_before_dislysis.created_time
  791. })
  792. arr4[0].schedules.sort(this.compare('created_time'))
  793. this.allPatient = arr4
  794. console.log("arr4",arr4)
  795. }else{
  796. this.allPatient = arr4
  797. }
  798. // let arr5 = JSON.parse(JSON.stringify(this.allPatient))
  799. // if(this.callVal == 1){
  800. // let arr = []
  801. // arr = JSON.parse(JSON.stringify(arr5))
  802. // for (let i = 0; i < arr.length; i++) {
  803. // for (let j = 0; j < arr[i].schedules.length; j++) {
  804. // // console.log(this.waitingCalled)
  805. // let a = []
  806. // this.waitingCalled.map(item => {
  807. // a.push(parseInt(item.patient_id))
  808. // })
  809. // console.log(6666666666,a)
  810. // console.log(2222,arr[i].schedules[j].patient_id)
  811. // if (a.indexOf(arr[i].schedules[j].patient_id) == -1) {
  812. // // 删除元素后改变i的值
  813. // console.log('下标值',a.indexOf(arr[i].schedules[j].patient_id))
  814. // arr[i].schedules.splice(j--, 1);
  815. // }
  816. // }
  817. // }
  818. // console.log('arr111111111111',arr)
  819. // }else if(this.callVal == 2) {
  820. // let arr = []
  821. // arr = JSON.parse(JSON.stringify(arr5))
  822. // for (let i = 0; i < arr.length; i++) {
  823. // for (let j = 0; j < arr[i].schedules.length; j++) {
  824. // // console.log(this.waitingCalled)
  825. // let a = []
  826. // this.called.map(item => {
  827. // a.push(parseInt(item.patient_id))
  828. // })
  829. // console.log(6666666666,a)
  830. // console.log(2222,arr[i].schedules[j].patient_id)
  831. // if (a.indexOf(arr[i].schedules[j].patient_id) == -1) {
  832. // // 删除元素后改变i的值
  833. // console.log('下标值',a.indexOf(arr[i].schedules[j].patient_id))
  834. // arr[i].schedules.splice(j--, 1);
  835. // }
  836. // }
  837. // }
  838. // console.log('arr222222222',arr)
  839. // }
  840. },
  841. compare(property){
  842. return function(a,b){
  843. var value1 = a[property];
  844. var value2 = b[property];
  845. return value1 - value2;
  846. }
  847. }
  848. }
  849. }
  850. </script>
  851. <style rel="stylesheet/scss" lang="scss" scoped>
  852. .app-container {
  853. // margin: 20px;
  854. font-size: 15px;
  855. .filter-container {
  856. padding-bottom: 5px;
  857. }
  858. .search-component {
  859. width: 500px;
  860. .searchBox {
  861. width: 300px;
  862. height: 36px;
  863. line-height: 36px;
  864. padding-left: 15px;
  865. border: 1px #dcdfe6 solid;
  866. border-right: none;
  867. outline: none;
  868. float: left;
  869. border-radius: 6px 0 0 6px;
  870. font-size: 14px;
  871. color: #333;
  872. background: #fff;
  873. box-shadow: 3px 3px 4px rgba(135, 135, 135, 0.05);
  874. }
  875. .searchBtn {
  876. background-color: #409eff;
  877. color: #fff;
  878. font-size: 15px;
  879. text-align: center;
  880. height: 36px;
  881. line-height: 36px;
  882. float: left;
  883. outline: none;
  884. width: 70px;
  885. border: none;
  886. border-radius: 0 6px 6px 0;
  887. font-family: "Microsoft Yahei";
  888. cursor: pointer;
  889. }
  890. }
  891. .amount {
  892. font-weight: normal;
  893. padding: 10px 0 0 0;
  894. color: #606266;
  895. font-size: 14px;
  896. span {
  897. color: #ef2525;
  898. font-family: "Arial";
  899. padding: 0 2px;
  900. }
  901. }
  902. }
  903. .PatientArea{
  904. .list{
  905. .title{
  906. font-size: 16px;
  907. color: #34495e;
  908. height:50px ;
  909. line-height: 50px;
  910. font-weight: bold;
  911. }
  912. }
  913. }
  914. .smallWidth{
  915. width:88%;
  916. }
  917. .nowCalling{
  918. height: 313px;
  919. border: 1px solid #e5e5ee;
  920. // flex: 1;
  921. width: 12%;
  922. text-align: center;
  923. .nowCallingTitle{
  924. font-size: 20px;
  925. font-weight: 600;
  926. margin-top: 20px;
  927. text-align: center;
  928. }
  929. .nowCallingName{
  930. color: #338AFB;
  931. font-size: 18px;
  932. margin-top: 10px;
  933. font-weight: 600;
  934. }
  935. .nowCallingTime{
  936. font-size: 16px;
  937. margin-top: 30px;
  938. }
  939. }
  940. </style>