123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- <template>
- <div class="page_beforeDialysisCalling">
- <div class="cell clearfix">
- <label class="title"><span class="name">叫号状态</span> : </label>
- <div class="time ">
- <ul class="">
- <li v-for="option in patient_state" :key="option.value" @click="handleStateChange(option.value)" :class="patientStateVal == option.value ? 'active' : ''" >{{option.label}}
- </li>
- </ul>
- </div>
- </div>
- <div style="display:flex;justify-content: space-between;">
- <div class="callingArea">
- <waiting-called v-if="patientStateVal == 0" :waitingCalled='waitingCalledAm' ></waiting-called>
- <waiting-called v-if="patientStateVal == 1" :waitingCalled='waitingCalledPm' ></waiting-called>
- <called v-if="patientStateVal == 2" :called="called"></called>
- </div>
- <div class="nowCalling" v-if="patientStateVal == 0 || patientStateVal == 1">
- <p class="nowCallingTitle">当前叫号</p>
- <p class="nowCallingName">{{ fisrtQueueInfo ? fisrtQueueInfo.patient_name : '' }}</p>
- <p class="nowCallingTime">签到时间:{{ fisrtQueueInfo ? fisrtQueueInfo.create_time : '' }}</p>
- <el-button type="primary" @click="call(fisrtQueueInfo && fisrtQueueInfo.patient_id ? fisrtQueueInfo.patient_id : '')" style="margin-left:0;margin: 30px 0 20px 0;"> 叫号 </el-button>
- <!-- <el-button style="margin: 0px 0 20px 0;" @click="pass(fisrtQueueInfo.patient_id)"> 过号 </el-button> -->
- <el-button style="margin:0 auto;" @click="next(fisrtQueueInfo && fisrtQueueInfo.patient_id ? fisrtQueueInfo.patient_id : '',fisrtQueueInfo && fisrtQueueInfo.schedule_type ? fisrtQueueInfo.schedule_type : '')">下一位</el-button>
- </div>
- </div>
- </div>
- </template>
-
-
- <script>
- const moment = require('moment')
- import axios from 'axios'
- import waitingCalled from './waitingCalled'
- import called from './called'
- export default {
- components:{
- waitingCalled,
- called
- },
- data(){
- return{
- patient_state:[
- {value: 0,label: '上午待叫号'},
- {value: 1,label: '下午待叫号'},
- {value: 2,label: '已叫号'},
- ],
- patientStateVal: 0,
- waitingCalled:[],
- called:[],
- fisrtQueueInfo:{},
- timer:null,
-
- waitingCalledAm:[],
- waitingCalledPm:[],
- newFisrtQueueInfo:{}
-
- }
- },
- computed: {
- websocket() {
- return this.$store.state.user.websocket;
- },
- },
- created(){
- this.initData = {
- cmd: "queue/join",
- data: {type:3,page:0,size:0},
- };
- this.websocketSend(this.initData)
- },
- beforeMount() {
- if (this.websocket) {
- if (this.websocket.readyState == 1) {
- this.websocketMess();
- } else {
- setTimeout(() => {
- this.websocketMess();
- }, 1000);
- }
- } else {
- setTimeout(() => {
- if (this.websocket.readyState == 1) {
- this.websocketMess();
- } else {
- setTimeout(() => {
- this.websocketMess();
- }, 1000);
- }
- }, 1000);
- }
- },
- mounted(){
- // let obj = {
- // cmd: "queue/join",
- // data: {type:3,page:0,size:0},
- // };
- // this.websocketSend(obj)
- },
- beforeDestroy(){
-
- let unObj = {
- cmd: "queue/unjoin",
- data: {type:3},
- };
- this.websocketSend(unObj)
- },
- methods:{
- websocketSend(data) {
- try {
- this.websocket.send(JSON.stringify(data))
-
- } catch (error) {
- this.showError = true;
- this.showIndex = 4;
- this.errorInfo = "网络异常,请稍后退出重试!";
- }
- },
- websocketMess() {
- console.log('执行',this.websocket)
- this.websocket.onmessage = e => {
- let res = JSON.parse(e.data);
- // let res = re.data;
- console.log('res3333333333',res)
- if(res.data.type == 3){
- if(res.channel == 'queue/join'){
- let fisrtQueueInfo = []
- this.newFisrtQueueInfo = res.data.fisrtQueueInfo
- if(res.data.fisrtQueueInfo != null){
- if(this.patientStateVal == 0){
- fisrtQueueInfo = res.data.fisrtQueueInfo.morning
- if(fisrtQueueInfo.create_time){
- fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
- }
- }else if(this.patientStateVal == 1){
- fisrtQueueInfo = res.data.fisrtQueueInfo.afternoon
- if(fisrtQueueInfo.create_time){
- fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
- }
- }
- }
- this.fisrtQueueInfo = fisrtQueueInfo
- let arr = res.data.patientQueueList.data
- // let waitingCalledArr = []
- let waitingCalledAm = []
- let waitingCalledPm = []
- let calledArr = []
- arr.map(item => {
- if(item.status == 1){
- item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
- // waitingCalledArr.push(item)
- if(item.schedule_type == 1){
- waitingCalledAm.push(item)
- }else if(item.schedule_type == 2){
- waitingCalledPm.push(item)
- }
- }else if(item.status == 2){
- item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
- calledArr.push(item)
- }
- })
- console.log('waitingCalledArr待叫号',waitingCalledArr)
- console.log('waitingCalledArr以较好',calledArr)
- // this.waitingCalled = waitingCalledArr
- this.waitingCalledAm = waitingCalledArr
- this.waitingCalledPm = waitingCalledArr
- this.called = calledArr
- }else if(res.channel == 'allQueueList'){
- let arr = res.data.queue_list.data
- let waitingCalledArr = []
- let calledArr = []
- arr.map(item => {
- if(item.status == 1){
- item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
- waitingCalledArr.push(item)
- }else if(item.status == 2){
- item.create_time = moment(item.create_time * 1000).format('HH:mm:ss')
- calledArr.push(item)
- }
- })
- this.waitingCalled = waitingCalledArr
- this.called = calledArr
- }else if(res.channel == 'patientCallInfo'){
- res.data.patientInfo.create_time = moment(parseInt(res.data.patientInfo.create_time) * 1000).format('HH:mm')
- this.fisrtQueueInfo = res.data.patientInfo
- }
- }
- }
- },
- handleStateChange: function(index) {
- this.patientStateVal = index
- // if(index == 0){
- // let arr = this.waitingCalledAm
- // let newArr = []
- // arr.map(item => {
- // if(item.schedule_type == 1){
- // newArr.push(item)
- // }
- // })
- // this.waitingCalledAm = newArr
- // }else if(index == 1){
- // let arr = this.waitingCalledPm
- // let newArr = []
- // arr.map(item => {
- // if(item.schedule_type == 2){
- // newArr.push(item)
- // }
- // })
- // this.waitingCalledPm = newArr
- // }
- let fisrtQueueInfo = []
- if(this.newFisrtQueueInfo != null){
- if(this.patientStateVal == 0){
- fisrtQueueInfo = this.newFisrtQueueInfo.morning
- if(fisrtQueueInfo.create_time){
- fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
- }
- }else if(this.patientStateVal == 1){
- fisrtQueueInfo = this.newFisrtQueueInfo.afternoon
- if(fisrtQueueInfo.create_time){
- fisrtQueueInfo.create_time = moment(parseInt(fisrtQueueInfo.create_time) * 1000).format('HH:mm')
- }
- }
- }
- this.fisrtQueueInfo = fisrtQueueInfo
- },
- call(patient_id){
- if(patient_id == undefined || patient_id == ""){
- this.$message.error('已经是最后一位了');
- return
- }
- console.log('patient_id',patient_id)
- let org_id = parseInt(sessionStorage.getItem("org_id"));
- let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
- axios.get('/api/index/callpatient?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
- console.log(res)
- // let patientArr = res.data.queue_list.data
- // this.patientArr = patientArr
- // this.$emit('child-event',this.patientArr)
- if(res.data.code == 200){
- this.$message({
- message: res.data.msg,
- type: 'success'
- });
- }
- })
- },
- next(patient_id,schedule_type){
- if(patient_id == undefined || patient_id == ""){
- this.$message.error('已经是最后一位了');
- return
- }
- console.log('patient_id',patient_id)
- let org_id = parseInt(sessionStorage.getItem("org_id"));
- let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
- 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 => {
- console.log(res)
- // let patientArr = res.data.queue_list.data
- // this.patientArr = patientArr
- // this.$emit('child-event',this.patientArr)
- if(res.data.data.patientInfo == null){
- this.$message.error('已经是最后一位了');
- return
- }
- if(res.data.code == 200){
- this.$message({
- message: res.data.msg,
- type: 'success'
- });
- }
- })
- },
- pass(patient_id){
- console.log('patient_id',patient_id)
- let org_id = parseInt(sessionStorage.getItem("org_id"));
- let admin_user_id = parseInt(sessionStorage.getItem("admin_user_id"));
- axios.get('/api/index/passcall?org_id=' + org_id + '&patient_id=' + patient_id + '&admin_user_id=' + admin_user_id).then(res => {
- console.log(res)
- // let patientArr = res.data.queue_list.data
- // this.patientArr = patientArr
- // this.$emit('child-event',this.patientArr)
- if(res.data.code == 200){
- this.$message({
- message: res.data.msg,
- type: 'success'
- });
- }
- })
- },
-
- }
- }
- </script>
-
- <style lang="scss" scoped>
- .callingArea{
- display: flex;
- flex-wrap: wrap;
- width: 88%;
- // @media only screen and (max-width: 1340px) {
- // width:750px;
- // }
-
- // @media only screen and (min-width: 415px) and (max-width: 767px) {
- // }
- }
- .nowCalling{
- height: 313px;
- border: 1px solid #e5e5ee;
- // flex: 1;
- width: 12%;
- text-align: center;
- .nowCallingTitle{
- font-size: 20px;
- font-weight: 600;
- margin-top: 20px;
- text-align: center;
- }
- .nowCallingName{
- color: #338AFB;
- font-size: 18px;
- margin-top: 10px;
- font-weight: 600;
- }
- .nowCallingTime{
- font-size: 16px;
- margin-top: 30px;
- }
- }
- </style>
|