|
|
|
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: [] as any,
|
|
|
|
|
|
|
|
caseId: "",
|
|
|
|
roomId: "",
|
|
|
|
create: false,
|
|
|
|
|
|
|
|
userInfo: {} as any,
|
|
|
|
},
|
|
|
|
onLoad(options) {
|
|
|
|
this.setData({
|
|
|
|
roomId: options.rid,
|
|
|
|
caseId: options.cid,
|
|
|
|
create: options.create === "1",
|
|
|
|
});
|
|
|
|
app.waitLogin().then(() => {
|
|
|
|
this.getList();
|
|
|
|
this.getDoctorDict();
|
|
|
|
this.getHostipalDict();
|
|
|
|
this.getArea();
|
|
|
|
app.getUserInfo(this);
|
|
|
|
});
|
|
|
|
},
|
|
|
|
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, DoctorId, userInfo } = this.data;
|
|
|
|
const id: any = (list as any)[index].doctorId;
|
|
|
|
if (userInfo.DoctorLevel > 3) {
|
|
|
|
this.setData({
|
|
|
|
DoctorId: DoctorId.includes(id) ? DoctorId.filter((item: any) => item !== id) : [...DoctorId, id],
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.setData({
|
|
|
|
DoctorId: DoctorId.includes(id) ? [] : [id],
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handleSubmit() {
|
|
|
|
const { caseId, roomId, DoctorId, create } = this.data;
|
|
|
|
if (DoctorId.length === 0) {
|
|
|
|
wx.showToast({
|
|
|
|
title: "请选择医生",
|
|
|
|
icon: "none",
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const url = create ? "?r=takeda/chat/create-room" : "?r=takeda/chat/invite-doctor";
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url,
|
|
|
|
data: {
|
|
|
|
caseId,
|
|
|
|
roomId,
|
|
|
|
inviteDoctorId: DoctorId,
|
|
|
|
},
|
|
|
|
}).then((res) => {
|
|
|
|
wx.reLaunch({
|
|
|
|
url: `/module1/pages/chatRoom/index?id=${res.roomId || roomId}`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleBack() {
|
|
|
|
wx.navigateBack();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export {};
|