Example #1
0
        public UpdateResult AddCase(Case patientCase, Guid accountId)
        {
            return(Execute(context =>
            {
                context.Cases.Add(patientCase);

                Data.Patient patient = context.Patients.Single(x => x.PatientId == patientCase.PatientId);
                patient.LastUpdateTimestamp = DateTime.Now;
                patient.LastUpdateAccountId = accountId;

                if (patientCase.ImpairmentGroupId.HasValue)
                {
                    foreach (var c in patient.Cases)
                    {
                        c.ImpairmentGroupId = patientCase.ImpairmentGroupId;
                    }

                    context.PatientImpairmentGroupHistories.Add(new Data.PatientImpairmentGroupHistory()
                    {
                        ImpairmentGroupId = patientCase.ImpairmentGroupId,
                        PatientId = patient.PatientId,
                        Timestamp = DateTime.Now
                    });
                }

                WriteAudit(context, accountId);

                context.SaveChanges();

                return new UpdateResult(true);
            }));
        }
Example #2
0
 /// <summary>
 /// 在此页将要在 Frame 中显示时进行调用。
 /// </summary>
 /// <param name="e">描述如何访问此页的事件数据。Parameter
 /// 属性通常用于配置页。</param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     Data.Patient          patient = iSmartMedical.iCommon.Patient;
     Views.AdviceEventArgs arg     = new Views.AdviceEventArgs(patient.InhosID);
     arg.StandingFlag = "长期";
     OnQueryAdviceTypeList(null, arg);
     OnQueryPatientAdvices(null, arg);
 }
Example #3
0
 private void ShowPatientInfo()
 {
     Data.Patient patient = iSmartMedical.iCommon.Patient;
     this.labPatientName.Text          = patient.PatientName;
     this.labInhosInfo.Text            = "(" + patient.BedName + ")" + patient.GradeName;
     this.gridPatientList.ItemsSource  = iSmartMedical.iCommon.PatientList;
     this.gridPatientList.SelectedItem = patient;
     OnChangePatient(null, new Views.PatientCheckEventArgs(patient.InhosID));
 }
Example #4
0
        private void ChangePatient()
        {
            Data.Patient p = gridPatientList.SelectedItem as Data.Patient;
            iSmartMedical.iCommon.Patient = p;
            ShowPatientInfo();
            string functionName = aryFunction[CurrentIndex];

            ShowPage(functionName);
        }
Example #5
0
 private void gridPatientList_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (this.gridPatientList.SelectedItem == null)
     {
         return;
     }
     Data.Patient patient = this.gridPatientList.SelectedItem as Data.Patient;
     iSmartMedical.iCommon.Patient = patient;
     Frame.Navigate(typeof(Doctor.PatientCheckPage), CurrentTile);
 }
Example #6
0
        public UpdateResult UpdateCase(Case patientCase, Guid accountId)
        {
            return(Execute(context =>
            {
                Case caseCurrent = context.Cases.Single(c => c.CaseId == patientCase.CaseId);


                bool hasImpairmentGroupChanged = caseCurrent.ImpairmentGroupId != patientCase.ImpairmentGroupId;

                caseCurrent.StartDate = patientCase.StartDate;
                caseCurrent.PatientProviders = patientCase.PatientProviders;
                caseCurrent.ICD10Id = patientCase.ICD10Id;
                caseCurrent.ImpairmentGroupId = patientCase.ImpairmentGroupId;
                caseCurrent.ReferringDoctor = patientCase.ReferringDoctor;
                caseCurrent.ReferringDoctorContact = patientCase.ReferringDoctorContact;
                caseCurrent.ReferringDoctorEmail = patientCase.ReferringDoctorEmail;
                caseCurrent.ReferringDoctorPracticeNumber = patientCase.ReferringDoctorPracticeNumber;
                caseCurrent.TreatingDoctor = patientCase.TreatingDoctor;
                caseCurrent.TreatingDoctorContact = patientCase.TreatingDoctorContact;
                caseCurrent.TreatingDoctorEmail = patientCase.TreatingDoctorEmail;
                caseCurrent.TreatingDoctorPracticeNumber = patientCase.TreatingDoctorPracticeNumber;
                caseCurrent.AdmissionStatusId = patientCase.AdmissionStatusId;

                caseCurrent.EndDate = patientCase.EndDate;

                Data.Patient patient = context.Patients.Single(x => x.PatientId == patientCase.PatientId);
                patient.LastUpdateTimestamp = DateTime.Now;
                patient.LastUpdateAccountId = accountId;

                foreach (var c in patient.Cases)
                {
                    c.ImpairmentGroupId = patientCase.ImpairmentGroupId;
                }

                if (hasImpairmentGroupChanged)
                {
                    context.PatientImpairmentGroupHistories.Add(new Data.PatientImpairmentGroupHistory()
                    {
                        ImpairmentGroupId = patientCase.ImpairmentGroupId,
                        PatientId = patient.PatientId,
                        Timestamp = DateTime.Now
                    });
                }

                WriteAudit(context, accountId);

                caseCurrent.LastUpdateAccountId = accountId;
                caseCurrent.LastUpdateTimestamp = DateTime.Now;
                context.SaveChanges();

                return new UpdateResult(true);
            }));
        }
Example #7
0
        public UpdateResult AddPatient(Data.Patient patient, Guid accountId)
        {
            return(Execute(context =>
            {
                context.Patients.Add(patient);

                WriteAudit(context, accountId);

                context.SaveChanges();

                return new UpdateResult(true);
            }));
        }
Example #8
0
 public static Patient FromPatient(Data.Patient data)
 {
     return(new Patient(data.PatientId, data.LastUpdateTimestamp.Ticks)
     {
         FirstName = data.FirstName,
         LastName = data.LastName,
         BirthDate = data.BirthDate,
         Gender = data.Gender == null ? "" : data.Gender.Description,
         Race = data.Race == null ? "" : data.Race.Description,
         IDNumber = data.IDNumber,
         MedicalScheme = data.MedicalScheme == null ? "" : data.MedicalScheme.Description,
         Avatar = data.Avatar != null?string.Format("data:image/png;base64,{0}", Convert.ToBase64String(data.Avatar)) : "/Content/images/nopatient.png",
     });
 }
        public ActionResult ViewProfile()
        {
            var     email = (string)Session["Email"];
            Patient pa    = new Data.Patient();

            pa = obj1.Patients.Where(m => m.email == email).FirstOrDefault();
            ViewProfile obj = new ViewProfile();

            obj.email             = pa.email;
            obj.id                = pa.id;
            obj.Address           = pa.address;
            obj.blood_group       = pa.blood_group;
            obj.name              = pa.name;
            obj.contact           = pa.contact;
            obj.emergency_contact = pa.emergency_contact;
            obj.gender            = pa.gender;

            obj.date = pa.dob != null ? (pa.dob.ToString()).Split(' ')[0] : string.Empty;



            return(View(obj));
        }
Example #10
0
        public UpdateResult UpdatePatient(Data.Models.Patient model, Guid accountId)
        {
            return(Execute(context =>
            {
                Guid patientId = BaseModel.DecryptId(model.ID);

                Data.Patient patient = context.Patients.FirstOrDefault(x => x.PatientId == patientId);


                patient.FirstName = model.FirstName;
                patient.LastName = model.LastName;
                patient.TitleId = BaseModel.DecryptNullableId(model.TitleId);
                patient.BirthDate = model.BirthDate;
                patient.GenderId = BaseModel.DecryptNullableId(model.GenderID);
                patient.RaceId = BaseModel.DecryptNullableId(model.RaceID);
                patient.ContactNumber = model.ContactNumber;
                patient.IDNumber = model.IDNumber;
                patient.Street = model.Street;
                patient.CityId = BaseModel.DecryptNullableId(model.CityId);
                patient.ProvinceId = BaseModel.DecryptNullableId(model.ProvinceId);
                patient.CountryId = BaseModel.DecryptNullableId(model.CountryID);
                patient.PostalCode = model.PostalCode;
                patient.NextOfKinName = model.NextOfKinName;
                patient.NextOfKinContact = model.NextOfKinContact;
                patient.MedicalSchemeMembershipNumber = model.MedicalSchemeNo;
                patient.MedicalSchemeId = BaseModel.DecryptNullableId(model.MedicalSchemeID);
                patient.NextOfKinEmail = model.NextOfKinEmail;
                patient.NextOfKinRelationship = model.NextOfKinRelationship;
                patient.ResidentialEnvironmentId = BaseModel.DecryptNullableId(model.ResidentialEnvironmentID);
                patient.AdmitFromId = BaseModel.DecryptNullableId(model.AdmitFromID);
                patient.DischargeToId = BaseModel.DecryptNullableId(model.DischargeToID);

                var deleteList = new List <PatientSupportService>();

                foreach (var supportService in patient.PatientSupportServices)
                {
                    if (model.SupportServices.Count(x => x.SupportServiceId == supportService.SupportServiceId) == 0)
                    {
                        deleteList.Add(supportService);
                    }
                    else
                    {
                        supportService.Note = model.SupportServices.Single(x => x.SupportServiceId == supportService.SupportServiceId).Note;
                    }
                }

                foreach (var supportService in deleteList)
                {
                    context.PatientSupportServices.Remove(supportService);
                }

                if (model.SupportServices != null)
                {
                    foreach (var supportService in model.SupportServices)
                    {
                        if (patient.PatientSupportServices.Count(x => x.SupportServiceId == supportService.SupportServiceId) == 0)
                        {
                            patient.PatientSupportServices.Add(new PatientSupportService()
                            {
                                SupportServiceId = supportService.SupportServiceId,
                                Note = supportService.Note,
                                LastUpdatedTimestamp = DateTime.Now,
                                LastUpdatedAccountId = accountId
                            });
                        }
                    }
                }



                WriteAudit(context, accountId);


                patient.LastUpdateTimestamp = DateTime.Now;
                patient.LastUpdateAccountId = accountId;

                context.SaveChanges();

                return new UpdateResult(true);
            }));
        }
        public ActionResult EditProfile(ViewProfile user)
        {
            if (ModelState.IsValid)
            {
                var email = (string)Session["Email"];

                Patient pa = new Data.Patient();
                pa = obj1.Patients.Where(m => m.email == email).FirstOrDefault();
                if (user.name != null)
                {
                    pa.name = user.name;
                }

                if (user.contact != null)
                {
                    pa.contact = user.contact;
                }

                if (user.emergency_contact != null)
                {
                    pa.emergency_contact = user.emergency_contact;
                }

                if (user.Address != null)
                {
                    pa.address = user.Address;
                }

                if (user.gender != null)
                {
                    pa.gender = user.gender;
                }

                if (user.blood_group != null)
                {
                    pa.blood_group = user.blood_group;
                }

                if (user.dob != null)
                {
                    pa.dob = user.dob;
                }
                if (user.new_password != null && user.current_password != null)
                {
                    if (string.Equals(user.current_password, pa.password))
                    {
                        pa.password = user.new_password;
                    }
                    else
                    {
                        ViewBag.a = "Enter your current password";
                        return(View("EditProfile"));
                    }
                }

                obj1.Patients.AddOrUpdate(pa);
                obj1.SaveChanges();

                return(RedirectToAction("ViewProfile", "ViewProfile"));
            }

            return(RedirectToAction("ViewProfile", "ViewProfile"));
        }
Example #12
0
        public JsonResult NewPatient(ViewModels.Patient model)
        {
            Data.Models.Account account = UserHelper.GetCurrentAccount();
            Guid accountId = account.GetId();

            try
            {
                Data.Patient patient = new Data.Patient()
                {
                    ResidentialEnvironmentId = SADFM.Data.Models.BaseModel.DecryptNullableId(model.ResidentialEnvironmentID),
                    AdmitFromId                   = SADFM.Data.Models.BaseModel.DecryptNullableId(model.AdmitFromID),
                    Street                        = model.Street,
                    DischargeToId                 = SADFM.Data.Models.BaseModel.DecryptNullableId(model.DischargeToID),
                    FirstName                     = model.FirstName,
                    PatientId                     = Guid.NewGuid(),
                    LastName                      = model.LastName,
                    DateCreatedTimestamp          = DateTime.Now,
                    LastUpdateTimestamp           = DateTime.Now,
                    LastUpdateAccountId           = accountId,
                    IDNumber                      = model.IDNumber,
                    ContactNumber                 = model.ContactNumber,
                    ProvinceId                    = SADFM.Data.Models.BaseModel.DecryptNullableId(model.ProvinceId),
                    CityId                        = SADFM.Data.Models.BaseModel.DecryptNullableId(model.CityId),
                    PostalCode                    = model.PostalCode,
                    NextOfKinName                 = model.NextOfKinName,
                    NextOfKinContact              = model.NextOfKinContact,
                    NextOfKinEmail                = model.NextOfKinEmail,
                    NextOfKinRelationship         = model.NextOfKinRelationship,
                    RaceId                        = SADFM.Data.Models.BaseModel.DecryptNullableId(model.RaceID),
                    GenderId                      = SADFM.Data.Models.BaseModel.DecryptNullableId(model.GenderID),
                    BirthDate                     = Convert.ToDateTime(model.BirthDate),
                    TitleId                       = SADFM.Data.Models.BaseModel.DecryptNullableId(model.TitleId),
                    CountryId                     = SADFM.Data.Models.BaseModel.DecryptNullableId(model.CountryID),
                    MedicalSchemeMembershipNumber = model.MedicalSchemeNo,
                    PatientSupportServices        = model.SupportServices != null?model.SupportServices.Select(x => new Data.PatientSupportService()
                    {
                        SupportServiceId     = x.SupportServiceId,
                        Note                 = x.Note,
                        LastUpdatedTimestamp = DateTime.Now,
                        LastUpdatedAccountId = UserHelper.GetCurrentAccount().GetId()
                    }).ToList() : null
                };

                if (model.MedicalSchemeID != null)
                {
                    patient.MedicalSchemeId = SADFM.Data.Models.BaseModel.DecryptId(model.MedicalSchemeID);
                }
                DataAccess.Account.AddPatient(patient, accountId);


                if (UserHelper.SelectedClientId.HasValue)
                {
                    bool hasClosedCase;
                    Guid?caseId;
                    DataAccess.Patient.AddPatientProvider(new Data.Models.PatientProvider()
                    {
                        AssignedTimestamp   = DateTime.Now,
                        DischargedTimestamp = null,
                        ProviderId          = BaseModel.EncryptId(UserHelper.SelectedClientId.Value),
                        CaseId            = null,
                        AccountID         = BaseModel.EncryptId(accountId),
                        PatientId         = BaseModel.EncryptId(patient.PatientId),
                        PatientProviderID = null
                    }, accountId, out hasClosedCase, out caseId);
                }
                return(Json(new
                {
                    Success = true,
                    Id = patient.PatientId.ToString("N"),
                    Guid = patient.PatientId.ToString()
                }));
            }
            catch (Exception e)
            {
                SADFM.Base.NLogHelper.WriteEvent(NLog.LogLevel.Info, "PatientController.NewPatient" + " ->> " + "Account: " + account.Username + "\r\n" + e.Message);
                return(Json(new
                {
                    Success = false,
                    Message = "Error has occurred."
                }));
            }
        }
Example #13
0
 private string GroupAndOrderByRoom(Data.Patient p)
 {
     return(p.RoomName);
 }
Example #14
0
 private string GroupByIllfield(Data.Patient p)
 {
     return(p.RoomName);
 }
Example #15
0
 private string OrderByBed(Data.Patient p)
 {
     return(p.BedName);
 }
Example #16
0
        public ActionResult SignUp(Signup user)

        {
            if (ModelState.IsValid)
            {
                if (string.Equals(user.usertype, "Patient"))
                {
                    if (!(obj1.Patients.Where(m => m.email == user.email).FirstOrDefault() == null))
                    {
                        ViewBag.a = "Account already exists";
                    }
                    else
                    {
                        if (string.Equals(user.password, user.confirmpassword))
                        {
                            Patient pa = new Data.Patient();
                            pa.name     = user.name;
                            pa.email    = user.email;
                            pa.password = user.confirmpassword;
                            obj1.Patients.Add(pa);
                            obj1.SaveChanges();
                            ViewBag.a = "Successfully Added";
                            return(RedirectToAction("Login", "Login"));
                        }
                        else
                        {
                            ViewBag.a = "Password not match";
                            return(View("SignUp"));
                        }
                    }
                }
                else if (string.Equals(user.usertype, "Doctor"))
                {
                    if (!(obj2.Doctors.Where(m => m.email == user.email).FirstOrDefault() == null))
                    {
                        ViewBag.a = "Account already exists";
                    }
                    else
                    {
                        if (string.Equals(user.password, user.confirmpassword))
                        {
                            Doctor doc = new Data.Doctor();
                            doc.name     = user.name;
                            doc.email    = user.email;
                            doc.password = user.confirmpassword;
                            obj2.Doctors.Add(doc);
                            obj2.SaveChanges();
                            ViewBag.a = "Successfully Added";
                            return(RedirectToAction("Login", "Login"));
                        }
                        else
                        {
                            ViewBag.a = "Password not match";
                            return(View("SignUp"));
                        }
                    }
                }
                else if (string.Equals(user.usertype, "DrugStore"))
                {
                    if (!(obj3.DrugStores.Where(m => m.email == user.email).FirstOrDefault() == null))
                    {
                        ViewBag.a = "Account already exists";
                    }
                    else
                    {
                        if (string.Equals(user.password, user.confirmpassword))
                        {
                            DrugStore dru = new Data.DrugStore();
                            dru.name     = user.name;
                            dru.email    = user.email;
                            dru.password = user.confirmpassword;
                            obj3.DrugStores.Add(dru);
                            obj3.SaveChanges();
                            ViewBag.a = "Successfully Added";

                            return(RedirectToAction("Login", "Login"));
                        }
                        else
                        {
                            ViewBag.a = "Password not match";
                            return(View("SignUp"));
                        }
                    }
                }
                else if (string.Equals(user.usertype, "DiagnosticCenter"))
                {
                    if (!(obj4.DiagnosticCenters.Where(m => m.email == user.email).FirstOrDefault() == null))
                    {
                        ViewBag.a = "Account already exists";
                    }
                    else
                    {
                        if (string.Equals(user.password, user.confirmpassword))
                        {
                            DiagnosticCenter dia = new Data.DiagnosticCenter();
                            dia.name     = user.name;
                            dia.email    = user.email;
                            dia.password = user.confirmpassword;
                            obj4.DiagnosticCenters.Add(dia);
                            obj4.SaveChanges();
                            ViewBag.a = "Successfully Added";
                            return(RedirectToAction("Login", "Login"));
                        }

                        else
                        {
                            ViewBag.a = "Password not match";
                            return(View("SignUp"));
                        }
                    }
                }
            }


            return(View());
        }