diff --git a/src/api/cases/index.js b/src/api/cases/index.js
index b74dd0a..0c8ae1e 100644
--- a/src/api/cases/index.js
+++ b/src/api/cases/index.js
@@ -115,11 +115,19 @@ export function postReportInfo(data) {
}
// 审核人
export function postReportViewers(data) {
- return request({ url: '/report/reviewers', method: 'post', data })
+ return request({
+ url: '/report/reviewers',
+ method: 'post',
+ data
+ })
}
// �病例库-修改
export function postReportEdit(data) {
- return request({ url: '/report/edit', method: 'post', data })
+ return request({
+ url: '/report/edit',
+ method: 'post',
+ data
+ })
}
// 修改预约时间
export function postReportTimeSectionEdit(data) {
@@ -131,45 +139,81 @@ export function postReportTimeSectionEdit(data) {
}
// 影像文件-新增
export function postReportImageCompress(data) {
- return request({ url: '/common/image/compress', method: 'post', data })
+ return request({
+ url: '/common/image/compress',
+ method: 'post',
+ data
+ })
}
// 部位模板-列表
export function postReportTplList(data) {
- return request({ url: '/report/tpl/list', method: 'post', data })
+ return request({
+ url: '/report/tpl/list',
+ method: 'post',
+ data
+ })
}
// 部位模板-新增
export function postReportTplCreate(data) {
- return request({ url: '/report/tpl/create', method: 'post', data })
+ return request({
+ url: '/report/tpl/create',
+ method: 'post',
+ data
+ })
}
// 部位模板-修改
export function postReportTplEdit(data) {
- return request({ url: '/report/tpl/edit', method: 'post', data })
+ return request({
+ url: '/report/tpl/edit',
+ method: 'post',
+ data
+ })
}
// 部位模板-删除
export function postReportTplDelete(data) {
- return request({ url: '/report/tpl/delete', method: 'post', data })
+ return request({
+ url: '/report/tpl/delete',
+ method: 'post',
+ data
+ })
}
// 部位模板-统计
export function postReportTplCount(data) {
- return request({ url: '/report/tpl/count', method: 'post', data })
+ return request({
+ url: '/report/tpl/count',
+ method: 'post',
+ data
+ })
}
// 片语-列表
export function postReportPhraseList(data) {
- return request({ url: '/report/reviewers', method: 'post', data })
-}
-// // 片语-新增
-// export function postReportPhraseCreate(data) {
-// return request({ url: '/report/create', method: 'post', data })
-// }
-// // 部位模板-修改
-// export function postReportTplEdit(data) {
-// return request({ url: '/report/tpl/edit', method: 'post', data })
-// }
-// // 部位模板-删除
-// export function postReportTplDelete(data) {
-// return request({ url: '/report/tpl/delete', method: 'post', data })
-// }
-// // 部位模板-统计
-// export function postReportTplCount(data) {
-// return request({ url: '/report/tpl/count', method: 'post', data })
-// }
\ No newline at end of file
+ return request({
+ url: '/report/reviewers',
+ method: 'post',
+ data
+ })
+}
+// 片语-新增/修改
+export function postReportPhraseEdit(data) {
+ return request({
+ url: '/report/phrase/edit',
+ method: 'post',
+ data
+ })
+}
+// 片语-删除
+export function postReportPhraseDelete(data) {
+ return request({
+ url: '/report/phrase/delete',
+ method: 'post',
+ data
+ })
+}
+// 片语-统计
+export function postReportPhraseCount(data) {
+ return request({
+ url: '/report/phrase_count',
+ method: 'post',
+ data
+ })
+}
\ No newline at end of file
diff --git a/src/views/cases/detail.vue b/src/views/cases/detail.vue
index 22f3316..8086cd1 100644
--- a/src/views/cases/detail.vue
+++ b/src/views/cases/detail.vue
@@ -63,7 +63,7 @@
type="text"
icon="el-icon-check"
@click="handleSave"
- v-if="caseStatus !== 'submitted'"
+ v-if="form.status == 1 || form.status == 5"
>
暂存
@@ -71,7 +71,7 @@
type="text"
icon="el-icon-check"
@click="handleSubmit"
- v-if="caseStatus !== 'submitted'"
+ v-if="form.status == 1 || form.status == 5"
>
提交
@@ -79,7 +79,7 @@
type="text"
icon="el-icon-print"
@click="handlePrint"
- v-if="caseStatus == 'submitted'"
+ v-if="form.status != 1 && form.status != 5"
>
打印
@@ -170,7 +170,13 @@
- {{ form.positions.map((item) => item.level2.name).join("|") }}
+ {{
+ (form.positions.length
+ ? form.positions
+ .map((item) => item.level2.name)
+ .join("|") + "|"
+ : "") + form.position_text
+ }}
@@ -270,7 +276,7 @@
阳性
@@ -290,8 +296,8 @@
新增
@@ -299,15 +305,15 @@
type="text"
icon="el-icon-delete"
@click="deleteTemplate"
- :disabled="caseStatus === 'submitted'"
+ v-if="form.status == 1 || form.status == 5"
>
删除
编辑
@@ -326,7 +332,7 @@
@@ -334,16 +340,16 @@
应用
@@ -352,7 +358,7 @@
应用
@@ -376,8 +382,8 @@
新增
@@ -388,21 +394,21 @@
:show-header="false"
height="calc(100vh - 265px)"
>
-
+
@@ -447,7 +453,7 @@
@@ -469,7 +475,7 @@
@@ -494,8 +500,6 @@
{
+ this.imgList = this.imgList.filter((i) => i.id !== row.id);
+ this.$message.success("删除成功");
+ });
+ },
// 根据路由参数获取病例数据
getReportInfo(id) {
if (id) {
@@ -625,7 +646,7 @@ export default {
getReviewers() {
postReportViewers().then((res) => {
if (res.code === 200) {
- this.form.reviewersList = res.data;
+ this.reviewersList = res.data;
}
});
},
@@ -633,18 +654,6 @@ export default {
handlePrint() {
this.printDialogVisible = true; // 打开打印预览弹窗
},
- // 病例操作
- handleSave() {
- this.$confirm("您确定暂存病例吗?").then(() => {
- this.$message.success("暂存成功");
- });
- },
- handleSubmit() {
- this.$confirm("提交后不可修改,确定提交?").then(() => {
- this.$message.success("提交成功");
- this.caseStatus = "submitted";
- });
- },
handleClose() {
this.$confirm("未保存内容将丢失,确定退出?").then(() => {
this.$router.back();
@@ -655,7 +664,7 @@ export default {
patientName: this.form.patientName,
medicalNo: this.form.medicalNo,
text_comment: this.form.text_comment,
- text_conclusion: this.form.text_conclusion,
+ conclusion: this.form.conclusion,
};
this.shareDialogVisible = true;
},
@@ -666,30 +675,26 @@ export default {
console.log("分享病例:", this.shareItem, "给:", shareTarget);
}
this.shareDialogVisible = false;
+ ss;
this.shareItem = null;
},
-
- // 图片操作
- handleOpenFile() {
- this.$refs.fileInput.click();
- },
- handleFileChange(e) {
- const files = e.target.files || [];
- for (let file of files) {
- if (!file.type.startsWith("image/")) continue;
- const url = URL.createObjectURL(file);
- this.imgList.push({ id: Date.now(), url });
+ // 部位模板列表
+ async loadTemplateList() {
+ try {
+ const response = await postReportTplList({
+ keyword: "",
+ part_ids: this.form.positions.map((item) => item.level2.id),
+ });
+ this.templateList = response.data || [];
+ if (this.templateList.length > 0) {
+ this.templateForm = { ...this.templateList[0] };
+ }
+ } catch (error) {
+ console.error("加载模板列表失败:", error);
+ this.$message.error("加载模板列表失败");
}
- e.target.value = "";
},
- handleDeleteImg(row) {
- this.$confirm("确定删除该影像?").then(() => {
- this.imgList = this.imgList.filter((i) => i.id !== row.id);
- this.$message.success("删除成功");
- });
- },
-
- // ====================== 模板核心方法 ======================
+ // 部位模板切换
changeTemplate() {
const target = this.templateList.find(
(t) => t.id === this.templateForm.id
@@ -698,103 +703,145 @@ export default {
this.templateForm = { ...target };
}
},
- openTemplateDialog(type) {
- this.templateType = type;
- this.dialogTitle = type === "add" ? "模板创建" : "模板编辑";
- if (type === "add") {
- this.newTemplateForm = {
- id: Date.now(),
- type: "abdomen-liver",
- title: "",
- text_comment: "",
- text_conclusion: "",
- };
- } else {
- this.newTemplateForm = { ...this.templateForm };
- }
+ // 部位模板-新增/编辑
+ openTemplateDialog(form) {
+ this.newTemplateForm = { ...form };
this.templateDialogVisible = true;
},
- saveTemplate() {
+ // 部位模板-保存或编辑
+ async saveTemplate() {
if (!this.newTemplateForm.title) {
this.$message.warning("请输入模板标题");
return;
}
- if (this.templateType === "add") {
- this.templateList.push({ ...this.newTemplateForm });
- this.templateForm = { ...this.newTemplateForm };
- } else {
- const index = this.templateList.findIndex(
- (t) => t.id === this.newTemplateForm.id
- );
- if (index > -1) {
- this.templateList.splice(index, 1, { ...this.newTemplateForm });
- this.templateForm = { ...this.newTemplateForm };
+ try {
+ if (this.newTemplateForm.id === null) {
+ // 新增模板
+ const response = await postReportTplCreate(this.newTemplateForm);
+ const newTemplate = response.data;
+ this.templateList.unshift(newTemplate);
+ this.templateForm = { ...newTemplate };
+ this.$message.success("创建成功");
+ } else {
+ // 编辑模板
+ await postReportTplEdit(this.newTemplateForm);
+ const index = this.templateList.findIndex(
+ (t) => t.id === this.newTemplateForm.id
+ );
+ if (index > -1) {
+ this.templateList.splice(index, 1, { ...this.newTemplateForm });
+ this.templateForm = { ...this.newTemplateForm };
+ }
+ this.$message.success("修改成功");
}
+ this.templateDialogVisible = false;
+ } catch (error) {
+ console.error("保存模板失败:", error);
+ this.$message.error("保存模板失败");
}
- this.$message.success("保存成功");
- this.templateDialogVisible = false;
},
+ // 部位模板-删除
deleteTemplate() {
if (this.templateList.length <= 1) {
this.$message.warning("至少保留一个模板");
return;
}
- this.$confirm("确定删除当前模板?").then(() => {
- const index = this.templateList.findIndex(
- (t) => t.id === this.templateForm.id
- );
- this.templateList.splice(index, 1);
- this.templateForm = { ...this.templateList[0] };
- this.$message.success("删除成功");
+ this.$confirm("确定删除当前模板?").then(async () => {
+ try {
+ await postReportTplDelete({ id: this.templateForm.id });
+ const index = this.templateList.findIndex(
+ (t) => t.id === this.templateForm.id
+ );
+ this.templateList.splice(index, 1);
+ this.templateForm = { ...this.templateList[0] };
+ this.$message.success("删除成功");
+ } catch (error) {
+ console.error("删除模板失败:", error);
+ this.$message.error("删除模板失败");
+ }
});
},
- applytext_comment() {
- this.form.text_comment = this.templateForm.text_comment;
- this.$message.success("已应用超声所见");
+ // 部位模板-超声所见
+ handleComment() {
+ postReportTplCount({ tpl_id: this.templateForm.id }).then((res) => {
+ if (res.data) {
+ this.form.text_comment += this.templateForm.comment;
+ }
+ });
},
- applytext_conclusion() {
- this.form.text_conclusion = this.templateForm.text_conclusion;
- this.$message.success("已应用检查结论");
+ // 部位模板-超声结论
+ handleCnclusion() {
+ this.form.text_conclusion += this.templateForm.conclusion;
},
-
- // ====================== ✅ 片语核心方法(新增) ======================
- // 打开片语弹窗:创建/更新
- openPhraseDialog(type, row) {
- this.phraseType = type;
- this.phraseDialogTitle = type === "add" ? "片语创建" : "片语更新";
- if (type === "add") {
- this.newPhraseForm = { id: Date.now(), content: "" };
- } else {
- this.newPhraseForm = { ...row };
+ // 片语列表
+ async loadPhraseList() {
+ try {
+ const response = await postReportPhraseList({});
+ this.phraseList = response.data || [];
+ } catch (error) {
+ console.error("加载片语列表失败:", error);
+ this.$message.error("加载片语列表失败");
}
+ },
+ // 片语-新增/修改
+ openPhraseDialog(row) {
+ this.phraseDialogTitle = row.id === null ? "片语创建" : "片语更新";
+ this.newPhraseForm = { ...row };
this.phraseDialogVisible = true;
},
// 保存片语
- savePhrase() {
- if (!this.newPhraseForm.content) {
+ async savePhrase() {
+ if (!this.newPhraseForm.phrase) {
this.$message.warning("请输入片语内容");
return;
}
- if (this.phraseType === "add") {
- this.phraseList.push({ ...this.newPhraseForm });
- } else {
- const index = this.phraseList.findIndex(
- (p) => p.id === this.newPhraseForm.id
- );
- if (index > -1) {
- this.phraseList.splice(index, 1, { ...this.newPhraseForm });
+ try {
+ if (this.phraseType === "add") {
+ // 新增片语
+ const response = await postReportPhraseEdit(this.newPhraseForm);
+ const newPhrase = response.data;
+ this.phraseList.unshift(newPhrase);
+ this.$message.success("创建成功");
+ } else {
+ // 编辑片语
+ await postReportPhraseEdit(this.newPhraseForm);
+ const index = this.phraseList.findIndex(
+ (p) => p.phrase_id === this.newPhraseForm.phrase_id
+ );
+ if (index > -1) {
+ this.phraseList.splice(index, 1, { ...this.newPhraseForm });
+ }
+ this.$message.success("更新成功");
}
+ this.phraseDialogVisible = false;
+ } catch (error) {
+ console.error("保存片语失败:", error);
+ this.$message.error("保存片语失败");
}
- this.$message.success(
- this.phraseType === "add" ? "创建成功" : "更新成功"
- );
- this.phraseDialogVisible = false;
},
// 删除片语
deletePhrase(row) {
- this.$confirm("确定删除该片语?").then(() => {
- this.phraseList = this.phraseList.filter((p) => p.id !== row.id);
- this.$message.success("删除成功");
+ this.$modal
+ .confirm("是否确认删除当前片语?")
+ .then(function () {
+ return postReportPhraseDelete({ phrase_id: row.id });
+ })
+ .then(() => {
+ this.loadPhraseList();
+ this.$modal.msgSuccess("删除成功");
+ })
+ .catch(() => {});
+ },
+
+ // 病例操作
+ handleSave() {
+ this.$confirm("您确定暂存病例吗?").then(() => {
+ this.$message.success("暂存成功");
+ });
+ },
+ handleSubmit() {
+ this.$confirm("提交后不可修改,确定提交?").then(() => {
+ this.$message.success("提交成功");
});
},
},
@@ -804,7 +851,7 @@ export default {