update docs and prep for frontend

This commit is contained in:
voltsrage
2026-06-19 15:44:58 +08:00
parent abc781c9c0
commit 49973271e5
20 changed files with 1071 additions and 26 deletions
@@ -1,2 +1,3 @@
public record ApiResponse<T>(bool Success, T Data, string? Error);
public record ApiResponse<T>(bool Success, int StatusCode, T? Data, ApiError? Error);
public record ApiError(string Message, string Code);
public record PagedResponse<T>(List<T> Items, int TotalCount, int Page, int PageSize);
@@ -65,7 +65,7 @@ public class VigilCareApiClient
Guid encounterId, string orderDescription, string? resultSummary)
{
var ordersResponse = await _http.GetAsync(
$"/api/v1/encounters/{encounterId}/orders?status=Pending");
$"/api/v1/encounters/{encounterId}/orders?status=PENDING");
if (!ordersResponse.IsSuccessStatusCode)
return false;
+1 -1
View File
@@ -40,7 +40,7 @@ public class ReplayEngine
encounter = await _client.OpenEncounterAsync(patient.Id, new OpenEncounterRequest(
scenario.Encounter.EncounterType,
scenario.Encounter.Department,
DepartmentMapper.ToApiDepartment(scenario.Encounter.Department),
scenario.Encounter.AttendingPhysician,
scenario.Encounter.RoomBed,
scenario.Encounter.AdmissionReason));
@@ -0,0 +1,21 @@
public static class DepartmentMapper
{
private static readonly Dictionary<string, string> ScenarioToApi = new(StringComparer.OrdinalIgnoreCase)
{
["Icu"] = "ICU",
["GeneralMedicine"] = "GENERAL_MEDICINE",
["Emergency"] = "EMERGENCY",
["Cardiology"] = "CARDIOLOGY",
["Surgery"] = "SURGERY",
["Pediatrics"] = "PEDIATRICS",
};
public static string ToApiDepartment(string scenarioDepartment)
{
if (ScenarioToApi.TryGetValue(scenarioDepartment, out var apiValue))
return apiValue;
throw new InvalidOperationException(
$"Unknown scenario department '{scenarioDepartment}'. Expected one of: {string.Join(", ", ScenarioToApi.Keys)}.");
}
}