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.
292 lines
6.6 KiB
292 lines
6.6 KiB
6 months ago
|
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: "",
|
||
|
|
||
|
params: {},
|
||
|
|
||
|
caseId: "",
|
||
|
detailInvite: false,
|
||
|
feedBackInvite: false,
|
||
|
},
|
||
|
onLoad(options) {
|
||
|
this.setData({
|
||
|
caseId: options.cid,
|
||
|
});
|
||
|
app.waitLogin().then(() => {
|
||
|
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 { caseId, search, hospitalId, provinceId, cityId, countyId, specialtyId } = this.data;
|
||
|
wx.ajax({
|
||
|
method: "GET",
|
||
|
url: "?r=takeda/chat/get-invite-doctor-list",
|
||
|
data: {
|
||
|
caseId,
|
||
|
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, hospitalClassification } = 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: hospitalClassification[item.HospitalClassification],
|
||
|
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.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,
|
||
|
});
|
||
|
},
|
||
|
handleSubmit() {
|
||
|
const { feedBackInvite, caseId, DoctorId, params, detailInvite } = this.data;
|
||
|
if (!DoctorId) {
|
||
|
wx.showToast({
|
||
|
title: "请选择指派医生",
|
||
|
icon: "none",
|
||
|
});
|
||
|
}
|
||
|
if (feedBackInvite) {
|
||
|
wx.ajax({
|
||
|
method: "POST",
|
||
|
url: "?r=takeda/case/add-feedback",
|
||
|
data: {
|
||
|
caseId,
|
||
|
dealDoctorId: DoctorId,
|
||
|
...params,
|
||
|
},
|
||
|
}).then(() => {
|
||
|
wx.redirectTo({
|
||
|
url: `/module1/pages/casesDetail/index?id=${caseId}`,
|
||
|
});
|
||
|
});
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (detailInvite) {
|
||
|
wx.ajax({ method: "POST", url: "?r=takeda/case/invite-doctor", data: { caseId, dealDoctorId: DoctorId } }).then(
|
||
|
(res) => {
|
||
|
wx.navigateTo({
|
||
|
url: `/module1/pages/entryCasesResult/index?isf=${res.isSubscribe}&wxi=${encodeURIComponent(res.wxImg)}&cid=${res.caseId}`,
|
||
|
});
|
||
|
},
|
||
|
);
|
||
|
return;
|
||
|
}
|
||
|
const url = caseId ? "?r=takeda/case/save-case" : "?r=takeda/case/create-case";
|
||
|
wx.ajax({
|
||
|
method: "POST",
|
||
|
url,
|
||
|
data: {
|
||
|
...params,
|
||
|
caseId,
|
||
|
isSubmit: 1,
|
||
|
dealDoctorId: DoctorId,
|
||
|
},
|
||
|
}).then((res) => {
|
||
|
wx.reLaunch({
|
||
|
url: `/module1/pages/entryCasesResult/index?isf=${res.isSubscribe}&wxi=${encodeURIComponent(res.wxImg)}&cid=${res.caseId || caseId}`,
|
||
|
});
|
||
|
});
|
||
|
},
|
||
|
handleBack() {
|
||
|
wx.navigateBack();
|
||
|
},
|
||
|
});
|
||
|
|
||
|
export {};
|