更新
This commit is contained in:
@@ -495,7 +495,7 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
||||
if ($prescriptionIds !== []) {
|
||||
$prescriptions = \app\common\model\tcm\Prescription::whereIn('id', $prescriptionIds)
|
||||
->whereNull('delete_time')
|
||||
->field(['id', 'creator_id', 'doctor_name', 'phone'])
|
||||
->field(['id', 'creator_id', 'doctor_name', 'phone', 'assistant_id'])
|
||||
->select()
|
||||
->toArray();
|
||||
$doctorIds = [];
|
||||
@@ -508,6 +508,7 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
||||
'doctor_id' => $doctorId,
|
||||
'doctor_name' => $doctorName,
|
||||
'phone' => (string) ($rx['phone'] ?? ''),
|
||||
'assistant_id' => (int) ($rx['assistant_id'] ?? 0),
|
||||
];
|
||||
if ($doctorId > 0) {
|
||||
$doctorIds[] = $doctorId;
|
||||
@@ -533,7 +534,20 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
||||
if ($diagIdsForAssist !== []) {
|
||||
$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 !== []
|
||||
? \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);
|
||||
$item['creator_name'] = $creatorId > 0 ? ($creatorNames[$creatorId] ?? '') : '';
|
||||
|
||||
// 添加医助(来自诊单 assistant_id)
|
||||
// 医助:与处方列表一致优先关联处方 assistant_id,否则诊单 assistant_id(见 PrescriptionOrderLogic::resolveAssistantAdminIdForPrescriptionOrderRow)
|
||||
$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_name'] = $assistantIdForItem > 0
|
||||
? ($assistantNames[$assistantIdForItem] ?? '')
|
||||
: '';
|
||||
|
||||
// 添加开方人姓名、处方登记手机(与业务订单收货手机比对用)
|
||||
$rxId = (int) ($item['prescription_id'] ?? 0);
|
||||
$item['doctor_name'] = $rxId > 0 ? ($prescriptionCreators[$rxId]['doctor_name'] ?? '') : '';
|
||||
$item['prescription_phone'] = $rxId > 0 ? ($prescriptionCreators[$rxId]['phone'] ?? '') : '';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user