const app = getApp(); Page({ data: { showDetail: false, popupDoctorDetail: {}, showResolve: false, showArea: false, fieldNames: { text: "label", value: "value", children: "children" }, area: [], id: "", DoctorTitleType: {}, hospitalClassification: {}, hospitalLevel: {}, SpecialtyList: [], Search: "", HospitalId: "", HospitalName: "", ProvinceId: "", CityId: "", CountyId: "", ProvinceName: "", CityName: "", CountyName: "", SpecialtyId: "", SpecialtyName: "", detail: {}, list: [], DoctorId: "", }, onLoad(options) { this.setData({ id: options.id, }); if (options.hid) { this.setData({ HospitalId: options.hid, HospitalName: options.hname, }); } app.waitLogin().then(() => { this.getDetail(); this.getList(); this.getDoctorDict(); this.getHostipalDict(); this.getArea(); }); }, getDoctorDict() { wx.ajax({ method: "GET", url: "?r=takeda/reg/doctor-dict", data: {}, }).then((res) => { const SpecialtyList: any = []; res.DoctorSpecialtyLabel.forEach((item: any) => { SpecialtyList.push(...item.options); }); this.setData({ DoctorTitleType: res.DoctorTitleType, SpecialtyList, }); }); }, getHostipalDict() { wx.ajax({ method: "GET", url: "?r=takeda/reg/hospital-dict", data: {}, }).then((res) => { this.setData({ hospitalClassification: res.hospitalClassification, hospitalLevel: res.hospitalLevel, }); }); }, getArea() { wx.ajax({ method: "GET", url: "/js/area.json", isJSON: true, }).then((res) => { this.setData({ area: res, }); }); }, getDetail() { wx.ajax({ method: "GET", url: "?r=takeda/doctor/audit-detail", data: { AuditId: this.data.id, }, }).then((res) => { this.setData({ detail: res, }); }); }, handleSearch() { this.setData({ list: [], }); this.getList(); }, getList() { const { Search, HospitalId, ProvinceId, CityId, CountyId, SpecialtyId } = this.data; wx.ajax({ method: "GET", url: "?r=takeda/doctor/second-doctor-list", data: { Search, HospitalId, ProvinceId, CityId, CountyId, SpecialtyId, }, }).then((res) => { this.setData({ list: res.list, }); }); }, handlePopupDetail(e) { const { index } = e.currentTarget.dataset; const { list, DoctorTitleType, hospitalClassification, hospitalLevel } = this.data; const item: any = list[index]; this.setData({ showDetail: true, popupDoctorDetail: { DoctorLevel: item.DoctorLevel, DoctorImg: item.DoctorImg, DoctorName: item.DoctorName, DoctorTitleName: item.DoctorTitleType === "99" ? item.DoctorOtherTitle : DoctorTitleType[item.DoctorTitleType], HospitalName: item.HospitalName, HospitalClassificationName: hospitalClassification[item.HospitalClassification], HospitalLevelName: hospitalLevel[item.HospitalLevel], CityName: item.CityName, CountyName: item.CountyName, Introduce: item.Introduce, department: item.department, specialty: item.specialty, }, }); }, handlePopupClose() { this.setData({ showDetail: false, }); }, handleHostipal() { const prev = encodeURIComponent(`/module1/pages/setDoctor/index?id=${this.data.id}`); wx.redirectTo({ url: `/module1/pages/sHostipal/index?prev=${prev}}`, }); }, handleArea() { this.setData({ showArea: true, }); }, onClose() { this.setData({ showArea: false, showResolve: false, }); }, onFinish(e: any) { this.setData({ ProvinceId: e.detail.selectedOptions[0].value, ProvinceName: e.detail.selectedOptions[0].label, CityId: e.detail.selectedOptions[1].value, CityName: e.detail.selectedOptions[1].label, CountyId: e.detail.selectedOptions[2].value, CountyName: e.detail.selectedOptions[2].label, showArea: false, }); this.handleSearch(); }, handleSpecialChange(e: any) { const index = e.detail.value; const { SpecialtyList } = this.data; const item: any = SpecialtyList[index]; this.setData({ SpecialtyId: item.value, SpecialtyName: item.label, }); this.handleSearch(); }, handleRadio(e) { const { index } = e.currentTarget.dataset; const { list } = this.data; this.setData({ DoctorId: (list as any)[index].DoctorId, }); }, handleResolve() { const { DoctorId } = this.data; if (!DoctorId) { wx.showToast({ title: "请选择指派医生", icon: "none", }); return; } this.setData({ showResolve: true, }); }, handleSubmit() { const { id, DoctorId } = this.data; wx.ajax({ method: "POST", url: "?r=takeda/doctor/audit-pass", data: { AuditId: id, InviteDoctorId: DoctorId }, }).then(() => { wx.navigateBack(); }); }, handleBack() { wx.navigateBack(); }, }); export {};