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

beforeDialysisCalling.vue 10KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. <template>
  2. <div class="page_beforeDialysisCalling">
  3. <div class="cell clearfix">
  4. <label class="title"><span class="name">叫号状态</span> : </label>
  5. <div class="time ">
  6. <ul class="">
  7. <li v-for="option in patient_state" :key="option.value" @click="handleStateChange(option.value)" :class="patientStateVal == option.value ? 'active' : ''" >{{option.label}}
  8. </li>
  9. </ul>
  10. </div>
  11. </div>
  12. <div style="display:flex;justify-content: space-between;">
  13. <div class="callingArea">
  14. <waiting-called v-if="patientStateVal == 0" :waitingCalled='waitingCalled' ></waiting-called>
  15. <called v-if="patientStateVal == 1" :called="called"></called>
  16. </div>
  17. <div class="nowCalling" v-if="patientStateVal == 0">
  18. <p class="nowCallingTitle">当前叫号</p>
  19. <p class="nowCallingName">{{ fisrtQueueInfo ? fisrtQueueInfo.patient_name : '' }}</p>
  20. <p class="nowCallingTime">签到时间:{{ fisrtQueueInfo ? fisrtQueueInfo.create_time : '' }}</p>
  21. <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>
  22. <!-- <el-button style="margin: 0px 0 20px 0;" @click="pass(fisrtQueueInfo.patient_id)">&ensp;过号&ensp;</el-button> -->
  23. <el-button style="margin:0 auto;" @click="next(fisrtQueueInfo && fisrtQueueInfo.patient_id ? fisrtQueueInfo.patient_id : '')">下一位</el-button>
  24. </div>
  25. </div>
  26. </div>
  27. </template>
  28. <script>
  29. const moment = require('moment')
  30. import axios from 'axios'
  31. import waitingCalled from './waitingCalled'
  32. import called from './called'
  33. export default {
  34. components:{
  35. waitingCalled,
  36. called
  37. },
  38. data(){
  39. return{
  40. patient_state:[
  41. {value: 0,label: '待叫号'},
  42. {value: 1,label: '已叫号'},
  43. ],
  44. patientStateVal: 0,
  45. waitingCalled:[],
  46. called:[],
  47. fisrtQueueInfo:{},
  48. timer:null,
  49. }
  50. },
  51. computed: {
  52. websocket() {
  53. return this.$store.state.user.websocket;
  54. },
  55. },
  56. created(){
  57. this.initData = {
  58. cmd: "queue/join",
  59. data: {type:3,page:0,size:0},
  60. };
  61. this.websocketSend(this.initData)
  62. },
  63. beforeMount() {
  64. if (this.websocket) {
  65. if (this.websocket.readyState == 1) {
  66. this.websocketMess();
  67. } else {
  68. setTimeout(() => {
  69. this.websocketMess();
  70. }, 1000);
  71. }
  72. } else {
  73. setTimeout(() => {
  74. if (this.websocket.readyState == 1) {
  75. this.websocketMess();
  76. } else {
  77. setTimeout(() => {
  78. this.websocketMess();
  79. }, 1000);
  80. }
  81. }, 1000);
  82. }
  83. },
  84. mounted(){
  85. // let obj = {
  86. // cmd: "queue/join",
  87. // data: {type:3,page:0,size:0},
  88. // };
  89. // this.websocketSend(obj)
  90. },
  91. beforeDestroy(){
  92. let unObj = {
  93. cmd: "queue/unjoin",
  94. data: {type:3},
  95. };
  96. this.websocketSend(unObj)
  97. },
  98. methods:{
  99. websocketSend(data) {
  100. try {
  101. this.websocket.send(JSON.stringify(data))
  102. } catch (error) {
  103. this.showError = true;
  104. this.showIndex = 4;
  105. this.errorInfo = "网络异常,请稍后退出重试!";
  106. }
  107. },
  108. websocketMess() {
  109. console.log('执行',this.websocket)
  110. this.websocket.onmessage = e => {
  111. let res = JSON.parse(e.data);
  112. // let res = re.data;
  113. console.log('res3333333333',res)
  114. if(res.channel == 'queue/join'){
  115. if(res.data.fisrtQueueInfo != null){
  116. if(res.data.fisrtQueueInfo.create_time){
  117. res.data.fisrtQueueInfo.create_time = moment(parseInt(res.data.fisrtQueueInfo.create_time) * 1000).format('HH:mm')
  118. }
  119. }
  120. this.fisrtQueueInfo = res.data.fisrtQueueInfo
  121. let arr = res.data.patientQueueList.data
  122. let waitingCalledArr = []
  123. let calledArr = []
  124. arr.map(item => {
  125. if(item.status == 1){
  126. item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  127. waitingCalledArr.push(item)
  128. }else if(item.status == 2){
  129. item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  130. calledArr.push(item)
  131. }
  132. })
  133. console.log('waitingCalledArr待叫号',waitingCalledArr)
  134. console.log('waitingCalledArr以较好',calledArr)
  135. this.waitingCalled = waitingCalledArr
  136. this.called = calledArr
  137. }else if(res.channel == 'allQueueList'){
  138. let arr = res.data.queue_list.data
  139. let waitingCalledArr = []
  140. let calledArr = []
  141. arr.map(item => {
  142. if(item.status == 1){
  143. item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  144. waitingCalledArr.push(item)
  145. }else if(item.status == 2){
  146. item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
  147. calledArr.push(item)
  148. }
  149. })
  150. this.waitingCalled = waitingCalledArr
  151. this.called = calledArr
  152. }else if(res.channel == 'patientCallInfo'){
  153. res.data.patientInfo.create_time = moment(parseInt(res.data.patientInfo.create_time) * 1000).format('HH:mm')
  154. this.fisrtQueueInfo = res.data.patientInfo
  155. }
  156. }
  157. },
  158. handleStateChange: function(index) {
  159. this.patientStateVal = index
  160. },
  161. call(patient_id){
  162. if(patient_id == undefined || patient_id == ""){
  163. this.$message.error('已经是最后一位了');
  164. return
  165. }
  166. console.log('patient_id',patient_id)
  167. let org_id = parseInt(sessionStorage.getItem("org_id"));
  168. let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
  169. axios.get('/api/index/callpatient?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
  170. console.log(res)
  171. // let patientArr = res.data.queue_list.data
  172. // this.patientArr = patientArr
  173. // this.$emit('child-event',this.patientArr)
  174. if(res.data.code == 200){
  175. this.$message({
  176. message: res.data.msg,
  177. type: 'success'
  178. });
  179. }
  180. })
  181. },
  182. next(patient_id){
  183. if(patient_id == undefined || patient_id == ""){
  184. this.$message.error('已经是最后一位了');
  185. return
  186. }
  187. console.log('patient_id',patient_id)
  188. let org_id = parseInt(sessionStorage.getItem("org_id"));
  189. let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
  190. axios.get('/api/index/nextcall?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
  191. console.log(res)
  192. // let patientArr = res.data.queue_list.data
  193. // this.patientArr = patientArr
  194. // this.$emit('child-event',this.patientArr)
  195. if(res.data.data.patientInfo == null){
  196. this.$message.error('已经是最后一位了');
  197. return
  198. }
  199. if(res.data.code == 200){
  200. this.$message({
  201. message: res.data.msg,
  202. type: 'success'
  203. });
  204. }
  205. })
  206. },
  207. pass(patient_id){
  208. console.log('patient_id',patient_id)
  209. let org_id = parseInt(sessionStorage.getItem("org_id"));
  210. let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
  211. axios.get('/api/index/passcall?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
  212. console.log(res)
  213. // let patientArr = res.data.queue_list.data
  214. // this.patientArr = patientArr
  215. // this.$emit('child-event',this.patientArr)
  216. if(res.data.code == 200){
  217. this.$message({
  218. message: res.data.msg,
  219. type: 'success'
  220. });
  221. }
  222. })
  223. },
  224. }
  225. }
  226. </script>
  227. <style lang="scss" scoped>
  228. .callingArea{
  229. display: flex;
  230. flex-wrap: wrap;
  231. width: 88%;
  232. // @media only screen and (max-width: 1340px) {
  233. // width:750px;
  234. // }
  235. // @media only screen and (min-width: 415px) and (max-width: 767px) {
  236. // }
  237. }
  238. .nowCalling{
  239. height: 313px;
  240. border: 1px solid #e5e5ee;
  241. // flex: 1;
  242. width: 12%;
  243. text-align: center;
  244. .nowCallingTitle{
  245. font-size: 20px;
  246. font-weight: 600;
  247. margin-top: 20px;
  248. text-align: center;
  249. }
  250. .nowCallingName{
  251. color: #338AFB;
  252. font-size: 18px;
  253. margin-top: 10px;
  254. font-weight: 600;
  255. }
  256. .nowCallingTime{
  257. font-size: 16px;
  258. margin-top: 30px;
  259. }
  260. }
  261. </style>