|  |  |  | const app = getApp<IAppOption>(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Page({ | 
					
						
							|  |  |  |   data: { | 
					
						
							|  |  |  |     show1: false, // 驳回病例
 | 
					
						
							|  |  |  |     show2: false, // 优质病例
 | 
					
						
							|  |  |  |     show3: false, // 归档
 | 
					
						
							|  |  |  |     show4: false, // 取消优质病例
 | 
					
						
							|  |  |  |     show5: false, // 取消归档
 | 
					
						
							|  |  |  |     show6: false, // 创建聊天室
 | 
					
						
							|  |  |  |     show7: false, // 更改标签
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     showRejectReason: false, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     deptList: [] as any, | 
					
						
							|  |  |  |     labelList: [] as any, | 
					
						
							|  |  |  |     deptId: "", | 
					
						
							|  |  |  |     labelIds: [] as any, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     id: "", | 
					
						
							|  |  |  |     auth: {}, | 
					
						
							|  |  |  |     userInfo: {}, | 
					
						
							|  |  |  |     dealDoctorInfo: {}, | 
					
						
							|  |  |  |     dealInfo: {}, | 
					
						
							|  |  |  |     detail: { | 
					
						
							|  |  |  |       dealCaseInfo: { | 
					
						
							|  |  |  |         dealDoctorInfo: {}, | 
					
						
							|  |  |  |         dealInfo: {}, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |       createDoctorInfo: {}, | 
					
						
							|  |  |  |       caseLabels: {}, | 
					
						
							|  |  |  |       caseImages: {}, | 
					
						
							|  |  |  |       caseAudios: {}, | 
					
						
							|  |  |  |       caseFiles: {}, | 
					
						
							|  |  |  |       feedbackList: [], | 
					
						
							|  |  |  |     }, | 
					
						
							|  |  |  |     rejectReason: {}, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   onLoad(options) { | 
					
						
							|  |  |  |     this.setData({ | 
					
						
							|  |  |  |       id: options.id, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |     app.waitLogin().then(() => { | 
					
						
							|  |  |  |       this.handleResoure(); | 
					
						
							|  |  |  |       this.getDoctorDict(); | 
					
						
							|  |  |  |       app.getUserInfo(this); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   handleResoure() { | 
					
						
							|  |  |  |     this.getDetail(); | 
					
						
							|  |  |  |     this.getAuth(); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   getDetail() { | 
					
						
							|  |  |  |     wx.ajax({ | 
					
						
							|  |  |  |       method: "GET", | 
					
						
							|  |  |  |       url: "?r=takeda/case/get-case-detail", | 
					
						
							|  |  |  |       data: { | 
					
						
							|  |  |  |         caseId: this.data.id, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }).then((res) => { | 
					
						
							|  |  |  |       this.setData({ | 
					
						
							|  |  |  |         detail: res, | 
					
						
							|  |  |  |         dealDoctorInfo: res.dealCaseInfo.dealDoctorInfo, | 
					
						
							|  |  |  |         dealInfo: res.dealCaseInfo.dealInfo, | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   getAuth() { | 
					
						
							|  |  |  |     wx.ajax({ | 
					
						
							|  |  |  |       method: "GET", | 
					
						
							|  |  |  |       url: "?r=takeda/case/get-case-detail-op-auth", | 
					
						
							|  |  |  |       data: { caseId: this.data.id }, | 
					
						
							|  |  |  |     }).then((res) => { | 
					
						
							|  |  |  |       this.setData({ | 
					
						
							|  |  |  |         auth: res, | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |       if (res.canViewRejectReason) { | 
					
						
							|  |  |  |         this.getRejectReason(); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   onClose() { | 
					
						
							|  |  |  |     this.setData({ | 
					
						
							|  |  |  |       show1: false, | 
					
						
							|  |  |  |       show2: false, | 
					
						
							|  |  |  |       show3: false, | 
					
						
							|  |  |  |       show4: false, | 
					
						
							|  |  |  |       show5: false, | 
					
						
							|  |  |  |       show6: false, | 
					
						
							|  |  |  |       show7: false, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   handleImagePreview(e) { | 
					
						
							|  |  |  |     const { url } = e.currentTarget.dataset; | 
					
						
							|  |  |  |     wx.previewImage({ | 
					
						
							|  |  |  |       urls: [url], | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   getRejectReason() { | 
					
						
							|  |  |  |     wx.ajax({ | 
					
						
							|  |  |  |       method: "GET", | 
					
						
							|  |  |  |       url: "?r=takeda/case/view-reject-reason", | 
					
						
							|  |  |  |       data: { | 
					
						
							|  |  |  |         caseId: this.data.id, | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }).then((res) => { | 
					
						
							|  |  |  |       this.setData({ | 
					
						
							|  |  |  |         rejectReason: res, | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   handleShowRejectReason() { | 
					
						
							|  |  |  |     this.setData({ | 
					
						
							|  |  |  |       showRejectReason: !this.data.showRejectReason, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   handleShowLable() { | 
					
						
							|  |  |  |     this.setData({ | 
					
						
							|  |  |  |       show7: true, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   getDoctorDict() { | 
					
						
							|  |  |  |     wx.ajax({ | 
					
						
							|  |  |  |       method: "GET", | 
					
						
							|  |  |  |       url: "?r=takeda/reg/doctor-dict", | 
					
						
							|  |  |  |       data: {}, | 
					
						
							|  |  |  |     }).then((res) => { | 
					
						
							|  |  |  |       this.setData({ | 
					
						
							|  |  |  |         deptList: res.DoctorSpecialtyLabel, | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   handleDept(e) { | 
					
						
							|  |  |  |     const { params } = e.currentTarget.dataset; | 
					
						
							|  |  |  |     this.setData({ | 
					
						
							|  |  |  |       deptId: params.value, | 
					
						
							|  |  |  |       labelList: params.options, | 
					
						
							|  |  |  |       labelIds: [], | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   handleLabel(e) { | 
					
						
							|  |  |  |     const { params } = e.currentTarget.dataset; | 
					
						
							|  |  |  |     const labelIds = this.data.labelIds; | 
					
						
							|  |  |  |     const newLabelId = labelIds.includes(params.value) | 
					
						
							|  |  |  |       ? labelIds.filter((item: any) => item !== params.value) | 
					
						
							|  |  |  |       : [...labelIds, ...params.value]; | 
					
						
							|  |  |  |     this.setData({ | 
					
						
							|  |  |  |       labelIds: newLabelId, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   handleLableSubmit() { | 
					
						
							|  |  |  |     const { id, deptId, labelIds } = this.data; | 
					
						
							|  |  |  |     if (!deptId) { | 
					
						
							|  |  |  |       wx.showToast({ | 
					
						
							|  |  |  |         title: "请选择科室", | 
					
						
							|  |  |  |         icon: "none", | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if (!labelIds.length) { | 
					
						
							|  |  |  |       wx.showToast({ | 
					
						
							|  |  |  |         title: "请选择标签", | 
					
						
							|  |  |  |         icon: "none", | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |       return; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     wx.ajax({ | 
					
						
							|  |  |  |       method: "POST", | 
					
						
							|  |  |  |       url: "?r=takeda/case/save-case-label", | 
					
						
							|  |  |  |       data: { | 
					
						
							|  |  |  |         caseId: id, | 
					
						
							|  |  |  |         deptId, | 
					
						
							|  |  |  |         labelIds: JSON.stringify(labelIds), | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }).then(() => { | 
					
						
							|  |  |  |       this.setData({ | 
					
						
							|  |  |  |         show7: false, | 
					
						
							|  |  |  |       }); | 
					
						
							|  |  |  |       this.handleResoure(); | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   handleInvite() { | 
					
						
							|  |  |  |     wx.navigateTo({ | 
					
						
							|  |  |  |       url: `/module1/pages/setCaseDoctor/index`, | 
					
						
							|  |  |  |       success: (res) => { | 
					
						
							|  |  |  |         res.eventChannel.emit("acceptDataFromOpenerPage", { | 
					
						
							|  |  |  |           caseId: this.data.id, | 
					
						
							|  |  |  |           detailInvite: true, | 
					
						
							|  |  |  |         }); | 
					
						
							|  |  |  |       }, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   handleFeedBack() { | 
					
						
							|  |  |  |     wx.navigateTo({ | 
					
						
							|  |  |  |       url: `/module1/pages/casesFeedback/index?id=${this.data.id}`, | 
					
						
							|  |  |  |     }); | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  | }); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | export {}; |