Ejemplo n.º 1
0
        protected static FR_CAS_GCDfCID_1435 Execute(DbConnection Connection, DbTransaction Transaction, P_CAS_GCDfCID_1435 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            #region UserCode
            var returnValue = new FR_CAS_GCDfCID_1435();
            returnValue.Result = new CAS_GCDfCID_1435();
            //Put your code here
            var base_data = cls_Get_Case_BaseData_for_CaseID.Invoke(Connection, Transaction, new P_CAS_GCBDfCID_1054()
            {
                CaseID = Parameter.CaseID
            }, securityTicket).Result;
            if (base_data != null)
            {
                #region Base data
                returnValue.Result.case_id             = base_data.case_id;
                returnValue.Result.drug_id             = base_data.drug_id;
                returnValue.Result.treatment_date      = base_data.treatment_date;
                returnValue.Result.treatment_doctor_id = base_data.treatment_doctor_bpt_id;
                returnValue.Result.practice_id         = base_data.practice_id;
                returnValue.Result.case_number         = base_data.case_number;
                #endregion

                #region Patient
                returnValue.Result.patient_display_name = base_data.patient_display_name;
                returnValue.Result.patient_id           = base_data.patient_id;
                returnValue.Result.Patient_Age          = base_data.patient_age;
                returnValue.Result.Patient_BirthDate    = base_data.patient_birthdate;
                returnValue.Result.Patient_FirstName    = base_data.patient_first_name;
                returnValue.Result.Patient_Gender       = base_data.patient_gender;
                returnValue.Result.Patient_LastName     = base_data.patient_last_name;
                #endregion

                #region Drug order
                var order_data = cls_Get_Case_Order_Data_for_OrderID.Invoke(Connection, Transaction, new P_CAS_GCODfOID_1156()
                {
                    OrderID = base_data.drug_order_position_id
                }, securityTicket).Result;

                returnValue.Result.order_status = "";
                if (order_data != null)
                {
                    returnValue.Result.order_comment = order_data.order_comment;
                    returnValue.Result.order_id      = base_data.drug_order_position_id;
                    returnValue.Result.order_modification_timestamp   = order_data.order_modification_timestamp;
                    returnValue.Result.order_status_code              = order_data.order_status_code;
                    returnValue.Result.alternative_delivery_date_from = order_data.alternative_delivery_date_from;
                    returnValue.Result.alternative_delivery_date_to   = order_data.alternative_delivery_date_to;
                    returnValue.Result.delivery_date         = order_data.delivery_date;
                    returnValue.Result.is_patient_fee_waived = order_data.is_patient_fee_waived;
                    returnValue.Result.is_label_only         = order_data.is_label_only;
                    returnValue.Result.order_status          = "MO" + order_data.order_status_code;
                }
                #endregion

                #region Treatment
                returnValue.Result.treatment_planned_action_id = base_data.treatment_planned_action_id;
                var treatment_data = cls_Get_Case_Treatment_Data_for_CaseID.Invoke(Connection, Transaction, new P_CAS_GCTDfCID_1143()
                {
                    CaseID = Parameter.CaseID
                }, securityTicket).Result;
                if (treatment_data != null)
                {
                    returnValue.Result.diagnose_id  = treatment_data.diagnose_id;
                    returnValue.Result.localization = treatment_data.localization;
                    returnValue.Result.op_doctor_id = treatment_data.op_doctor_id;
                    returnValue.Result.is_confirmed = treatment_data.is_confirmed;
                }
                #endregion

                #region Aftercare
                var aftercare_planned_action_data = cls_Get_Case_PlannedActionData_for_CaseID_and_ActionTypeGpmID.Invoke(Connection, Transaction, new P_CAS_GCPADfCIDaATGpmID_1235()
                {
                    CaseID          = Parameter.CaseID,
                    ActionTypeGpmID = "mm.docconect.doc.app.planned.action.aftercare"
                }, securityTicket).Result;

                if (aftercare_planned_action_data != null)
                {
                    returnValue.Result.aftercare_planned_action_id = aftercare_planned_action_data.planned_action_id;
                    returnValue.Result.aftercare_performed_date    = aftercare_planned_action_data.performed_on_date;

                    var aftercare_doctor = cls_Get_Case_DoctorData_for_DoctorBptID.Invoke(Connection, Transaction, new P_CAS_GCDDfDBptID_1242()
                    {
                        DoctorBptID = aftercare_planned_action_data.to_be_performed_by_bpt_id
                    }, securityTicket).Result;
                    if (aftercare_doctor != null)
                    {
                        returnValue.Result.ac_doctor_id = aftercare_doctor.id;
                        returnValue.Result.aftercare_doctor_display_name = GenericUtils.GetDoctorName(aftercare_doctor);
                        returnValue.Result.aftercare_doctors_practice_id = aftercare_doctor.practice_id;
                        returnValue.Result.is_aftercare_doctor           = true;
                    }
                    else
                    {
                        var aftercare_practice = cls_Get_Case_PracticeData_for_PracticeBptID.Invoke(Connection, Transaction, new P_CAS_GCPDfPBptID_1248()
                        {
                            PracticeBptID = aftercare_planned_action_data.to_be_performed_by_bpt_id
                        }, securityTicket).Result;
                        if (aftercare_practice != null)
                        {
                            returnValue.Result.ac_practice_id = aftercare_practice.id;
                            returnValue.Result.aftercare_practice_display_name = aftercare_practice.name;
                            returnValue.Result.is_aftercare_practice           = true;
                        }
                    }
                }
                #endregion

                #region Oct
                var oct_planned_action_data = cls_Get_Case_PlannedActionData_for_CaseID_and_ActionTypeGpmID.Invoke(Connection, Transaction, new P_CAS_GCPADfCIDaATGpmID_1235()
                {
                    CaseID          = Parameter.CaseID,
                    ActionTypeGpmID = EActionType.PlannedOct.Value()
                }, securityTicket).Result;

                if (oct_planned_action_data != null)
                {
                    var oct_doctor = cls_Get_Case_DoctorData_for_DoctorBptID.Invoke(Connection, Transaction, new P_CAS_GCDDfDBptID_1242()
                    {
                        DoctorBptID = oct_planned_action_data.to_be_performed_by_bpt_id
                    }, securityTicket).Result;
                    if (oct_doctor != null)
                    {
                        returnValue.Result.oct_doctor_id           = oct_doctor.id;
                        returnValue.Result.oct_doctor_display_name = GenericUtils.GetDoctorName(oct_doctor);
                    }
                }
                #endregion

                #region Case properties
                var properties = cls_Get_Case_Properties_for_CaseID.Invoke(Connection, Transaction, new P_CAS_GCPfCID_1204()
                {
                    CaseID = Parameter.CaseID
                }, securityTicket).Result;
                if (properties.Any())
                {
                    var invoice_to_practice = properties.SingleOrDefault(t => t.property_gpmid == "mm.doc.connect.case.practice.invoice");
                    var documentation_only  = properties.SingleOrDefault(t => t.property_gpmid == "mm.doc.connect.case.is.for.documentation.only");

                    if (invoice_to_practice != null)
                    {
                        returnValue.Result.is_send_invoice_to_practice = invoice_to_practice.boolean_value;
                    }

                    if (documentation_only != null)
                    {
                        returnValue.Result.is_documentation_only = documentation_only.boolean_value;
                    }
                }
                #endregion
            }

            return(returnValue);

            #endregion UserCode
        }
Ejemplo n.º 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_CAS_GCDfCID_1435 Invoke(DbConnection Connection, DbTransaction Transaction, P_CAS_GCDfCID_1435 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(Connection, Transaction, null, Parameter, securityTicket));
 }
Ejemplo n.º 3
0
        ///<summary>
        /// Method Invocation of wrapper classes
        ///<summary>
        protected static FR_CAS_GCDfCID_1435 Invoke(DbConnection Connection, DbTransaction Transaction, string ConnectionString, P_CAS_GCDfCID_1435 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
        {
            bool cleanupConnection  = Connection == null;
            bool cleanupTransaction = Transaction == null;

            FR_CAS_GCDfCID_1435 functionReturn = new FR_CAS_GCDfCID_1435();

            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_Case_Details_for_CaseID", ex);
            }
            return(functionReturn);
        }
Ejemplo n.º 4
0
 ///<summary>
 /// Opens the connection/transaction for the given connectionString, and closes them when complete
 ///<summary>
 public static FR_CAS_GCDfCID_1435 Invoke(string ConnectionString, P_CAS_GCDfCID_1435 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null)
 {
     return(Invoke(null, null, ConnectionString, Parameter, securityTicket));
 }