initial commit

This commit is contained in:
voltsrage
2026-06-26 04:20:20 +08:00
commit 869006e5e7
64 changed files with 4632 additions and 0 deletions
@@ -0,0 +1,83 @@
public enum Department
{
EmergencyDepartment,
InternalMedicine,
GeneralMedicine,
Surgery,
Icu,
Nicu,
MedSurg,
OutpatientClinic,
Pediatrics,
ObstetricsGynecology,
LaborAndDelivery,
Cardiology,
Orthopedics,
Neurology,
Oncology,
Radiology,
Laboratory,
Psychiatry,
PhysicalTherapy,
Anesthesiology
}
public static class DepartmentExtensions
{
public static string ToDbString(this Department d) => d switch
{
Department.EmergencyDepartment => "Emergency Department",
Department.InternalMedicine => "Internal Medicine",
Department.GeneralMedicine => "General Medicine",
Department.Surgery => "Surgery",
Department.Icu => "ICU",
Department.Nicu => "NICU",
Department.MedSurg => "Medical-Surgical",
Department.OutpatientClinic => "Outpatient Clinic",
Department.Pediatrics => "Pediatrics",
Department.ObstetricsGynecology => "Obstetrics & Gynecology",
Department.LaborAndDelivery => "Labor & Delivery",
Department.Cardiology => "Cardiology",
Department.Orthopedics => "Orthopedics",
Department.Neurology => "Neurology",
Department.Oncology => "Oncology",
Department.Radiology => "Radiology",
Department.Laboratory => "Laboratory",
Department.Psychiatry => "Psychiatry",
Department.PhysicalTherapy => "Physical Therapy",
Department.Anesthesiology => "Anesthesiology",
_ => throw new ArgumentOutOfRangeException(nameof(d))
};
public static Department FromDbString(string v) => v switch
{
"Emergency Department" => Department.EmergencyDepartment,
"Internal Medicine" => Department.InternalMedicine,
"General Medicine" => Department.GeneralMedicine,
"Surgery" => Department.Surgery,
"ICU" => Department.Icu,
"NICU" => Department.Nicu,
"Medical-Surgical" => Department.MedSurg,
"Outpatient Clinic" => Department.OutpatientClinic,
"Pediatrics" => Department.Pediatrics,
"Obstetrics & Gynecology" => Department.ObstetricsGynecology,
"Labor & Delivery" => Department.LaborAndDelivery,
"Cardiology" => Department.Cardiology,
"Orthopedics" => Department.Orthopedics,
"Neurology" => Department.Neurology,
"Oncology" => Department.Oncology,
"Radiology" => Department.Radiology,
"Laboratory" => Department.Laboratory,
"Psychiatry" => Department.Psychiatry,
"Physical Therapy" => Department.PhysicalTherapy,
"Anesthesiology" => Department.Anesthesiology,
_ => throw new ArgumentOutOfRangeException(nameof(v), $"Unknown department: '{v}'")
};
public static bool TryFromDbString(string? v, out Department result)
{
if (v is null) { result = default; return false; }
try { result = FromDbString(v); return true; }
catch (ArgumentOutOfRangeException) { result = default; return false; }
}
}