예제 #1
0
        public void TestGetPatient()
        {
            PatientsDBAccess.ICUStatu obj       = new ICUStatu();
            List <ICUStatu>           patients1 = new List <ICUStatu>();
            List <ICUStatu>           patients2 = new List <ICUStatu>();

            obj.FirstName        = "Pranay";
            obj.LastName         = "Kumar";
            obj.PatientDob       = "07/11/1996";
            obj.PatientGender    = "Male";
            obj.PatientHeight    = 179;
            obj.DoctorAssigned   = "Navaneeth";
            obj.bedNo            = 5;
            obj.PatientWeight    = 63;
            obj.ReasonAdmitted   = "yo";
            obj.OtherMedications = "yo";
            obj.PatientId        = "1";
            obj.AdmissionDate    = "yo";
            patients1.Add(obj);
            IcuDbMySqlRepo obj2 = new IcuDbMySqlRepo();

            patients2 = obj2.GetPatient();
            Assert.AreEqual(patients1[0].FirstName, patients2[0].FirstName);
            Assert.AreEqual(patients1[0].PatientGender, patients2[0].PatientGender);
            Assert.AreEqual(patients1[0].PatientHeight, patients2[0].PatientHeight);
            Assert.AreEqual(patients1[0].LastName, patients2[0].LastName);
            Assert.AreEqual(patients1[0].PatientDob, patients2[0].PatientDob);
            Assert.AreEqual(patients1[0].PatientId, patients2[0].PatientId);
            Assert.AreEqual(patients1[0].ReasonAdmitted, patients2[0].ReasonAdmitted);
            Assert.AreEqual(patients1[0].PatientWeight, patients2[0].PatientWeight);
        }
예제 #2
0
        public void TestAddPatient()
        {
            PatientsDBAccess.ICUStatu obj       = new ICUStatu();
            List <ICUStatu>           patients1 = new List <ICUStatu>();
            List <ICUStatu>           patients2 = new List <ICUStatu>();
            Random r = new Random();

            obj.FirstName        = RandomString(5, true);
            obj.LastName         = RandomString(5, true);;
            obj.PatientDob       = "07/11/96";
            obj.PatientGender    = "Male";
            obj.PatientHeight    = r.Next();
            obj.DoctorAssigned   = RandomString(5, true);;
            obj.bedNo            = 5;
            obj.PatientWeight    = 63;
            obj.ReasonAdmitted   = "yo";
            obj.OtherMedications = "yo";
            obj.PatientId        = RandomString(5, true);;
            obj.AdmissionDate    = "yo";

            IcuDbMySqlRepo obj2 = new IcuDbMySqlRepo();

            patients2 = obj2.GetPatient();
            int initialcount = patients2.Count;

            obj2.AddPatient(obj);
            patients2 = obj2.GetPatient();
            int finalcount = patients2.Count;

            Assert.AreEqual(initialcount + 1, finalcount);
        }
예제 #3
0
 public ICUStatu AddPatient(ICUStatu record)
 {
     using (ICUDBEntities1 entities = new ICUDBEntities1())
     {
         var entity = entities.ICUStatus.Add(record);
         entities.SaveChanges();
         return(entity);
     }
 }
예제 #4
0
        public HttpResponseMessage Put(string id, [FromBody] ICUStatu patientstatus)
        {
            _icu = _con.Resolve <ICUDBMySQLRepoInterfaceLib.IICUDBRepo>();
            var entity = _icu.UpdatePatientStatus(id, patientstatus);

            if (entity == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "patient with id" + id + "Is not found"));
            }

            else
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "models details successfully updated "));
            }
        }
예제 #5
0
        [HttpPost]//Adding customer details

        public HttpResponseMessage Post([FromBody] ICUStatu registerpatient)

        {
            _icu = _con.Resolve <ICUDBMySQLRepoInterfaceLib.IICUDBRepo>();

            var entity = _icu.AddPatient(registerpatient);

            if (entity == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Patient not admitted "));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.OK, "Patient admitted  "));
            }
        }
예제 #6
0
 public ICUStatu UpdatePatientStatus(string id, ICUStatu updatestatus)
 {
     using (ICUDBEntities1 entities = new ICUDBEntities1())
     {
         var entity = entities.ICUStatus.FirstOrDefault(e => e.PatientId == id);
         entity.FirstName        = updatestatus.FirstName;
         entity.LastName         = updatestatus.LastName;
         entity.AdmissionDate    = updatestatus.AdmissionDate;
         entity.DoctorAssigned   = updatestatus.DoctorAssigned;
         entity.PatientAge       = updatestatus.PatientAge;
         entity.PatientGender    = updatestatus.PatientGender;
         entity.PatientHeight    = updatestatus.PatientHeight;
         entity.PatientWeight    = updatestatus.PatientWeight;
         entity.PatientStatus    = updatestatus.PatientStatus;
         entity.SPO2             = updatestatus.SPO2;
         entity.Temperature      = updatestatus.Temperature;
         entity.PulseRate        = updatestatus.PulseRate;
         entity.bedNo            = updatestatus.bedNo;
         entity.OtherMedications = updatestatus.OtherMedications;
         entity.PatientDob       = updatestatus.PatientDob;
         entities.SaveChanges();
         return(entity);
     }
 }