更新
This commit is contained in:
@@ -319,8 +319,13 @@ 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 }) {
|
export function prescriptionPatchPatient(params: {
|
||||||
|
id: number
|
||||||
|
patient_name: string
|
||||||
|
phone: string
|
||||||
|
gender: number
|
||||||
|
}) {
|
||||||
return request.post({ url: '/tcm.prescription/patchPatient', params })
|
return request.post({ url: '/tcm.prescription/patchPatient', params })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -992,7 +992,7 @@
|
|||||||
<!-- 修正处方笺姓名 / 手机号(zyt_tcm_prescription,写入订单日志) -->
|
<!-- 修正处方笺姓名 / 手机号(zyt_tcm_prescription,写入订单日志) -->
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="patchPatientVisible"
|
v-model="patchPatientVisible"
|
||||||
title="修正处方姓名与手机号"
|
title="修正姓名、性别与手机号"
|
||||||
width="440px"
|
width="440px"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
destroy-on-close
|
destroy-on-close
|
||||||
@@ -1010,12 +1010,18 @@
|
|||||||
<el-form-item label="患者姓名" prop="patient_name">
|
<el-form-item label="患者姓名" prop="patient_name">
|
||||||
<el-input v-model="patchPatientForm.patient_name" maxlength="50" show-word-limit placeholder="处方笺展示姓名" />
|
<el-input v-model="patchPatientForm.patient_name" maxlength="50" show-word-limit placeholder="处方笺展示姓名" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
<el-form-item label="性别" prop="gender">
|
||||||
|
<el-radio-group v-model="patchPatientForm.gender">
|
||||||
|
<el-radio :label="1">男</el-radio>
|
||||||
|
<el-radio :label="0">女</el-radio>
|
||||||
|
</el-radio-group>
|
||||||
|
</el-form-item>
|
||||||
<el-form-item label="手机号" prop="phone">
|
<el-form-item label="手机号" prop="phone">
|
||||||
<el-input v-model="patchPatientForm.phone" maxlength="20" placeholder="处方笺展示手机号" />
|
<el-input v-model="patchPatientForm.phone" maxlength="20" placeholder="处方笺展示手机号" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
<p class="text-xs text-gray-500 -mt-2 mb-2">
|
<p class="text-xs text-gray-500 -mt-2 mb-2">
|
||||||
仅更新处方表 patient_name、phone,不改变审核状态;记录写入业务订单操作日志(有关联订单时可在此订单日志中查看)。
|
仅更新处方表 patient_name、gender、phone,不改变审核状态;记录写入业务订单操作日志(有关联订单时可在此订单日志中查看)。
|
||||||
</p>
|
</p>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="patchPatientVisible = false">取消</el-button>
|
<el-button @click="patchPatientVisible = false">取消</el-button>
|
||||||
@@ -1584,16 +1590,20 @@ const patchPatientFormRef = ref<FormInstance>()
|
|||||||
const patchPatientForm = reactive({
|
const patchPatientForm = reactive({
|
||||||
id: 0,
|
id: 0,
|
||||||
patient_name: '',
|
patient_name: '',
|
||||||
|
gender: 1 as 0 | 1,
|
||||||
phone: ''
|
phone: ''
|
||||||
})
|
})
|
||||||
const patchPatientRules: FormRules = {
|
const patchPatientRules: FormRules = {
|
||||||
patient_name: [{ required: true, message: '请输入患者姓名', trigger: 'blur' }],
|
patient_name: [{ required: true, message: '请输入患者姓名', trigger: 'blur' }],
|
||||||
|
gender: [{ required: true, message: '请选择性别', trigger: 'change' }],
|
||||||
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }]
|
phone: [{ required: true, message: '请输入手机号', trigger: 'blur' }]
|
||||||
}
|
}
|
||||||
|
|
||||||
function openPatchPatientDialog(row: Record<string, unknown>) {
|
function openPatchPatientDialog(row: Record<string, unknown>) {
|
||||||
patchPatientForm.id = Number(row.id) || 0
|
patchPatientForm.id = Number(row.id) || 0
|
||||||
patchPatientForm.patient_name = String(row.patient_name ?? '').trim()
|
patchPatientForm.patient_name = String(row.patient_name ?? '').trim()
|
||||||
|
const g = Number(row.gender)
|
||||||
|
patchPatientForm.gender = g === 0 || g === 1 ? (g as 0 | 1) : 1
|
||||||
patchPatientForm.phone = String(row.phone ?? '').trim()
|
patchPatientForm.phone = String(row.phone ?? '').trim()
|
||||||
patchPatientVisible.value = true
|
patchPatientVisible.value = true
|
||||||
}
|
}
|
||||||
@@ -1601,6 +1611,7 @@ function openPatchPatientDialog(row: Record<string, unknown>) {
|
|||||||
function resetPatchPatientForm() {
|
function resetPatchPatientForm() {
|
||||||
patchPatientForm.id = 0
|
patchPatientForm.id = 0
|
||||||
patchPatientForm.patient_name = ''
|
patchPatientForm.patient_name = ''
|
||||||
|
patchPatientForm.gender = 1
|
||||||
patchPatientForm.phone = ''
|
patchPatientForm.phone = ''
|
||||||
patchPatientFormRef.value?.clearValidate()
|
patchPatientFormRef.value?.clearValidate()
|
||||||
}
|
}
|
||||||
@@ -1618,7 +1629,8 @@ async function submitPatchPatient() {
|
|||||||
await prescriptionPatchPatient({
|
await prescriptionPatchPatient({
|
||||||
id: patchPatientForm.id,
|
id: patchPatientForm.id,
|
||||||
patient_name: patchPatientForm.patient_name.trim(),
|
patient_name: patchPatientForm.patient_name.trim(),
|
||||||
phone: patchPatientForm.phone.trim()
|
phone: patchPatientForm.phone.trim(),
|
||||||
|
gender: patchPatientForm.gender
|
||||||
})
|
})
|
||||||
feedback.msgSuccess('已保存')
|
feedback.msgSuccess('已保存')
|
||||||
patchPatientVisible.value = false
|
patchPatientVisible.value = false
|
||||||
|
|||||||
@@ -495,7 +495,7 @@
|
|||||||
>修改单号</el-button>
|
>修改单号</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="canShipRow(row)"
|
v-if="canShipRow(row)"
|
||||||
v-perms="['tcm.prescriptionOrder/ship']"
|
v-perms="['tcm.prescriptionOrder/ship', 'tcm.prescriptionOrder/submitGancaoRecipel']"
|
||||||
type="primary"
|
type="primary"
|
||||||
link
|
link
|
||||||
@click="openShip(row)"
|
@click="openShip(row)"
|
||||||
@@ -606,7 +606,7 @@
|
|||||||
</el-button>
|
</el-button>
|
||||||
<el-button
|
<el-button
|
||||||
v-if="canShipRow(detailData)"
|
v-if="canShipRow(detailData)"
|
||||||
v-perms="['tcm.prescriptionOrder/ship']"
|
v-perms="['tcm.prescriptionOrder/ship', 'tcm.prescriptionOrder/submitGancaoRecipel']"
|
||||||
type="primary"
|
type="primary"
|
||||||
size="small"
|
size="small"
|
||||||
plain
|
plain
|
||||||
@@ -1917,6 +1917,15 @@
|
|||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
>
|
>
|
||||||
<el-alert
|
<el-alert
|
||||||
|
v-if="shipForm.ship_mode === 'gancao'"
|
||||||
|
title="甘草药方由甘草侧履约配送,无需填写快递单号。点击下方按钮将提交处方至甘草药管家(与「上传药方」相同)。"
|
||||||
|
type="info"
|
||||||
|
:closable="false"
|
||||||
|
show-icon
|
||||||
|
class="mb-4"
|
||||||
|
/>
|
||||||
|
<el-alert
|
||||||
|
v-else
|
||||||
title="确认后订单状态将变更为「已发货」,请核对快递信息无误。"
|
title="确认后订单状态将变更为「已发货」,请核对快递信息无误。"
|
||||||
type="warning"
|
type="warning"
|
||||||
:closable="false"
|
:closable="false"
|
||||||
@@ -1930,27 +1939,33 @@
|
|||||||
<el-radio label="direct">药房直发</el-radio>
|
<el-radio label="direct">药房直发</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="承运商">
|
<template v-if="shipForm.ship_mode === 'direct'">
|
||||||
<el-select v-model="shipForm.express_company" class="w-full">
|
<el-form-item label="承运商">
|
||||||
<el-option label="自动识别" value="auto" />
|
<el-select v-model="shipForm.express_company" class="w-full">
|
||||||
<el-option label="顺丰速运" value="sf" />
|
<el-option label="自动识别" value="auto" />
|
||||||
<el-option label="京东快递" value="jd" />
|
<el-option label="顺丰速运" value="sf" />
|
||||||
<el-option label="极兔速递" value="jt" />
|
<el-option label="京东快递" value="jd" />
|
||||||
</el-select>
|
<el-option label="极兔速递" value="jt" />
|
||||||
</el-form-item>
|
</el-select>
|
||||||
<el-form-item label="快递单号">
|
</el-form-item>
|
||||||
<el-input
|
<el-form-item label="快递单号">
|
||||||
v-model="shipForm.tracking_number"
|
<el-input
|
||||||
maxlength="80"
|
v-model="shipForm.tracking_number"
|
||||||
placeholder="请输入快递单号"
|
maxlength="80"
|
||||||
clearable
|
placeholder="请输入快递单号"
|
||||||
/>
|
clearable
|
||||||
</el-form-item>
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</template>
|
||||||
</el-form>
|
</el-form>
|
||||||
<template #footer>
|
<template #footer>
|
||||||
<el-button @click="shipVisible = false">取消</el-button>
|
<el-button @click="shipVisible = false">取消</el-button>
|
||||||
<el-button type="primary" :loading="shipSaving" @click="submitShip">
|
<el-button
|
||||||
确认发货
|
type="primary"
|
||||||
|
:loading="shipSaving || (shipForm.ship_mode === 'gancao' && gancaoSubmitId === shipRowId)"
|
||||||
|
@click="submitShip"
|
||||||
|
>
|
||||||
|
{{ shipForm.ship_mode === 'gancao' ? '确认并上传药方' : '确认发货' }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
@@ -2589,6 +2604,7 @@ import { getDictData } from '@/api/app'
|
|||||||
import { deptAll } from '@/api/org/department'
|
import { deptAll } from '@/api/org/department'
|
||||||
import { usePaging } from '@/hooks/usePaging'
|
import { usePaging } from '@/hooks/usePaging'
|
||||||
import feedback from '@/utils/feedback'
|
import feedback from '@/utils/feedback'
|
||||||
|
import { hasPermission } from '@/utils/perm'
|
||||||
import { ElMessageBox } from 'element-plus'
|
import { ElMessageBox } from 'element-plus'
|
||||||
import type { FormInstance, FormRules } from 'element-plus'
|
import type { FormInstance, FormRules } from 'element-plus'
|
||||||
import useUserStore from '@/stores/modules/user'
|
import useUserStore from '@/stores/modules/user'
|
||||||
@@ -4747,13 +4763,31 @@ const shipForm = reactive({
|
|||||||
|
|
||||||
function openShip(row: { id: number; express_company?: unknown; tracking_number?: unknown; ship_mode?: unknown }) {
|
function openShip(row: { id: number; express_company?: unknown; tracking_number?: unknown; ship_mode?: unknown }) {
|
||||||
shipRowId.value = row.id
|
shipRowId.value = row.id
|
||||||
shipForm.ship_mode = String(row.ship_mode || 'gancao') || 'gancao'
|
const tn = String(row.tracking_number ?? '').trim()
|
||||||
|
const sm = String(row.ship_mode ?? '').trim()
|
||||||
|
if (sm === 'direct' || sm === 'gancao') {
|
||||||
|
shipForm.ship_mode = sm
|
||||||
|
} else if (tn) {
|
||||||
|
// 已填单号时默认走药房直发(如快捷填单号后「确认发货」)
|
||||||
|
shipForm.ship_mode = 'direct'
|
||||||
|
} else {
|
||||||
|
shipForm.ship_mode = 'gancao'
|
||||||
|
}
|
||||||
shipForm.express_company = String(row.express_company || 'auto') || 'auto'
|
shipForm.express_company = String(row.express_company || 'auto') || 'auto'
|
||||||
shipForm.tracking_number = String(row.tracking_number || '')
|
shipForm.tracking_number = String(row.tracking_number || '')
|
||||||
shipVisible.value = true
|
shipVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
async function submitShip() {
|
async function submitShip() {
|
||||||
|
if (shipForm.ship_mode !== 'direct') {
|
||||||
|
if (!hasPermission(['tcm.prescriptionOrder/submitGancaoRecipel'])) {
|
||||||
|
feedback.msgError('暂无上传甘草药方权限,请改用「药房直发」并填写快递单号,或联系管理员开通权限')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
shipVisible.value = false
|
||||||
|
await confirmSubmitGancaoRecipel({ id: shipRowId.value })
|
||||||
|
return
|
||||||
|
}
|
||||||
if (!shipForm.tracking_number.trim()) {
|
if (!shipForm.tracking_number.trim()) {
|
||||||
feedback.msgError('请先填写快递单号再确认发货')
|
feedback.msgError('请先填写快递单号再确认发货')
|
||||||
return
|
return
|
||||||
@@ -4762,7 +4796,7 @@ async function submitShip() {
|
|||||||
try {
|
try {
|
||||||
await prescriptionOrderShip({
|
await prescriptionOrderShip({
|
||||||
id: shipRowId.value,
|
id: shipRowId.value,
|
||||||
ship_mode: shipForm.ship_mode === 'direct' ? 'direct' : 'gancao',
|
ship_mode: 'direct',
|
||||||
express_company: shipForm.express_company || 'auto',
|
express_company: shipForm.express_company || 'auto',
|
||||||
tracking_number: shipForm.tracking_number.trim()
|
tracking_number: shipForm.tracking_number.trim()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class PrescriptionController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @notes 修正处方患者姓名手机号
|
* @notes 修正处方患者姓名手机性别
|
||||||
*/
|
*/
|
||||||
public function patchPatient()
|
public function patchPatient()
|
||||||
{
|
{
|
||||||
@@ -58,6 +58,7 @@ class PrescriptionController extends BaseAdminController
|
|||||||
(int) $params['id'],
|
(int) $params['id'],
|
||||||
(string) $params['patient_name'],
|
(string) $params['patient_name'],
|
||||||
(string) $params['phone'],
|
(string) $params['phone'],
|
||||||
|
(int) $params['gender'],
|
||||||
(int) $this->adminId,
|
(int) $this->adminId,
|
||||||
$this->adminInfo
|
$this->adminInfo
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
|||||||
if ($prescriptionIds !== []) {
|
if ($prescriptionIds !== []) {
|
||||||
$prescriptions = \app\common\model\tcm\Prescription::whereIn('id', $prescriptionIds)
|
$prescriptions = \app\common\model\tcm\Prescription::whereIn('id', $prescriptionIds)
|
||||||
->whereNull('delete_time')
|
->whereNull('delete_time')
|
||||||
->field(['id', 'creator_id', 'doctor_name', 'phone'])
|
->field(['id', 'creator_id', 'doctor_name', 'phone', 'assistant_id'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
$doctorIds = [];
|
$doctorIds = [];
|
||||||
@@ -508,6 +508,7 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
|||||||
'doctor_id' => $doctorId,
|
'doctor_id' => $doctorId,
|
||||||
'doctor_name' => $doctorName,
|
'doctor_name' => $doctorName,
|
||||||
'phone' => (string) ($rx['phone'] ?? ''),
|
'phone' => (string) ($rx['phone'] ?? ''),
|
||||||
|
'assistant_id' => (int) ($rx['assistant_id'] ?? 0),
|
||||||
];
|
];
|
||||||
if ($doctorId > 0) {
|
if ($doctorId > 0) {
|
||||||
$doctorIds[] = $doctorId;
|
$doctorIds[] = $doctorId;
|
||||||
@@ -533,7 +534,20 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
|||||||
if ($diagIdsForAssist !== []) {
|
if ($diagIdsForAssist !== []) {
|
||||||
$assistantByDiag = Diagnosis::whereIn('id', $diagIdsForAssist)->whereNull('delete_time')->column('assistant_id', 'id');
|
$assistantByDiag = Diagnosis::whereIn('id', $diagIdsForAssist)->whereNull('delete_time')->column('assistant_id', 'id');
|
||||||
}
|
}
|
||||||
$assistantIds = array_values(array_unique(array_filter(array_map('intval', array_values($assistantByDiag)))));
|
$assistantIds = [];
|
||||||
|
foreach (array_values($assistantByDiag) as $v) {
|
||||||
|
$vid = (int) $v;
|
||||||
|
if ($vid > 0) {
|
||||||
|
$assistantIds[] = $vid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($prescriptionCreators as $pc) {
|
||||||
|
$aid = (int) ($pc['assistant_id'] ?? 0);
|
||||||
|
if ($aid > 0) {
|
||||||
|
$assistantIds[] = $aid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$assistantIds = array_values(array_unique($assistantIds));
|
||||||
$assistantNames = $assistantIds !== []
|
$assistantNames = $assistantIds !== []
|
||||||
? \app\common\model\auth\Admin::whereIn('id', $assistantIds)->column('name', 'id')
|
? \app\common\model\auth\Admin::whereIn('id', $assistantIds)->column('name', 'id')
|
||||||
: [];
|
: [];
|
||||||
@@ -558,16 +572,18 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
|||||||
$creatorId = (int) ($item['creator_id'] ?? 0);
|
$creatorId = (int) ($item['creator_id'] ?? 0);
|
||||||
$item['creator_name'] = $creatorId > 0 ? ($creatorNames[$creatorId] ?? '') : '';
|
$item['creator_name'] = $creatorId > 0 ? ($creatorNames[$creatorId] ?? '') : '';
|
||||||
|
|
||||||
// 添加医助(来自诊单 assistant_id)
|
// 医助:与处方列表一致优先关联处方 assistant_id,否则诊单 assistant_id(见 PrescriptionOrderLogic::resolveAssistantAdminIdForPrescriptionOrderRow)
|
||||||
$diagIdForAssist = (int) ($item['diagnosis_id'] ?? 0);
|
$diagIdForAssist = (int) ($item['diagnosis_id'] ?? 0);
|
||||||
$assistantIdForItem = (int) ($assistantByDiag[$diagIdForAssist] ?? 0);
|
$diagAst = (int) ($assistantByDiag[$diagIdForAssist] ?? 0);
|
||||||
|
$rxId = (int) ($item['prescription_id'] ?? 0);
|
||||||
|
$rxAst = $rxId > 0 ? (int) (($prescriptionCreators[$rxId] ?? [])['assistant_id'] ?? 0) : 0;
|
||||||
|
$assistantIdForItem = PrescriptionOrderLogic::resolveAssistantAdminIdForPrescriptionOrderRow($rxAst, $diagAst);
|
||||||
$item['assistant_id'] = $assistantIdForItem;
|
$item['assistant_id'] = $assistantIdForItem;
|
||||||
$item['assistant_name'] = $assistantIdForItem > 0
|
$item['assistant_name'] = $assistantIdForItem > 0
|
||||||
? ($assistantNames[$assistantIdForItem] ?? '')
|
? ($assistantNames[$assistantIdForItem] ?? '')
|
||||||
: '';
|
: '';
|
||||||
|
|
||||||
// 添加开方人姓名、处方登记手机(与业务订单收货手机比对用)
|
// 添加开方人姓名、处方登记手机(与业务订单收货手机比对用)
|
||||||
$rxId = (int) ($item['prescription_id'] ?? 0);
|
|
||||||
$item['doctor_name'] = $rxId > 0 ? ($prescriptionCreators[$rxId]['doctor_name'] ?? '') : '';
|
$item['doctor_name'] = $rxId > 0 ? ($prescriptionCreators[$rxId]['doctor_name'] ?? '') : '';
|
||||||
$item['prescription_phone'] = $rxId > 0 ? ($prescriptionCreators[$rxId]['phone'] ?? '') : '';
|
$item['prescription_phone'] = $rxId > 0 ? ($prescriptionCreators[$rxId]['phone'] ?? '') : '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -437,9 +437,9 @@ class PrescriptionLogic
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 仅修正处方笺展示用患者姓名与手机号(zyt_tcm_prescription),不改变审核状态与其它字段
|
* 仅修正处方笺展示用患者姓名、手机号与性别(zyt_tcm_prescription),不改变审核状态与其它字段
|
||||||
*/
|
*/
|
||||||
public static function patchPatientContact(int $rxId, string $patientName, string $phone, int $adminId, array $adminInfo): bool
|
public static function patchPatientContact(int $rxId, string $patientName, string $phone, int $gender, int $adminId, array $adminInfo): bool
|
||||||
{
|
{
|
||||||
self::$error = '';
|
self::$error = '';
|
||||||
$prescription = Prescription::find($rxId);
|
$prescription = Prescription::find($rxId);
|
||||||
@@ -476,20 +476,38 @@ class PrescriptionLogic
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!in_array($gender, [0, 1], true)) {
|
||||||
|
self::setError('性别无效');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$oldName = trim((string) ($prescription->patient_name ?? ''));
|
$oldName = trim((string) ($prescription->patient_name ?? ''));
|
||||||
$oldPhone = trim((string) ($prescription->phone ?? ''));
|
$oldPhone = trim((string) ($prescription->phone ?? ''));
|
||||||
|
$oldGender = (int) ($prescription->gender ?? 0);
|
||||||
|
|
||||||
if ($oldName === $patientName && $oldPhone === $phone) {
|
if ($oldName === $patientName && $oldPhone === $phone && $oldGender === $gender) {
|
||||||
self::setError('信息未变更');
|
self::setError('信息未变更');
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$genderText = static function (int $g): string {
|
||||||
|
if ($g === 1) {
|
||||||
|
return '男';
|
||||||
|
}
|
||||||
|
if ($g === 0) {
|
||||||
|
return '女';
|
||||||
|
}
|
||||||
|
|
||||||
|
return '未知';
|
||||||
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$prescription->save([
|
$prescription->save([
|
||||||
'patient_name' => $patientName,
|
'patient_name' => $patientName,
|
||||||
'phone' => $phone,
|
'phone' => $phone,
|
||||||
|
'gender' => $gender,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$latestPo = PrescriptionOrder::where('prescription_id', $rxId)
|
$latestPo = PrescriptionOrder::where('prescription_id', $rxId)
|
||||||
@@ -500,13 +518,17 @@ class PrescriptionLogic
|
|||||||
|
|
||||||
$nameFrom = $oldName === '' ? '—' : $oldName;
|
$nameFrom = $oldName === '' ? '—' : $oldName;
|
||||||
$phoneFrom = $oldPhone === '' ? '—' : $oldPhone;
|
$phoneFrom = $oldPhone === '' ? '—' : $oldPhone;
|
||||||
|
$genderFrom = $genderText($oldGender);
|
||||||
|
$genderTo = $genderText($gender);
|
||||||
$summary = sprintf(
|
$summary = sprintf(
|
||||||
'处方 #%d:患者姓名「%s」→「%s」,手机「%s」→「%s」',
|
'处方 #%d:患者姓名「%s」→「%s」,手机「%s」→「%s」,性别「%s」→「%s」',
|
||||||
$rxId,
|
$rxId,
|
||||||
$nameFrom,
|
$nameFrom,
|
||||||
$patientName,
|
$patientName,
|
||||||
$phoneFrom,
|
$phoneFrom,
|
||||||
$phone
|
$phone,
|
||||||
|
$genderFrom,
|
||||||
|
$genderTo
|
||||||
);
|
);
|
||||||
PrescriptionOrderLogic::appendRxPatientPatchLog($logOrderId, $adminId, $adminInfo, $summary);
|
PrescriptionOrderLogic::appendRxPatientPatchLog($logOrderId, $adminId, $adminInfo, $summary);
|
||||||
|
|
||||||
|
|||||||
@@ -2486,6 +2486,25 @@ class PrescriptionOrderLogic
|
|||||||
return $m[$fs] ?? ('状态' . (string) $fs);
|
return $m[$fs] ?? ('状态' . (string) $fs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务订单列表/导出:「诊单医助」admin id。
|
||||||
|
* 与 {@see PrescriptionLists} 一致优先 {@see Prescription::$assistant_id}(开方时从诊单快照到处方表);
|
||||||
|
* 为 0 时再取诊单当前 {@see Diagnosis::$assistant_id}(兼容历史处方或未写入快照列的数据)。
|
||||||
|
*/
|
||||||
|
public static function resolveAssistantAdminIdForPrescriptionOrderRow(
|
||||||
|
int $prescriptionAssistantId,
|
||||||
|
int $diagnosisAssistantId
|
||||||
|
): int {
|
||||||
|
if ($prescriptionAssistantId > 0) {
|
||||||
|
return $prescriptionAssistantId;
|
||||||
|
}
|
||||||
|
if ($diagnosisAssistantId > 0) {
|
||||||
|
return $diagnosisAssistantId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 导出用:诊单医助在 admin_dept 中的部门路径(多部门「;」、路径内「 / 」)
|
* 导出用:诊单医助在 admin_dept 中的部门路径(多部门「;」、路径内「 / 」)
|
||||||
*/
|
*/
|
||||||
@@ -2656,7 +2675,7 @@ class PrescriptionOrderLogic
|
|||||||
$rxById = [];
|
$rxById = [];
|
||||||
if ($rxIdList !== []) {
|
if ($rxIdList !== []) {
|
||||||
$rxRows = Prescription::whereIn('id', $rxIdList)->whereNull('delete_time')
|
$rxRows = Prescription::whereIn('id', $rxIdList)->whereNull('delete_time')
|
||||||
->field(['id', 'prescription_type', 'need_decoction', 'dose_unit'])
|
->field(['id', 'prescription_type', 'need_decoction', 'dose_unit', 'assistant_id'])
|
||||||
->select()
|
->select()
|
||||||
->toArray();
|
->toArray();
|
||||||
foreach ($rxRows as $xr) {
|
foreach ($rxRows as $xr) {
|
||||||
@@ -2697,13 +2716,17 @@ class PrescriptionOrderLogic
|
|||||||
|
|
||||||
$diagId = (int) ($item['diagnosis_id'] ?? 0);
|
$diagId = (int) ($item['diagnosis_id'] ?? 0);
|
||||||
$dg = $diagById[$diagId] ?? null;
|
$dg = $diagById[$diagId] ?? null;
|
||||||
|
$rxId = (int) ($item['prescription_id'] ?? 0);
|
||||||
|
$rx = $rxById[$rxId] ?? [];
|
||||||
$item['export_patient_name'] = \is_array($dg) ? (string) ($dg['patient_name'] ?? '') : '';
|
$item['export_patient_name'] = \is_array($dg) ? (string) ($dg['patient_name'] ?? '') : '';
|
||||||
if (\is_array($dg)) {
|
if (\is_array($dg)) {
|
||||||
$g = (int) ($dg['gender'] ?? 0);
|
$g = (int) ($dg['gender'] ?? 0);
|
||||||
$item['export_patient_gender'] = $g === 1 ? '男' : '女';
|
$item['export_patient_gender'] = $g === 1 ? '男' : '女';
|
||||||
$item['export_patient_age'] = (string) ($dg['age'] ?? '');
|
$item['export_patient_age'] = (string) ($dg['age'] ?? '');
|
||||||
$item['export_patient_phone'] = (string) ($dg['phone'] ?? '');
|
$item['export_patient_phone'] = (string) ($dg['phone'] ?? '');
|
||||||
$astId = (int) ($dg['assistant_id'] ?? 0);
|
$rxAst = \is_array($rx) ? (int) ($rx['assistant_id'] ?? 0) : 0;
|
||||||
|
$diagAst = (int) ($dg['assistant_id'] ?? 0);
|
||||||
|
$astId = self::resolveAssistantAdminIdForPrescriptionOrderRow($rxAst, $diagAst);
|
||||||
if ($astId > 0) {
|
if ($astId > 0) {
|
||||||
if (!isset($assistantDeptCache[$astId])) {
|
if (!isset($assistantDeptCache[$astId])) {
|
||||||
$assistantDeptCache[$astId] = self::formatAssistantDeptPathForExport($astId);
|
$assistantDeptCache[$astId] = self::formatAssistantDeptPathForExport($astId);
|
||||||
@@ -2719,8 +2742,6 @@ class PrescriptionOrderLogic
|
|||||||
$item['export_assistant_dept'] = '';
|
$item['export_assistant_dept'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rxId = (int) ($item['prescription_id'] ?? 0);
|
|
||||||
$rx = $rxById[$rxId] ?? [];
|
|
||||||
$item['export_medication_form'] = self::formatMedicationFormForExport(\is_array($rx) ? $rx : []);
|
$item['export_medication_form'] = self::formatMedicationFormForExport(\is_array($rx) ? $rx : []);
|
||||||
|
|
||||||
$item['export_channel'] = (string) ($item['service_channel'] ?? '');
|
$item['export_channel'] = (string) ($item['service_channel'] ?? '');
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ class PrescriptionValidate extends BaseValidate
|
|||||||
'dosage_bag_count' => 'integer|between:1,5',
|
'dosage_bag_count' => 'integer|between:1,5',
|
||||||
'patient_name' => 'require',
|
'patient_name' => 'require',
|
||||||
'phone' => 'require|max:20',
|
'phone' => 'require|max:20',
|
||||||
|
'gender' => 'require|in:0,1',
|
||||||
'clinical_diagnosis' => 'require',
|
'clinical_diagnosis' => 'require',
|
||||||
'herbs' => 'require|array',
|
'herbs' => 'require|array',
|
||||||
'action' => 'require|in:approve,reject',
|
'action' => 'require|in:approve,reject',
|
||||||
@@ -27,6 +28,8 @@ class PrescriptionValidate extends BaseValidate
|
|||||||
'patient_name.require' => '患者姓名不能为空',
|
'patient_name.require' => '患者姓名不能为空',
|
||||||
'phone.require' => '手机号不能为空',
|
'phone.require' => '手机号不能为空',
|
||||||
'phone.max' => '手机号过长',
|
'phone.max' => '手机号过长',
|
||||||
|
'gender.require' => '请选择性别',
|
||||||
|
'gender.in' => '性别无效',
|
||||||
'clinical_diagnosis.require' => '临床诊断不能为空',
|
'clinical_diagnosis.require' => '临床诊断不能为空',
|
||||||
'herbs.require' => '请添加中药',
|
'herbs.require' => '请添加中药',
|
||||||
];
|
];
|
||||||
@@ -68,7 +71,7 @@ class PrescriptionValidate extends BaseValidate
|
|||||||
|
|
||||||
public function scenePatchPatient()
|
public function scenePatchPatient()
|
||||||
{
|
{
|
||||||
return $this->only(['id', 'patient_name', 'phone']);
|
return $this->only(['id', 'patient_name', 'phone', 'gender']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sceneAudit()
|
public function sceneAudit()
|
||||||
|
|||||||
Reference in New Issue
Block a user