Beispiel #1
0
        public string ManagePatientArvHistory(int id, int patientId, int patientMasterVisitId, dynamic artuseStrings, int userId)
        {
            try
            {
                //dynamic artuse = JsonConvert.DeserializeObject(artuseStrings);
                dynamic artuse = new JavaScriptSerializer().DeserializeObject(artuseStrings);


                var patientHivHistory = new PatientArvHistoryManager();
                if (id < 1)
                {
                    foreach (var item in artuse)
                    {
                        _result = patientHivHistory.AddPatientArtUseHistory(id, patientId, patientMasterVisitId, item.treatment.ToString(), item.purpose.ToString(), item.regimen.ToString(), Convert.ToDateTime(item.dateLastUsed), userId);
                    }
                }
                else
                {
                    foreach (var item in artuse)
                    {
                        _result = patientHivHistory.UpdatePatientArtUseHistory(id, patientId, patientMasterVisitId, item.treatment, item.purpose, item.regimen, item.dateLastUsed, userId);
                    }
                }
                if (_result > 0)
                {
                    _jsonMessage = "Patient ARV History Complete!";
                }
            }
            catch (Exception e)
            {
                _jsonMessage = e.Message + ' ' + e.InnerException;
            }
            return(_jsonMessage);
        }
Beispiel #2
0
        public string GetCurrentPatientARVUseHistory(int patientId)
        {
            try
            {
                var patientArvHistory = new PatientArvHistoryManager();
                var arvHistory        = patientArvHistory.GetPatientArtUseHistory(patientId);
                //_jsonMessage = JsonConvert.SerializeObject(arvHistory);
                _jsonMessage = new JavaScriptSerializer().Serialize(arvHistory);
            }
            catch (Exception e)
            {
                _jsonMessage = e.Message;
            }

            return(_jsonMessage);
        }
Beispiel #3
0
 public string GetPatientPriorArvHistory(int patientId)
 {
     try
     {
         var patientArvHistory = new PatientArvHistoryManager();
         var arvHistory        = patientArvHistory.GetPatientArtUseHistory(patientId);
         foreach (var item in arvHistory)
         {
             _jsonMessage += "<tr> <td align='left'>" + item.Purpose + "</td> <td align='left'>" + item.Regimen + "</td> <td align='left'>" + item.DateLastUsed.ToString("dd-MMM-yyyy") + "</td> </tr>";
         }
         // _jsonMessage=JsonConvert.SerializeObject(patientArvHistory.GetPatientArtUseHistory(patientId))
     }
     catch (Exception e)
     {
         _jsonMessage = e.Message;
     }
     return(_jsonMessage);
 }
        public string ManagePatientArvHistory(int id, int patientId, int patientMasterVisitId, dynamic artuseStrings, int userId)
        {
            try
            {
                //dynamic artuse = JsonConvert.DeserializeObject(artuseStrings);
                dynamic artuse = new JavaScriptSerializer().DeserializeObject(artuseStrings);


                var patientHivHistory = new PatientArvHistoryManager();
                if (id < 1)
                {
                    foreach (var item in artuse)
                    {
                        string   treatment;
                        string   purpose;
                        string   regimen;
                        DateTime dateLastUsed;
                        if (item.ContainsKey("treatment") &&
                            item["treatment"] != null &&
                            !string.IsNullOrEmpty(item["treatment"].ToString())
                            )
                        {
                            treatment = item["treatment"].ToString();
                        }
                        else
                        {
                            treatment = String.Empty;
                        }
                        if (item.ContainsKey("purpose") &&
                            item["purpose"] != null &&
                            !string.IsNullOrEmpty(item["purpose"].ToString())
                            )
                        {
                            purpose = item["purpose"].ToString();
                        }
                        else
                        {
                            purpose = String.Empty;
                        }

                        if (item.ContainsKey("regimen") &&
                            item["regimen"] != null &&
                            !string.IsNullOrEmpty(item["regimen"].ToString())
                            )
                        {
                            regimen = item["regimen"].ToString();
                        }
                        else
                        {
                            regimen = String.Empty;
                        }
                        if (item.ContainsKey("dateLastUsed") &&
                            item["dateLastUsed"] != null

                            )
                        {
                            dateLastUsed = Convert.ToDateTime(item["dateLastUsed"]);
                        }
                        else
                        {
                            dateLastUsed = DateTime.MinValue;
                        }

                        _result = patientHivHistory.AddPatientArtUseHistory(id, patientId, patientMasterVisitId, treatment.ToString(), purpose.ToString(), regimen.ToString(), dateLastUsed, userId);
                    }
                }
                else
                {
                    foreach (var item in artuse)
                    {
                        string   treatment;
                        string   purpose;
                        string   regimen;
                        DateTime dateLastUsed;
                        if (item.ContainsKey("treatment") &&
                            item["treatment"] != null &&
                            !string.IsNullOrEmpty(item["treatment"].ToString())
                            )
                        {
                            treatment = item["treatment"].ToString();
                        }
                        else
                        {
                            treatment = String.Empty;
                        }
                        if (item.ContainsKey("purpose") &&
                            item["purpose"] != null &&
                            !string.IsNullOrEmpty(item["purpose"].ToString())
                            )
                        {
                            purpose = item["purpose"].ToString();
                        }
                        else
                        {
                            purpose = String.Empty;
                        }

                        if (item.ContainsKey("regimen") &&
                            item["regimen"] != null &&
                            !string.IsNullOrEmpty(item["regimen"].ToString())
                            )
                        {
                            regimen = item["regimen"].ToString();
                        }
                        else
                        {
                            regimen = String.Empty;
                        }
                        if (item.ContainsKey("dateLastUsed") &&
                            item["dateLastUsed"] != null

                            )
                        {
                            dateLastUsed = Convert.ToDateTime(item["dateLastUsed"]);
                        }
                        else
                        {
                            dateLastUsed = DateTime.MinValue;
                        }


                        _result = patientHivHistory.UpdatePatientArtUseHistory(id, patientId, patientMasterVisitId, treatment.ToString(), purpose.ToString(), regimen.ToString(), dateLastUsed, userId);
                    }
                }
                if (_result > 0)
                {
                    _jsonMessage = "Patient ARV History Complete!";
                }
            }
            catch (Exception e)
            {
                _jsonMessage = e.Message + ' ' + e.InnerException;
            }
            return(_jsonMessage);
        }