更新
This commit is contained in:
@@ -243,7 +243,8 @@ class DeptLogic extends BaseLogic
|
||||
private static function computeErCenterRevisitFullPack(
|
||||
array $subtreeDeptIds,
|
||||
?int $orderStartTs = null,
|
||||
?int $orderEndTs = null
|
||||
?int $orderEndTs = null,
|
||||
?array $visibleCreatorIds = null
|
||||
): array {
|
||||
$emptySlots = [];
|
||||
$emptyTotals = [];
|
||||
@@ -284,6 +285,14 @@ class DeptLogic extends BaseLogic
|
||||
/** 复用 buildAssistantCanonicalDeptInSubtree —— 该方法实际是 admin → 子树内 canonical 部门,与 admin 角色无关 */
|
||||
$canonicalDept = self::buildAssistantCanonicalDeptInSubtree($creatorIds, $subtreeSet);
|
||||
|
||||
$creatorFlip = null;
|
||||
if ($visibleCreatorIds !== null && $visibleCreatorIds !== []) {
|
||||
$creatorFlip = array_flip(array_values(array_unique(array_filter(
|
||||
array_map('intval', $visibleCreatorIds),
|
||||
static fn (int $id): bool => $id > 0
|
||||
))));
|
||||
}
|
||||
|
||||
/** @var array<int, array<int, int>> $leafByDeptSlot dept_id => [ slot => cnt ],slot≥2 */
|
||||
$leafByDeptSlot = [];
|
||||
/** @var array<int, array<int, int>> $byCreatorSlot 复诊按订单创建人聚合(与诊金/接诊诊单口径一致) */
|
||||
@@ -293,6 +302,9 @@ class DeptLogic extends BaseLogic
|
||||
for ($i = 1; $i < $n; $i++) {
|
||||
$slot = $i + 1;
|
||||
$cid = (int) ($orders[$i]['creator_id'] ?? 0);
|
||||
if ($creatorFlip !== null && ($cid <= 0 || !isset($creatorFlip[$cid]))) {
|
||||
continue;
|
||||
}
|
||||
$deptId = $canonicalDept[$cid] ?? null;
|
||||
if ($deptId === null || !isset($subtreeSet[$deptId])) {
|
||||
continue;
|
||||
@@ -337,14 +349,17 @@ class DeptLogic extends BaseLogic
|
||||
*
|
||||
* @return array{totals: array<int, int>, slots: array<int, array<int, int>>}
|
||||
*/
|
||||
public static function getErCenterRevisitRollupIndexedByDept(?int $orderStartTs = null, ?int $orderEndTs = null): array
|
||||
{
|
||||
public static function getErCenterRevisitRollupIndexedByDept(
|
||||
?int $orderStartTs = null,
|
||||
?int $orderEndTs = null,
|
||||
?array $visibleCreatorIds = null
|
||||
): array {
|
||||
$erRoots = self::findErCenterRootDeptIds();
|
||||
$subtreeIds = self::unionErCenterSubtreeDeptIds($erRoots);
|
||||
if ($subtreeIds === []) {
|
||||
return ['totals' => [], 'slots' => []];
|
||||
}
|
||||
$pack = self::computeErCenterRevisitFullPack($subtreeIds, $orderStartTs, $orderEndTs);
|
||||
$pack = self::computeErCenterRevisitFullPack($subtreeIds, $orderStartTs, $orderEndTs, $visibleCreatorIds);
|
||||
|
||||
return ['totals' => $pack['totals'], 'slots' => $pack['slots']];
|
||||
}
|
||||
@@ -354,14 +369,17 @@ class DeptLogic extends BaseLogic
|
||||
*
|
||||
* @return array{totals: array<int, int>, slots: array<int, array<int, int>>}
|
||||
*/
|
||||
public static function getErCenterRevisitCountsByCreator(?int $orderStartTs = null, ?int $orderEndTs = null): array
|
||||
{
|
||||
public static function getErCenterRevisitCountsByCreator(
|
||||
?int $orderStartTs = null,
|
||||
?int $orderEndTs = null,
|
||||
?array $visibleCreatorIds = null
|
||||
): array {
|
||||
$erRoots = self::findErCenterRootDeptIds();
|
||||
$subtreeIds = self::unionErCenterSubtreeDeptIds($erRoots);
|
||||
if ($subtreeIds === []) {
|
||||
return ['totals' => [], 'slots' => []];
|
||||
}
|
||||
$pack = self::computeErCenterRevisitFullPack($subtreeIds, $orderStartTs, $orderEndTs);
|
||||
$pack = self::computeErCenterRevisitFullPack($subtreeIds, $orderStartTs, $orderEndTs, $visibleCreatorIds);
|
||||
$by = $pack['by_creator_slots'];
|
||||
$totals = [];
|
||||
$slots = [];
|
||||
@@ -436,7 +454,8 @@ class DeptLogic extends BaseLogic
|
||||
int $rootDeptId,
|
||||
int $revisitSlot,
|
||||
int $orderStartTs,
|
||||
int $orderEndTs
|
||||
int $orderEndTs,
|
||||
?array $visibleCreatorIds = null
|
||||
): array {
|
||||
if ($rootDeptId <= 0 || $orderStartTs <= 0 || $orderEndTs < $orderStartTs) {
|
||||
return ['rows' => []];
|
||||
@@ -479,6 +498,13 @@ class DeptLogic extends BaseLogic
|
||||
}
|
||||
}
|
||||
$canonicalDept = self::buildAssistantCanonicalDeptInSubtree(array_keys($creatorNeed), $erSubtreeSet);
|
||||
$creatorFlip = null;
|
||||
if ($visibleCreatorIds !== null && $visibleCreatorIds !== []) {
|
||||
$creatorFlip = array_flip(array_values(array_unique(array_filter(
|
||||
array_map('intval', $visibleCreatorIds),
|
||||
static fn (int $id): bool => $id > 0
|
||||
))));
|
||||
}
|
||||
/** @var array<int, int> $counts */
|
||||
$counts = [];
|
||||
foreach ($byPatient as $orders) {
|
||||
@@ -492,6 +518,9 @@ class DeptLogic extends BaseLogic
|
||||
if ($cid <= 0) {
|
||||
continue;
|
||||
}
|
||||
if ($creatorFlip !== null && !isset($creatorFlip[$cid])) {
|
||||
continue;
|
||||
}
|
||||
$canon = $canonicalDept[$cid] ?? null;
|
||||
if ($canon === null || !isset($erSubtreeSet[$canon]) || !isset($descFlip[$canon])) {
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user