schedualPatient.vue 38KB

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