protected static FR_L5EX_GED_1024 Execute(DbConnection Connection, DbTransaction Transaction, P_L5EX_GED_1024 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L5EX_GED_1024(); returnValue.Result = new L5EX_GED_1024(); //observations var madeObservationsForPerformedActionID = ORM_HEC_ACT_PerformedAction_MadeObservation.Query.Search(Connection, Transaction, new ORM_HEC_ACT_PerformedAction_MadeObservation.Query() { IsDeleted = false, Tenant_RefID = securityTicket.TenantID, HEC_ACT_PerformedAction_RefID = Parameter.ExaminationID }).ToArray(); List <L5EX_GED_1024_patient_observations> observaionList = new List <L5EX_GED_1024_patient_observations>(); foreach (var item in madeObservationsForPerformedActionID) { L5EX_GED_1024_patient_observations observation = new L5EX_GED_1024_patient_observations(); observation.id = item.HEC_ACT_PerformedAction_ObservationID.ToString(); if (item.Comment == null) { var potentialObservationQuery = new ORM_HEC_PotentialObservation.Query(); potentialObservationQuery.HEC_PotentialObservationID = item.PotentialObservation_RefID; potentialObservationQuery.IsDeleted = false; potentialObservationQuery.Tenant_RefID = securityTicket.TenantID; var potentialObdervation = ORM_HEC_PotentialObservation.Query.Search(Connection, Transaction, potentialObservationQuery).First(); observation.name = potentialObdervation.Observation_Text.Contents[0].Content; } else { observation.name = item.Comment; } observaionList.Add(observation); } returnValue.Result.observations = observaionList.ToArray(); //diagnoses var patient_diagnoses_list = cls_Get_Examination_Diagnoses.Invoke(Connection, Transaction, new P_L5EX_GED_1640 { ExaminationID = Parameter.ExaminationID, PatientID = Parameter.PatientID }, securityTicket).Result.ToList(); List <L5EX_GED_1024_patient_diagnoses> diagnoseList = new List <L5EX_GED_1024_patient_diagnoses>(); foreach (var item in patient_diagnoses_list) { L5EX_GED_1024_patient_diagnoses diagnose = new L5EX_GED_1024_patient_diagnoses(); diagnose.id = item.HEC_Patient_DiagnosisID.ToString(); diagnose.name = item.ICD10_Code + " " + item.PotentialDiagnosis_Name.Contents[0].Content; diagnoseList.Add(diagnose); } returnValue.Result.patient_diagnoses = diagnoseList.ToArray(); //medications var productList = cls_Get_MedicationProduct_for_PerformedActionID.Invoke(Connection, Transaction, new P_L5ME_GMPfPAID_1133 { PerformedActionID = Parameter.ExaminationID }, securityTicket).Result.ToList(); List <L5EX_GED_1024_patient_medications> medication_list = new List <L5EX_GED_1024_patient_medications>(); foreach (var item in productList) { L5EX_GED_1024_patient_medications medication = new L5EX_GED_1024_patient_medications(); medication.id = item.HEC_ACT_PerformedAction_MedicationUpdateID.ToString(); medication.name = item.Product_Name.Contents[0].Content + " " + item.DosageForm_Name.Contents[0].Content + " " + item.DosageText; medication.image = item.IsMedicationDeactivated == false ? "../Images/icons/added.png" : "../Images/icons/removed.png"; medication_list.Add(medication); } P_L5EMR_GSfEID_1210 substancesParameter = new P_L5EMR_GSfEID_1210(); substancesParameter.PerformedActionID = Parameter.ExaminationID; var substanceList = cls_Get_Substances_for_ExaminationID.Invoke(Connection, Transaction, substancesParameter, securityTicket).Result; foreach (var item in substanceList) { L5EX_GED_1024_patient_medications medication = new L5EX_GED_1024_patient_medications(); medication.id = item.HEC_ACT_PerformedAction_MedicationUpdateID.ToString(); medication.name = item.GlobalPropertyMatchingID + " " + item.IfSubstance_Strength + " " + item.ISOCode; medication.image = item.IsMedicationDeactivated == false ? "../Images/icons/added.png" : "../Images/icons/removed.png"; medication_list.Add(medication); } returnValue.Result.medications = medication_list.ToArray(); //aftercares var aftercareList = cls_Get_Followups_for_PatientID_and_ExaminationID.Invoke(Connection, Transaction, new P_L5EX_GFPIDEID_1805 { ExaminationID = Parameter.ExaminationID, PatientID = Parameter.PatientID }, securityTicket).Result; List <L5EX_GED_1024_patient_aftercares> aftercare_list = new List <L5EX_GED_1024_patient_aftercares>(); foreach (var item in aftercareList) { L5EX_GED_1024_patient_aftercares aftercare = new L5EX_GED_1024_patient_aftercares(); aftercare.id = item.HEC_ACT_PlannedActionID.ToString(); aftercare.date = item.date.ToShortDateString(); aftercare.reason = item.FollowupReason; aftercare_list.Add(aftercare); } returnValue.Result.aftercares = aftercare_list.ToArray(); //Referral var referralList = cls_Get_Examination_Referrals.Invoke(Connection, Transaction, new P_L5EX_GER_1744 { ExaminationID = Parameter.ExaminationID }, securityTicket).Result; List <L5EX_GED_1024_patient_referrals> referral_list = new List <L5EX_GED_1024_patient_referrals>(); foreach (var item in referralList) { L5EX_GED_1024_patient_referrals referral = new L5EX_GED_1024_patient_referrals(); referral.id = item.id.ToString(); if (item.OrganizationalUnit_Name_DictID.Contents.Count != 0) { referral.medical_practice = item.OrganizationalUnit_Name_DictID.Contents[0].Content; } if (item.MedicalPracticeType_Name.Contents.Count != 0) { referral.medical_practice_type = item.MedicalPracticeType_Name.Contents[0].Content; } referral_list.Add(referral); } returnValue.Result.referrals = referral_list.ToArray(); return(returnValue); #endregion UserCode }
protected static FR_L6EX_GMEaMfEID_1340 Execute(DbConnection Connection, DbTransaction Transaction, P_L6EX_GMEaMfEID_1340 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_L6EX_GMEaMfEID_1340(); //Put your code here //P_L5MPC_GAPaASE_1022 medicationsElasticParam = new P_L5MPC_GAPaASE_1022(); //medicationsElasticParam.is_substance_count = Parameter.is_substance_count; //medicationsElasticParam.number_of_elements = Parameter.number_of_elements; //medicationsElasticParam.search_params = Parameter.search_params.ToString(); //medicationsElasticParam.sort_by = Parameter.sort_by.ToString(); //medicationsElasticParam.sort_order = Parameter.sort_order.ToString(); //medicationsElasticParam.start_row_index = Parameter.start_row_index; //var elasticResult = cls_Get_AllProducts_and_AllSupstances_Elastic.Invoke(Connection, Transaction, medicationsElasticParam,securityTicket).Result; //returnValue.Result = new L6EX_GMEaMfEID_1340(); //returnValue.Result.medications = elasticResult; P_L5ME_GMIfEID_1534 patientMedicationsParameter = new P_L5ME_GMIfEID_1534(); patientMedicationsParameter.PerformedActionID = Parameter.ExaminationID; var patientMedications = cls_Get_MedicationInfo_for_ExaminationID.Invoke(Connection, Transaction, patientMedicationsParameter, securityTicket).Result; returnValue.Result.patientMedications = new List <L5ME_GMIfEID_1534>().ToArray(); returnValue.Result.patientMedications = patientMedications; P_L5EMR_GSfEID_1210 substancesparameter = new P_L5EMR_GSfEID_1210(); substancesparameter.PerformedActionID = Parameter.ExaminationID; var patientSubstances = cls_Get_Substances_for_ExaminationID.Invoke(Connection, Transaction, substancesparameter, securityTicket).Result; returnValue.Result.patientSubstances = new List <L5EMR_GSfEID_1210>().ToArray(); returnValue.Result.patientSubstances = patientSubstances; var units = ORM_CMN_Unit.Query.Search(Connection, Transaction, new ORM_CMN_Unit.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false }).Select(unit => new { ID = unit.CMN_UnitID, ISOCode = unit.ISOCode, Label = unit.Label }); List <L6EX_GMEaMfEID_1340Units> UnitsPrepacked = new List <L6EX_GMEaMfEID_1340Units>(); foreach (var unit in units) { L6EX_GMEaMfEID_1340Units Unit = new L6EX_GMEaMfEID_1340Units(); Unit.ISOCode = unit.ISOCode; Unit.UnitID = unit.ID; Unit.UnitLabel = unit.Label; UnitsPrepacked.Add(Unit); } var dosagesForTenant = ORM_HEC_Dosage.Query.Search(Connection, Transaction, new ORM_HEC_Dosage.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false }); List <L6EX_GMEaMfEID_1340Dosages> dosages = new List <L6EX_GMEaMfEID_1340Dosages>(); foreach (var dosage in dosagesForTenant) { L6EX_GMEaMfEID_1340Dosages Dosage = new L6EX_GMEaMfEID_1340Dosages(); Dosage.DosageID = dosage.HEC_DosageID; Dosage.DosageName = dosage.DosageText; dosages.Add(Dosage); } returnValue.Result.units = new List <L6EX_GMEaMfEID_1340Units>().ToArray(); returnValue.Result.units = UnitsPrepacked.ToArray(); returnValue.Result.dosages = new List <L6EX_GMEaMfEID_1340Dosages>().ToArray(); returnValue.Result.dosages = dosages.ToArray(); return(returnValue); #endregion UserCode }