|
|
|
const app = getApp<IAppOption>();
|
|
|
|
|
|
|
|
Page({
|
|
|
|
data: {
|
|
|
|
show1: false, // 驳回病历
|
|
|
|
show2: false, // 优质病历
|
|
|
|
show3: false, // 归档
|
|
|
|
show4: false, // 取消优质病历
|
|
|
|
show5: false, // 取消归档
|
|
|
|
show6: false, // 创建聊天室
|
|
|
|
show7: false, // 更改标签
|
|
|
|
|
|
|
|
showRejectReason: false,
|
|
|
|
more: false,
|
|
|
|
moreShow: false,
|
|
|
|
showMoreAuth: 0,
|
|
|
|
foldAuth: {},
|
|
|
|
|
|
|
|
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: [],
|
|
|
|
} as any,
|
|
|
|
rejectReason: {},
|
|
|
|
|
|
|
|
remark: "",
|
|
|
|
|
|
|
|
fold: false,
|
|
|
|
},
|
|
|
|
onLoad(options) {
|
|
|
|
this.setData({
|
|
|
|
id: options.id,
|
|
|
|
beforeClose1: (e: any) => {
|
|
|
|
if (e === "confirm") {
|
|
|
|
if (!this.data.remark) {
|
|
|
|
wx.showToast({
|
|
|
|
title: "请输入驳回原因",
|
|
|
|
icon: "none",
|
|
|
|
});
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
this.handleRejectSubmit();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
beforeClose2: (e: any) => {
|
|
|
|
if (e === "confirm") {
|
|
|
|
this.handleQualitySubmit();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
beforeClose3: (e: any) => {
|
|
|
|
if (e === "confirm") {
|
|
|
|
this.handleArchiveSubmit();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
beforeClose5: (e: any) => {
|
|
|
|
if (e === "confirm") {
|
|
|
|
this.handleUnArchiveSubmit();
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
onShow() {
|
|
|
|
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,
|
|
|
|
});
|
|
|
|
this.readFeedback();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
readFeedback() {
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/case/read-feedback",
|
|
|
|
data: {
|
|
|
|
caseId: this.data.id,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
getAuth() {
|
|
|
|
wx.ajax({
|
|
|
|
method: "GET",
|
|
|
|
url: "?r=takeda/case/get-case-detail-op-auth",
|
|
|
|
data: { caseId: this.data.id },
|
|
|
|
}).then((res) => {
|
|
|
|
let showMoreAuth = 0;
|
|
|
|
const moreAuth = [
|
|
|
|
"canReject",
|
|
|
|
"canViewRejectReason",
|
|
|
|
"canCreateChatRoom",
|
|
|
|
"canArchive",
|
|
|
|
"canCancelArchive",
|
|
|
|
"canEnterChatRoom",
|
|
|
|
"canSetHighQuality",
|
|
|
|
"canInvite",
|
|
|
|
"canDel",
|
|
|
|
"canEdit",
|
|
|
|
"canSetOpen",
|
|
|
|
];
|
|
|
|
|
|
|
|
const foldAuth: any = {};
|
|
|
|
|
|
|
|
moreAuth.forEach((item) => {
|
|
|
|
if (res[item]) {
|
|
|
|
showMoreAuth += 1;
|
|
|
|
if (showMoreAuth > 2) {
|
|
|
|
foldAuth[item] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
this.setData({
|
|
|
|
auth: res,
|
|
|
|
foldAuth,
|
|
|
|
showMoreAuth,
|
|
|
|
more: Boolean(Object.keys(foldAuth).length),
|
|
|
|
});
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handlePreviewFile(e) {
|
|
|
|
const { item } = e.currentTarget.dataset;
|
|
|
|
wx.downloadFile({
|
|
|
|
url: item.url,
|
|
|
|
success(res) {
|
|
|
|
wx.openDocument({
|
|
|
|
filePath: res.tempFilePath,
|
|
|
|
showMenu: true,
|
|
|
|
fail() {
|
|
|
|
wx.showToast({
|
|
|
|
title: "该文件无法预览",
|
|
|
|
icon: "none",
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleDownloadFile(e) {
|
|
|
|
const { item } = e.currentTarget.dataset;
|
|
|
|
wx.downloadFile({
|
|
|
|
url: item.url,
|
|
|
|
success(res) {
|
|
|
|
if (res.statusCode === 200) {
|
|
|
|
wx.hideLoading();
|
|
|
|
const tempFilePath = res.tempFilePath;
|
|
|
|
const FileSystemManager = wx.getFileSystemManager();
|
|
|
|
|
|
|
|
FileSystemManager.saveFile({
|
|
|
|
tempFilePath,
|
|
|
|
success() {
|
|
|
|
wx.showToast({
|
|
|
|
icon: "none",
|
|
|
|
title: "保存成功",
|
|
|
|
});
|
|
|
|
},
|
|
|
|
fail() {
|
|
|
|
wx.showToast({
|
|
|
|
title: "下载失败,请重新尝试",
|
|
|
|
icon: "none",
|
|
|
|
mask: true,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
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}`,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleToggleMore() {
|
|
|
|
this.setData({
|
|
|
|
moreShow: !this.data.moreShow,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleArchive() {
|
|
|
|
this.setData({
|
|
|
|
show3: true,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleArchiveSubmit() {
|
|
|
|
const { id } = this.data;
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/case/archive-case",
|
|
|
|
data: {
|
|
|
|
caseId: id,
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
this.handleResoure();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleUnArchive() {
|
|
|
|
this.setData({
|
|
|
|
show5: true,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleUnArchiveSubmit() {
|
|
|
|
const { id } = this.data;
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/case/cancel-archive-case",
|
|
|
|
data: {
|
|
|
|
caseId: id,
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
this.handleResoure();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleOpen() {
|
|
|
|
const { detail, id } = this.data;
|
|
|
|
const isOpen = detail.isOpen === "1";
|
|
|
|
wx.showModal({
|
|
|
|
confirmColor: "#00B4C5",
|
|
|
|
cancelColor: "#141515",
|
|
|
|
title: `确认${isOpen ? "取消公开" : "公开"}?`,
|
|
|
|
success: (res) => {
|
|
|
|
if (res.confirm) {
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/case/set-open",
|
|
|
|
data: {
|
|
|
|
caseId: id,
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
this.handleResoure();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleQuality() {
|
|
|
|
const { detail } = this.data;
|
|
|
|
const isHighQuality = detail.isHighQuality === "1";
|
|
|
|
if (isHighQuality) {
|
|
|
|
this.setData({
|
|
|
|
show4: true,
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
this.setData({
|
|
|
|
show2: true,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
handleQualitySubmit() {
|
|
|
|
const { id } = this.data;
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/case/set-high-quality",
|
|
|
|
data: {
|
|
|
|
caseId: id,
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
this.handleResoure();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleDel() {
|
|
|
|
const { id } = this.data;
|
|
|
|
wx.showModal({
|
|
|
|
confirmColor: "#00B4C5",
|
|
|
|
cancelColor: "#141515",
|
|
|
|
title: `确认删除?`,
|
|
|
|
success: (res) => {
|
|
|
|
if (res.confirm) {
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/case/delete-case",
|
|
|
|
data: {
|
|
|
|
caseId: id,
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
wx.reLaunch({
|
|
|
|
url: "/pages/cases/index",
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleEdit() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/module1/pages/entryCases/index?id=${this.data.id}`,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleDelFeedBack(e) {
|
|
|
|
const { index } = e.currentTarget.dataset;
|
|
|
|
const { detail } = this.data;
|
|
|
|
const item = detail.feedbackList[index];
|
|
|
|
wx.showModal({
|
|
|
|
confirmColor: "#00B4C5",
|
|
|
|
cancelColor: "#141515",
|
|
|
|
title: `确认删除该反馈?`,
|
|
|
|
success: (res) => {
|
|
|
|
if (res.confirm) {
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/case/delete-feedback",
|
|
|
|
data: {
|
|
|
|
feedbackId: item.feedbackId,
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
this.handleResoure();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleReject() {
|
|
|
|
this.setData({
|
|
|
|
show1: true,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleQuickRemark(e) {
|
|
|
|
const { value } = e.currentTarget.dataset;
|
|
|
|
this.setData({
|
|
|
|
remark: `${this.data.remark}${value}`,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleRejectSubmit() {
|
|
|
|
const { id, remark } = this.data;
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/case/reject-case",
|
|
|
|
data: {
|
|
|
|
caseId: id,
|
|
|
|
remark,
|
|
|
|
},
|
|
|
|
}).then(() => {
|
|
|
|
wx.reLaunch({
|
|
|
|
url: "/pages/cases/index",
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleFold() {
|
|
|
|
this.setData({
|
|
|
|
fold: !this.data.fold,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleFeedBackFold(e) {
|
|
|
|
const { index } = e.currentTarget.dataset;
|
|
|
|
const { detail } = this.data;
|
|
|
|
const feedbackList = detail.feedbackList;
|
|
|
|
feedbackList[index].fold = !feedbackList[index].fold;
|
|
|
|
this.setData({
|
|
|
|
detail: {
|
|
|
|
...detail,
|
|
|
|
feedbackList,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
handleCreateRoomShow() {
|
|
|
|
this.setData({
|
|
|
|
show6: true,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleRoom() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/module1/pages/chatRoom/index?id=${this.data.id}`,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleCreateRoomInvite() {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/module1/pages/setChatDoctor/index?cid=${this.data.id}&create=1`,
|
|
|
|
});
|
|
|
|
},
|
|
|
|
handleCreateRoom() {
|
|
|
|
wx.ajax({
|
|
|
|
method: "POST",
|
|
|
|
url: "?r=takeda/chat/create-room",
|
|
|
|
data: { caseId: this.data.id },
|
|
|
|
}).then((res) => {
|
|
|
|
wx.navigateTo({
|
|
|
|
url: `/module1/pages/chatRoom/index?id=${res.roomId}`,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export {};
|