public JsonResult downloadsessionrecords(string sessionid, string rxid) { try { if (!string.IsNullOrEmpty(sessionid) && !string.IsNullOrEmpty(rxid)) { Patient lpatient = IPatient.GetPatientBySessionID(sessionid); if (lpatient != null) { List <SessionItem> _result = lISessionRepository.getSessionList(lpatient.PatientId, rxid); return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", sessionlist = _result, TimeZone = DateTime.UtcNow.ToString("s") })); } else { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "patient is not registered", TimeZone = DateTime.UtcNow.ToString("s") })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "request string is not proper", TimeZone = DateTime.UtcNow.ToString("s") })); } } catch (Exception ex) { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "Internal server error", TimeZone = DateTime.UtcNow.ToString("s") })); } }
public JsonResult cancelappointment([FromBody] cancelappointment pcancelappointment, string sessionid) { string timezoneid = TimeZoneInfo.Local.SupportsDaylightSavingTime ? TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName;//"US Eastern Standard Time";// try { if (!string.IsNullOrEmpty(sessionid) && pcancelappointment != null) { Patient lpatient = IPatient.GetPatientBySessionID(sessionid); if (lpatient != null) { string _result = lIAppointmentScheduleRepository.CancelAppointments(lpatient.PatientId, pcancelappointment.UserID, pcancelappointment.DateTime); return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", TimeZone = timezoneid })); } else { return(Json(new { Status = (int)HttpStatusCode.BadRequest, result = "patient is not registered", TimeZone = timezoneid })); } } else { return(Json(new { Status = (int)HttpStatusCode.Created, result = "request string is not proper", TimeZone = timezoneid })); } } catch (Exception ex) { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "Internal server error", TimeZone = timezoneid })); } }
public JsonResult downloadmessages(string sessionid, string datetime = "") { try { if (!string.IsNullOrEmpty(sessionid)) { Patient lpatient = IPatient.GetPatientBySessionID(sessionid); if (lpatient != null) { MessageViewList lmessageList = new MessageViewList(); if (string.IsNullOrEmpty(datetime)) { lmessageList.messages = lIMessageRepository.getMessages(lpatient.PatientLoginId); } else { lmessageList.messages = lIMessageRepository.getMessages(lpatient.PatientLoginId, datetime); } string timezoneid = TimeZoneInfo.Local.SupportsDaylightSavingTime ? TimeZoneInfo.Local.DaylightName : TimeZoneInfo.Local.StandardName; lmessageList.timezoneOffset = timezoneid; return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", timezoneOffset = lmessageList.timezoneOffset, messages = lmessageList.messages })); } else { return(Json(new { Status = (int)HttpStatusCode.Forbidden, result = "patient is not configured", TimeZone = DateTime.UtcNow.ToString("s") })); } } else { return(Json(new { Status = (int)HttpStatusCode.Forbidden, result = "input is not valid", TimeZone = DateTime.UtcNow.ToString("s") })); } } catch (Exception ex) { logger.LogDebug("Get Rx Error: " + ex); return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "getting messages failed" })); } }
public JsonResult patientsummary(string sessionid, string rxid) { PatientSummary lsummary = new PatientSummary(); try { if (!string.IsNullOrEmpty(sessionid) && !string.IsNullOrEmpty(rxid)) { Patient lpatient = IPatient.GetPatientBySessionID(sessionid); if (lpatient != null) { PatientRx lPatientRx = lIPatientRxRepository.getPatientRxbyRxId(rxid, lpatient.PatientId.ToString()); if (lPatientRx != null) { lsummary.RxStartDate = lPatientRx.RxStartDate.Value; lsummary.RxEndDate = lPatientRx.RxEndDate.Value; lsummary.RxDuration = Convert.ToInt32((lsummary.RxEndDate - lsummary.RxStartDate).TotalDays); lsummary.RemainingDays = Convert.ToInt32((lsummary.RxEndDate - DateTime.Now).TotalDays); double requiredSession = (((Convert.ToDateTime(lPatientRx.RxEndDate) - Convert.ToDateTime(lPatientRx.RxStartDate)).TotalDays / 7) * (int)lPatientRx.RxDaysPerweek * (int)lPatientRx.RxSessionsPerWeek); int totalSession = lPatientRx.Session != null?lPatientRx.Session.ToList().Count : 0; lsummary.SessionSuggested = Convert.ToInt32(requiredSession); lsummary.SessionCompleted = totalSession; PatientRx lPatientRxPain = lIPatientRxRepository.getPatientRxPain(lPatientRx.RxId, lPatientRx.PatientId.ToString()); if (lPatientRxPain != null) { List <Session> lSessionList = lPatientRx.Session != null?lPatientRxPain.Session.ToList() : null; if (lSessionList != null && lSessionList.Count > 0) { lsummary.MaxPainLevel = lSessionList.Select(x => x.Pain.Max(y => y.PainLevel)).Max().HasValue ? lSessionList.Select(x => x.Pain.Max(y => y.PainLevel)).Max().Value : 0; lsummary.MaxFlexionAchieved = lSessionList.Max(x => x.MaxFlexion); lsummary.MaxExtensionAchieved = lSessionList.Max(x => x.MaxExtension); lsummary.TrexMinutes = lSessionList.Select(x => x.RangeDuration1).Sum().HasValue ? lSessionList.Select(x => x.RangeDuration1).Sum().Value : 0; lsummary.FlexionExtensionMinutes = lSessionList.Select(x => x.RangeDuration2).Sum().HasValue ? lSessionList.Select(x => x.RangeDuration2).Sum().Value : 0; } } } else { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "patientrx is not configured", TimeZone = DateTime.UtcNow.ToString("s") })); } } else { return(Json(new { Status = (int)HttpStatusCode.Forbidden, result = "patient is not configured", TimeZone = DateTime.UtcNow.ToString("s") })); } } else { return(Json(new { Status = (int)HttpStatusCode.Forbidden, result = "session id not valid", TimeZone = DateTime.UtcNow.ToString("s") })); } } catch (Exception ex) { return(Json(new { Status = (int)HttpStatusCode.InternalServerError, result = "Internal server error", TimeZone = DateTime.UtcNow.ToString("s") })); } return(Json(new { Status = (int)HttpStatusCode.OK, result = "success", Summary = lsummary, TimeZone = DateTime.UtcNow.ToString("s") })); }