更新
This commit is contained in:
@@ -1044,9 +1044,12 @@ class DiagnosisLogic extends BaseLogic
|
||||
$patientImId = 'patient_' . $patientId;
|
||||
$archived = self::loadArchivedImChatRows($diagnosisId);
|
||||
|
||||
if ($onlyArchived) {
|
||||
$lists = self::enrichImMessagesWithStaffNames($archived);
|
||||
return [
|
||||
if ($onlyArchived) {
|
||||
$lists = self::attachDiagnosisIdToImMessages(
|
||||
self::enrichImMessagesWithStaffNames($archived),
|
||||
$diagnosisId
|
||||
);
|
||||
return [
|
||||
'lists' => $lists,
|
||||
'patient_im_id' => $patientImId,
|
||||
'patient_name' => $diag['patient_name'] ?? '',
|
||||
@@ -1061,7 +1064,10 @@ class DiagnosisLogic extends BaseLogic
|
||||
self::setError('请先配置腾讯云 TRTC / IM 参数');
|
||||
return false;
|
||||
}
|
||||
$lists = self::enrichImMessagesWithStaffNames($archived);
|
||||
$lists = self::attachDiagnosisIdToImMessages(
|
||||
self::enrichImMessagesWithStaffNames($archived),
|
||||
$diagnosisId
|
||||
);
|
||||
|
||||
return [
|
||||
'lists' => $lists,
|
||||
@@ -1082,9 +1088,12 @@ class DiagnosisLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
|
||||
$live = self::pullLiveImChatMessagesForDiagnosis($diag, $doctorAccounts);
|
||||
$merged = self::mergeImMessagesByMsgId($archived, $live);
|
||||
$merged = self::enrichImMessagesWithStaffNames($merged);
|
||||
$live = self::pullLiveImChatMessagesForDiagnosis($diag, $doctorAccounts);
|
||||
$merged = self::mergeImMessagesByMsgId($archived, $live);
|
||||
$merged = self::attachDiagnosisIdToImMessages(
|
||||
self::enrichImMessagesWithStaffNames($merged),
|
||||
$diagnosisId
|
||||
);
|
||||
|
||||
// 首次云端拉取后异步落库,下一次即可直接读归档,无需再全量扫描医生账号
|
||||
if (!empty($live)) {
|
||||
@@ -1175,7 +1184,7 @@ class DiagnosisLogic extends BaseLogic
|
||||
/**
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
private static function loadArchivedImChatRows(int $diagnosisId): array
|
||||
private static function loadArchivedImChatRows(int $diagnosisId): array
|
||||
{
|
||||
if ($diagnosisId <= 0) {
|
||||
return [];
|
||||
@@ -1203,8 +1212,25 @@ class DiagnosisLogic extends BaseLogic
|
||||
'doctor_peer_account' => (string)($row['doctor_peer_account'] ?? ''),
|
||||
];
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep the parent diagnosis on every child row so clients can reject
|
||||
* accidentally mixed or stale IM payloads before rendering them.
|
||||
*
|
||||
* @param array<int, array<string, mixed>> $rows
|
||||
* @return array<int, array<string, mixed>>
|
||||
*/
|
||||
private static function attachDiagnosisIdToImMessages(array $rows, int $diagnosisId): array
|
||||
{
|
||||
foreach ($rows as &$row) {
|
||||
$row['diagnosis_id'] = $diagnosisId;
|
||||
}
|
||||
unset($row);
|
||||
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array<int, array<string, mixed>> $archived
|
||||
|
||||
Reference in New Issue
Block a user