Ejemplo n.º 1
0
        public string AddPatientAsFamilyMember(int linkedPatientPersonId, int relationshipTypeId, string baselineDate, string cccNumber)
        {
            try
            {
                int patientId            = int.Parse(HttpContext.Current.Session["PatientPK"].ToString());
                int userId               = Convert.ToInt32(Session["AppUserId"]);
                int patientMasterVisitId = Convert.ToInt32(Session["PatientMasterVisitId"].ToString());
                int baselineResult       = 0;

                LookupLogic logic = new LookupLogic();
                HivReConfirmatoryTestManager reConfirmatoryTestManager = new HivReConfirmatoryTestManager();


                var items = logic.GetItemIdByGroupAndItemName("BaseLineHivStatus", "Tested Positive");
                var positiveHivReconfirmation = logic.GetItemIdByGroupAndItemName("ReConfirmatoryTest", "Positive");
                if (items.Count > 0)
                {
                    baselineResult = items[0].ItemId;
                }

                if (positiveHivReconfirmation.Count > 0)
                {
                    int positiveHivReconfirmationId = positiveHivReconfirmation[0].ItemId;

                    HivReConfirmatoryTest hivReConfirmatoryTest = reConfirmatoryTestManager.GetPersonLastestReConfirmatoryTest(linkedPatientPersonId, positiveHivReconfirmationId);
                    if (hivReConfirmatoryTest != null)
                    {
                        baselineDate = hivReConfirmatoryTest.TestResultDate.ToString();
                    }
                }

                var testing = new PatientFamilyTestingManager();

                testing.AddLinkedPatientFamilyTesting(linkedPatientPersonId, patientId, patientMasterVisitId, baselineResult, DateTime.Parse(baselineDate), relationshipTypeId, userId, cccNumber);

                return("Successfully Linked");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Ejemplo n.º 2
0
        public string AddReconfirmatoryTest(int reconfirmatoryTest, int resultReConfirmatoryTest, string reConfirmatoryTestDate)
        {
            ExMessage message = new ExMessage();

            try
            {
                PersonId = int.Parse(Session["PersonId"].ToString());
                int userId = Convert.ToInt32(Session["AppUserId"]);
                int result = 0;

                HivReConfirmatoryTestManager hivReConfirmatoryTestManager = new HivReConfirmatoryTestManager();

                var hivReConfirmatoryTest = hivReConfirmatoryTestManager.GetPersonLastReConfirmatoryTest(PersonId);
                if (hivReConfirmatoryTest != null)
                {
                    hivReConfirmatoryTest.DeleteFlag = true;
                    hivReConfirmatoryTestManager.UpdateHivReConfirmatoryTest(hivReConfirmatoryTest);
                    result = hivReConfirmatoryTestManager.AddHivReConfirmatoryTest(PersonId, reconfirmatoryTest, resultReConfirmatoryTest, reConfirmatoryTestDate, userId);
                }
                else
                {
                    result = hivReConfirmatoryTestManager.AddHivReConfirmatoryTest(PersonId, reconfirmatoryTest, resultReConfirmatoryTest, reConfirmatoryTestDate, userId);
                }

                if (result > 0)
                {
                    message.errorcode = 0;
                    message.msg      += "<p>Successfully added patient re-confirmation test.</p>";
                }
            }
            catch (SoapException ex)
            {
                message.errorcode = 1;
                message.msg       = ex.Message;
            }

            return(Msg = new JavaScriptSerializer().Serialize(message));
        }