通过:处方保持有效。驳回:将同时作废此处方(与诊间「驳回/作废处方」一致)。
@@ -1153,7 +1247,8 @@ import {
prescriptionDetail,
prescriptionOrderCreate,
prescriptionOrderPaidPayOrders,
- getDoctors
+ getDoctors,
+ prescriptionLibraryLists
} from '@/api/tcm'
import { searchPatients as searchPatientsAPI } from '@/api/order'
import { getDictData } from '@/api/app'
@@ -1163,6 +1258,7 @@ import useUserStore from '@/stores/modules/user'
import feedback from '@/utils/feedback'
import type { FormInstance, FormRules } from 'element-plus'
import DaterangePicker from '@/components/daterange-picker/index.vue'
+import { Search } from '@element-plus/icons-vue'
import { computed, onMounted, reactive, ref, watch, nextTick } from 'vue'
import { useRouter } from 'vue-router'
@@ -1783,6 +1879,10 @@ const editForm = reactive({
audit_by_name: '',
audit_remark: '',
diagnosis_id: 0,
+ /** 开方医师 admin id(处方库导入按此医生筛选) */
+ creator_id: 0,
+ /** 1=系统自动生成(如挂号完成) */
+ is_system_auto: 0,
/** 列表带入:业务订单「处方审核」驳回(消费者处方本身可能仍为已通过) */
business_prescription_audit_rejected: 0,
business_prescription_audit_remark: '',
@@ -1938,7 +2038,7 @@ function resetParams() {
dateQuickTab.value = 'all'
formData.patient_name = ''
formData.creator_ids = []
- formData.audit_filter = userCanAudit() ? 'pending' : 'all'
+ formData.audit_filter = 'all'
formData.start_time = ''
formData.end_time = ''
syncingDateTab = false
@@ -2103,6 +2203,108 @@ async function loadRoleOptions() {
}
}
+// —— 处方库导入(与 components/tcm-prescription 一致,按 creator_id 拉取该医师库内处方)——
+const showLibraryDialog = ref(false)
+const libraryLoading = ref(false)
+const libraryList = ref([])
+const librarySearchName = ref('')
+const libraryPage = ref(1)
+const libraryPageSize = ref(15)
+const libraryTotal = ref(0)
+
+/** 当前用于检索处方库的开方医师 ID:编辑用处方 creator_id,新增用当前登录账号 */
+const libraryDoctorId = computed(() => {
+ const cid = Number(editForm.creator_id)
+ if (cid > 0) return cid
+ const uid = Number(userStore.userInfo?.id)
+ return uid > 0 ? uid : 0
+})
+
+function normalizeHerbNameLocal(s: string) {
+ return String(s || '')
+ .trim()
+ .toLowerCase()
+}
+
+function findDuplicateHerbNamesLocal(): string[] {
+ const map = new Map()
+ for (const h of editForm.herbs) {
+ const key = normalizeHerbNameLocal(h?.name)
+ if (!key) continue
+ map.set(key, (map.get(key) ?? 0) + 1)
+ }
+ return [...map.entries()]
+ .filter(([, c]) => c > 1)
+ .map(([name]) => name)
+}
+
+const loadLibraryList = async () => {
+ const doctorId = libraryDoctorId.value
+ if (!doctorId) {
+ feedback.msgWarning('无法确定开方医师,无法加载处方库')
+ libraryList.value = []
+ libraryTotal.value = 0
+ return
+ }
+ libraryLoading.value = true
+ try {
+ const res: any = await prescriptionLibraryLists({
+ page_no: libraryPage.value,
+ page_size: libraryPageSize.value,
+ prescription_name: librarySearchName.value,
+ is_public: '',
+ creator_id: doctorId
+ })
+ libraryList.value = res?.lists || []
+ libraryTotal.value = res?.count || 0
+ } catch (e) {
+ console.error(e)
+ feedback.msgError('加载处方库失败')
+ } finally {
+ libraryLoading.value = false
+ }
+}
+
+const searchLibrary = () => {
+ libraryPage.value = 1
+ loadLibraryList()
+}
+
+const openLibraryDialog = () => {
+ const doctorId = libraryDoctorId.value
+ if (!doctorId) {
+ feedback.msgWarning('无法确定开方医师,无法从处方库导入')
+ return
+ }
+ showLibraryDialog.value = true
+}
+
+const handleSelectLibraryRow = (row: any) => {
+ handleImportLibrary(row)
+}
+
+const handleImportLibrary = (row: any) => {
+ if (!row.herbs || row.herbs.length === 0) {
+ feedback.msgWarning('该处方没有药材信息')
+ return
+ }
+ const imported = JSON.parse(JSON.stringify(row.herbs)) as Array<{ name: string; dosage: number }>
+ editForm.herbs = imported
+ if (findDuplicateHerbNamesLocal().length) {
+ feedback.msgWarning('导入的处方中存在重复药名,请合并剂量或删除多余行')
+ }
+ feedback.msgSuccess(`已导入处方「${row.prescription_name}」,共${imported.length}味药材`)
+ showLibraryDialog.value = false
+}
+
+watch(showLibraryDialog, (open) => {
+ if (open) {
+ librarySearchName.value = ''
+ libraryPage.value = 1
+ loadLibraryList()
+ }
+})
+
// 添加药材
const addHerb = () => {
editForm.herbs.push({
@@ -2147,6 +2349,8 @@ const resetForm = () => {
editForm.audit_by_name = ''
editForm.audit_remark = ''
editForm.diagnosis_id = 0
+ editForm.creator_id = Number(userStore.userInfo?.id) || 0
+ editForm.is_system_auto = 0
editForm.business_prescription_audit_rejected = 0
editForm.business_prescription_audit_remark = ''
}
@@ -2249,6 +2453,8 @@ const handleEdit = (row: any) => {
editForm.audit_by_name = row.audit_by_name || ''
editForm.audit_remark = row.audit_remark || ''
editForm.diagnosis_id = row.diagnosis_id ?? 0
+ editForm.creator_id = Number(row.creator_id) > 0 ? Number(row.creator_id) : 0
+ editForm.is_system_auto = Number(row.is_system_auto) === 1 ? 1 : 0
editForm.business_prescription_audit_rejected = Number(row.business_prescription_audit_rejected) === 1 ? 1 : 0
editForm.business_prescription_audit_remark = String(row.business_prescription_audit_remark || '')
@@ -2336,9 +2542,6 @@ onMounted(async () => {
} catch {
/* 已登录页仍可无用户信息,保持默认筛选 */
}
- if (userCanAudit()) {
- formData.audit_filter = 'pending'
- }
getLists()
})
diff --git a/admin/src/views/consumer/prescription/order_list.vue b/admin/src/views/consumer/prescription/order_list.vue
index af563687..78be33f3 100644
--- a/admin/src/views/consumer/prescription/order_list.vue
+++ b/admin/src/views/consumer/prescription/order_list.vue
@@ -42,6 +42,22 @@
{{ tab.label }}
+
+
发货状态
+
+ {{ tab.label }}
+
+
@@ -63,6 +79,46 @@
@keyup.enter="resetPage"
/>
+
+
+
+
+
+
+
+
+
+
+
+
+
查询
重置
@@ -469,12 +525,29 @@
—
-
- 服用{{ detailPrescription.usage_days }}天
- ,
- 每天{{ detailPrescription.times_per_day }}次
-
- —
+
+
+ 每天次数:
+ {{ detailPrescription.times_per_day ? detailPrescription.times_per_day + ' 次' : '—' }}
+
+
+ 处方开立:
+ {{
+ detailPrescription.usage_days != null && detailPrescription.usage_days !== ''
+ ? detailPrescription.usage_days + ' 天'
+ : '—'
+ }}
+
+
+ 订单设置:
+ {{
+ detailData.medication_days != null &&
+ String(detailData.medication_days).trim() !== ''
+ ? detailData.medication_days + ' 天'
+ : '—'
+ }}
+
+
@@ -1468,7 +1541,7 @@