///<summary> /// Save Patient Parameter Types for current Tenant (from SessionSecurityTicket) ///<summary> private static Guid Save_PatientParameterTypesForTenant(DbConnection Connection, DbTransaction Transaction, String Type, SessionSecurityTicket securityTicket) { var allContactTypes = EnumUtils.GetAllEnumTypeDescriptionPairs <EPatientParameterTypes>(); var enumType = allContactTypes[Type]; string description = GetEnumDescription(enumType); ORM_HEC_Patient_ParameterType ORMPatientParameterType = new ORM_HEC_Patient_ParameterType(); ORMPatientParameterType.HEC_Patient_ParameterTypeID = Guid.NewGuid(); ORMPatientParameterType.GlobalPropertyMatchingID = description; ORMPatientParameterType.Creation_Timestamp = DateTime.Now; ORMPatientParameterType.Tenant_RefID = securityTicket.TenantID; ORMPatientParameterType.Save(Connection, Transaction); Guid ParameterTypeGroupID = new Guid(); ///<summary> /// Save Patient Parameter Types2Patient Parameter TypeGroups for current Tenant (from SessionSecurityTicket) ///<summary> switch (Type) { case "myhealtclub.gpapp.pulse-volume": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.heartrate", securityTicket); break; case "myhealtclub.gpapp.pulse-rhytm": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.heartrate", securityTicket); break; case "myhealtclub.gpapp.pulse-frequency": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.heartrate", securityTicket); break; case "myhealtclub.gpapp.preasure-sys": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.preasure", securityTicket); break; case "myhealtclub.gpapp.preasure-dia": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.preasure", securityTicket); break; case "myhealtclub.gpapp.body-temp": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.temperature", securityTicket); break; case "myhealtclub.gpapp.bmi-height": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.bmi", securityTicket); break; case "myhealtclub.gpapp.bmi-weight": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.bmi", securityTicket); break; case "myhealtclub.gpapp.oxygen-saturation": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.oxygen-saturation", securityTicket); break; case "myhealtclub.gpapp.respiration": ParameterTypeGroupID = CL2_PatientParameters.DomainManagement.DMPatientParameterTypeGroups.Get_PatientParameterTypeGroup_for_GlobalPropertyMatchingID(Connection, Transaction, "myhealtclub.gpapp.group.respiration", securityTicket); break; } ORM_HEC_Patient_ParameterType_2_ParameterTypeGroup partype2pargroup = new ORM_HEC_Patient_ParameterType_2_ParameterTypeGroup(); partype2pargroup.AssignmentID = Guid.NewGuid(); partype2pargroup.Tenant_RefID = securityTicket.TenantID; partype2pargroup.HEC_Patient_ParameterType_Group_RefID = ParameterTypeGroupID; partype2pargroup.HEC_Patient_ParameterType_RefID = ORMPatientParameterType.HEC_Patient_ParameterTypeID; partype2pargroup.Save(Connection, Transaction); return(ORMPatientParameterType.HEC_Patient_ParameterTypeID); }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L5DI_SV_1333 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); //Put your code here var groupType = ORM_HEC_Patient_ParameterType_Group.Query.Search(Connection, Transaction, new ORM_HEC_Patient_ParameterType_Group.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, GlobalPropertyMatchingID = "myhealtclub.gpapp.group.custom" // promeniti }).SingleOrDefault(); if (groupType == null) { groupType = new ORM_HEC_Patient_ParameterType_Group() { GlobalPropertyMatchingID = "myhealtclub.gpapp.group.custom", HEC_Patient_ParameterType_GroupID = Guid.NewGuid(), Tenant_RefID = securityTicket.TenantID }; groupType.Save(Connection, Transaction); } ORM_HEC_Patient_Parameter vital; if (Parameter.HEC_Patient_ParameterID != Guid.Empty) { vital = ORM_HEC_Patient_Parameter.Query.Search(Connection, Transaction, new ORM_HEC_Patient_Parameter.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, HEC_Patient_ParameterID = Parameter.HEC_Patient_ParameterID }).Single(); returnValue.Result = vital.HEC_Patient_ParameterID; if (Parameter.IsDeleted) { vital.IsDeleted = true; vital.Save(Connection, Transaction); var avaUnitDel = ORM_HEC_Patient_ParameterType_AvailableUnit.Query.SoftDelete(Connection, Transaction, new ORM_HEC_Patient_ParameterType_AvailableUnit.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, Patient_ParameterType_RefID = vital.ParameterType_RefID }); var typeDel = ORM_HEC_Patient_ParameterType.Query.SoftDelete(Connection, Transaction, new ORM_HEC_Patient_ParameterType.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, HEC_Patient_ParameterTypeID = vital.ParameterType_RefID }); var t2gtDel = ORM_HEC_Patient_ParameterType_2_ParameterTypeGroup.Query.SoftDelete(Connection, Transaction, new ORM_HEC_Patient_ParameterType_2_ParameterTypeGroup.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, HEC_Patient_ParameterType_RefID = vital.ParameterType_RefID, HEC_Patient_ParameterType_Group_RefID = groupType.HEC_Patient_ParameterType_GroupID }); } else { var AvaUnit = ORM_HEC_Patient_ParameterType_AvailableUnit.Query.Search(Connection, Transaction, new ORM_HEC_Patient_ParameterType_AvailableUnit.Query() { Tenant_RefID = securityTicket.TenantID, IsDeleted = false, Patient_ParameterType_RefID = vital.ParameterType_RefID }).Single(); AvaUnit.Unit_RefID = Parameter.Unit_RefID; AvaUnit.Save(Connection, Transaction); vital.Parameter_Name = Parameter.Parameter_Name; vital.IfFloat_MaxValue = Parameter.MaxValue; vital.IfFloat_MinValue = Parameter.MinValue; vital.Save(Connection, Transaction); } } else { vital = new ORM_HEC_Patient_Parameter() { Tenant_RefID = securityTicket.TenantID, IsVitalParameter = true, Parameter_Name = Parameter.Parameter_Name, HEC_Patient_ParameterID = Guid.NewGuid(), PatientParameterITL = Guid.NewGuid().ToString(), IsFloat = true }; returnValue.Result = vital.HEC_Patient_ParameterID; var type = new ORM_HEC_Patient_ParameterType() { Tenant_RefID = securityTicket.TenantID, HEC_Patient_ParameterTypeID = Guid.NewGuid(), }; type.Save(Connection, Transaction); vital.Parameter_Name = Parameter.Parameter_Name; vital.IfFloat_MaxValue = Parameter.MaxValue; vital.IfFloat_MinValue = Parameter.MinValue; vital.ParameterType_RefID = type.HEC_Patient_ParameterTypeID; vital.Save(Connection, Transaction); var t2gt = new ORM_HEC_Patient_ParameterType_2_ParameterTypeGroup() { Tenant_RefID = securityTicket.TenantID, AssignmentID = Guid.NewGuid(), HEC_Patient_ParameterType_Group_RefID = groupType.HEC_Patient_ParameterType_GroupID, HEC_Patient_ParameterType_RefID = type.HEC_Patient_ParameterTypeID }; t2gt.Save(Connection, Transaction); var AvaUnit = new ORM_HEC_Patient_ParameterType_AvailableUnit() { Tenant_RefID = securityTicket.TenantID, IsDefaultUnit = true, Patient_ParameterType_RefID = type.HEC_Patient_ParameterTypeID, HEC_Patient_ParameterType_AvailableUnitID = Guid.NewGuid(), Unit_RefID = Parameter.Unit_RefID }; AvaUnit.Save(Connection, Transaction); } return(returnValue); #endregion UserCode }