public IActionResult AddVisits() { PatientProgram pp = VisitModel.Program; pp.ArtStartedOn = DateTime.Parse(VisitModel.ArtStartedOn); pp.CptStartedOn = DateTime.Parse(VisitModel.CptStartedOn); pp.UpdateVisit(); //Test If Regimen has Changed, then Update PatientRegimen pr = VisitModel.Regimen; pr.Program = pp; pr.Save(HttpContext); //Post Visit PatientExamination px = VisitModel.Examination; px.Program = pp; px.LabNo = pp.LaboratoryNumber; px.SputumSmearDate = DateTime.Parse(VisitModel.SputumSmearDate); px.GeneXpertDate = DateTime.Parse(VisitModel.GeneXpertDate); px.HivExamDate = DateTime.Parse(VisitModel.HivExamDate); px.XrayExamDate = DateTime.Parse(VisitModel.XrayExamDate); px.Save(HttpContext); return(LocalRedirect("/patients/profile/" + pp.Patient.GetUuid())); }
public IActionResult UpdatePatientOutcome() { DateTime date = DateTime.ParseExact(ProfileModel.OutcomeDate, "dd/MM/yyyy", CultureInfo.InvariantCulture); PatientProgram pp = ProfileModel.Program; PatientExamination px = ProfileModel.Examination; Patient pt = ProfileModel.Patient; pp.DateCompleted = date; pp.LaboratoryNumber = px.LabNo; pp.UpdateOutcome(); px.SputumSmearDate = date; px.Visit = new Visit(25); px.Program = pp; px.Save(HttpContext); if (pp.Outcome.Id.Equals(Constants.PATIENT_DIED)) { pt.isDead(true); pt.DiedOn = date; pt.CauseOfDeath = new Concept(pp.Program.Id); pt.Update(); } return(LocalRedirect("/patients/profile/" + pt.GetUuid())); }
public IActionResult RegisterNewIntake() { PatientProgram pp = IntakeModel.Program; pp.ArtStartedOn = DateTime.Parse(IntakeModel.ArtStartedOn); pp.CptStartedOn = DateTime.Parse(IntakeModel.CptStartedOn); pp.UpdateIntake(); PatientRegimen pr = IntakeModel.Regimen; pr.Program = pp; pr.Save(HttpContext); PatientExamination px = IntakeModel.Examination; px.Program = pp; px.Visit = new Visit(1); px.LabNo = pp.LaboratoryNumber; px.SputumSmearDate = DateTime.Parse(IntakeModel.SputumSmearDate); px.GeneXpertDate = DateTime.Parse(IntakeModel.GeneXpertDate); px.HivExamDate = DateTime.Parse(IntakeModel.HivExamDate); px.XrayExamDate = DateTime.Parse(IntakeModel.XrayExamDate); px.Save(HttpContext); return(LocalRedirect("/patients/profile/" + pp.Patient.GetUuid())); }
public IActionResult RegisterMultiple() { Facility facility = new Facility { Id = MultipleModel.Facility }; foreach (var line in MultipleModel.PatientModel) { if (string.IsNullOrEmpty(line.PatientProgram.Patient.Person.Name)) { continue; } Patient patient = line.PatientProgram.Patient; patient.Person.DateOfBirth = DateTime.Now.AddYears(0 - Convert.ToInt32(line.Age)); patient.Save(); patient.Person.Address = new PersonAddress { Telephone = line.Address, Person = patient.Person }.Save(HttpContext); PatientProgram pp = line.PatientProgram; pp.Facility = facility; pp.Patient = patient; pp.DateEnrolled = DateTime.Parse(line.Date); pp.Create(HttpContext); //Update Intake pp.ArtStartedOn = DateTime.Parse(line.Date); pp.CptStartedOn = DateTime.Parse(line.Date); pp.UpdateIntake(); //Regimen new PatientRegimen { Regimen = new Regimen { Id = Constants.REG_SHORT_ADULT }, Program = pp }.Save(HttpContext); //Examinations PatientExamination px = line.Examination; px.Program = pp; px.Visit = new Visit(1); px.LabNo = "N/A"; px.SputumSmearDate = DateTime.Parse(line.Date); px.GeneXpertDate = DateTime.Parse(line.Date); px.HivExamDate = DateTime.Parse(line.Date); px.XrayExamDate = DateTime.Parse(line.Date); px.Save(HttpContext); } return(LocalRedirect("/patients/register/tb?fac=" + MultipleModel.Facility)); }