Exemplo n.º 1
0
        public ActionResult Add(AddClinicianInputModel clinicianInputModel)
        {
            if (ModelState.IsValid)
            {
                using (var unitOfwork = new UnitOfWork())
                {
                    var hospital  = GetHospitalById(clinicianInputModel.SelectedHospital, unitOfwork);
                    var specialty = GetSpecialtyByCode(clinicianInputModel.SelectedSpecialty, unitOfwork);

                    var clinician = new Clinician
                    {
                        Name      = clinicianInputModel.Name,
                        Hospital  = hospital,
                        Specialty = specialty
                    };

                    unitOfwork.Clinicians.Add(clinician);
                    unitOfwork.SaveChanges();
                }

                return(RedirectToAction("Add"));
            }

            clinicianInputModel.Hospitals     = GetHospitals();
            clinicianInputModel.Specialties   = GetSpecialties();
            clinicianInputModel.AllClinicians = GetAllClinicians();

            return(View(clinicianInputModel));
        }
Exemplo n.º 2
0
        void Clinician_Login_Screen_Login()
        {
            _clinician = clinican_Login_Screen.CurrentClinician;
            if (_clinician.EditClinicians) //if they can edit clinicians
            {
                if (clinician_Records_Screen == null)
                {
                    clinician_Records_Screen      = new Clinician_Records_Screen();
                    clinician_Records_Screen.Dock = DockStyle.Fill;
                    this.Controls.Add(clinician_Records_Screen);
                }
                clinician_Records_Screen.UpdateClinicians();
                clinican_Login_Screen.Visible    = false;
                clinician_Records_Screen.Visible = true;
            }
            else
            {
                if (patient_Records_Screen == null)
                {
                    SetStatusLabelValue("Loading Patients From Server...");
                    patient_Records_Screen      = new Patient_Records_Screen();
                    patient_Records_Screen.Dock = DockStyle.Fill;
                    this.Controls.Add(patient_Records_Screen);
                }
                patient_Records_Screen.CurrentClinician = _clinician;
                clinican_Login_Screen.Visible           = false;
                patient_Records_Screen.Visible          = true;

                if (patient_Screen != null)
                {
                    patient_Screen.CurrentClinician = _clinician;
                    patient_Screen.Visible          = false;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Sets token and password for the given clinician
        /// </summary>
        /// <returns>
        /// An HttpStatusCode response
        /// </returns>
        public async Task <HttpStatusCode> updateAccountSettings(Clinician clinician, string token, bool setPassword)
        {
            String     url    = ServerConfig.Instance.serverAddress;
            HttpClient client = ServerConfig.Instance.client;

            Newtonsoft.Json.Linq.JObject o;
            if (setPassword)
            {
                o = Newtonsoft.Json.Linq.JObject.FromObject(new
                {
                    username = clinician.username,
                    password = clinician.password
                });
            }
            else
            {
                o = Newtonsoft.Json.Linq.JObject.FromObject(new
                {
                    username = clinician.username
                });
            }

            String      itemRequestBody = JsonConvert.SerializeObject(o);
            HttpContent body            = new StringContent(itemRequestBody);

            var request = new HttpRequestMessage(new HttpMethod("PATCH"), url + "/clinicians/" + clinician.staffID + "/account");

            request.Content = body;

            request.Headers.Add("token", token);

            var response = await client.SendAsync(request);

            return(response.StatusCode);
        }
Exemplo n.º 4
0
        internal IList <Clinician> toSurrogates(IDataReader rdr)
        {
            IList <domain.sm.Clinician> surrogates = new List <domain.sm.Clinician>();

            while (rdr.Read())
            {
                domain.sm.enums.ParticipantTypeEnum surrogateType = (domain.sm.enums.ParticipantTypeEnum)Convert.ToInt32(rdr.GetDecimal(rdr.GetOrdinal("SURROGATE_TYPE")));

                if (surrogateType == domain.sm.enums.ParticipantTypeEnum.DISTRIBUTION_GROUP ||
                    surrogateType == domain.sm.enums.ParticipantTypeEnum.CLINCIAN_TRIAGE)
                {
                    IList <Clinician> surrogateGroup = getTriageGroupMembers(Convert.ToInt32(rdr.GetDecimal(rdr.GetOrdinal("SURROGATE_ID"))));
                    foreach (Clinician groupMember in surrogateGroup)
                    {
                        surrogates.Add(groupMember);
                    }
                    continue;
                }

                // can't do this in a join because of different surrogate types - must make sure surrogate ID is a user ID!
                Clinician newSurrogate = getClinicianById(Convert.ToInt32(rdr.GetDecimal(rdr.GetOrdinal("SURROGATE_ID"))));

                surrogates.Add(newSurrogate);
            }

            return(surrogates);
        }
        public ActionResult <List <Clinician> > Clinician(bool?isActive = true)
        {
            List <Clinician> Result = new List <Clinician>();
            var predicate           = PredicateBuilder.New <CM_S_EMPLOYEE>(true);

            string[] AllowedTypes = { "AUD", "CSO" };
            predicate = predicate.And(E => AllowedTypes.Contains(E.EMPLOYEE_TYPE_CODE));
            if (isActive.HasValue)
            {
                if (isActive.Value)
                {
                    predicate = predicate.And(E => (E.DT_START == null || E.DT_START <= DateTime.Today) && ((E.DT_END == null) || E.DT_END >= DateTime.Today));
                }
                else
                {
                    predicate = predicate.And(E => !((E.DT_START == null || E.DT_START <= DateTime.Today) && ((E.DT_END == null) || E.DT_END >= DateTime.Today)));
                }
            }

            foreach (CM_S_EMPLOYEE item in DBContext.CM_S_EMPLOYEE.Where(predicate))
            {
                Clinician model = EntityMapper.Map <Clinician, CM_S_EMPLOYEE>(DBContext, item);
                Result.Add(model);
            }

            return(Result);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Generates a list view item for the given clinician
 /// </summary>
 /// <param name="clinician"></param>
 /// <param name="index"></param>
 /// <returns></returns>
 private ListViewItem GenerateListViewClinicianItem(Clinician clinician, int index)
 {
     if (clinician.EditClinicians)
     {
         return(new ListViewItem(new string[] {
             clinician.LoginName,
             clinician.NameString,
             clinician.EditClinicians.ToString(),
             clinician.EditPatients.ToString(),
             clinician.EditSessions.ToString(),
             clinician.EditTasks.ToString(),
             clinician.ScheduleSessions.ToString(),
             clinician.RunSessions.ToString(),
             index.ToString(),
         }, listViewGroup_Special));
     }
     else
     {
         return(new ListViewItem(new string[] {
             clinician.LoginName,
             clinician.NameString,
             clinician.EditClinicians.ToString(),
             clinician.EditPatients.ToString(),
             clinician.EditSessions.ToString(),
             clinician.EditTasks.ToString(),
             clinician.ScheduleSessions.ToString(),
             clinician.RunSessions.ToString(),
             index.ToString(),
         }, listViewGroup_Clinicians));
     }
 }
Exemplo n.º 7
0
        public static List <DateTime> FindAvailableClinicianTimeSlots(Clinician clinician, DateTime Start, DateTime End, TimeSpan RequiredDelta, int AllowedOccurences, List <Birth> births)
        {
            List <DateTime> foundSlots = new();

            for (int i = 0; i < births.Count; i++)
            {
                var currentTime        = i == 0 ? Start : births[i].BirthDate;
                int CurrentOccurrences = 0;

                for (int j = i + 1; j < births.Count; j++)
                {
                    if (CurrentOccurrences > AllowedOccurences)
                    {
                        break;
                    }

                    var nextTime = j == births.Count - 1 ? End : births[j].BirthDate;

                    if (nextTime - currentTime > RequiredDelta)
                    {
                        foundSlots.Add(currentTime);
                        break;
                    }
                    else
                    {
                        CurrentOccurrences++;
                    }
                }
            }
            return(foundSlots);
        }
 /// <summary>
 /// Updates a clinician
 /// </summary>
 /// <param name="clinician"></param>
 public void ClientUpdateClinician(Clinician clinician)
 {
     if (UpdateClinicianRequestedByClient != null)
     {
         UpdateClinicianRequestedByClient(clinician);
     }
 }
 /// <summary>
 /// Deletes a clinician
 /// </summary>
 /// <param name="clinician"></param>
 public void ClientDeleteClinician(Clinician clinician)
 {
     if (DeleteClinicianRequestedByClient != null)
     {
         DeleteClinicianRequestedByClient(clinician);
     }
 }
 /// <summary>
 /// Saves a new clinician
 /// </summary>
 /// <param name="clinician"></param>
 public void ClientSaveNewClinician(Clinician clinician)
 {
     if (NewClinicianSaveRequestedByClient != null)
     {
         NewClinicianSaveRequestedByClient(clinician);
     }
 }
Exemplo n.º 11
0
        public async Task <IActionResult> PutClinician(string id, Clinician clinician)
        {
            if (id != clinician.ClinicianId)
            {
                return(BadRequest());
            }

            _context.Entry(clinician).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClinicianExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 12
0
        public async Task <IActionResult> Edit(int id, [Bind("ClinicianID,FirstName,LastName,Address,PhoneNumber,CreatedDate")] Clinician clinician)
        {
            if (id != clinician.ClinicianID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(clinician);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClinicianExists(clinician.ClinicianID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(clinician));
        }
Exemplo n.º 13
0
        public IActionResult Index()
        {
            //Clinician
            ClinicianManagerModel clinicianManagerModel = new ClinicianManagerModel
            {
                Clinicians = Clinician.Convert(ClinicianProcessor.GetAllClinicians()),
            };

            return(View(clinicianManagerModel));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> Create([Bind("ClinicianID,FirstName,LastName,Address,PhoneNumber,CreatedDate")] Clinician clinician)
        {
            if (ModelState.IsValid)
            {
                _context.Add(clinician);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(clinician));
        }
 /// <summary>
 /// Saves a new clinician (will fail if one with the same login already exists)
 /// </summary>
 /// <param name="clinician"></param>
 static void Clinician_Remote_DateManager_NewClinicianSaveRequestedByClient(Clinician clinician)
 {
     _clinicians = OpenClinciansFile(); // reload clincians
     foreach (Clinician c in _clinicians)
     {
         if (c.LoginName == clinician.LoginName) // already exists so fail as can't have two
         {
             return;
         }
     }
     _clinicians.Add(clinician);
     SaveClinciansFile(_clinicians);
 }
Exemplo n.º 16
0
        public static Clinician CreateFakeClinician(ClinicianType type)
        {
            var faker = new Faker("en");
            var o     = new Clinician()
            {
                FirstName      = faker.Name.FirstName(),
                LastName       = faker.Name.LastName(),
                AssignedBirths = new List <Birth>(),
                Role           = type
            };

            return(o);
        }
Exemplo n.º 17
0
        //[Authorize(Roles = Role.OfficeAdmin + "," + Role.SuperAdmin)]
        public async Task <ActionResult> UpdateClinician(Clinician clinician)
        {
            try
            {
                await _clinicianRepo.UpdateClinician(clinician);

                return(Ok());
            }
            catch (Exception)
            {
                return(StatusCode(500, "Internal Server Error"));
            }
        }
Exemplo n.º 18
0
        /// <summary>
        /// edits a clinician
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            Create_Edit_Clinician_Form form = new Create_Edit_Clinician_Form();

            form.CurrentClinician = _remote_DataManager.Clinicians[GetSelectedClinicianID()];
            if (form.ShowDialog() == DialogResult.OK)
            {
                Clinician clinician = form.CurrentClinician;
                _remote_DataManager.ClientUpdateClinician(clinician);
                _remote_DataManager.ClientRequestUpdatedClinicianList();
                UpdateClinicians();
            }
        }
        public void CreateClinicianMapping()
        {
            try
            {
                var dataSet = aHelper.GetAllAdminsUsers().Where(w => w.CPSiteId == MigrationVariables.CurrentSiteId).ToList();
                RecordCount = dataSet.Count;

                foreach (var adUser in dataSet)
                {
                    var userInfo = aHelper.GetAspUserInfo(adUser.UserId);
                    if (mHelper.HasUserMigrated((userInfo == null) ? String.Empty : userInfo.UserName, adUser.UserId))
                    {
                        MappingStatistics.LogFailedMapping("None", "None", "Clinicians", typeof(Clinician), String.Empty, "Clinician previously migrated.");
                        FailedCount++;
                    }
                    else
                    {
                        var clin = new Clinician
                        {
                            UserId             = nHelper.ValidGuid(adUser.UserId),
                            Firstname          = "No Name",
                            Lastname           = "No Name",
                            StateLicenseNumber = "No License Number",
                            Email                = "",
                            InstitutionId        = nHelper.GetInstitutionId(MigrationVariables.CurrentSiteId),
                            InstitutionAddressId = 0//nHelper.GetInstitutionAddressId(MigrationVariables.CurrentSiteId),
                        };

                        clin.LastUpdatedByUser = clin.UserId;

                        if (CanAddToContext(clin.UserId))
                        {
                            CompletedMappings.Add(clin);
                        }
                        else
                        {
                            MappingStatistics.LogFailedMapping("None", "None", "Clinicians", typeof(Clinician), JsonConvert.SerializeObject(clin), "Clinician already exist in database.");
                            FailedCount++;
                        }
                    }
                }

                MappingStatistics.LogMappingStat("None", 0, "Clinicians", CompletedMappings.Count, FailedCount);
            }
            catch (Exception e)
            {
                throw new Exception("Error creating Clinician mapping.", e);
            }
        }
        private void AddClinicianFromListExcecute()
        {
            Clinician clinician = AllClinicians[ClinicianIndex];

            Appointment.Clinicians.Add(clinician);

            string message = "";

            foreach (var staff in Appointment.Clinicians)
            {
                message += string.Join(", ", $"\n{staff.Type} {staff.FirstName} {staff.LastName}");
            }

            MessageBox.Show($"Currently added Clinicians:\n {message}", "Clinician added to appointment", MessageBoxButton.OK);
        }
        /// <summary>
        /// Updates a clincian
        /// </summary>
        /// <param name="clinician"></param>
        static void Clinician_Remote_DateManager_UpdateClinicianRequestedByClient(Clinician clinician)
        {
            _clinicians = OpenClinciansFile(); // reload clincians
            int i = 0;

            foreach (Clinician c in _clinicians)
            {
                if (c.LoginName == clinician.LoginName)
                {
                    _clinicians[i] = clinician;
                    SaveClinciansFile(_clinicians);
                    return;
                }
                i++;
            }
        }
Exemplo n.º 22
0
 public IActionResult EditClinicianCredentials(string previousHCPId, string HCPId, string password)
 {
     if (!Clinician.IsValidHCPId(HCPId))
     {
         return(PartialView("_StatusMessagePartial", new Tuple <bool, string>(false, $"Could not update Clinician, HCP ID: {HCPId} is not valid.")));
     }
     if (!Clinician.IsValidPassword(password))
     {
         return(PartialView("_StatusMessagePartial", new Tuple <bool, string>(false, $"Could not update Clinician, Password: {password} is not valid.")));
     }
     if (ClinicianProcessor.UpdateClinician(previousHCPId, HCPId, password) == 1)
     {
         return(PartialView("_StatusMessagePartial", new Tuple <bool, string>(true, $"Successfully updated Clinician.")));
     }
     return(PartialView("_StatusMessagePartial", new Tuple <bool, string>(false, $"Could not update Clinician, a Clinician already exists with HCP ID: {HCPId}.")));
 }
Exemplo n.º 23
0
        /// <summary>
        /// Fetches a single user with a given id
        /// </summary>
        /// <returns>
        /// Tuple containing the HTTP return code and the User object
        /// </returns>
        public async Task <Tuple <HttpStatusCode, Clinician> > GetSingleClinician(string id)
        {
            // Check internet connection
            if (!ServerConfig.Instance.IsConnectedToInternet())
            {
                return(new Tuple <HttpStatusCode, Clinician>(HttpStatusCode.ServiceUnavailable, null));
            }

            // Fetch the url and client from the server config class
            String     url    = ServerConfig.Instance.serverAddress;
            HttpClient client = ServerConfig.Instance.client;

            HttpResponseMessage response;
            var request = new HttpRequestMessage(new HttpMethod("GET"), url + "/clinicians/" + id);

            if (ClinicianController.Instance.isLoggedIn())
            {
                request.Headers.Add("token", ClinicianController.Instance.AuthToken);
            }
            else
            {
                request.Headers.Add("token", UserController.Instance.AuthToken);
            }


            try
            {
                response = await client.SendAsync(request);
            }
            catch (HttpRequestException)
            {
                return(new Tuple <HttpStatusCode, Clinician>(HttpStatusCode.ServiceUnavailable, null));
            }

            if (response.StatusCode != HttpStatusCode.OK)
            {
                return(new Tuple <HttpStatusCode, Clinician>(response.StatusCode, null));
            }

            string responseContent = await response.Content.ReadAsStringAsync();

            Clinician resultUser = JsonConvert.DeserializeObject <Clinician>(responseContent);

            return(new Tuple <HttpStatusCode, Clinician>(HttpStatusCode.OK, resultUser));
        }
        /// <summary>
        /// Generates the default clinician
        /// </summary>
        /// <returns></returns>
        private static Clinician GenderateDefaultClinician()
        {
            Clinician newClinician = new Clinician();

            newClinician.LoginName        = "admin";
            newClinician.FirstName        = "Clinician";
            newClinician.LastName         = "Manager";
            newClinician.EditClinicians   = true;
            newClinician.EditPatients     = false;
            newClinician.EditSessions     = false;
            newClinician.EditTasks        = false;
            newClinician.RunSessions      = false;
            newClinician.ScheduleSessions = false;
            newClinician.CanEditDetails   = false; // block changing details
            newClinician.SetPassword("stromohab");

            return(newClinician);
        }
        public ActionResult <List <Clinician> > GetWorkingClinician(string shopCode, DateTime date, string employeeTypeCodes = null)
        {
            string[] employeeTypes = null;
            if (!string.IsNullOrWhiteSpace(employeeTypeCodes))
            {
                employeeTypes = employeeTypeCodes.Split("|");
            }

            List <Clinician> Result = new List <Clinician>();
            var predicate           = PredicateBuilder.New <CM_S_EMPLOYEE>(true);

            if (employeeTypes == null)
            {
                employeeTypes = new string[] { "SRO" }
            }
            ;                                                           //{ "SRO", "AUD", "CSO" };


            List <string> AllowedTypes = new List <string>();

            employeeTypes.ToList().ForEach(E => AllowedTypes.Add("'" + E + "'"));

            StringBuilder SQL = new StringBuilder("SELECT DISTINCT E.* FROM CM_S_EMPLOYEE E");

            SQL.Append(" JOIN AG_B_EMPLOYEE_WORKING_HOURS WH ON E.SHOP_CODE=WH.SHOP_CODE AND E.EMPLOYEE_CODE=WH.EMPLOYEE_CODE");
            SQL.Append($" WHERE E.SHOP_CODE IN ('*', '{shopCode}') AND WH.DT_VALID <= '{date:yyyy-MM-dd}' AND E.EMPLOYEE_TYPE_CODE IN (" + string.Join(", ", AllowedTypes) + ")");
            SQL.Append(" AND (E.DT_START IS NULL OR E.DT_START <= CAST(GETDATE() AS DATE)) AND (E.DT_END IS NULL OR E.DT_END >= CAST(GETDATE() AS DATE))");

            List <CM_S_EMPLOYEE> employees = DBContext.CM_S_EMPLOYEE.FromSql(SQL.ToString()).ToList();
            List <AG_B_EMPLOYEE_WORKING_HOURS> workingHours = GetEmployeeValidWorkingHours(shopCode, employees, date);

            foreach (CM_S_EMPLOYEE item in employees)
            {
                if (workingHours.Any(E => E.EMPLOYEE_CODE == item.EMPLOYEE_CODE && SlotHelper.BynaryCheck(E, date)))
                {
                    Clinician model = EntityMapper.Map <Clinician, CM_S_EMPLOYEE>(DBContext, item);
                    Result.Add(model);
                }
            }

            return(Result);
        }
    }
Exemplo n.º 26
0
        /// <summary>
        /// Creates a new clinician
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonNew_Click(object sender, EventArgs e)
        {
            Create_Edit_Clinician_Form form = new Create_Edit_Clinician_Form();

            if (form.ShowDialog() == DialogResult.OK)
            {
                Clinician clinician = form.CurrentClinician;
                _remote_DataManager.ClientSaveNewClinician(clinician);
                UpdateClinicians();
            }
            else
            {
                listViewClinicians.SelectedItems.Clear();
            }
            _justAdded = true;
            form.Dispose();
            buttonEdit.Enabled   = false;
            buttonDelete.Enabled = false;
        }
Exemplo n.º 27
0
        public async Task UpdateClinician(Clinician clinician)
        {
            using (var con = mainConn)
            {
                string query = @"UPDATE [dbo].[Clinicians]
                                    SET
                                [UserID] = @UserID
                                ,[FirstName] = @FirstName
                                ,[LastName] = @LastName
                                ,[PhoneNum] = @PhoneNum
                                ,[EmailAddress] = @EmailAddress
                                ,[Title] = @Title
                                ,[Address] = @Address
                                ,[Practice] = @Practice
                                ,[FaxNum] = @FaxNum
                                WHERE ID = @ID;";
                await con.QueryAsync <int>(query, clinician);

                return;
            }
        }
Exemplo n.º 28
0
        public async Task <ActionResult <Clinician> > PostClinician(Clinician clinician)
        {
            _context.Clinicians.Add(clinician);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (ClinicianExists(clinician.ClinicianId))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetClinician", new { id = clinician.ClinicianId }, clinician));
        }
        /// <summary>
        /// Processes a login request
        /// </summary>
        /// <param name="login"></param>
        /// <param name="password"></param>
        static void Clinician_Remote_DateManager_LoginRequestByClient(string login, string password)
        {
            _clinicians = OpenClinciansFile(); //Load in the clincians

            Clinician clinician = null;

            //go through all clincians, if you find the same login name then check the password, if it matches then that is the clincian
            foreach (Clinician c in _clinicians)
            {
                if (c.LoginName == login)
                {
                    if (c.ValidateLogin(password))
                    {
                        clinician = c;
                        break;
                    }
                }
            }
            //if login failed then clicnian will be null, otherwise it will be a valid clincian
            RespondToLoginRequest(clinician);
        }
Exemplo n.º 30
0
        public IActionResult Index(ImportClinicianCredentials clinicianCredentials)
        {
            ClinicianManagerModel clinicianManagerModel = new ClinicianManagerModel();

            if (clinicianCredentials.File == null)
            {
                ViewData["ErrorMessage"]         = "Could not upload clinicians, no file was provided.";
                clinicianManagerModel.Clinicians = Clinician.Convert(ClinicianProcessor.GetAllClinicians());
                return(View(clinicianManagerModel));
            }

            if (!CsvProcessor.IsCsv(clinicianCredentials.File))
            {
                ViewData["ErrorMessage"]         = "Could not upload clinicians, the file provided was not a CSV file.";
                clinicianManagerModel.Clinicians = Clinician.Convert(ClinicianProcessor.GetAllClinicians());
                return(View(clinicianManagerModel));
            }

            var errorMessages = CsvProcessor.GetClinicianCredentials(clinicianCredentials.File, out List <Clinician> clinicians);

            if (clinicians.Count == 0 || (errorMessages.Count > 0 && !clinicianCredentials.UploadWithErrors))
            {
                ViewData["ErrorMessage"]         = "No clinicians were uploaded, check the file matches the format required.";
                clinicianManagerModel.Clinicians = Clinician.Convert(ClinicianProcessor.GetAllClinicians());
                return(View(clinicianManagerModel));
            }

            int successfulInserts = ClinicianProcessor.SaveClinicians(Clinician.Convert(clinicians), errorMessages);

            if (errorMessages.Count != 0)
            {
                ViewData["ErrorMessages"] = errorMessages;
            }

            ViewData["SuccessMessage"]       = $"{successfulInserts} Clinicians were uploaded successfully.";
            clinicianManagerModel.Clinicians = Clinician.Convert(ClinicianProcessor.GetAllClinicians());
            return(View(clinicianManagerModel));
        }
Exemplo n.º 31
0
            public Patient oPatient; //患者信息

            #endregion Fields

            #region Constructors

            public Role()
            {
                oPatient = new Patient();
                oClinician = new Clinician();
            }
Exemplo n.º 32
0
        private static void SerializePatient()
        {
            Patient patient = new Patient();

            PersonData cd = new PersonData();
            cd.ID = Guid.NewGuid();
            cd.Surname = "Androulidakis";
            cd.Name = "Aggelos";

            List<Communication> communications = new List<Communication>();

            Communication commun1 = new Communication();
            commun1.IsPrimary = true;
            commun1.Type = CommunicationType.Phone;
            commun1.Value = "+302107722453";
            communications.Add(commun1);

            Communication commun2 = new Communication();
            commun2.IsPrimary = false;
            commun2.Value = "*****@*****.**";
            commun2.Type = CommunicationType.Email;
            communications.Add(commun2);

            cd.CommunicationList = new List<Communication>(communications);

            List<Address> addresses = new List<Address>();
            Address address = new Address();
            address.Street = "Patission";
            address.StreetNo = "42";
            address.City = "Athens";
            address.Country = "GR";
            address.Notes = "3rd floor";
            address.IsPrimary = true;
            address.ZipCode = "123-45";
            address.County = "Attica";
            addresses.Add(address);
            addresses.Add(address);

            List<Identifier> ids = new List<Identifier>();
            Identifier id = new Identifier();
            id.Type = IdentifierType.PassportID;
            id.Number = "AB202825";
            id.IssueDate = "17/02/2003";
            id.IssueAuthority = "ABC";
            ids.Add(id);
            ids.Add(id);

            cd.IdentifierList = ids;

            cd.AddressList = new List<Address>(addresses);

            patient.PersonData = cd;

            SocioDemographicData sd = new SocioDemographicData();
            sd.Age = 82;
            SystemParameter maritalStatus = new SystemParameter();
            maritalStatus.Code = 1;
            maritalStatus.Description = "widow";
            sd.MaritalStatus = maritalStatus;

            sd.Children = 2;
            SystemParameter sex = new SystemParameter();
            sex.Code = 1;
            sex.Description = "Male";

            sd.Gender = sex;

            SystemParameter livingWith = new SystemParameter();
            livingWith.Code = 1;
            livingWith.Description = "with son/daughter";

            sd.LivingWith = livingWith;

            patient.SD_Data = sd;

            Carer c1 = new Carer();
            c1.PersonData = patient.PersonData;
            c1.SD_Data = patient.SD_Data;

            PatientCaregiver pc1 = new PatientCaregiver();
            pc1.Caregiver = c1;
            pc1.IsPrimary = true;

            PatientCaregiver pc2 = new PatientCaregiver();
            pc2.Caregiver = c1;
            pc2.IsPrimary = false;

            patient.PatientCaregiverList.ListOfCaregivers.Add(pc1);
            patient.PatientCaregiverList.ListOfCaregivers.Add(pc2);

            Clinician respClinician = new Clinician();
            respClinician.PersonData = patient.PersonData;

            patient.ResponsibleClinician = respClinician;

            //PatientAssessment assessment = new PatientAssessment();
            //assessment.MMSE = 22;
            //assessment.DateOfAssessment = System.DateTime.Now;

            //patient.Assessments.ListOfAssessments.Add(assessment);

            SerializeMe(patient, "Patient.xml");
        }