diff --git a/apps/web-antd/src/views/doctor/doctor-reception/components/DiagnosisModal.vue b/apps/web-antd/src/views/doctor/doctor-reception/components/DiagnosisModal.vue
index 05b90c9b..a9d12b31 100644
--- a/apps/web-antd/src/views/doctor/doctor-reception/components/DiagnosisModal.vue
+++ b/apps/web-antd/src/views/doctor/doctor-reception/components/DiagnosisModal.vue
@@ -4,11 +4,15 @@ import {ref} from 'vue';
import {Page, useVbenModal} from '@vben/common-ui';
import {
- Badge,
+ PlusOutlined,
+ DeleteOutlined,
+} from '@ant-design/icons-vue';
+import {
Button,
Col,
InputSearch,
message,
+ Popconfirm,
Row,
} from 'ant-design-vue';
@@ -16,7 +20,11 @@ import {
getDiseaseList,
} from '#/views/doctor/doctor-reception/api';
import { debounce } from 'lodash-es';
-import {getDoctorMyDiseaseListApi} from "#/views/doctor/settings/api"; // 或者使用自定义防抖函数
+import {
+ getDoctorMyDiseaseListApi,
+ addDoctorMyDiseaseApi,
+ deleteDoctorMyDiseaseApi,
+} from "#/views/doctor/settings/api";
const searchKey = ref('');
const diagnosisList = ref([]);
@@ -78,6 +86,10 @@ function getDiagnosisList(searchKey = '') {
getDiseaseList(searchKey).then((res) => {
diagnosisList.value = res.map((item) => {
item.isSelect = 0;
+ // 检查是否已在常用诊断中
+ item.isInMyList = doctorMyDiseaseList.value.some(
+ (myItem) => myItem.disease.id === item.id
+ );
if (selectDiagnosisList.value) {
// 把values的字符串转为数组根据,分解
const valuesArr = selectDiagnosisList.value.split(',');
@@ -96,6 +108,7 @@ function getDiagnosisList(searchKey = '') {
const getDiagnosisListChage = debounce(async (searchText = '') => {
getDiagnosisList(searchText);
}, 300)
+
/**
* 选择诊断
* @param item
@@ -119,10 +132,48 @@ function selectDiagnosis(item) {
// 将数组转回字符串更新到响应式变量
selectDiagnosisList.value = arr.join(',');
}
+
+/**
+ * 添加到常用诊断
+ * @param item 诊断项
+ */
+async function addToMyDiagnosis(item) {
+ try {
+ await addDoctorMyDiseaseApi(item.id);
+ message.success(`已将「${item.name}」添加到常用诊断`);
+ // 刷新常用诊断列表
+ await getDoctorMyDiseaseList();
+ // 更新搜索结果中的状态
+ item.isInMyList = true;
+ } catch (error) {
+ message.error('添加失败,请重试');
+ }
+}
+
+/**
+ * 从常用诊断中删除
+ * @param item 常用诊断项(包含id和disease)
+ */
+async function removeFromMyDiagnosis(item) {
+ try {
+ await deleteDoctorMyDiseaseApi(item.id);
+ message.success(`已将「${item.disease.name}」从常用诊断中移除`);
+ // 刷新常用诊断列表
+ await getDoctorMyDiseaseList();
+ // 更新搜索结果中的状态
+ const searchItem = diagnosisList.value.find(
+ (d) => d.id === item.disease.id
+ );
+ if (searchItem) {
+ searchItem.isInMyList = false;
+ }
+ } catch (error) {
+ message.error('删除失败,请重试');
+ }
+}
-
@@ -136,19 +187,152 @@ function selectDiagnosis(item) {
/>
- 常用
-
-
-
+
+ 常用
+
+
+
+
+
+
- 搜索结果
-
-
-
+
+ 搜索结果
+
+
+
+
+
+
-
diff --git a/apps/web-antd/src/views/doctor/doctor-reception/components/DoctorOrderModal.vue b/apps/web-antd/src/views/doctor/doctor-reception/components/DoctorOrderModal.vue
index 70d029fb..1edb5388 100644
--- a/apps/web-antd/src/views/doctor/doctor-reception/components/DoctorOrderModal.vue
+++ b/apps/web-antd/src/views/doctor/doctor-reception/components/DoctorOrderModal.vue
@@ -4,23 +4,36 @@ import {ref} from 'vue';
import {Page, useVbenModal} from '@vben/common-ui';
import {
- Badge,
+ PlusOutlined,
+ DeleteOutlined,
+} from '@ant-design/icons-vue';
+import {
Button,
Col,
- InputSearch,
+ Input,
message,
+ Popconfirm,
Row,
} from 'ant-design-vue';
import {
- getDiseaseList, getDoctorOrderList,
+ getDoctorOrderList,
} from '#/views/doctor/doctor-reception/api';
+import {
+ createDoctorOrderApi,
+ deleteDoctorOrderApi,
+} from '#/views/doctor/settings/api';
const searchKey = ref('');
const doctorOrderCommonList = ref([]);
const doctorOrderMyList = ref([]);
const selectDiagnosisList = ref('');
const setUpdateDoctorOrder = ref();
+
+// 新增医嘱相关
+const newOrderContent = ref('');
+const showAddInput = ref(false);
+
const [Modal, modalApi] = useVbenModal({
fullscreenButton: false,
draggable: true,
@@ -40,16 +53,15 @@ const [Modal, modalApi] = useVbenModal({
if (values) {
selectDiagnosisList.value = values;
}
- getDiagnosisList();
+ getDoctorOrderListData();
}
},
});
/**
- * 获取诊断列表
- * @param searchKey
+ * 获取医嘱列表
*/
-function getDiagnosisList() {
+function getDoctorOrderListData() {
getDoctorOrderList().then((res) => {
doctorOrderCommonList.value = res.common.map((item) => {
item.isSelect = 0;
@@ -83,10 +95,11 @@ function getDiagnosisList() {
}
/**
- * 选择诊断
+ * 选择医嘱
* @param item
+ * @param type 1=我的医嘱(content字段), 2=公共医嘱(name字段)
*/
-function selectDiagnosis(item, type = 1) {
+function selectDoctorOrder(item, type = 1) {
// 将当前值转换为数组(过滤空值)
let arr = selectDiagnosisList.value ? selectDiagnosisList.value.split(',').filter(Boolean) : [];
@@ -119,34 +132,258 @@ function selectDiagnosis(item, type = 1) {
// 将数组转回字符串更新到响应式变量
selectDiagnosisList.value = arr.join(',');
}
+
+/**
+ * 添加自定义医嘱
+ */
+async function addMyDoctorOrder() {
+ if (!newOrderContent.value.trim()) {
+ message.warning('请输入医嘱内容');
+ return;
+ }
+
+ try {
+ await createDoctorOrderApi(newOrderContent.value.trim());
+ message.success('添加成功');
+ newOrderContent.value = '';
+ showAddInput.value = false;
+ // 刷新列表
+ await getDoctorOrderListData();
+ } catch (error) {
+ message.error('添加失败,请重试');
+ }
+}
+
+/**
+ * 删除我的医嘱
+ * @param item 医嘱项
+ */
+async function deleteMyDoctorOrder(item) {
+ try {
+ await deleteDoctorOrderApi(item.id);
+ message.success('删除成功');
+ // 刷新列表
+ await getDoctorOrderListData();
+ } catch (error) {
+ message.error('删除失败,请重试');
+ }
+}
+
+/**
+ * 取消添加
+ */
+function cancelAdd() {
+ newOrderContent.value = '';
+ showAddInput.value = false;
+}
-
+
-
+ 我的医嘱
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+ 公共医嘱
+
+
+
+
+
-
diff --git a/apps/web-antd/src/views/doctor/settings/api/index.ts b/apps/web-antd/src/views/doctor/settings/api/index.ts
index 9e636f8d..10a323db 100644
--- a/apps/web-antd/src/views/doctor/settings/api/index.ts
+++ b/apps/web-antd/src/views/doctor/settings/api/index.ts
@@ -34,3 +34,27 @@ export async function saveServicePriceApi(data: Record) {
export async function createDoctorOrderApi(content: string) {
return requestClient.post(`${prefix}create-doctor-order`, { content });
}
+
+/**
+ * 删除医嘱
+ * @param id 医嘱ID
+ */
+export async function deleteDoctorOrderApi(id: number) {
+ return requestClient.post(`${prefix}delete-doctor-order`, { id });
+}
+
+/**
+ * 添加常用诊断
+ * @param disease_id 疾病ID
+ */
+export async function addDoctorMyDiseaseApi(disease_id: number) {
+ return requestClient.post(`${prefix}add-my-disease`, { disease_id });
+}
+
+/**
+ * 删除常用诊断
+ * @param id 常用诊断记录ID
+ */
+export async function deleteDoctorMyDiseaseApi(id: number) {
+ return requestClient.post(`${prefix}delete-my-disease`, { id });
+}
diff --git a/apps/web-antd/src/views/system/base-config/config/table.ts b/apps/web-antd/src/views/system/base-config/config/table.ts
index 51234dc9..84aaae10 100644
--- a/apps/web-antd/src/views/system/base-config/config/table.ts
+++ b/apps/web-antd/src/views/system/base-config/config/table.ts
@@ -24,7 +24,7 @@ export const gridOptions: VxeGridProps = {
columns: [
{ field: 'id', align: 'left', title: 'ID', width: 100 },
{ field: 'desc', align: 'left', title: '协议名称' },
- { field: 'content', title: '协议介绍', slots: { default: 'content' } },
+ // { field: 'content', title: '协议介绍', slots: { default: 'content' } },
{ field: 'end_txt', title: '协议端口' },
{ field: 'created_at', title: '创建时间' },
{ type: 'html', title: '操作', slots: { default: 'action' } },