-
+
@@ -137,14 +137,14 @@
-
+
@@ -162,11 +162,13 @@
v-else-if="formData.prescription_type === '饮片'"
v-model="formData.dosage_amount"
placeholder="请选择用量"
- class="!w-32"
+ class="!w-full"
>
+
+
@@ -176,14 +178,31 @@
v-model="formData.dosage_amount"
:min="0"
:precision="2"
- class="!w-32"
+ class="!w-full"
/>
{{ formData.dosage_unit }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
代煎
@@ -191,6 +210,7 @@
+
@@ -198,7 +218,7 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -859,7 +879,7 @@
{
+ return data.map((province: any) => ({
+ name: province.province,
+ code: province.code,
+ children: province.citys?.map((city: any) => ({
+ name: city.city,
+ code: city.code,
+ children: city.areas?.map((area: any) => ({
+ name: area.area,
+ code: area.code
+ })) || []
+ })) || []
+ }))
+}
+
+// 加载省市区数据
+const loadRegionData = async () => {
+ try {
+ console.log('开始加载省市区数据...')
+ // 使用代理路径,需要在vite.config.ts中配置代理
+ const response = await fetch('/api-proxy/area/ChinaCitys.json')
+ console.log('响应状态:', response.status)
+
+ if (!response.ok) {
+ throw new Error(`HTTP error! status: ${response.status}`)
+ }
+
+ const data = await response.json()
+ console.log('加载的数据条数:', data?.length)
+
+ // 转换数据格式
+ regionOptions.value = transformRegionData(data)
+ console.log('regionOptions 已设置,条数:', regionOptions.value.length)
+ } catch (error) {
+ console.error('加载省市区数据失败:', error)
+ // 如果加载失败,使用基本的省市数据作为后备
+ regionOptions.value = [
{
- name: '成都市',
+ name: '四川省',
children: [
- { name: '锦江区' },
- { name: '青羊区' },
- { name: '金牛区' },
- { name: '武侯区' },
- { name: '成华区' },
- { name: '龙泉驿区' },
- { name: '青白江区' },
- { name: '新都区' },
- { name: '温江区' },
- { name: '双流区' },
- { name: '郫都区' },
- { name: '新津区' },
- { name: '都江堰市' },
- { name: '彭州市' },
- { name: '邛崃市' },
- { name: '崇州市' },
- { name: '简阳市' },
- { name: '金堂县' },
- { name: '大邑县' },
- { name: '蒲江县' }
+ {
+ name: '成都市',
+ children: [
+ { name: '锦江区' },
+ { name: '青羊区' },
+ { name: '金牛区' },
+ { name: '武侯区' },
+ { name: '成华区' },
+ { name: '龙泉驿区' },
+ { name: '青白江区' },
+ { name: '新都区' },
+ { name: '温江区' },
+ { name: '双流区' }
+ ]
+ },
+ {
+ name: '绵阳市',
+ children: [
+ { name: '涪城区' },
+ { name: '游仙区' },
+ { name: '安州区' }
+ ]
+ }
]
},
- {
- name: '绵阳市',
- children: [
- { name: '涪城区' },
- { name: '游仙区' },
- { name: '安州区' },
- { name: '江油市' },
- { name: '三台县' },
- { name: '盐亭县' },
- { name: '梓潼县' },
- { name: '北川羌族自治县' },
- { name: '平武县' }
- ]
- }
- ]
- },
- {
- name: '北京市',
- children: [
{
name: '北京市',
children: [
- { name: '东城区' },
- { name: '西城区' },
- { name: '朝阳区' },
- { name: '丰台区' },
- { name: '石景山区' },
- { name: '海淀区' },
- { name: '门头沟区' },
- { name: '房山区' },
- { name: '通州区' },
- { name: '顺义区' },
- { name: '昌平区' },
- { name: '大兴区' },
- { name: '怀柔区' },
- { name: '平谷区' },
- { name: '密云区' },
- { name: '延庆区' }
- ]
- }
- ]
- },
- {
- name: '上海市',
- children: [
- {
- name: '上海市',
- children: [
- { name: '黄浦区' },
- { name: '徐汇区' },
- { name: '长宁区' },
- { name: '静安区' },
- { name: '普陀区' },
- { name: '虹口区' },
- { name: '杨浦区' },
- { name: '闵行区' },
- { name: '宝山区' },
- { name: '嘉定区' },
- { name: '浦东新区' },
- { name: '金山区' },
- { name: '松江区' },
- { name: '青浦区' },
- { name: '奉贤区' },
- { name: '崇明区' }
- ]
- }
- ]
- },
- {
- name: '广东省',
- children: [
- {
- name: '广州市',
- children: [
- { name: '荔湾区' },
- { name: '越秀区' },
- { name: '海珠区' },
- { name: '天河区' },
- { name: '白云区' },
- { name: '黄埔区' },
- { name: '番禺区' },
- { name: '花都区' },
- { name: '南沙区' },
- { name: '从化区' },
- { name: '增城区' }
+ {
+ name: '北京市',
+ children: [
+ { name: '东城区' },
+ { name: '西城区' },
+ { name: '朝阳区' },
+ { name: '丰台区' },
+ { name: '海淀区' }
+ ]
+ }
]
},
{
- name: '深圳市',
+ name: '上海市',
children: [
- { name: '罗湖区' },
- { name: '福田区' },
- { name: '南山区' },
- { name: '宝安区' },
- { name: '龙岗区' },
- { name: '盐田区' },
- { name: '龙华区' },
- { name: '坪山区' },
- { name: '光明区' }
+ {
+ name: '上海市',
+ children: [
+ { name: '黄浦区' },
+ { name: '徐汇区' },
+ { name: '长宁区' },
+ { name: '静安区' },
+ { name: '普陀区' }
+ ]
+ }
+ ]
+ },
+ {
+ name: '广东省',
+ children: [
+ {
+ name: '广州市',
+ children: [
+ { name: '荔湾区' },
+ { name: '越秀区' },
+ { name: '海珠区' },
+ { name: '天河区' },
+ { name: '白云区' }
+ ]
+ },
+ {
+ name: '深圳市',
+ children: [
+ { name: '罗湖区' },
+ { name: '福田区' },
+ { name: '南山区' },
+ { name: '宝安区' }
+ ]
+ }
]
}
]
+ console.log('使用后备数据,条数:', regionOptions.value.length)
}
-])
+}
// 处理省市区选择变化
const handleRegionChange = (value: string[]) => {
console.log('选择的省市区:', value)
+ // value is an array like ['四川省', '成都市', '锦江区']
+ // We'll extract these in the submit function
}
const createOrderLinkedPaidTotal = computed(() => {
@@ -1619,6 +1634,14 @@ async function submitCreateOrderFromPrescription() {
amount: createOrderForm.amount,
remark_extra: createOrderForm.remark_extra || ''
}
+
+ // 添加省市区字段
+ if (createOrderForm.region && createOrderForm.region.length >= 3) {
+ payload.shipping_province = createOrderForm.region[0]
+ payload.shipping_city = createOrderForm.region[1]
+ payload.shipping_district = createOrderForm.region[2]
+ }
+
if (createOrderForm.medication_days != null && createOrderForm.medication_days > 0) {
payload.medication_days = createOrderForm.medication_days
}
@@ -1672,6 +1695,7 @@ const editForm = reactive({
dosage_amount: 1 as number | undefined,
dosage_unit: 'g',
need_decoction: false,
+ bags_per_dose: 1,
patient_name: '',
gender: 1,
age: 0,
@@ -1705,20 +1729,31 @@ const editForm = reactive({
times_per_day: 2
})
+// 标志:是否正在加载数据(防止watch函数覆盖已加载的值)
+const isLoadingData = ref(false)
+
// 监听处方类型变化,自动调整用量单位和默认值
watch(() => editForm.prescription_type, (newType) => {
+ // 如果正在加载数据,不要自动重置值
+ if (isLoadingData.value) {
+ return
+ }
+
if (newType === '浓缩水丸') {
editForm.dosage_unit = 'g'
editForm.dosage_amount = 1
editForm.need_decoction = false
+ editForm.bags_per_dose = 1
} else if (newType === '饮片') {
editForm.dosage_unit = 'ml'
editForm.dosage_amount = 50
+ editForm.bags_per_dose = 1
// need_decoction 保持用户选择
} else {
editForm.dosage_unit = 'g'
editForm.dosage_amount = undefined
editForm.need_decoction = false
+ editForm.bags_per_dose = 1
}
})
@@ -2062,6 +2097,8 @@ const handleAdd = () => {
editingWasVoid.value = false
editingWasRejected.value = false
editMode.value = 'add'
+ // 新建时允许watch自动设置默认值
+ isLoadingData.value = false
showEdit.value = true
nextTick(() => {
formRef.value?.clearValidate()
@@ -2096,12 +2133,34 @@ const handleEdit = (row: any) => {
editingWasVoid.value = Number(row.void_status) === 1
editingWasRejected.value = Number(row.audit_status) === 2
editMode.value = 'edit'
+
+ // 开始加载数据,暂时禁用watch自动重置
+ isLoadingData.value = true
+
// 深拷贝数据到表单
editForm.id = row.id
editForm.prescription_type = row.prescription_type || '浓缩水丸'
- editForm.dosage_amount = row.dosage_amount ?? undefined
- editForm.dosage_unit = row.dosage_unit || ''
+
+ // 确保 dosage_amount 是数字类型,以匹配下拉框的 :value
+ if (row.dosage_amount !== null && row.dosage_amount !== undefined && row.dosage_amount !== '') {
+ editForm.dosage_amount = Number(row.dosage_amount)
+ } else {
+ editForm.dosage_amount = undefined
+ }
+
+ // 如果数据库中没有 dosage_unit,根据 prescription_type 设置默认值
+ if (row.dosage_unit) {
+ editForm.dosage_unit = row.dosage_unit
+ } else {
+ if (editForm.prescription_type === '饮片') {
+ editForm.dosage_unit = 'ml'
+ } else {
+ editForm.dosage_unit = 'g'
+ }
+ }
+
editForm.need_decoction = row.need_decoction === 1 || row.need_decoction === true
+ editForm.bags_per_dose = row.bags_per_dose ? Number(row.bags_per_dose) : 1
editForm.patient_name = row.patient_name || ''
editForm.gender = row.gender ?? 1
editForm.age = row.age ?? 0
@@ -2132,6 +2191,13 @@ const handleEdit = (row: any) => {
editForm.diagnosis_id = row.diagnosis_id ?? 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 || '')
+
+ // 数据加载完成,重新启用watch
+ // 使用 setTimeout 确保所有数据都已经渲染完成
+ setTimeout(() => {
+ isLoadingData.value = false
+ }, 0)
+
showEdit.value = true
nextTick(() => {
formRef.value?.clearValidate()
@@ -2195,6 +2261,7 @@ const handleDelete = async (id: number) => {
onMounted(async () => {
await loadRoleOptions()
+ await loadRegionData()
try {
const list = await getDoctors()
doctorOptions.value = Array.isArray(list) ? list : []
diff --git a/admin/src/views/consumer/prescription/order_list.vue b/admin/src/views/consumer/prescription/order_list.vue
index 8bea3c33..c648987d 100644
--- a/admin/src/views/consumer/prescription/order_list.vue
+++ b/admin/src/views/consumer/prescription/order_list.vue
@@ -592,14 +592,14 @@
{{ detailData.recipient_name }}
{{ detailData.recipient_phone }}
- {{ detailData.shipping_address }}
+ {{ detailFullAddress }}
{{ detailData.is_follow_up ? '是' : '否' }}
{{ detailData.medication_days ? detailData.medication_days + ' 天' : '—' }}
{{ detailData.prev_staff || '—' }}
{{ detailData.service_channel || '—' }}
- {{ detailData.service_package || '—' }}
+ {{ formatServicePackage(detailData.service_package) }}
{{ feeTypeText(detailData.fee_type) }}
@@ -757,8 +757,10 @@
@@ -840,7 +842,22 @@
-
+
+
+
@@ -1451,6 +1468,7 @@ import {
prescriptionOrderPreviewGancaoRecipel,
prescriptionDetail
} from '@/api/tcm'
+import { getDictData } from '@/api/app'
import { usePaging } from '@/hooks/usePaging'
import feedback from '@/utils/feedback'
import { ElMessageBox } from 'element-plus'
@@ -1472,90 +1490,99 @@ const canViewFinanceFields = () => {
}
// 省市区数据
-const regionOptions = [
- {
- value: '四川省',
- label: '四川省',
- children: [
+const regionOptions = ref([])
+
+// 服务套餐选项
+const servicePackageOptions = ref
>([])
+
+// 转换省市区数据格式
+const transformRegionData = (data: any[]) => {
+ return data.map((province: any) => ({
+ value: province.province,
+ label: province.province,
+ code: province.code,
+ children: province.citys?.map((city: any) => ({
+ value: city.city,
+ label: city.city,
+ code: city.code,
+ children: city.areas?.map((area: any) => ({
+ value: area.area,
+ label: area.area,
+ code: area.code
+ })) || []
+ })) || []
+ }))
+}
+
+// 加载省市区数据
+const loadRegionData = async () => {
+ try {
+ console.log('开始加载省市区数据...')
+ // 使用代理路径,需要在vite.config.ts中配置代理
+ const response = await fetch('/api-proxy/area/ChinaCitys.json')
+ console.log('响应状态:', response.status)
+
+ if (!response.ok) {
+ throw new Error(`HTTP error! status: ${response.status}`)
+ }
+
+ const data = await response.json()
+ console.log('加载的数据条数:', data?.length)
+
+ // 转换数据格式
+ regionOptions.value = transformRegionData(data)
+ console.log('regionOptions 已设置,条数:', regionOptions.value.length)
+ } catch (error) {
+ console.error('加载省市区数据失败:', error)
+ // 如果加载失败,使用基本的省市数据作为后备
+ regionOptions.value = [
{
- value: '成都市',
- label: '成都市',
+ value: '四川省',
+ label: '四川省',
children: [
- { value: '武侯区', label: '武侯区' },
- { value: '锦江区', label: '锦江区' },
- { value: '青羊区', label: '青羊区' },
- { value: '金牛区', label: '金牛区' },
- { value: '成华区', label: '成华区' },
- { value: '高新区', label: '高新区' }
+ {
+ value: '成都市',
+ label: '成都市',
+ children: [
+ { value: '武侯区', label: '武侯区' },
+ { value: '锦江区', label: '锦江区' },
+ { value: '青羊区', label: '青羊区' },
+ { value: '金牛区', label: '金牛区' },
+ { value: '成华区', label: '成华区' }
+ ]
+ }
]
},
- {
- value: '绵阳市',
- label: '绵阳市',
- children: [
- { value: '涪城区', label: '涪城区' },
- { value: '游仙区', label: '游仙区' }
- ]
- }
- ]
- },
- {
- value: '北京市',
- label: '北京市',
- children: [
{
value: '北京市',
label: '北京市',
children: [
- { value: '朝阳区', label: '朝阳区' },
- { value: '海淀区', label: '海淀区' },
- { value: '东城区', label: '东城区' },
- { value: '西城区', label: '西城区' }
- ]
- }
- ]
- },
- {
- value: '上海市',
- label: '上海市',
- children: [
- {
- value: '上海市',
- label: '上海市',
- children: [
- { value: '浦东新区', label: '浦东新区' },
- { value: '黄浦区', label: '黄浦区' },
- { value: '徐汇区', label: '徐汇区' },
- { value: '静安区', label: '静安区' }
- ]
- }
- ]
- },
- {
- value: '广东省',
- label: '广东省',
- children: [
- {
- value: '广州市',
- label: '广州市',
- children: [
- { value: '天河区', label: '天河区' },
- { value: '越秀区', label: '越秀区' },
- { value: '海珠区', label: '海珠区' }
- ]
- },
- {
- value: '深圳市',
- label: '深圳市',
- children: [
- { value: '南山区', label: '南山区' },
- { value: '福田区', label: '福田区' },
- { value: '罗湖区', label: '罗湖区' }
+ {
+ value: '北京市',
+ label: '北京市',
+ children: [
+ { value: '朝阳区', label: '朝阳区' },
+ { value: '海淀区', label: '海淀区' },
+ { value: '东城区', label: '东城区' }
+ ]
+ }
]
}
]
}
-]
+}
+
+// 加载服务套餐选项
+const loadServicePackageOptions = async () => {
+ try {
+ const data = await getDictData({ type: 'server_order' })
+ servicePackageOptions.value = (data?.server_order || []).filter((item: any) => item.status !== 0)
+ console.log('服务套餐选项已加载:', servicePackageOptions.value.length)
+ } catch (error) {
+ console.error('加载服务套餐选项失败:', error)
+ servicePackageOptions.value = []
+ }
+}
const queryParams = reactive({
order_no: '',
@@ -1602,6 +1629,28 @@ function feeTypeText(t: number | undefined) {
return m[Number(t)] ?? '—'
}
+// 格式化服务套餐显示
+function formatServicePackage(value: any): string {
+ if (!value) return '—'
+
+ let packages: string[] = []
+ if (Array.isArray(value)) {
+ packages = value
+ } else if (typeof value === 'string') {
+ packages = value.split(',').filter(v => v.trim() !== '')
+ }
+
+ if (packages.length === 0) return '—'
+
+ // 将值转换为名称
+ const names = packages.map(val => {
+ const option = servicePackageOptions.value.find(opt => opt.value === val)
+ return option ? option.name : val
+ })
+
+ return names.join('、')
+}
+
function auditStatusText(s: number | undefined) {
if (s === 1) return '已通过'
if (s === 2) return '已驳回'
@@ -1847,6 +1896,20 @@ const detailRxHerbs = computed(() => normalizeSlipHerbs(detailPrescription.value
/** false=无权限;true/缺省兼容旧接口(旧版未下发该字段时仍展示药材) */
const detailHerbsVisible = computed(() => detailData.value?.prescription_detail_herbs_visible !== false)
+// 完整收货地址(省市区 + 详细地址)
+const detailFullAddress = computed(() => {
+ const d = detailData.value
+ if (!d) return '—'
+
+ const parts = []
+ if (d.shipping_province) parts.push(d.shipping_province)
+ if (d.shipping_city) parts.push(d.shipping_city)
+ if (d.shipping_district) parts.push(d.shipping_district)
+ if (d.shipping_address) parts.push(d.shipping_address)
+
+ return parts.length > 0 ? parts.join(' ') : '—'
+})
+
function consumerRxAuditText(s: number | undefined) {
const n = Number(s)
if (n === 1) return '已通过'
@@ -2003,7 +2066,7 @@ const editForm = reactive({
dose_unit: '剂',
prev_staff: '',
service_channel: '',
- service_package: '',
+ service_package: [] as string[],
express_company: 'auto',
tracking_number: '',
fee_type: 3,
@@ -2123,7 +2186,18 @@ async function openEdit(row: { id: number }) {
editForm.dose_unit = d.dose_unit || '剂'
editForm.prev_staff = d.prev_staff || ''
editForm.service_channel = d.service_channel || ''
- editForm.service_package = d.service_package || ''
+ // 处理服务套餐:如果是字符串,转换为数组
+ if (d.service_package) {
+ if (Array.isArray(d.service_package)) {
+ editForm.service_package = d.service_package
+ } else if (typeof d.service_package === 'string') {
+ editForm.service_package = d.service_package.split(',').filter(v => v.trim() !== '')
+ } else {
+ editForm.service_package = []
+ }
+ } else {
+ editForm.service_package = []
+ }
editForm.express_company = String(d.express_company || 'auto') || 'auto'
editForm.tracking_number = d.tracking_number || ''
editForm.fee_type = Number(d.fee_type) || 3
@@ -2172,7 +2246,7 @@ async function submitEdit() {
is_follow_up: editForm.is_follow_up,
prev_staff: editForm.prev_staff || '',
service_channel: editForm.service_channel || '',
- service_package: editForm.service_package || '',
+ service_package: Array.isArray(editForm.service_package) ? editForm.service_package.join(',') : '',
express_company: editForm.express_company || 'auto',
tracking_number: editForm.tracking_number || '',
fee_type: editForm.fee_type,
@@ -2325,10 +2399,10 @@ async function testGancaoPreview() {
gancaoPreviewDrawerVisible.value = true
feedback.msgSuccess('预下单测试成功')
} else {
- feedback.msgError(d?.error || '预下单失败')
+ // feedback.msgError(d?.error || '预下单失败')
}
} catch (e: any) {
- feedback.msgError(e?.message || '预下单失败')
+ // feedback.msgError(e?.message || '预下单失败')
} finally {
gancaoPreviewLoading.value = false
}
@@ -2354,12 +2428,12 @@ async function testGancaoPreviewFromDetail() {
if (d && d.success) {
gancaoPreviewData.value = d
gancaoPreviewDrawerVisible.value = true
- feedback.msgSuccess('预下单测试成功')
+ //feedback.msgSuccess('预下单测试成功')
} else {
- feedback.msgError(d?.error || '预下单失败')
+ // feedback.msgError(d?.error || '预下单失败')
}
} catch (e: any) {
- feedback.msgError(e?.message || '预下单失败')
+ // feedback.msgError(e?.message || '预下单失败')
} finally {
gancaoPreviewLoading.value = false
}
@@ -2396,7 +2470,9 @@ async function confirmSubmitGancaoRecipel(row: { id: number }) {
}
}
-onMounted(() => {
+onMounted(async () => {
+ await loadRegionData()
+ await loadServicePackageOptions()
getLists()
})
@@ -2434,6 +2510,9 @@ async function submitQuickTrack() {
id: d.id,
recipient_name: d.recipient_name || '',
recipient_phone: d.recipient_phone || '',
+ shipping_province: d.shipping_province || '',
+ shipping_city: d.shipping_city || '',
+ shipping_district: d.shipping_district || '',
shipping_address: d.shipping_address || '',
is_follow_up: d.is_follow_up ? 1 : 0,
medication_days: (d.medication_days != null && String(d.medication_days).trim() !== '') ? d.medication_days : '',
diff --git a/admin/vite.config.ts b/admin/vite.config.ts
index 01ae565f..35e6ca86 100644
--- a/admin/vite.config.ts
+++ b/admin/vite.config.ts
@@ -41,7 +41,14 @@ export default defineConfig({
server: {
host: '0.0.0.0',
hmr: true,
- open: true
+ open: true,
+ proxy: {
+ '/api-proxy': {
+ target: 'https://admin.zhenyangtang.com.cn',
+ changeOrigin: true,
+ rewrite: (path) => path.replace(/^\/api-proxy/, '')
+ }
+ }
},
plugins: [
vue(),
diff --git a/server/app/adminapi/logic/tcm/PrescriptionLogic.php b/server/app/adminapi/logic/tcm/PrescriptionLogic.php
index d474cd97..7e63a228 100644
--- a/server/app/adminapi/logic/tcm/PrescriptionLogic.php
+++ b/server/app/adminapi/logic/tcm/PrescriptionLogic.php
@@ -230,6 +230,7 @@ class PrescriptionLogic
'dosage_amount' => isset($params['dosage_amount']) ? (float)$params['dosage_amount'] : null,
'dosage_unit' => $params['dosage_unit'] ?? '',
'need_decoction' => (int)($params['need_decoction'] ?? 0),
+ 'bags_per_dose' => isset($params['bags_per_dose']) ? (int)$params['bags_per_dose'] : 1,
'diagnosis_id' => (int)($params['diagnosis_id'] ?? 0),
'appointment_id' => (int)($params['appointment_id'] ?? 0),
'patient_id' => (int)($params['patient_id'] ?? 0),
@@ -358,6 +359,7 @@ class PrescriptionLogic
'dosage_amount' => isset($params['dosage_amount']) ? (float)$params['dosage_amount'] : $prescription->dosage_amount,
'dosage_unit' => $params['dosage_unit'] ?? $prescription->dosage_unit,
'need_decoction' => isset($params['need_decoction']) ? (int)$params['need_decoction'] : (int)($prescription->need_decoction ?? 0),
+ 'bags_per_dose' => isset($params['bags_per_dose']) ? (int)$params['bags_per_dose'] : (int)($prescription->bags_per_dose ?? 1),
'patient_name' => $params['patient_name'] ?? $prescription->patient_name,
'gender' => (int)($params['gender'] ?? $prescription->gender),
'age' => (int)($params['age'] ?? $prescription->age),
diff --git a/server/app/adminapi/logic/tcm/PrescriptionOrderLogic.php b/server/app/adminapi/logic/tcm/PrescriptionOrderLogic.php
index 63708826..e9d61061 100644
--- a/server/app/adminapi/logic/tcm/PrescriptionOrderLogic.php
+++ b/server/app/adminapi/logic/tcm/PrescriptionOrderLogic.php
@@ -477,6 +477,18 @@ class PrescriptionOrderLogic
$order->creator_id = $adminId;
$order->recipient_name = (string) $params['recipient_name'];
$order->recipient_phone = (string) $params['recipient_phone'];
+
+ // 处理省市区字段
+ if (isset($params['shipping_province'])) {
+ $order->shipping_province = (string) $params['shipping_province'];
+ }
+ if (isset($params['shipping_city'])) {
+ $order->shipping_city = (string) $params['shipping_city'];
+ }
+ if (isset($params['shipping_district'])) {
+ $order->shipping_district = (string) $params['shipping_district'];
+ }
+
$order->shipping_address = (string) $params['shipping_address'];
$order->is_follow_up = (int) ($params['is_follow_up'] ?? 0) === 1 ? 1 : 0;
$order->medication_days = $medDays > 0 ? $medDays : null;
diff --git a/server/app/adminapi/validate/tcm/PrescriptionValidate.php b/server/app/adminapi/validate/tcm/PrescriptionValidate.php
index c4e70939..189ad07a 100644
--- a/server/app/adminapi/validate/tcm/PrescriptionValidate.php
+++ b/server/app/adminapi/validate/tcm/PrescriptionValidate.php
@@ -28,10 +28,11 @@ class PrescriptionValidate extends BaseValidate
public function sceneAdd()
{
return $this->only([
- 'prescription_type', 'patient_name', 'gender', 'age',
+ 'prescription_type', 'dosage_amount', 'dosage_unit', 'need_decoction', 'bags_per_dose',
+ 'patient_name', 'gender', 'age',
'visit_no', 'prescription_date', 'tongue', 'tongue_image', 'pulse',
'pulse_condition', 'clinical_diagnosis', 'herbs', 'dose_count', 'dose_unit',
- 'usage_days', 'usage_instruction', 'usage_time', 'usage_way', 'dietary_taboo',
+ 'usage_days', 'times_per_day', 'usage_instruction', 'usage_time', 'usage_way', 'dietary_taboo',
'usage_notes', 'doctor_name', 'is_shared', 'visible_role_ids',
'diagnosis_id', 'appointment_id', 'audit_status',
]);
@@ -40,10 +41,11 @@ class PrescriptionValidate extends BaseValidate
public function sceneEdit()
{
return $this->only([
- 'id', 'prescription_type', 'patient_name', 'gender', 'age',
+ 'id', 'prescription_type', 'dosage_amount', 'dosage_unit', 'need_decoction', 'bags_per_dose',
+ 'patient_name', 'gender', 'age',
'visit_no', 'prescription_date', 'tongue', 'tongue_image', 'pulse',
'pulse_condition', 'clinical_diagnosis', 'herbs', 'dose_count', 'dose_unit',
- 'usage_days', 'usage_instruction', 'usage_time', 'usage_way', 'dietary_taboo',
+ 'usage_days', 'times_per_day', 'usage_instruction', 'usage_time', 'usage_way', 'dietary_taboo',
'usage_notes', 'doctor_name', 'is_shared', 'visible_role_ids', 'diagnosis_id',
]);
}
diff --git a/server/app/common/service/gancao/GancaoScmRecipelService.php b/server/app/common/service/gancao/GancaoScmRecipelService.php
index f2049e47..77c9552e 100644
--- a/server/app/common/service/gancao/GancaoScmRecipelService.php
+++ b/server/app/common/service/gancao/GancaoScmRecipelService.php
@@ -412,21 +412,50 @@ final class GancaoScmRecipelService
'package' => 'igc_scm.ops.api.order',
'class' => 'CTM_PREVIEW',
];
- dd($rx);
+
if ($dfId === 101) {
- $isDecoct = (int) $c['default_is_decoct'] ? 1 : 0;
+
$base['df101ext'] = [
- 'times_per_day' => max(1, min(10, (int) $c['default_times_per_day'])),
- 'is_decoct' => $isDecoct,
- 'num_per_pack' => max(1, min(9, (int) $c['default_num_per_pack'])),
- 'is_special_writing' => 0,
- 'dose' => max(50, min(250, (int) $c['default_dose_ml'])),
+ 'times_per_day' =>$rx['times_per_day'],
+ 'is_decoct' => $rx['need_decoction'],
+ 'num_per_pack' => $rx['bags_per_dose'],
+ 'is_special_writing' => $rx['bags_per_dose']==$rx['times_per_day']?0:1,
+ 'dose' => $rx['dosage_amount'],
'usage_mode' => 'ORAL',
'ds_type' => 1
];
+
+ $base['doct_advice']=[
+ 'taboo'=>$rx['dietary_taboo'],
+ 'usage_time'=>$rx['usage_time'],
+ 'usage_brief'=>$rx['usage_instruction'],
+ 'others'=>$rx['usage_notes']
+ ];
+ $base['express_type']="general";
+ $base['cradle_store']="线上接诊";
+ $base['app_order_no']=$order['order_no'];
+ $base['express_to']=[
+ 'name'=>$order['recipient_name'],
+ 'phone'=>$order['recipient_phone'],
+ 'province'=>$order['shipping_province'],
+ 'city'=>$order['shipping_city'],
+ 'addr'=>$order['shipping_province'].$order['shipping_city'].$order['shipping_city'].$order['shipping_address']
+ ];
+ $base['callback_url']= $c['callback_url'];
+ $base['diagnosis']= $rx['clinical_diagnosis']||'无';
+ $base['disease']= $rx['clinical_diagnosis']||'无';
+ $base['doctor']=[
+ 'name'=>$rx['doctor_name'],
+ 'phone'=>''
+ ];
+
+ $base['patient']=[
+ 'name'=>$rx['patient_name'],
+ 'age'=>$rx['age'],
+ 'sex'=>$rx['gender_desc']=='男'?1:0
+ ];
}
if ($dfId === 102) {
- $isDecoct = (int) $c['default_is_decoct'] ? 1 : 0;
$base['df102ext'] = [
'times_per_day' =>$rx['times_per_day'],
'take_days'=>$order['medication_days']?$order['medication_days']:$rx['usage_days'],