feat: add lab tests, patient file management, and prescription improvements

This commit is contained in:
SajjadMahmoody
2026-04-17 20:15:38 +03:30
parent 6a301c5529
commit bf0ada051f
53 changed files with 3201 additions and 387 deletions
+13 -1
View File
@@ -55,7 +55,7 @@ public function sync(): array
try {
$pullResponse = Http::timeout(30)
->withHeader('X-Sync-Token', $this->token)
->get("{$baseUrl}/api/sync/export", ['since' => $ourLastSync]);
->get("{$baseUrl}/api/sync/export", ['since' => $peerCursor]);
if ($pullResponse->successful()) {
$peerChanges = $pullResponse->json('changes', []);
@@ -69,6 +69,9 @@ public function sync(): array
}
});
$maxPeerChangeId = max(array_column($peerChanges, 'id'));
$this->savePeerCursor(max($peerCursor, $maxPeerChangeId));
if ($this->isFtpConfigured()) {
$this->transferFilesViaFtp($peerChanges, 's2c', $report);
} else {
@@ -312,6 +315,15 @@ private function applyChange(array $change, string $prefix, array &$report): voi
}
}
private function savePeerCursor(int $cursor): void
{
\App\Models\OsurgInitial::updateOrCreate(
['init_parameter' => 'sync_peer_cursor'],
['init_value' => $cursor],
);
cache()->forget('osurg_initial.sync_peer_cursor');
}
private function sanitize(array $data): array
{
$result = [];