Beispiel #1
0
        public async Task <IActionResult> Get(int id, PatientDetail patientDetail)
        {
            if (id != patientDetail.Id)
            {
                return(BadRequest());
            }
            _context.Entry(patientDetail).State = EntityState.Modified;

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

            return(NoContent());
        }
Beispiel #2
0
        public async Task <IActionResult> PutPatient(long id, Patient patient)
        {
            if (id != patient.Id)
            {
                return(BadRequest());
            }

            var existingPatient = await _context.Patients.FindAsync(id);

            if (existingPatient == null)
            {
                return(NotFound());
            }

            //trying to restore a patient
            if (existingPatient.Deleted && !patient.Deleted)
            {
                return(BadRequest("Cannot restore a patient"));
            }

            _context.Entry(existingPatient).State = EntityState.Detached;

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

            await _context.SaveChangesAsync();

            return(NoContent());
        }
Beispiel #3
0
        public IActionResult Update(int id, Patient patient)
        {
            if (ModelState.IsValid)
            {
                var existingPatient = _context.Patients
                                      .Include(pa => pa.Contacts)
                                      .Single(p => p.Id == id);
                if (existingPatient == null)
                {
                    return(NotFound());
                }

                // Update Existing Patient
                existingPatient.ModifiedDate = DateTime.Now;
                _context.Entry(existingPatient).CurrentValues.SetValues(patient);

                // Delete Contacts
                foreach (var existingContact in existingPatient.Contacts.ToList())
                {
                    if (!patient.Contacts.Any(c => c.Id == existingContact.Id))
                    {
                        _context.ContactPoints.Remove(existingContact);
                    }
                }

                // Update and Insert Contacts
                foreach (var contactModel in patient.Contacts)
                {
                    var existingContact = existingPatient.Contacts
                                          .Where(c => c.Id == contactModel.Id)
                                          .SingleOrDefault();
                    if (existingContact != null)
                    {
                        _context.Entry(existingContact).CurrentValues.SetValues(contactModel);
                    }
                    else
                    {
                        var newContact = new ContactPoint
                        {
                            Id     = contactModel.Id,
                            System = contactModel.System,
                            Use    = contactModel.Use,
                            Value  = contactModel.Value
                        };
                        existingPatient.Contacts.Add(newContact);
                    }
                }

                _context.SaveChanges();

                return(NoContent());
            }
            else
            {
                return(BadRequest(ModelState));
            }
        }
        public ActionResult EditPatient(Patient patient)
        {
            dbp.Entry(patient).State = System.Data.Entity.EntityState.Modified;
            dbp.SaveChanges();

            return(RedirectToAction("IndexPat"));
        }
Beispiel #5
0
        public async Task <IActionResult> PutPatient([FromRoute] long id, [FromBody] Patient patient)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != patient.PatientKey)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Beispiel #6
0
        public ActionResult Edit([Bind(Include = "ImmId,PatientId,ImmDate,Notes,FilePath,FileContent")] Immunizations immunizations, HttpPostedFileBase file)
        {
            // Logger.Log(LogLevel.Debug, "Starting ImmunizationsController Post Edit.", "Patient Id = " + immunizations.PatientId.ToString(), "", "");
            if (ModelState.IsValid)
            {
                try
                {
                    string FileExt = Path.GetExtension(file.FileName).ToUpper();

                    if (FileExt == ".PDF")
                    {
                        Stream       str     = file.InputStream;
                        BinaryReader Br      = new BinaryReader(str);
                        Byte[]       FileDet = Br.ReadBytes((Int32)str.Length);
                        immunizations.FilePath    = Path.GetFileName(file.FileName);
                        immunizations.FileContent = FileDet;
                    }
                    else
                    {
                        ViewBag.FileStatus = "Invalid file format.  Choose a pdf file.";
                        return(View());
                    }

                    db.Entry(immunizations).State = EntityState.Modified;
                    db.SaveChanges();

                    //  Logger.Log(LogLevel.Debug, "Returning ImmunizationsController Post Edit.", "Patient Id = " + immunizations.PatientId.ToString(), "", "Saved changes full path name");
                    return(RedirectToAction("ImmIndex", "Immunizations", new { id = immunizations.PatientId }));
                }
                catch (Exception ex)
                {
                }
            }
            return(View(immunizations));
        }
        public ActionResult EditPatient(Patient patient)
        {
            dbp.Entry(patient).State = System.Data.Entity.EntityState.Modified;
            dbp.SaveChanges();

            return(RedirectToAction("Index", new { id = Session["userID"] }));
        }
Beispiel #8
0
        public ActionResult Edit([Bind(Include = "DocFileId,DocDate,DocType,PatientId,Notes,FilePath, FileContent")] Documents documents, HttpPostedFileBase file)
        {
            // Logger.Log(LogLevel.Debug, "Starting DocumentsController Post Edit.", "Patient id = " + documents.PatientId, "", "");
            if (ModelState.IsValid)
            {
                try
                {
                    string FileExt = Path.GetExtension(file.FileName).ToUpper();

                    if (FileExt == ".PDF")
                    {
                        Stream       str     = file.InputStream;
                        BinaryReader Br      = new BinaryReader(str);
                        Byte[]       FileDet = Br.ReadBytes((Int32)str.Length);
                        documents.FilePath    = Path.GetFileName(file.FileName);
                        documents.FileContent = FileDet;
                    }
                    else
                    {
                        ViewBag.FileStatus = "Invalid file format.  Choose a pdf file.";
                        return(View());
                    }

                    db.Entry(documents).State = EntityState.Modified;
                    db.SaveChanges();
                    // Logger.Log(LogLevel.Debug, "Saved DocumentsController Get Edit.", "Patient id = " + documents.PatientId, "", documents.DocFileId.ToString());
                    return(RedirectToAction("DocFileIndex", "Documents", new { id = documents.PatientId }));
                }
                catch (Exception ex)
                {
                }
            }
            //Logger.Log(LogLevel.Debug, "Model not valid DocumentsController Get Edit.", "Patient id = " + documents.PatientId, "", documents.DocFileId.ToString());
            return(View(documents));
        }
        public async Task <IActionResult> PutLabResult(int id, LabResult labResult)
        {
            if (id != labResult.LabID)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
Beispiel #10
0
        public ActionResult Discharge(Patient patient1)
        {
            Patient patient = dbp.Patients.Find(patient1.Id);

            patient.discharged       = patient1.discharged;
            dbp.Entry(patient).State = System.Data.Entity.EntityState.Modified;
            dbp.SaveChanges();

            return(RedirectToAction("Index", new { id = Session["userID"] }));
        }
Beispiel #11
0
 public ActionResult Edit([Bind(Include = "Id,IIN,FIO,Address,Phone")] Patients patient)
 {
     if (ModelState.IsValid)
     {
         db.Entry(patient).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(patient));
 }
Beispiel #12
0
        public async Task <ActionResult <Patient> > DeletePatient(long id)
        {
            var patient = await _patientContext.Patients.FindAsync(id);

            patient.Deleted = true;

            _patientContext.Entry(patient).State = EntityState.Modified;

            await _patientContext.SaveChangesAsync();

            return(patient);
        }
 public ActionResult Edit([Bind(Include = "OtherId,PatientId,VisitDate,TCell,ViralLoad,WhiteBloodCell,Hemoglobin,PlasmaIronTurnover,OtherWeight,Triglycerides,TotalCholesterol,OtherDocuments")] OtherManagement otherManagement)
 {
     //      Logger.Log(LogLevel.Debug, "Starting OtherManagementsController Post Edit.", "Patient Id = " + otherManagement.PatientId.ToString(), "", "");
     if (ModelState.IsValid)
     {
         db.Entry(otherManagement).State = EntityState.Modified;
         db.SaveChanges();
         //          Logger.Log(LogLevel.Debug, "Returning OtherManagementsController Post Edit.", "Patient Id = " + otherManagement.PatientId.ToString(), "", "Saved Changes");
         return(RedirectToAction("OtherIndex", "OtherManagements", new { id = otherManagement.PatientId }));
     }
     //       Logger.Log(LogLevel.Debug, "Returning OtherManagementsController Post Edit.", "Patient Id = " + otherManagement.PatientId.ToString(), "", "");
     return(View(otherManagement));
 }
Beispiel #14
0
 public ActionResult Edit([Bind(Include = "VisitId,PatientId,Initial,VisitType,VisitDate,DiagnosisCode,CoPay,PaymentType,CheckNumber,TotalPaid,MedicalAllergy,ReferralReason,History,PastHistory,Epidemiology,FamilyHistory,SocialHistory,RosGeneral,RosHeent,Respiratory,Cardiovascular,Gastrointestinal,Genitourniary,RosNeurological,psychosocial,Medications,PeGeneral,BloodPressure,HeartRate,Tempurature,Weight,PeHeent,Neck,Skin,Lungs,Heart,Abdomen,Musculoskeletal,PeNeurological,Additional,Documentsoratory,Assessment,Plan,ProblemList,DateSignedByPhys")] Visits visit)
 {
     //       Logger.Log(LogLevel.Debug, "Starting VisitsController Post Edit.", "Patient Id = " + visit.PatientId.ToString(), "", "");
     if (ModelState.IsValid)
     {
         db.Entry(visit).State = EntityState.Modified;
         db.SaveChanges();
         //          Logger.Log(LogLevel.Debug, "Returning VisitsController Post Edit.", "Patient Id = " + visit.PatientId.ToString(), "", "Saved changes");
         return(RedirectToAction("PatientIndex", new { id = visit.PatientId }));
     }
     //      Logger.Log(LogLevel.Debug, "Returning VisitsController Post Edit.", "Patient Id = " + visit.PatientId.ToString(), "", "");
     return(View(visit));
 }
Beispiel #15
0
 public ActionResult Edit([Bind(Include = "HIVManagmentId,PatientId,Problem,VisitDate,ICD10,MedicationStart,Medication,MedDiscDate")] HIVManagement hIVManagement)
 {
     //     Logger.Log(LogLevel.Debug, "Starting HIVManagementsController Post Edit.", "Patient Id = " + hIVManagement.PatientId.ToString(), "", "");
     if (ModelState.IsValid)
     {
         db.Entry(hIVManagement).State = EntityState.Modified;
         db.SaveChanges();
         //        Logger.Log(LogLevel.Debug, "Returning HIVManagementsController Post Edit.", "Patient Id = " + hIVManagement.PatientId.ToString(), "", "Saved Changes");
         return(RedirectToAction("HIVIndex", "HIVManagements", new { id = hIVManagement.PatientId }));
     }
     //     Logger.Log(LogLevel.Debug, "Returning HIVManagementsController Post Edit.", "Patient Id = " + hIVManagement.PatientId.ToString(), "", "s");
     return(View(hIVManagement));
 }
 public ActionResult Edit([Bind(Include = "Id,Active,LastName,FirstName,MiddleInitial,StreetAddress,City,State,PostalCode,PatientPhone,PatientPhoneType,OtherPatientPhone,OtherPhoneType," +
                                          "BirthDate,SOC,Gender,Status,Employed,EmployerName,EmployerPhone,Relation,SubscriberLastName,SubscriberMiddleInitial,SubscriberBirthDate,SubscriberSOC," +
                                          "SubscriberGender,ReferingPhysician,ReferingPhysicianPhone,EmergencyContact,EmergencyPhone,PrimaryInsurance,SecondaryInsurance,PharmacyPhone,HIVDiagnosisDate,TCellAtDiagnosis,ViralLoadAtDiagnosis,Signature,DateSigned")] Patient patient)
 {
     //        Logger.Log(LogLevel.Debug, "Starting PatientsController Post Edit.", "Patient Id = " + patient.Id.ToString(), "", "");
     if (ModelState.IsValid)
     {
         db.Entry(patient).State = EntityState.Modified;
         db.SaveChanges();
         //            Logger.Log(LogLevel.Debug, "Starting PatientsController Post Edit.", "Patient Id = " + patient.Id.ToString(), "", "Save changes");
         return(RedirectToAction("Index"));
     }
     //        Logger.Log(LogLevel.Debug, "Returning PatientsController Post Edit.", "Patient Id = " + patient.Id.ToString(), "", "");
     return(View(patient));
 }
        public ActionResult Edit([Bind(Include = "CommId,PatientId,CommDate,Notes")] Communication communication, HttpPostedFileBase file)
        {
            // Logger.Log(LogLevel.Debug, "Starting Patient CommunicationController Post Edit.", "Patient Id = " + communication.PatientId.ToString(), "", "");

            if (ModelState.IsValid)
            {
                string notes = communication.Notes.Replace("\r", "<br />");
                communication.Notes = notes;

                db.Entry(communication).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("CommIndex", "Communications", new { id = communication.PatientId }));
            }
            // Logger.Log(LogLevel.Debug, "Returning Patient CommunicationController Post Edit.", "Patient Id = " + communication.PatientId.ToString(), "", "");
            return(View(communication));
        }
Beispiel #18
0
 public ActionResult Edit(Patient patient)
 {
     if (ModelState.IsValid)
     {
         try
         {
             db.Entry(patient).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch (Exception)
         {
             return(RedirectToRoute("Error"));
         }
     }
     return(View(patient));
 }
Beispiel #19
0
        public void Edit(int id, Patient PatientData)
        {
            Patient patient;

            using (var db = new PatientContext())
            {
                patient                = db.Patients.Find(id);
                patient.First_name     = PatientData.First_name;
                patient.Middle_initial = PatientData.Middle_initial;
                patient.Last_name      = patient.Last_name;
                patient.Email          = PatientData.Email;
                patient.Phone          = PatientData.Phone;
                patient.Address        = PatientData.Address;

                db.Entry(patient).State = EntityState.Modified;
                db.SaveChanges();
            }
        }
Beispiel #20
0
 public void Update(PatientInformation info)
 {
     _context.PatientInformations.Attach(info);
     _context.Entry(info).State = EntityState.Modified;
 }
Beispiel #21
0
 public void Update(PersonalDatum datum)
 {
     _context.PersonalData.Attach(datum);
     _context.Entry(datum).State = EntityState.Modified;
 }