武田小程序
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.

506 lines
12 KiB

6 months ago
const app = getApp<IAppOption>();
6 months ago
Page({
data: {
6 months ago
fold: true,
show1: false,
show2: false,
show3: false,
6 months ago
showArea: false,
fieldNames: { text: "label", value: "value", children: "children" },
nav: "0",
area: [],
caseStatusList: {},
fileTypeList: {},
reasonList: {},
pagination: {
page: 1,
pages: 1,
count: 1,
},
list: [],
hostilatSearch: "",
hostipalList: [],
hospitalClassification: {},
hospitalLevel: {},
hostipalPagination: {
page: 1,
pages: 1,
count: 1,
},
deptList: [] as any,
labelList: [] as any,
caseStatusName: "全部",
hospitalName: "全部",
deptName: "全部",
6 months ago
labelName: "全部",
6 months ago
provinceName: "",
cityName: "",
countyName: "",
search: "",
caseStatus: [] as any,
hospitalId: [] as any,
submitTimeBegin: "",
submitTimeEnd: "",
feedbackTimeBegin: "",
feedbackTimeEnd: "",
deptId: [] as any,
labelId: [] as any,
provinceId: "",
cityId: "",
countyId: "",
isReject: "",
isHighQuality: "",
isOpen: "",
needDeal: "",
6 months ago
orderType: "feedbackTime",
6 months ago
myCaseCount: 0,
6 months ago
userInfo: {},
5 months ago
entryDetail: false,
},
6 months ago
onLoad() {
this.getTabBar().setData({
active: 2,
6 months ago
});
6 months ago
},
onShow() {
5 months ago
if (this.data.entryDetail) {
this.setData({
entryDetail: false,
});
return;
}
this.handleNav({ currentTarget: { dataset: { nav: app.globalData.caseNav, noSearch: true } } });
app.globalData.caseNav = "0";
5 months ago
this.setData({
needDeal: app.globalData.needDeal,
});
app.globalData.needDeal = "";
6 months ago
app.waitLogin().then(() => {
this.getBaseInfo();
this.getList();
this.getHospitalsList();
this.getHostipalDict();
this.getDoctorDict();
this.getArea();
6 months ago
app.getUserInfo(this, (userInfo) => {
this.getTabBar().setData({
userInfo,
});
});
5 months ago
this.getNotice();
});
},
getNotice() {
wx.ajax({
method: "GET",
url: "?r=takeda/doctor/todo",
data: {},
}).then((res) => {
this.getTabBar().setData({
notice: res.notReadChatRoomCount > 0,
});
6 months ago
});
},
getBaseInfo() {
wx.ajax({
method: "GET",
url: "?r=takeda/case/get-base-info",
data: {},
}).then((res) => {
this.setData({
caseStatusList: res.caseStatusList,
fileTypeList: res.fileTypeList,
reasonList: res.reasonList,
});
});
},
getArea() {
wx.ajax({
method: "GET",
url: "/js/area.json",
isJSON: true,
}).then((res) => {
this.setData({
area: res,
});
});
},
handleNav(e) {
5 months ago
const { nav, noSearch } = e.currentTarget.dataset;
6 months ago
this.setData({
nav,
isOpen: nav === "1" ? "1" : "",
isHighQuality: nav === "2" ? "1" : "",
5 months ago
isReject: "",
6 months ago
});
5 months ago
if (noSearch) return;
6 months ago
this.handleSearch();
},
getList(newPage = 1) {
wx.ajax({
method: "POST",
5 months ago
url: `?r=takeda/case/get-list&type=${Number(this.data.nav) + 1}&page=${newPage}`,
6 months ago
data: {
search: this.data.search,
caseStatus: this.data.caseStatus,
submitTimeBegin: this.data.submitTimeBegin,
submitTimeEnd: this.data.submitTimeEnd,
feedbackTimeBegin: this.data.feedbackTimeBegin,
feedbackTimeEnd: this.data.feedbackTimeEnd,
deptId: this.data.deptId,
labelId: this.data.labelId,
provinceId: this.data.provinceId,
cityId: this.data.cityId,
countyId: this.data.countyId,
hospitalId: this.data.hospitalId,
isReject: this.data.isReject,
isHighQuality: this.data.isHighQuality,
isOpen: this.data.isOpen,
needDeal: this.data.needDeal,
orderType: this.data.orderType,
},
}).then((res) => {
const list = res.page === 1 ? res.list : [...this.data.list, ...res.list];
this.setData({
6 months ago
myCaseCount: res.myCaseCount,
6 months ago
list,
pagination: {
page: res.page,
pages: res.pages,
count: res.count,
},
});
});
},
onReachBottom() {
const { page, pages } = this.data.pagination;
5 months ago
if (pages > page && this.data.list.length) {
6 months ago
this.getList(page + 1);
}
},
handleSearch() {
this.getList();
},
handleCaseShow() {
this.setData({
show1: true,
});
},
5 months ago
handleCancel(e) {
const { key } = e.currentTarget.dataset;
this.setData({
[key]: "",
});
this.handleSearch();
},
6 months ago
handleCase(e) {
const { value } = e.currentTarget.dataset;
const { caseStatus, caseStatusList } = this.data;
if (!value) {
this.setData({
caseStatus: [],
caseStatusName: "全部",
});
return;
}
if (caseStatus.includes(value)) {
this.setData({
caseStatus: caseStatus.filter((item) => item !== value),
5 months ago
caseStatusName:
caseStatus
.filter((item) => item !== value)
.map((item) => caseStatusList[item])
.join(",") || "全部",
6 months ago
});
} else {
this.setData({
caseStatus: [...caseStatus, value],
5 months ago
caseStatusName: [...caseStatus, value].map((item) => caseStatusList[item]).join(",") || "全部",
6 months ago
});
}
},
handleCaseSubmit() {
this.setData({
show1: false,
});
this.handleSearch();
},
onClose() {
5 months ago
const { show2, show3, showArea } = this.data;
6 months ago
this.setData({
show1: false,
show2: false,
show3: false,
showArea: false,
});
6 months ago
if (show2) {
this.setData({
hospitalId: "",
6 months ago
hospitalName: "全部",
6 months ago
});
this.handleSearch();
}
if (showArea) {
this.setData({
provinceId: "",
cityId: "",
countyId: "",
provinceName: "",
cityName: "",
countyName: "",
});
this.handleSearch();
}
5 months ago
if (show3) {
this.setData({
deptId: [],
labelId: [],
deptName: "全部",
labelName: "全部",
});
this.handleSearch();
}
6 months ago
},
handleImagePreview(e) {
5 months ago
const { url, parent } = e.currentTarget.dataset;
const urls = parent.map((item) => item.url);
wx.previewImage({
5 months ago
urls,
current: url,
6 months ago
});
},
6 months ago
handleDetail(e) {
const { params } = e.currentTarget.dataset;
5 months ago
this.setData({
entryDetail: true,
});
wx.navigateTo({
6 months ago
url: `/module1/pages/casesDetail/index?id=${params.caseId}`,
6 months ago
});
},
// 医院选择弹窗
handleHostipalShow() {
this.setData({
show2: true,
});
},
getHostipalDict() {
wx.ajax({
method: "GET",
url: "?r=takeda/reg/hospital-dict",
data: {},
}).then((res) => {
this.setData({
hospitalClassification: res.hospitalClassification,
hospitalLevel: res.hospitalLevel,
});
});
},
handleSearchHostipal() {
this.getHospitalsList();
},
getHospitalsList(newPage = 1) {
wx.ajax({
method: "GET",
url: "?r=takeda/reg/hospitals",
data: {
page: newPage,
Search: this.data.hostilatSearch,
},
}).then((res) => {
const hostipalList = res.page === 1 ? res.list : [...this.data.hostipalList, ...res.list];
this.setData({
hostipalList,
hostipalPagination: {
page: res.page,
pages: res.pages,
count: res.count,
},
});
});
},
handleHostipalBottom(e) {
const hostipalPagination = this.data.hostipalPagination;
if (e.detail.direction === "botttom" && hostipalPagination.page < hostipalPagination.pages) {
this.getHospitalsList(Number(hostipalPagination.page) + 1);
}
},
handleHostipal(e) {
const { params } = e.currentTarget.dataset;
this.setData({
show2: false,
hospitalId: this.data.hospitalId.includes(params.HospitalId) ? [] : [params.HospitalId],
hospitalName: this.data.hospitalId.includes(params.HospitalId) ? "全部" : params.Name,
});
6 months ago
this.handleSearch();
6 months ago
},
getDoctorDict() {
wx.ajax({
6 months ago
method: "GET",
6 months ago
url: "?r=takeda/reg/doctor-dict",
data: {},
}).then((res) => {
this.setData({
deptList: res.DoctorSpecialtyLabel,
});
});
},
handleTagShow() {
this.setData({
show3: true,
});
},
handleDept(e) {
const { params } = e.currentTarget.dataset;
const deptId = this.data.deptId;
const newDeptId: any = deptId.includes(params.value)
? deptId.filter((item) => item !== params.value)
: [...deptId, params.value];
const newDeptName = this.data.deptList
.filter((item) => newDeptId.includes(item.value))
.map((item) => item.label)
.join(",");
const labelList = this.data.deptList
.filter((item) => newDeptId.includes(item.value))
.reduce((pre, cur) => {
return [...pre, ...cur.options];
}, []);
this.setData({
deptId: newDeptId,
deptName: newDeptName || "全部",
labelList,
labelId: [],
5 months ago
labelName: "全部",
6 months ago
});
},
handleLabel(e) {
const { params } = e.currentTarget.dataset;
6 months ago
const { labelId, labelList } = this.data;
6 months ago
const newLabelId = labelId.includes(params.value)
6 months ago
? labelId.filter((item) => item !== params.value)
6 months ago
: [...labelId, params.value];
6 months ago
let labelName = "";
labelList.forEach((item) => {
if (newLabelId.includes(item.value)) {
labelName = `${labelName}${labelName ? "," : ""}${item.label}`;
}
});
6 months ago
this.setData({
6 months ago
labelId: newLabelId,
6 months ago
labelName: labelName || "全部",
6 months ago
});
},
handleTagSubmit() {
6 months ago
const { deptId, labelId } = this.data;
if (deptId.length && !labelId.length) {
wx.showToast({
title: "请选择标签",
icon: "none",
});
return;
}
6 months ago
this.setData({
show3: false,
});
this.handleSearch();
},
handleArea() {
this.setData({
showArea: true,
});
},
onFinish(e: any) {
this.setData({
5 months ago
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],
6 months ago
showArea: false,
});
this.handleSearch();
},
handleRadio(e) {
const { key } = e.currentTarget.dataset;
this.setData({
[key]: this.data[key] === "1" ? "" : "1",
});
this.handleSearch();
},
handleOrder(e) {
const { value } = e.currentTarget.dataset;
this.setData({
orderType: value,
});
this.handleSearch();
},
handleFold() {
this.setData({
fold: !this.data.fold,
});
},
handleDel(e) {
const { index } = e.currentTarget.dataset;
const params: any = this.data.list[index];
wx.showModal({
6 months ago
confirmColor: "#00B4C5",
cancelColor: "#141515",
6 months ago
title: "确认删除该病历?",
success: (e) => {
if (e.confirm) {
wx.ajax({
method: "POST",
url: "?r=takeda/case/delete-case",
data: {
caseId: params.caseId,
},
}).then(() => {
this.setData({
list: this.data.list.filter((item: any) => item.caseId !== params.caseId),
});
});
}
},
});
},
handleQuestion(e) {
const { index } = e.currentTarget.dataset;
const message = {
1: "设为公开的病历,公开病历平台所有医生均可访问",
2: "标为优质的病历,病历所在科室医生均可访问",
5 months ago
3: "属于您所在科室的所有病历",
}[index];
6 months ago
wx.showModal({
confirmColor: "#00B4C5",
showCancel: false,
confirmText: "知道了",
content: message,
});
},
6 months ago
handleCatch() {
return false;
},
6 months ago
});
export {};