public static void UpdatePatient(Company.ClinicalDAL.Patient pat) { using (var dal = new Company.ClinicalDAL.ClinicalDAL(context)) { dal.UpdatePatient(pat); UserAction ua = new UserAction { User = ClinicalUser, Action_id = UserActionCode.Patient_Updated.ToString(), Action_desc = UserActionDesc[UserActionCode.Patient_Updated], Action_date = DateTime.Now, Patient_id = pat.id, External_id = pat.External_id, External_source = pat.External_source }; dal.AddUserAction(ua); } }
// Only take the 1st character for sex/gender public static int add_fhir_patient(FHIR_Patient fp) { var pat = new Company.ClinicalDAL.Patient(); pat.MRN = fp.MRN; pat.LastName = fp.LastName; pat.FirstName = fp.FirstName; pat.Sex = !string.IsNullOrEmpty(fp.Gender) ? fp.Gender.Substring(0, 1) : "U"; pat.DateOfBirth = !string.IsNullOrEmpty(fp.Birthdate) ? DateTime.Parse(fp.Birthdate) : (DateTime?)null; pat.AddressLine1 = fp.Address; pat.City = fp.City; pat.State = fp.State; pat.Zip = fp.Zip; pat.HomePhone = fp.Phone; pat.External_id = fp.External_id; pat.External_source = fp.External_source; return(AddPatient(pat)); }
// if the patient doesn't have external info, it was added manually. public static int AddPatient(Company.ClinicalDAL.Patient pat) { using (var dal = new Company.ClinicalDAL.ClinicalDAL(context)) { int patient_id = dal.AddPatient(pat); UserActionCode uac = UserActionCode.Patient_Added; if (!String.IsNullOrEmpty(pat.External_id)) { uac = UserActionCode.External_Patient_Added; } UserAction ua = new UserAction { User = ClinicalUser, Action_id = uac.ToString(), Action_desc = UserActionDesc[uac], Action_date = DateTime.Now, Patient_id = patient_id, External_id = pat.External_id, External_source = pat.External_source }; dal.AddUserAction(ua); return(patient_id); } }