You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
281 lines
6.1 KiB
281 lines
6.1 KiB
const app = getApp<IAppOption>(); |
|
|
|
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: "", |
|
|
|
pagination: { |
|
page: 1, |
|
pages: 1, |
|
count: 1, |
|
}, |
|
list: [], |
|
|
|
DoctorId: "", |
|
|
|
show: false, |
|
|
|
doctorRejectCount: 0, |
|
}, |
|
onLoad(options) { |
|
if (options.hid) { |
|
this.setData({ |
|
hospitalId: options.hid, |
|
HospitalName: options.hname, |
|
}); |
|
} |
|
app.waitLogin().then(() => { |
|
app.mpBehavior({ PageName: "PG_SELECTBINDDOCTOR" }); |
|
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, |
|
}); |
|
}); |
|
}, |
|
handleSearch() { |
|
this.setData({ |
|
list: [], |
|
}); |
|
this.getList(); |
|
}, |
|
handleReset() { |
|
this.setData({ |
|
search: "", |
|
hospitalId: "", |
|
HospitalName: "", |
|
provinceId: "", |
|
cityId: "", |
|
countyId: "", |
|
ProvinceName: "", |
|
CityName: "", |
|
CountyName: "", |
|
specialtyId: "", |
|
SpecialtyName: "", |
|
}); |
|
this.handleSearch(); |
|
}, |
|
getList(newPage = 1) { |
|
const { search, hospitalId, provinceId, cityId, countyId, specialtyId } = this.data; |
|
wx.ajax({ |
|
method: "GET", |
|
url: "?r=takeda/doctor/get-can-invite-doctor-list", |
|
data: { |
|
search, |
|
hospitalId, |
|
provinceId, |
|
cityId, |
|
countyId, |
|
specialtyId, |
|
page: newPage, |
|
}, |
|
}).then((res) => { |
|
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list]; |
|
this.setData({ |
|
list, |
|
pagination: { |
|
page: res.page, |
|
pages: res.pages, |
|
count: res.count, |
|
}, |
|
}); |
|
}); |
|
}, |
|
onReachBottom() { |
|
const { page, pages } = this.data.pagination; |
|
if (pages > page) { |
|
this.getList(page + 1); |
|
} |
|
}, |
|
handlePopupDetail(e) { |
|
const { index } = e.currentTarget.dataset; |
|
const { list } = this.data; |
|
const item: any = list[index]; |
|
this.setData({ |
|
showDetail: true, |
|
popupDoctorDetail: { |
|
DoctorLevel: item.doctorLevel, |
|
DoctorImg: item.doctorImg, |
|
DoctorName: item.doctorName, |
|
DoctorTitleName: item.doctorTitleName || item.doctorOtherTitle, |
|
HospitalName: item.hospitalName, |
|
HospitalClassificationName: item.hospitalClassificationName, |
|
HospitalLevelName: item.hospitalLevelName, |
|
CityName: item.cityName, |
|
CountyName: item.countyName, |
|
Introduce: item.doctorIntroduce, |
|
department: item.doctorDept, |
|
specialty: item.doctorSpecialty, |
|
}, |
|
}); |
|
}, |
|
handlePopupClose() { |
|
this.setData({ |
|
showDetail: false, |
|
}); |
|
}, |
|
handleHostipal() { |
|
wx.navigateTo({ |
|
url: `/module1/pages/sHostipal/index`, |
|
events: { |
|
acceptDataFromOpenedPage: (data: any) => { |
|
this.setData({ |
|
hospitalId: data.hid, |
|
HospitalName: data.hname, |
|
}); |
|
this.handleSearch(); |
|
}, |
|
}, |
|
}); |
|
}, |
|
handleArea() { |
|
this.setData({ |
|
showArea: true, |
|
}); |
|
}, |
|
onClose() { |
|
this.setData({ |
|
showArea: false, |
|
showResolve: false, |
|
}); |
|
}, |
|
onFinish(e: any) { |
|
this.setData({ |
|
provinceId: e.detail.code[0], |
|
ProvinceName: e.detail.value[0], |
|
cityId: e.detail.code[1], |
|
CityName: e.detail.value[1], |
|
countyId: e.detail.code[2], |
|
CountyName: e.detail.value[2], |
|
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, |
|
doctorRejectCount: (list as any)[index].doctorRejectCount, |
|
}); |
|
}, |
|
handleSubmit({ exempt = false }) { |
|
const { DoctorId, doctorRejectCount } = this.data; |
|
app.mpBehavior({ PageName: "BTN_SELECTBINDDOCTORSEND" }); |
|
if (!DoctorId) { |
|
wx.showToast({ |
|
title: "请选择医生", |
|
icon: "none", |
|
}); |
|
return; |
|
} |
|
if (doctorRejectCount > 0 && !exempt) { |
|
this.setData({ |
|
show: true, |
|
}); |
|
return; |
|
} |
|
wx.ajax({ |
|
method: "POST", |
|
url: "?r=takeda/doctor/apply-binding", |
|
data: { |
|
inviteDoctorId: DoctorId, |
|
}, |
|
}).then((res) => { |
|
wx.redirectTo({ |
|
url: `/module1/pages/setApplicationDoctorResult/index?isf=${res.isFollow}&name=${res.InviteDoctorName}`, |
|
}); |
|
}); |
|
}, |
|
|
|
handleOk() { |
|
this.handleCancel(); |
|
this.handleSubmit({ exempt: true }); |
|
}, |
|
handleCancel() { |
|
this.setData({ |
|
show: false, |
|
}); |
|
}, |
|
handleBack() { |
|
app.mpBehavior({ PageName: "BTN_SELECTBINDDOCTORBACK" }); |
|
wx.navigateBack(); |
|
}, |
|
}); |
|
|
|
export {};
|
|
|