Example #1
0
        protected static FR_L5EX_GAPRD_1154 Execute(DbConnection Connection, DbTransaction Transaction, P_L5EX_GAPRD_1154 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_L5EX_GAPRD_1154();
            returnValue.Result = new L5EX_GAPRD_1154();
            //top medical pracices treba menjati nakon promene u bazi
            List <L5OU_GRPBD_1305_top_medical_practice_types> top_medical_practice_typesList = new List <L5OU_GRPBD_1305_top_medical_practice_types>();
            List <L5OU_GRPBD_1305_medical_practice_types>     medical_practice_typesList     = new List <L5OU_GRPBD_1305_medical_practice_types>();

            returnValue.Result.top_diagnoses = new List <L5OU_GRPBD_1305_top_diagnoses>().ToArray();
            returnValue.Result.doctors       = new List <L5OU_GRPBD_1305_doctors>().ToArray();
            returnValue.Result.hospitals     = new List <L5OU_GRPBD_1305_hospitals>().ToArray();
            var Hospitals = new List <L5OU_GRPBD_1305_hospitals>();
            var hospitals = cls_Get_All_Hospitals_for_Tenant.Invoke(Connection, Transaction, securityTicket).Result;
            foreach (var hospital in hospitals)
            {
                L5OU_GRPBD_1305_hospitals hosp = new L5OU_GRPBD_1305_hospitals();
                hosp.HospitalID   = hospital.HEC_MedicalPractiseID;
                hosp.HospitalName = hospital.OrganizationalUnit_Name.Contents[0].Content;
                Hospitals.Add(hosp);
            }
            returnValue.Result.hospitals = Hospitals.ToArray();
            #region Top medical practice types

            var HEC_ACT_PerformedAction_DoctorsQuery = new ORM_HEC_ACT_PerformedAction_Doctor.Query();
            HEC_ACT_PerformedAction_DoctorsQuery.IsDeleted    = false;
            HEC_ACT_PerformedAction_DoctorsQuery.Tenant_RefID = securityTicket.TenantID;
            HEC_ACT_PerformedAction_DoctorsQuery.HEC_ACT_PerformedAction_RefID = Parameter.ExaminationID;

            Guid DoctorID = ORM_HEC_ACT_PerformedAction_Doctor.Query.Search(Connection, Transaction, HEC_ACT_PerformedAction_DoctorsQuery).Single().HEC_ACT_PerformedAction_DoctorID;

            var TopMedicalPractices = cls_Get_Top_MedicalPracticeTypes.Invoke(Connection, Transaction, new P_L5EX_GTMPT_1129 {
                DoctorID = DoctorID
            }, securityTicket).Result.ToList();

            foreach (var item in TopMedicalPractices)
            {
                L5OU_GRPBD_1305_top_medical_practice_types top_mpt = new L5OU_GRPBD_1305_top_medical_practice_types();
                top_mpt.id = item.id.ToString();
                top_mpt.medical_pracitce_id = item.HEC_MedicalPractiseID.ToString();
                top_mpt.name = item.MedicalPracticeType_Name.Contents[0].Content;
                top_mpt.number_of_occurances = item.NumberOfOccurences.ToString();
                top_medical_practice_typesList.Add(top_mpt);
            }

            returnValue.Result.top_medical_practice_types = top_medical_practice_typesList.ToArray();
            #endregion

            #region All medical practice types that are not in the top 5 category

            var all_medical_practice_types = cls_Get_MedicalPracticeTypes_for_TenantID.Invoke(Connection, Transaction, securityTicket).Result.ToList();

            foreach (var item in all_medical_practice_types)
            {
                L5OU_GRPBD_1305_medical_practice_types practiceType = new L5OU_GRPBD_1305_medical_practice_types();
                practiceType.id   = item.HEC_MedicalPractice_TypeID.ToString();
                practiceType.name = item.MedicalPracticeType_Name.Contents[0].Content;
                medical_practice_typesList.Add(practiceType);
            }

            returnValue.Result.medical_practice_types = medical_practice_typesList.ToArray();

            ORM_HEC_ACT_PerformedAction_Referral examinationReferral = ORM_HEC_ACT_PerformedAction_Referral.Query.Search(Connection, Transaction, new ORM_HEC_ACT_PerformedAction_Referral.Query()
            {
                Tenant_RefID = securityTicket.TenantID,
                IsDeleted    = false,
                HEC_ACT_PerformedAction_RefID = Parameter.ExaminationID
            }).SingleOrDefault();
            returnValue.Result.referralSaved = false;
            if (examinationReferral != null)
            {
                returnValue.Result.referralSaved  = true;
                returnValue.Result.selectedDoctor = Guid.Empty;
                returnValue.Result.comment        = examinationReferral.ReferralComment;
                var doctor = ORM_HEC_Doctor.Query.Search(Connection, Transaction, new ORM_HEC_Doctor.Query()
                {
                    Tenant_RefID = securityTicket.TenantID,
                    IsDeleted    = false,
                    BusinessParticipant_RefID = examinationReferral.ReferralTo_BusinessParticipant_RefID
                }).SingleOrDefault();
                if (doctor != null)
                {
                    returnValue.Result.selectedDoctor = doctor.HEC_DoctorID;
                    P_L5DO_GDfMPTID_0848 doctorsParameter = new P_L5DO_GDfMPTID_0848();
                    doctorsParameter.MedicalPracticeTypeID = examinationReferral.ReferralTo_MedicalPracticeType_RefID;
                    var doctors = cls_Get_Doctors_for_MedicalPracticeTypeID.Invoke(Connection, Transaction, doctorsParameter, securityTicket).Result;
                    returnValue.Result.doctors = new List <L5OU_GRPBD_1305_doctors>().ToArray();
                    var Doctors = new List <L5OU_GRPBD_1305_doctors>();
                    foreach (var doc in doctors)
                    {
                        L5OU_GRPBD_1305_doctors doct = new L5OU_GRPBD_1305_doctors();
                        doct.doctor                = doc.doctor;
                        doct.doctor_id             = doc.doctor_id;
                        doct.HEC_MedicalPractiseID = doc.HEC_MedicalPractiseID;
                        Doctors.Add(doct);
                    }
                    returnValue.Result.doctors = Doctors.ToArray();
                }
                returnValue.Result.selectedPracticeTypeID = examinationReferral.ReferralTo_MedicalPracticeType_RefID;

                returnValue.Result.selectedHospitalID = examinationReferral.ReferralTo_MedicalPractice_RefID;

                returnValue.Result.selectedProcedureID = Guid.Empty;
                var procedureReferral = ORM_HEC_ACT_PerformedAction_Referral_RequestedPotentialProcedure.Query.Search(Connection, Transaction, new ORM_HEC_ACT_PerformedAction_Referral_RequestedPotentialProcedure.Query()
                {
                    Tenant_RefID          = securityTicket.TenantID,
                    IsDeleted             = false,
                    Action_Referral_RefID = examinationReferral.HEC_ACT_PerformedAction_ReferralID
                }).SingleOrDefault();

                if (procedureReferral != null)
                {
                    returnValue.Result.selectedProcedureID = procedureReferral.PotentialTreatment_RefID;
                }
            }

            #endregion

            return(returnValue);

            #endregion UserCode
        }
Example #2
0
 ///<summary>
 /// Invokes the method for the given Connection, and Transaction, leaving them open/not commited if no exceptions occured
 ///<summary>
 public static FR_L5EX_GAPRD_1154 Invoke(DbConnection Connection, DbTransaction Transaction, P_L5EX_GAPRD_1154 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Example #3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_L5EX_GAPRD_1154 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_L5EX_GAPRD_1154 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_L5EX_GAPRD_1154 functionReturn = new FR_L5EX_GAPRD_1154();

            try
            {
                if (cleanupConnection == true)
                {
                    Connection = CSV2Core_MySQL.Support.DBSQLSupport.CreateConnection(ConnectionString);
                    Connection.Open();
                }
                if (cleanupTransaction == true)
                {
                    Transaction = Connection.BeginTransaction();
                }

                functionReturn = Execute(Connection, Transaction, Parameter, securityTicket);

                #region Cleanup Connection/Transaction
                //Commit the transaction
                if (cleanupTransaction == true)
                {
                    Transaction.Commit();
                }
                //Close the connection
                if (cleanupConnection == true)
                {
                    Connection.Close();
                }
                #endregion
            }
            catch (Exception ex)
            {
                try
                {
                    if (cleanupTransaction == true && Transaction != null)
                    {
                        Transaction.Rollback();
                    }
                }
                catch { }

                try
                {
                    if (cleanupConnection == true && Connection != null)
                    {
                        Connection.Close();
                    }
                }
                catch { }

                throw new Exception("Exception occured in method cls_Get_All_PatientReferralData", ex);
            }
            return(functionReturn);
        }
Example #4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_L5EX_GAPRD_1154 Invoke(string ConnectionString, P_L5EX_GAPRD_1154 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }