Merge branch 'master' of https://gitee.com/v_cms/zyt
This commit is contained in:
@@ -30,7 +30,7 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['prescription_id', 'fulfillment_status', 'prescription_audit_status', 'payment_slip_audit_status'],
|
||||
'=' => ['prescription_id', 'diagnosis_id', 'fulfillment_status', 'prescription_audit_status', 'payment_slip_audit_status'],
|
||||
'%like%' => ['order_no'],
|
||||
'between_time' => 'create_time',
|
||||
];
|
||||
@@ -97,6 +97,7 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
||||
{
|
||||
$this->applyDoctorAssistantFilters($query);
|
||||
$this->applyPatientKeywordFilter($query);
|
||||
$this->applyPatientIdFilter($query);
|
||||
$this->applyExpressCompanyFilter($query);
|
||||
$this->applyExpressKeywordFilter($query);
|
||||
$this->applySupplyModeFilter($query);
|
||||
@@ -440,6 +441,10 @@ 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)))));
|
||||
$assistantNames = $assistantIds !== []
|
||||
? \app\common\model\auth\Admin::whereIn('id', $assistantIds)->column('name', 'id')
|
||||
: [];
|
||||
foreach ($lists as &$item) {
|
||||
PrescriptionOrderLogic::maskInternalCostIfNeeded($item, $this->adminInfo);
|
||||
PrescriptionOrderLogic::maskRemarkExtraIfNeeded($item, $this->adminInfo);
|
||||
@@ -456,11 +461,19 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
||||
$this->adminInfo,
|
||||
$assistantByDiag
|
||||
);
|
||||
|
||||
|
||||
// 添加创建人姓名
|
||||
$creatorId = (int) ($item['creator_id'] ?? 0);
|
||||
$item['creator_name'] = $creatorId > 0 ? ($creatorNames[$creatorId] ?? '') : '';
|
||||
|
||||
|
||||
// 添加医助(来自诊单 assistant_id)
|
||||
$diagIdForAssist = (int) ($item['diagnosis_id'] ?? 0);
|
||||
$assistantIdForItem = (int) ($assistantByDiag[$diagIdForAssist] ?? 0);
|
||||
$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'] ?? '') : '';
|
||||
@@ -831,6 +844,26 @@ class PrescriptionOrderLists extends BaseAdminDataLists implements ListsSearchIn
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按真实患者ID精确过滤(tcm_diagnosis.patient_id 是跨诊单的患者唯一ID)
|
||||
* 用于诊单编辑抽屉「业务订单」tab 列出该患者所有诊单产生的处方业务订单。
|
||||
*/
|
||||
private function applyPatientIdFilter($query): void
|
||||
{
|
||||
$patientId = (int) ($this->params['patient_id'] ?? 0);
|
||||
if ($patientId <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$poTbl = (new PrescriptionOrder())->getTable();
|
||||
$diagTbl = (new Diagnosis())->getTable();
|
||||
|
||||
$query->whereExists(
|
||||
"SELECT 1 FROM `{$diagTbl}` dg WHERE dg.`id` = `{$poTbl}`.`diagnosis_id` "
|
||||
. "AND dg.`delete_time` IS NULL AND dg.`patient_id` = {$patientId}"
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按快递单号 / 快递公司 模糊检索
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user