更新
This commit is contained in:
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace app\adminapi\logic\tcm;
|
||||
|
||||
use app\adminapi\logic\stats\YejiStatsLogic;
|
||||
use app\adminapi\logic\auth\AuthLogic;
|
||||
use app\adminapi\logic\order\OrderLogic;
|
||||
use app\common\model\Order;
|
||||
@@ -1049,11 +1050,13 @@ class PrescriptionOrderLogic
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务订单列表行批量附加 linked_appointment(解析规则与详情一致:优先处方 appointment_id,否则诊单最近一条预约)
|
||||
* 业务订单列表行批量附加 linked_appointment(解析规则与详情一致:优先处方 appointment_id,否则诊单最近一条预约;
|
||||
* 业绩侧栏且带 channel_code 时优先展示与渠道收窄同源的已完成挂号,避免列表行属自媒体2Q 但展示关联为自媒体1)
|
||||
*
|
||||
* @param array<int, array<string, mixed>> $lists
|
||||
* @param array<string, mixed> $listsParams PrescriptionOrderLists 请求参数(可选)
|
||||
*/
|
||||
public static function appendLinkedAppointmentsToListRows(array &$lists): void
|
||||
public static function appendLinkedAppointmentsToListRows(array &$lists, array $listsParams = []): void
|
||||
{
|
||||
if ($lists === []) {
|
||||
return;
|
||||
@@ -1063,6 +1066,23 @@ class PrescriptionOrderLogic
|
||||
}
|
||||
unset($item);
|
||||
|
||||
$yejiChannelHighlightByDiag = [];
|
||||
if (
|
||||
(int) ($listsParams['yeji_order_drawer'] ?? 0) === 1
|
||||
&& trim((string) ($listsParams['channel_code'] ?? '')) !== ''
|
||||
) {
|
||||
$allDiagIdsForYeji = array_values(array_unique(array_filter(
|
||||
array_map(static fn ($x): int => (int) ($x['diagnosis_id'] ?? 0), $lists),
|
||||
static fn (int $id): bool => $id > 0
|
||||
)));
|
||||
if ($allDiagIdsForYeji !== []) {
|
||||
$yejiChannelHighlightByDiag = YejiStatsLogic::batchResolveYejiChannelDrawerHighlightAppointmentIds(
|
||||
$allDiagIdsForYeji,
|
||||
$listsParams
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$rxIds = array_values(array_unique(array_filter(array_map(
|
||||
static fn ($x) => (int) ($x['prescription_id'] ?? 0),
|
||||
$lists
|
||||
@@ -1113,6 +1133,10 @@ class PrescriptionOrderLogic
|
||||
if ($resolved <= 0 && $dgId > 0) {
|
||||
$resolved = (int) ($latestApptByDiag[$dgId] ?? 0);
|
||||
}
|
||||
$preferredYeji = $dgId > 0 ? (int) ($yejiChannelHighlightByDiag[$dgId] ?? 0) : 0;
|
||||
if ($preferredYeji > 0) {
|
||||
$resolved = $preferredYeji;
|
||||
}
|
||||
if ($resolved > 0) {
|
||||
$resolvedPairs[$idx] = [$resolved, $rxApptId];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user