コード例 #1
0
        public int PatientCheckout(int id, int visitSchedule, int visitBy, int visitType, DateTime visitDate)
        {
            int result = 0;

            try
            {
                int patientId = Convert.ToInt32(Session["PatientPK"]);
                int visitId   = Convert.ToInt32(Session["patientMasterVisitId"]);
                PatientMasterVisitManager patientMasterVisit = new PatientMasterVisitManager();
                result = patientMasterVisit.PatientMasterVisitCheckout(visitId, patientId, visitSchedule, visitBy, visitType, visitDate);
                Session["EncounterStatusId"] = 0;
                Session["PatientEditId"]     = 0;
                Session["PatientPK"]         = 0;
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            return(result);
        }
コード例 #2
0
        public string saveTracingData(int PatientId, int PersonId, string tracingdate, int tracingmethod, int tracingoutcome, string othertracingoutcome, string tracingdateofdeath,
                                      string tracingdateoftransfer, string transferfacility, string tracingnotes, string tracingstatus, int?visitid)
        {
            ILookupManager mgr     = (ILookupManager)ObjectFactory.CreateInstance("BusinessProcess.CCC.BLookupManager, BusinessProcess.CCC");
            var            tracing = new ReportingResultsManager();
            int            userId  = Convert.ToInt32(Session["AppUserId"]);
            int            patientmastervisitresult = 0;
            int            EncounterResult          = 0;
            string         savestatus       = "";
            DateTime?      deathTracingDate = new DateTime();
            int            CheckoutResult   = 0;

            //save tracing data
            if (tracingdateofdeath == "")
            {
                deathTracingDate = null;
            }
            else
            {
                deathTracingDate = Convert.ToDateTime(tracingdateofdeath);
            }

            DateTime?transferTracingDate = new DateTime();

            if (tracingdateoftransfer == "")
            {
                transferTracingDate = null;
            }
            else
            {
                transferTracingDate = Convert.ToDateTime(tracingdateoftransfer);
            }

            try
            {
                //create patient master visit id
                PatientMasterVisitManager patientMasterVisit = new PatientMasterVisitManager();
                LookupLogic lookupLogic     = new LookupLogic();
                var         currentfacility = lookupLogic.GetFacility(Session["AppPosID"].ToString());
                if (currentfacility == null)
                {
                    currentfacility = lookupLogic.GetFacility();
                }

                if (visitid.HasValue && visitid.Value > 0)
                {
                    Tracing[] patientTracingData = tracing.getTracingData(visitid.Value).ToArray();
                    if (patientTracingData.Length > 0)
                    {
                        patientTracingData[0].Mode                    = tracingmethod;
                        patientTracingData[0].Outcome                 = tracingoutcome;
                        patientTracingData[0].DateTracingDone         = Convert.ToDateTime(tracingdate);
                        patientTracingData[0].TracingDateOfDeath      = deathTracingDate;
                        patientTracingData[0].TracingTransferFacility = transferfacility;
                        patientTracingData[0].TracingTransferDate     = transferTracingDate;
                        patientTracingData[0].Remarks                 = tracingnotes;

                        tracing.UpdatePatientTracing(patientTracingData[0]);
                        Session["PatientTrace"] = "";
                    }
                }
                else
                {
                    patientmastervisitresult = patientMasterVisit.PatientMasterVisitCheckin(PatientId, userId, currentfacility.FacilityID);

                    //create encounter
                    PatientEncounterManager patientEncounterManager = new PatientEncounterManager();
                    EncounterResult = patientEncounterManager.AddpatientEncounterTracing(Convert.ToInt32(PatientId), Convert.ToInt32(patientmastervisitresult),
                                                                                         patientEncounterManager.GetPatientEncounterId("EncounterType", "Patient-Tracing"), 203, userId, Convert.ToDateTime(tracingdate), Convert.ToDateTime(tracingdate));
                    int tracingType = Convert.ToInt32(mgr.GetLookupItemId("DefaulterTracing"));
                    //save tracing data
                    Tracing patientTracing = new Tracing()
                    {
                        PersonID             = PersonId,
                        TracingType          = tracingType,
                        PatientMasterVisitId = patientmastervisitresult,
                        DateTracingDone      = Convert.ToDateTime(tracingdate),
                        Mode                    = tracingmethod,
                        Outcome                 = tracingoutcome,
                        TracingDateOfDeath      = deathTracingDate,
                        TracingTransferFacility = transferfacility,
                        TracingTransferDate     = transferTracingDate,
                        Remarks                 = tracingnotes,
                        CreateDate              = DateTime.Now,
                        CreatedBy               = Convert.ToInt32(Session["AppUserId"])
                    };

                    Result = tracing.AddPatientTracing(patientTracing);

                    //checkout patient master visit
                    PatientMasterVisitManager patientMasterVisitcheckout = new PatientMasterVisitManager();
                    CheckoutResult = patientMasterVisit.PatientMasterVisitCheckout(patientmastervisitresult, PatientId, 0, 0, 0, Convert.ToDateTime(tracingdate));

                    Session["EncounterStatusId"] = 0;
                    Session["PatientEditId"]     = 0;
                    Session["PatientPK"]         = 0;
                    Session["PatientTrace"]      = "";

                    if (Result > 0 && CheckoutResult > 0)
                    {
                        Msg = "Patient appointment Added Successfully!";
                    }
                }
            }
            catch (Exception e)
            {
                Msg = e.Message;
            }
            return(savestatus);
        }