| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261 |
- const app = getApp();
- import yygh from "../../../../config/api/yygh/index.js";
- import regeneratorRuntime from "../../../../../utils/runtime.js";
- import common from "../../../../../utils/common.js";
- import icon from "../../../../../utils/icon.js";
- import { pagesPatientFn } from '@/utils';
- Page({
- data: {
- iconUrl:icon,
- isFocus: false, //input是否获取焦点
- searchValue: '', //搜索值
- searchList: [], //搜索结果
- deptListFir: [], //一级科室
- deptListFirIndex: -1, //当前一级科室
- deptListSec: [], //二级科室
- deptListSecIndex: -1, //当前二级科室
- pageConfig: {}, //页面配置
- serviceId:'',
- queryData: {
- HosId: '',
- ParentDeptCode: "",
- ServiceId:""
- },
- modalData: {}
- },
- onLoad: function(options) {
- this.setData({
- pageConfig: common.deepCopy(app.globalData.config.pageConfiguration.yyghDeptList_config),
- serviceId :options.serviceId || '',
- 'queryData.HosId': app.globalData.districtId || app.globalData.hosId,
- 'queryData.ServiceId': options.serviceId || '',
- })
- this.main()
- },
- onShow: function() {
- },
- async main() {
- let pageConfig = this.data.pageConfig
- //获取一级科室
- let deptListFir = [];
- let deptListSec = [];
- let queryData = this.data.queryData;
- let deptListFirResp = await yygh.queryClinicBaseDept(queryData)
- if (!common.isEmpty(deptListFirResp)) {
- deptListFir = deptListFirResp;
- if (pageConfig.showDeptSec) {
- // 如果有二级科室 默认取第一个一级科室
- queryData.ParentDeptCode = deptListFir[0].DeptCode
- let deptListSecResp = await yygh.queryClinicBaseDept(queryData)
- if (!common.isEmpty(deptListSecResp)) {
- deptListSec = deptListSecResp
- }
- }
- }
- this.setData({
- deptListFir: deptListFir,
- deptListSec: deptListSec,
- deptListFirIndex: pageConfig.showDeptSec ? 0 : -1,
- modalData: pageConfig.modalData,
- })
- //
- },
- /**
- * 科室点击
- */
- async deptClick(e) {
- let pageType = "";
- let type = e.currentTarget.dataset.type; // 当前触发方式 fir:一级科室 sec:二级科室 否者为搜索
- let pageConfig = this.data.pageConfig // 页面配置
- let item = e.currentTarget.dataset.item;
- let index = e.currentTarget.dataset.index;
- let deptListSec = this.data.deptListSec;
- let deptListFirIndex = this.data.deptListFirIndex;
- let deptListSecIndex = this.data.deptListSecIndex;
- if (type == 'fir') {
- //如果点击一级科室
- deptListFirIndex = index;
- if (pageConfig.showDeptSec) {
- //如果医院有二级科室
- deptListSec = []
- let queryData = this.data.queryData;
- queryData.ParentDeptCode = item.DeptCode
- let resp = await yygh.queryClinicBaseDept(queryData)
- if (!common.isEmpty(resp)) {
- deptListSec = resp;
- deptListSecIndex = -1;
- }
- }else{
- pageType = 'yyghDoctorList'
- }
- } else if (type == 'sec') {
- //如果点击二级科室
- deptListSecIndex = index
- pageType = 'yyghDoctorList'
- } else {
- pageType = 'yyghDoctorList'
- if (item.SearchType == '2') {
- /**如果点击医生 跳转到挂号页面*/
- pageType = "yyghClinicMsg"
- }
- }
- this.setData({
- deptListFirIndex: deptListFirIndex,
- deptListSecIndex: deptListSecIndex,
- deptListSec: deptListSec
- })
- // 判断如果不为空就是跳转
- if(common.isNotEmpty(pageType)){
- // 判断等于跳转医生列表页 且有配置特殊科室续弹窗显示内容
- if(pageType == 'yyghDoctorList' && pageConfig.deptShowMode[item.DeptCode]){
- common.showModal(pageConfig.deptShowMode[item.DeptCode],()=>{
- pagesPatientFn.handleRouter(e, pageType, this.data.serviceId)
- })
- }else{
- pagesPatientFn.handleRouter(e, pageType, this.data.serviceId)
- }
- }
- },
- /**
- * 点击搜索
- */
- async searchClick() {
- let pageConfig = this.data.pageConfig
- let searchValue = this.data.searchValue;
- if (common.isEmpty(searchValue)) {
- common.showModal('请输入搜索科室或医生')
- return
- }
- let result = []
- let queryData = {
- HosId: app.globalData.districtId || app.globalData.hosId,
- SearchLike: searchValue,
- ServiceId:this.data.serviceId,
- QueryLocal:"1",
- UseBaseInfo:true,
- ExcludeOneLv:pageConfig.showDeptSec ? 1 : 0 ,// 是否过滤一级科室,
- }
- let resp = await yygh.searchClinicDeptAndDoctor(queryData)
- if (!common.isEmpty(resp)) {
- result = resp;
- }
- this.setData({
- searchList: result
- })
- },
- // 搜索科室
- async queryDeptList(searchValue) {
- let queryData = {
- dept:{
- hospitalId: app.globalData.districtId || app.globalData.hosId,
- deptNameOrPingyinLike:searchValue,
- status:1
- },
- deptdoctor:{
- doctorServiceGh: 1,
- displaystatus: 1,
- },
- doctor:{},
- }
- let resp = await yygh.queryDeptList_V2(queryData)
- if (!common.isEmpty(resp)) {
- if(this.data.pageConfig.showDeptSec){
- resp = resp.filter(item=>item.parientId != -1)
- }
- resp = common.changeObj(resp)
- return resp
- }
- return []
- },
- // 搜索医生
- async queryDoctorList(searchValue) {
- let queryData = {
- isQueryDeptList: "1",//"是否返回医生的科室列表",
- doctor: {
- doctorNameOrPingYinLike:searchValue,//"拼音检索-模糊"
- status:1
- },
- dept: {
- hospitalId: app.globalData.districtId || app.globalData.hosId,
- status:1
- },
- deptdoctor: {
- doctorServiceGh: 1, // "是否开通挂号服务"
- displaystatus: "1"//"是否启用"
- }
- }
- let resp = await yygh.queryDoctorList_V2(queryData)
- if (!common.isEmpty(resp)) {
- let doctorList = []
- resp.map(item=>{
- item.searchType = '2'//医生数据做一个标识
- item.deptList.map(ele =>{ // 方向把当前医生所有的坐诊科室排列出来
- doctorList.push({...ele,...item})
- })
- })
- doctorList = common.changeObj(doctorList)
- return doctorList
- }
- return []
- },
- /**
- * 输入框聚焦
- */
- focusFn(e) {
- let type = e.currentTarget.dataset.type;
- this.setData({
- isFocus: type == 'focus' ? true : !this.data.isFocus,
- searchValue: type == 'focus' ? this.data.searchValue : '',
- searchList: type == 'focus' ? this.data.searchList : [],
- })
- },
- /**
- * 输入值获取
- */
- setVal(e) {
- let key = e.currentTarget.dataset.key;
- let value = e.detail.value;
- this.setData({
- [key]: value
- })
- },
- /**
- * 空函数 阻止搜索结果点击冒泡
- */
- doNothing() {
- },
- /**
- * ai导诊 历史医生点击
- */
- optionClick(e) {
- let type = e.currentTarget.dataset.type;
- if (type == 'ai') {
- //点击ai导诊
- // 跳转密影 根目录加公众号appid
- wx.navigateToMiniProgram({
- appId: this.data.pageConfig.aiMode.appId,
- // appid=: 需要自行对接配置相应医院的公众号appId
- path: this.data.pageConfig.aiMode.path
- })
- } else {
- //点击历史医生
- common.goToUrl('/pagesPatient/st1/business/yygh/yyghHistoryDoctor/yyghHistoryDoctor')
- }
- },
- // 就诊须知弹窗关闭
- modalCancel(){
- common.navigateBack(1)
- },
- modalConfirm(){
- this.setData({
- 'modalData.showModal' :false
- })
- },
- modalNoData(){
- common.navigateBack(1)
- }
- })
|