Merge branch 'chufan-2026-5-16'
This commit is contained in:
@@ -319,6 +319,11 @@ export function prescriptionEdit(params: any) {
|
|||||||
return request.post({ url: '/tcm.prescription/edit', params })
|
return request.post({ url: '/tcm.prescription/edit', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 仅修正处方笺患者姓名与手机号(不改审核状态),写入业务订单日志表 */
|
||||||
|
export function prescriptionPatchPatient(params: { id: number; patient_name: string; phone: string }) {
|
||||||
|
return request.post({ url: '/tcm.prescription/patchPatient', params })
|
||||||
|
}
|
||||||
|
|
||||||
// 删除处方
|
// 删除处方
|
||||||
export function prescriptionDelete(params: { id: number }) {
|
export function prescriptionDelete(params: { id: number }) {
|
||||||
return request.post({ url: '/tcm.prescription/delete', params })
|
return request.post({ url: '/tcm.prescription/delete', params })
|
||||||
|
|||||||
@@ -216,6 +216,15 @@
|
|||||||
<el-button type="primary" link @click="handleView(row)" v-perms="['cf.prescription/read']">
|
<el-button type="primary" link @click="handleView(row)" v-perms="['cf.prescription/read']">
|
||||||
查看
|
查看
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
v-if="Number(row.void_status) !== 1"
|
||||||
|
type="primary"
|
||||||
|
link
|
||||||
|
v-perms="['tcm.prescription/patchPatient']"
|
||||||
|
@click="openPatchPatientDialog(row)"
|
||||||
|
>
|
||||||
|
改姓名手机
|
||||||
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="!Number(row.has_prescription_order) && Number(row.void_status) !== 1"
|
v-if="!Number(row.has_prescription_order) && Number(row.void_status) !== 1"
|
||||||
type="success"
|
type="success"
|
||||||
@@ -980,6 +989,42 @@
|
|||||||
</template>
|
</template>
|
||||||
</el-drawer>
|
</el-drawer>
|
||||||
|
|
||||||
|
<!-- 修正处方笺姓名 / 手机号(zyt_tcm_prescription,写入订单日志) -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="patchPatientVisible"
|
||||||
|
title="修正处方姓名与手机号"
|
||||||
|
width="440px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
destroy-on-close
|
||||||
|
@closed="resetPatchPatientForm"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="patchPatientFormRef"
|
||||||
|
:model="patchPatientForm"
|
||||||
|
:rules="patchPatientRules"
|
||||||
|
label-width="88px"
|
||||||
|
>
|
||||||
|
<el-form-item label="处方编号">
|
||||||
|
<span class="text-gray-700">#{{ patchPatientForm.id || '—' }}</span>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="患者姓名" prop="patient_name">
|
||||||
|
<el-input v-model="patchPatientForm.patient_name" maxlength="50" show-word-limit placeholder="处方笺展示姓名" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="手机号" prop="phone">
|
||||||
|
<el-input v-model="patchPatientForm.phone" maxlength="20" placeholder="处方笺展示手机号" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<p class="text-xs text-gray-500 -mt-2 mb-2">
|
||||||
|
仅更新处方表 patient_name、phone,不改变审核状态;记录写入业务订单操作日志(有关联订单时可在此订单日志中查看)。
|
||||||
|
</p>
|
||||||
|
<template #footer>
|
||||||
|
<el-button @click="patchPatientVisible = false">取消</el-button>
|
||||||
|
<el-button type="primary" :loading="patchPatientSubmitLoading" @click="submitPatchPatient">
|
||||||
|
保存
|
||||||
|
</el-button>
|
||||||
|
</template>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 从消费者处方创建业务订单(zyt_tcm_prescription_order,与支付单 zyt_order 分离) -->
|
<!-- 从消费者处方创建业务订单(zyt_tcm_prescription_order,与支付单 zyt_order 分离) -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="createOrderVisible"
|
v-model="createOrderVisible"
|
||||||
@@ -1444,6 +1489,7 @@ import {
|
|||||||
prescriptionLists,
|
prescriptionLists,
|
||||||
prescriptionAdd,
|
prescriptionAdd,
|
||||||
prescriptionEdit,
|
prescriptionEdit,
|
||||||
|
prescriptionPatchPatient,
|
||||||
prescriptionDelete,
|
prescriptionDelete,
|
||||||
prescriptionAudit,
|
prescriptionAudit,
|
||||||
prescriptionDetail,
|
prescriptionDetail,
|
||||||
@@ -1531,6 +1577,60 @@ const auditTargetId = ref(0)
|
|||||||
const auditRemark = ref('')
|
const auditRemark = ref('')
|
||||||
const auditLoading = ref(false)
|
const auditLoading = ref(false)
|
||||||
|
|
||||||
|
/** 修正处方笺显示用姓名 / 手机号 */
|
||||||
|
const patchPatientVisible = ref(false)
|
||||||
|
const patchPatientSubmitLoading = ref(false)
|
||||||
|
const patchPatientFormRef = ref<FormInstance>()
|
||||||
|
const patchPatientForm = reactive({
|
||||||
|
id: 0,
|
||||||
|
patient_name: '',
|
||||||
|
phone: ''
|
||||||
|
})
|
||||||
|
const patchPatientRules: FormRules = {
|
||||||
|
patient_name: [{ required: true, message: '请输入患者姓名', trigger: 'blur' }],
|
||||||
|
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }]
|
||||||
|
}
|
||||||
|
|
||||||
|
function openPatchPatientDialog(row: Record<string, unknown>) {
|
||||||
|
patchPatientForm.id = Number(row.id) || 0
|
||||||
|
patchPatientForm.patient_name = String(row.patient_name ?? '').trim()
|
||||||
|
patchPatientForm.phone = String(row.phone ?? '').trim()
|
||||||
|
patchPatientVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetPatchPatientForm() {
|
||||||
|
patchPatientForm.id = 0
|
||||||
|
patchPatientForm.patient_name = ''
|
||||||
|
patchPatientForm.phone = ''
|
||||||
|
patchPatientFormRef.value?.clearValidate()
|
||||||
|
}
|
||||||
|
|
||||||
|
async function submitPatchPatient() {
|
||||||
|
const form = patchPatientFormRef.value
|
||||||
|
if (!form) return
|
||||||
|
try {
|
||||||
|
await form.validate()
|
||||||
|
} catch {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
patchPatientSubmitLoading.value = true
|
||||||
|
try {
|
||||||
|
await prescriptionPatchPatient({
|
||||||
|
id: patchPatientForm.id,
|
||||||
|
patient_name: patchPatientForm.patient_name.trim(),
|
||||||
|
phone: patchPatientForm.phone.trim()
|
||||||
|
})
|
||||||
|
feedback.msgSuccess('已保存')
|
||||||
|
patchPatientVisible.value = false
|
||||||
|
getLists()
|
||||||
|
} catch (e: unknown) {
|
||||||
|
const msg = e && typeof e === 'object' && 'msg' in e ? String((e as { msg?: string }).msg) : ''
|
||||||
|
feedback.msgError(msg || '保存失败')
|
||||||
|
} finally {
|
||||||
|
patchPatientSubmitLoading.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** 从消费者处方创建订单 */
|
/** 从消费者处方创建订单 */
|
||||||
const createOrderVisible = ref(false)
|
const createOrderVisible = ref(false)
|
||||||
/** 创建订单分步向导:0 患者与收货 / 1 服务与支付单 / 2 金额与确认 */
|
/** 创建订单分步向导:0 患者与收货 / 1 服务与支付单 / 2 金额与确认 */
|
||||||
|
|||||||
@@ -48,6 +48,26 @@ class PrescriptionController extends BaseAdminController
|
|||||||
return $this->success('编辑成功');
|
return $this->success('编辑成功');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @notes 修正处方患者姓名手机号
|
||||||
|
*/
|
||||||
|
public function patchPatient()
|
||||||
|
{
|
||||||
|
$params = (new PrescriptionValidate())->post()->goCheck('patchPatient');
|
||||||
|
$ok = PrescriptionLogic::patchPatientContact(
|
||||||
|
(int) $params['id'],
|
||||||
|
(string) $params['patient_name'],
|
||||||
|
(string) $params['phone'],
|
||||||
|
(int) $this->adminId,
|
||||||
|
$this->adminInfo
|
||||||
|
);
|
||||||
|
if (!$ok) {
|
||||||
|
return $this->fail(PrescriptionLogic::getError());
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->success('已更新');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 删除处方
|
* @notes 删除处方
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -436,6 +436,88 @@ class PrescriptionLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仅修正处方笺展示用患者姓名与手机号(zyt_tcm_prescription),不改变审核状态与其它字段
|
||||||
|
*/
|
||||||
|
public static function patchPatientContact(int $rxId, string $patientName, string $phone, int $adminId, array $adminInfo): bool
|
||||||
|
{
|
||||||
|
self::$error = '';
|
||||||
|
$prescription = Prescription::find($rxId);
|
||||||
|
if (!$prescription) {
|
||||||
|
self::setError('处方不存在');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!self::canViewPrescription($prescription, $adminId, $adminInfo)) {
|
||||||
|
self::setError('无权限修改此处方');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$patientName = trim($patientName);
|
||||||
|
$phone = trim($phone);
|
||||||
|
if ($patientName === '') {
|
||||||
|
self::setError('患者姓名不能为空');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (mb_strlen($patientName) > 50) {
|
||||||
|
self::setError('患者姓名过长');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ($phone === '') {
|
||||||
|
self::setError('手机号不能为空');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (strlen($phone) > 20) {
|
||||||
|
self::setError('手机号过长');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$oldName = trim((string) ($prescription->patient_name ?? ''));
|
||||||
|
$oldPhone = trim((string) ($prescription->phone ?? ''));
|
||||||
|
|
||||||
|
if ($oldName === $patientName && $oldPhone === $phone) {
|
||||||
|
self::setError('信息未变更');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$prescription->save([
|
||||||
|
'patient_name' => $patientName,
|
||||||
|
'phone' => $phone,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$latestPo = PrescriptionOrder::where('prescription_id', $rxId)
|
||||||
|
->whereNull('delete_time')
|
||||||
|
->order('id', 'desc')
|
||||||
|
->find();
|
||||||
|
$logOrderId = $latestPo ? (int) $latestPo->id : 0;
|
||||||
|
|
||||||
|
$nameFrom = $oldName === '' ? '—' : $oldName;
|
||||||
|
$phoneFrom = $oldPhone === '' ? '—' : $oldPhone;
|
||||||
|
$summary = sprintf(
|
||||||
|
'处方 #%d:患者姓名「%s」→「%s」,手机「%s」→「%s」',
|
||||||
|
$rxId,
|
||||||
|
$nameFrom,
|
||||||
|
$patientName,
|
||||||
|
$phoneFrom,
|
||||||
|
$phone
|
||||||
|
);
|
||||||
|
PrescriptionOrderLogic::appendRxPatientPatchLog($logOrderId, $adminId, $adminInfo, $summary);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
self::setError($e->getMessage());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除处方
|
* 删除处方
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1097,7 +1097,7 @@ class PrescriptionOrderLogic
|
|||||||
$phoneFrom,
|
$phoneFrom,
|
||||||
$phone
|
$phone
|
||||||
);
|
);
|
||||||
self::writeLog($prescriptionOrderId, $adminId, $adminInfo, 'patch_rx_patient', $summary);
|
self::appendRxPatientPatchLog($prescriptionOrderId, $adminId, $adminInfo, $summary);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -3248,4 +3248,14 @@ class PrescriptionOrderLogic
|
|||||||
// 忽略日志写入错误
|
// 忽略日志写入错误
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处方患者姓名/手机号修正日志(写入 zyt_tcm_prescription_order_log,与 patchPrescriptionPatient 同源)
|
||||||
|
*
|
||||||
|
* @param int $prescriptionOrderId 无关联订单时可传 0(若库表禁止则可能静默失败)
|
||||||
|
*/
|
||||||
|
public static function appendRxPatientPatchLog(int $prescriptionOrderId, int $adminId, array $adminInfo, string $summary): void
|
||||||
|
{
|
||||||
|
self::writeLog($prescriptionOrderId, $adminId, $adminInfo, 'patch_rx_patient', $summary);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class PrescriptionValidate extends BaseValidate
|
|||||||
'appointment_id' => 'number',
|
'appointment_id' => 'number',
|
||||||
'dosage_bag_count' => 'integer|between:1,5',
|
'dosage_bag_count' => 'integer|between:1,5',
|
||||||
'patient_name' => 'require',
|
'patient_name' => 'require',
|
||||||
|
'phone' => 'require|max:20',
|
||||||
'clinical_diagnosis' => 'require',
|
'clinical_diagnosis' => 'require',
|
||||||
'herbs' => 'require|array',
|
'herbs' => 'require|array',
|
||||||
'action' => 'require|in:approve,reject',
|
'action' => 'require|in:approve,reject',
|
||||||
@@ -24,6 +25,8 @@ class PrescriptionValidate extends BaseValidate
|
|||||||
'dosage_bag_count.integer' => '用量袋数必须为整数',
|
'dosage_bag_count.integer' => '用量袋数必须为整数',
|
||||||
'dosage_bag_count.between' => '用量袋数必须在1到5袋之间',
|
'dosage_bag_count.between' => '用量袋数必须在1到5袋之间',
|
||||||
'patient_name.require' => '患者姓名不能为空',
|
'patient_name.require' => '患者姓名不能为空',
|
||||||
|
'phone.require' => '手机号不能为空',
|
||||||
|
'phone.max' => '手机号过长',
|
||||||
'clinical_diagnosis.require' => '临床诊断不能为空',
|
'clinical_diagnosis.require' => '临床诊断不能为空',
|
||||||
'herbs.require' => '请添加中药',
|
'herbs.require' => '请添加中药',
|
||||||
];
|
];
|
||||||
@@ -63,6 +66,11 @@ class PrescriptionValidate extends BaseValidate
|
|||||||
return $this->only(['id']);
|
return $this->only(['id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function scenePatchPatient()
|
||||||
|
{
|
||||||
|
return $this->only(['id', 'patient_name', 'phone']);
|
||||||
|
}
|
||||||
|
|
||||||
public function sceneAudit()
|
public function sceneAudit()
|
||||||
{
|
{
|
||||||
return $this->only(['id', 'action', 'remark']);
|
return $this->only(['id', 'action', 'remark']);
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
-- 消费者处方列表:修正处方笺姓名 / 手机号(接口 tcm.prescription/patchPatient)
|
||||||
|
-- 执行前确认表前缀为 zyt_;若已有相同 perms 则跳过。
|
||||||
|
|
||||||
|
SET @cf_rx_menu_id := (
|
||||||
|
SELECT id FROM zyt_system_menu
|
||||||
|
WHERE type = 'C'
|
||||||
|
AND (
|
||||||
|
component = 'consumer/prescription/index'
|
||||||
|
OR component LIKE '%consumer/prescription/index%'
|
||||||
|
)
|
||||||
|
LIMIT 1
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO zyt_system_menu (
|
||||||
|
pid, type, name, icon, sort, perms, paths, component,
|
||||||
|
selected, params, is_cache, is_show, is_disable, create_time, update_time
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
@cf_rx_menu_id, 'A', '修正处方患者姓名手机', '', 53,
|
||||||
|
'tcm.prescription/patchPatient', '', '',
|
||||||
|
'', '', 0, 1, 0, UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
|
||||||
|
FROM DUAL
|
||||||
|
WHERE @cf_rx_menu_id IS NOT NULL
|
||||||
|
AND NOT EXISTS (SELECT 1 FROM zyt_system_menu WHERE perms = 'tcm.prescription/patchPatient');
|
||||||
Reference in New Issue
Block a user