Ejemplo n.º 1
0
 public static void Add_UserAction(UserAction ua)
 {
     using (var dal = new Company.ClinicalDAL.ClinicalDAL(context))
     {
         dal.AddUserAction(ua);
     }
 }
Ejemplo n.º 2
0
        // this will overwrite the current patient information with the value from the FHIR repo
        // if the patient is deleted, the patient will be reactivated
        public static void update_fhir_patient(FHIR_Patient fp)
        {
            using (var dal = new Company.ClinicalDAL.ClinicalDAL(context))
            {
                var pat = dal.GetPatient_External_Id_Source(fp.External_id, fp.External_source);
                if (pat != null)
                {
                    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.Active       = true;

                    dal.UpdatePatient(pat);
                    UserAction ua = new UserAction
                    {
                        User            = GlobalVariables.Instance.ClinicalUser,
                        Action_id       = UserActionCode.External_Patient_Updated.ToString(),
                        Action_desc     = UserActionDesc[UserActionCode.External_Patient_Updated],
                        Action_date     = DateTime.Now,
                        Patient_id      = pat.id,
                        External_id     = pat.External_id,
                        External_source = pat.External_source
                    };
                    dal.AddUserAction(ua);
                }
            }
        }
Ejemplo n.º 3
0
 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);
     }
 }
Ejemplo n.º 4
0
 public static ClinicalDAL.Patient GetPatient_ID(int patient_id)
 {
     using (var dal = new Company.ClinicalDAL.ClinicalDAL(context))
     {
         var pat = dal.GetPatient_ID(patient_id);
         if (pat != null)
         {
             UserAction ua = new UserAction
             {
                 User            = ClinicalUser,
                 Action_id       = UserActionCode.Patient_Viewed.ToString(),
                 Action_desc     = UserActionDesc[UserActionCode.Patient_Viewed],
                 Action_date     = DateTime.Now,
                 Patient_id      = patient_id,
                 External_id     = pat.External_id,
                 External_source = pat.External_source
             };
             dal.AddUserAction(ua);
         }
         return(pat);
     }
 }
Ejemplo n.º 5
0
 // 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);
     }
 }