internal static async Task <string> PutVitalData(VitalsDataModel requestObj) { try { HttpResponseMessage response = await Client.PutAsJsonAsync("api/VitalData/" + requestObj.PatientId, requestObj).ConfigureAwait(false); // Verification if (response.IsSuccessStatusCode) { response.Dispose(); return("Vitals update successful!"); } else { // Reading Response. string result = response.Content.ReadAsStringAsync().Result; result = JsonConvert.DeserializeObject <string>(result); return(result); } } catch (Exception exception) { return(exception.Message); } }
internal static async Task <VitalsDataModel> GetVitalData(string patientId) { try { HttpResponseMessage response = await Client.GetAsync("api/VitalData/" + patientId).ConfigureAwait(false); // Verification if (response.IsSuccessStatusCode) { // Reading Response. string result = response.Content.ReadAsStringAsync().Result; VitalsDataModel responseObj = JsonConvert.DeserializeObject <VitalsDataModel>(result); // Releasing. response.Dispose(); return(responseObj); } else { return(null); } } catch (Exception) { return(null); } }
public IActionResult Get(string id) { VitalsDataModel vital = _vitaldatabase.GetAllVital(id); if (vital != null) { return(Ok(vital)); } return(BadRequest("Vitals for patient not found.")); }
public IActionResult Delete(string id) { VitalsDataModel vital = _vitaldatabase.RemoveVital(id); if (vital != null) { return(Ok(vital)); } return(BadRequest("Vitals for patient does not exist.")); }
public IActionResult Post([FromBody] VitalsDataModel vital) { var result = _vitaldatabase.NewVitalAdd(vital); if (result != null) { return(Ok(result)); } return(BadRequest("Patient not found OR Vitals for patient already exist.")); }
public IActionResult Put(string id, [FromBody] VitalsDataModel vitalDetailchanges) { if (vitalDetailchanges.PatientId == id) { var result = _vitaldatabase.UpdatePatientVitals(vitalDetailchanges); if (result != null) { return(Ok(result)); } } return(BadRequest("Vitals for patient does not exist.")); }
public VitalsDataModel RemoveVital(string patientId) { VitalsDataModel vital = _context.Vitals.Find(patientId); if (vital != null) { _context.Vitals.Remove(vital); _context.SaveChanges(); return(vital); } return(null); }
internal static async Task <string> PostVitalsData(VitalsDataModel requestObj) { try { HttpResponseMessage response = await Client.PostAsJsonAsync("api/VitalData/", requestObj).ConfigureAwait(false); return(ConvertHttpResponseToStringResponse(ref response)); } catch (Exception exception) { return(exception.Message); } }
public VitalsDataModel NewVitalAdd(VitalsDataModel vital) { PatientDataModel idInPatientTable = _context.Patients.Find(vital.PatientId); VitalsDataModel idInVitalTable = _context.Vitals.Find(vital.PatientId); if (idInPatientTable != null && idInVitalTable == null) { _context.Vitals.Add(vital); _context.SaveChanges(); return(vital); } return(null); }
public UpdateVitalsViewModel(string patientId, string bedId) { _vitalsDataModel = new VitalsDataModel(patientId, bedId); VitalsDataModel responseObj = HttpClientUtility.GetVitalData(patientId).Result; Bpm = responseObj.Bpm; Spo2 = responseObj.Spo2; RespRate = responseObj.RespRate; Message = ""; UpdateVitalsCommand = new Command.DelegateCommandClass(UpdateVitalsWrapper, CanExecuteWrapper); }
public VitalsDataModel UpdatePatientVitals(VitalsDataModel patientvital) { string id = patientvital.PatientId; if (_context.Vitals.Find(id) == null) { return(null); } VitalsDataModel vital = _context.Vitals.Find(id); vital.PatientBedId = patientvital.PatientBedId; vital.RespRate = patientvital.RespRate; vital.Spo2 = patientvital.Spo2; vital.Bpm = patientvital.Bpm; _context.SaveChanges(); return(vital); }
public string CheckVital(string patientId) { VitalsDataModel vital = _context.Vitals.Find(patientId); if (vital == null) { return(null); } string email = "*****@*****.**"; string spo2Result = CheckSpo2InRange(vital.Spo2); string bpmResult = CheckBpmInRange(vital.Bpm); string respRateResult = CheckRespRateInRange(vital.RespRate); string alert = spo2Result + bpmResult + respRateResult; if (alert.Length != 0) { alert = "PatientId:" + patientId + " --> " + alert; SendAlert(email, alert); } return(alert); }
public VitalsDataModel GetAllVital(string patientId) { VitalsDataModel vital = _context.Vitals.Find(patientId); return(vital); }