| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323 |
- const app = getApp();
- import yygh from "../../../../config/api/yygh/index.js";
- import regeneratorRuntime from "../../../../../utils/runtime.js";
- import common from "../../../../../utils/common.js";
- import { pagesPatientFn } from '@/utils';
- import apiRootUrl from "../../../../config/api.js";
- import icon from "../../../../../utils/icon.js";
- Page({
- data: {
- iconUrl:icon,
- dialogIsShow: false, //是否展示医生职称筛选
- showNoData: false, //是否展示暂无数据
- timeList: [], //预约时段列表
- timeActive: '', //当前选择的预约时间index ''为全部
- doctorList: [], //预约医生列表
- noDataTip: '暂无排班数据', //暂无数据显示字段
- showCon: false, //是否展示页面
- titleInfoList: [], //医生职称列表
- titleSelect: {}, //当前选择的医生职称
- titleClick: {}, //当前点击的医生职称
- reducibleOnly: false, //是否仅显示可约医生
- doctorInfoIsShow: false,
- doctorInfo: {}, //医生详情信息
- pageConfig: {},
- serviceId:'',
- },
- onLoad: function(options) {
- /** 如果有区分院区 会传入院区Id 直接赋值 */
- app.globalData.districtId = options.DistrictId || app.globalData.districtId
- // 当前页面配置信息
- let pageConfig = common.deepCopy(app.globalData.config.pageConfiguration.yyghDoctorList_config)
- let queryBean = options.queryBean ? JSON.parse(options.queryBean) : app.globalData.queryBean ? app.globalData.queryBean :{}
- console.log(queryBean,'queryBean')
- options.deptName && (queryBean.DeptName = options?.deptName)
- options.deptCode && (queryBean.DeptCode = options?.deptCode)
- this.setData({
- queryBean: queryBean,
- serviceId:options.serviceId || '',
- pageConfig: pageConfig,
- timeActive: (pageConfig.hasAllSchedules && options.serviceId != '009') ? '' : 0
- })
- wx.setNavigationBarTitle({
- title: this.data.queryBean.DeptName,
- })
- this.main()
- },
-
- async main() {
-
- let timeList = [];
- let titleInfoList = [];
- let queryBean = this.data.queryBean;
- //获取排班日期列表
- let queryData = {
- HosId: app.globalData.districtId || app.globalData.hosId,
- DeptCode: queryBean.DeptCode
- }
- let timeListResp = await yygh.queryClinicScheduleDate(queryData)
- timeListResp.map(item=>{
- if(item.RegDate == common.newDay())item.WeekName = '今天'
- })
- timeList = !common.isEmpty(timeListResp) ? timeListResp : timeList;
- //获取排班医生列表
- let doctorListResp = this.setterDoctorList(timeList)
- this.setData({
- timeList: timeList,
- showCon: true,
- })
- },
- /**
- * 医生筛选点击
- */
- async titleClick(e) {
- let item = e.currentTarget.dataset.item;
- //为空 点击全部
- this.setData({
- titleClick: common.isEmpty(item) ? "" : item
- })
- },
- /**
- * 医生详情点击
- */
- async doctorInfoClick(e) {
- let item = e.currentTarget.dataset.item;
- let queryData = {
- HosId: app.globalData.districtId || app.globalData.hosId,
- DeptCode: item.DeptCode || '',
- DoctorCode: item.DoctorCode || '',
- DoctorName: ''
- }
- let resp = await yygh.queryClinicBaseDoctor(queryData);
- if (!common.isEmpty(resp)) {
- this.setData({
- doctorInfoIsShow: true,
- doctorInfo: resp[0]
- })
- }
- },
- /**
- * 点击医生职称重置 确定按钮
- */
- async titleBtnClick(e) {
- let type = e.currentTarget.dataset.type;
- if (type == 'reset') {
- //点击重置
- this.setData({
- titleClick: {}
- })
- } else {
- //点击确定
- this.setData({
- titleSelect: this.data.titleClick
- })
- await this.setterDoctorList()
- this.dialogShowChange()
- }
- },
- /**
- * 点击查看全部排班
- */
- showAll(e) {
- let doctorIndex = e.currentTarget.dataset.doctorindex;
- let schedulindex = e.currentTarget.dataset.schedulindex;
- let doctorList = this.data.doctorList;
- doctorList[doctorIndex].Scheduling[schedulindex].showAllSchedu = !doctorList[doctorIndex].Scheduling[schedulindex].showAllSchedu
- this.setData({
- doctorList: doctorList
- })
- },
- /**
- * 是否仅显示可约医生
- */
- async switchChange(e) {
- let value = e.detail.value;
- this.setData({
- reducibleOnly: value
- })
- await this.setterDoctorList()
- },
- /**
- * 点击排班时间
- */
- async timeClick(e) {
- let item = e.currentTarget.dataset.item;
- let index = e.currentTarget.dataset.index;
- let showNoData = true;
- let timeActive = this.data.timeActive;
- if (!common.isEmpty(item)) {
- timeActive = index
- } else {
- // 点击全部
- timeActive = ""
- }
- this.setData({
- timeActive: timeActive
- })
- await this.setterDoctorList();
- },
- /**
- * 医生dialog显隐
- */
- dialogShowChange() {
- this.setData({
- dialogIsShow: !this.data.dialogIsShow,
- titleClick: this.data.titleSelect
- })
- },
- /**
- * 空函数
- */
- doNothing() {
- },
- /**
- * 处理医生列表返回值
- */
- async setterDoctorList(timeList) {
- let list = timeList || this.data.timeList;
- let time = typeof this.data.timeActive == 'number' ? list[this.data.timeActive].RegDate : ""
- let queryData = {
- HosId: app.globalData.districtId || app.globalData.hosId,
- ServiceId:this.data.serviceId,
- DeptCode: this.data.queryBean.DeptCode,
- DoctorCode: "",
- WorkDateStart: time || "",
- WorkDateEnd: time || "",
- TitleCode: this.data.titleSelect.DoctorTitleCode || "",
- OrderByDoc: '1',
- WaitRule : '1'
- }
- let resp = await yygh.queryClinicDoctorSchedule(queryData)
- let reducibleOnly = this.data.reducibleOnly;
- if (!common.isEmpty(resp)) {
- for (let i of resp) {
- if (i.Data_1 && !common.isEmpty(i.Data_1)){
- i.Data_1.map(item => {
- item.RegDateDiy = item.RegDate.substring(5),
- item.WeekName = item.RegDate == common.newDay()?'今天':item.WeekName
- })
- }
- /**如果医生头像没有域名 添加域名 */
- if (i.PhotoUrl && i.PhotoUrl.indexOf('http') == '-1') {
- i.PhotoUrl = apiRootUrl.ApiRootUrl + i.PhotoUrl
- }
- i.PhotoUrl = i.PhotoUrl.replace(/\\/g, '/')
- if (i.Data_1.length > 6) {
- i.Data_1_Diy = i.Data_1.slice(0, 5);
- i.showAllSchedu = false
- } else {
- i.Data_1_Diy = i.Data_1;
- i.showAllSchedu = true;
- }
- }
- }
- if (reducibleOnly && !common.isEmpty(resp)) {
- resp = resp.filter(item => item.Data_1.filter(cell => cell.IsHalt != '7' && cell.IsHalt != '2').length > 0)
- }
- resp.map(item=>{
- let obj = [{
- Check:true,
- DeptName:item.DeptName,
- DeptCode:item.DeptCode,
- DoctorName:item.DoctorName,
- DoctorCode:item.DoctorCode,
- Data_1:item.Data_1,
- Data_1_Diy:item.Data_1_Diy,
- showAllSchedu:item.showAllSchedu,
- }]
- item.Scheduling = obj
- })
- this.setData({
- doctorList: resp,
- showNoData: common.isEmpty(resp) ? true : false
- })
- },
- /**
- * 点击医生具体排班时间
- */
- async toClinic(e) {
- let item = e.currentTarget.dataset.dataitem;
- let index = e.currentTarget.dataset.index;
- // 判断(约满且无候补)或者停诊
- if ((item.IsHalt==7&& item.WaitLeaveCount <= 0) || item.IsHalt == '2') {
- return;
- }
- /**判断有卡无卡 有无就诊人 有无最后操作就诊人的路径跳转处理 */
- pagesPatientFn.handleRouter(e, 'yyghClinicMsg',this.data.serviceId, index)
- },
- /**
- * 查询其它科室排班
- */
- async queryScheduleList(e){
- let doctorIndex = e.currentTarget.dataset.index
- let doctorItem = e.currentTarget.dataset.doctoritem
- let doctorList = common.deepCopy(this.data.doctorList,[])
- let time = typeof this.data.timeActive == 'number' ? this.data.timeList[this.data.timeActive].RegDate : ""
- let querData = {
- workDateEnd: time || "",
- workDateStart: time || "",
- doctorCode: doctorItem.DoctorCode,
- deptCode:doctorItem.DeptCode ,
- hosId: app.globalData.districtId || app.globalData.hosId,
- WaitRule: '1'
- }
- let res = await yygh.queryScheduleList(querData)
- if(common.isNotEmpty(res)){
- let scheduleList = []
- res.map(async (item,index)=>{
- // 转换返回数据 小写转大写
- item.hisQueryClinicSchedules = common.changeObj(item.hisQueryClinicSchedules)
- item.hisQueryBaseDoctor = common.changeObj(item.hisQueryBaseDoctor)
- if(item.hisQueryClinicSchedules.length > 0){
- // 判断是否多数据处理 星期 时间 上下午
- if(item.hisQueryClinicSchedules.length > 0){
- item.hisQueryClinicSchedules.map(ele=>{
- ele.WeekName = ele.RegDate == common.newDay()?'今天':common.weekDay(ele.RegDate,1)
- ele.RegDateDiy = ele.RegDate.substring(5)
- ele.TimeSliceStr = ele.TimeSlice==1?'上午':ele.TimeSlice==2?'下午':'全天'
- })
- }
- // 判断如果超出6个隐藏
- if (item.hisQueryClinicSchedules.length > 6) {
- item.Data_1_Diy = item.hisQueryClinicSchedules.slice(0, 5);
- item.showAllSchedu = false
- } else {
- item.Data_1_Diy = item.hisQueryClinicSchedules;
- item.showAllSchedu = true;
- }
- scheduleList.push({
- Check:item.hisQueryBaseDoctor.DeptCode==doctorItem.DeptCode?true:false,
- DeptName:item.hisQueryBaseDoctor.DeptName,
- DeptCode:item.hisQueryBaseDoctor.DeptCode,
- DoctorName:doctorItem.DoctorName,
- DoctorCode:doctorItem.DoctorCode,
- Data_1:item.hisQueryClinicSchedules,
- Data_1_Diy:item.Data_1_Diy,
- showAllSchedu:item.showAllSchedu,
- })
- }
- })
- // 给当前查询的医生新加列表
- doctorList[doctorIndex].Scheduling = scheduleList
- }
- // 查询过的医生 不展示switch
- doctorList[doctorIndex].ShowDeptSwitch = true
- this.setData({
- doctorList:doctorList
- })
- },
- /**
- * 折叠列表
- */
- foldList(e) {
- let doctorIndex = e.currentTarget.dataset.doctorindex
- let schedulIndex = e.currentTarget.dataset.schedulindex
- let doctorList = this.data.doctorList
- doctorList[doctorIndex].Scheduling[schedulIndex].Check = !doctorList[doctorIndex].Scheduling[schedulIndex].Check
- this.setData({
- doctorList
- })
- },
- })
|