private List <ConditionDetail> PrepareConditionDetail(int attributeArray) { List <ConditionDetail> conditions = new List <ConditionDetail>(); var rowCount = GetRowCountFromArray(attributeArray); if (rowCount > 0) { for (int i = 0; i < rowCount; i++) { var conditionDetail = new ConditionDetail(); conditionDetail.CustomAttributes = _modelExtensionBuilder.BuildModelExtension <PatientCondition>(); // Prepare first class conditionDetail.OnsetDate = DateTime.Today; conditionDetail.ConditionSource = GetAttributeValueFromArrayRow(attributeArray, i, "condition"); conditionDetail.TreatmentOutcome = GetAttributeValueFromArrayRow(attributeArray, i, "conditionStatus"); // Prepare attributes conditionDetail.SetAttributeValue("Condition Ongoing", GetAttributeValueFromArrayRow(attributeArray, i, "conditionStatus") == "Continues" ? "1" : "2"); conditions.Add(conditionDetail); } } return(conditions); }
/// <summary> /// Prepare the model for the condition /// </summary> private ConditionDetail PrepareConditionDetail(PatientConditionForUpdateDto conditionForUpdate) { var conditionDetail = new ConditionDetail(); conditionDetail.CustomAttributes = _modelExtensionBuilder.BuildModelExtension <PatientCondition>(); //conditionDetail = _mapper.Map<ConditionDetail>(conditionForUpdate); foreach (var newAttribute in conditionForUpdate.Attributes) { var customAttribute = _customAttributeRepository.Get(ca => ca.Id == newAttribute.Key); if (customAttribute != null) { // Validate attribute exists for household entity and is a PMT attribute var attributeDetail = conditionDetail.CustomAttributes.SingleOrDefault(ca => ca.AttributeKey == customAttribute.AttributeKey); if (attributeDetail == null) { ModelState.AddModelError("Message", $"Unable to locate custom attribute on patient condition {newAttribute.Key}"); } else { attributeDetail.Value = newAttribute.Value; } } else { ModelState.AddModelError("Message", $"Unable to locate custom attribute {newAttribute.Key}"); } } // Update patient custom attributes from source return(conditionDetail); }
private async Task <ConditionDetail> PrepareConditionDetailAsync(IDictionary <int, string> attributes) { var conditionDetail = new ConditionDetail(); conditionDetail.CustomAttributes = _modelExtensionBuilder.BuildModelExtension <PatientCondition>(); //conditionDetail = _mapper.Map<ConditionDetail>(conditionForUpdate); foreach (var newAttribute in attributes) { var customAttribute = await _customAttributeRepository.GetAsync(ca => ca.Id == newAttribute.Key); if (customAttribute == null) { throw new KeyNotFoundException($"Unable to locate custom attribute {newAttribute.Key}"); } var attributeDetail = conditionDetail.CustomAttributes.SingleOrDefault(ca => ca.AttributeKey == customAttribute.AttributeKey); if (attributeDetail == null) { throw new KeyNotFoundException($"Unable to locate custom attribute on patient condition {newAttribute.Key}"); } attributeDetail.Value = newAttribute.Value.Trim(); } return(conditionDetail); }
protected void LockABase(ConditionDetail.Condition condition, string parameterID, string sbasename) { foreach (ConditionDetail cd in conditions.Where(cd => !cd.disabled && cd.condition == condition && cd.parameter == parameterID)) { LaunchSiteManager.setSiteLocked(sbasename); cd.disabled = true; } }
protected void DisplayMessages(ConditionDetail.Condition condition, string parameterID, MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.GREEN) { foreach (ConditionDetail cd in conditions.Where(cd => !cd.disabled && cd.condition == condition && cd.parameter == parameterID)) { DisplayMessage(title, message, color); cd.disabled = true; } }
protected void CloseABase(ConditionDetail.Condition condition, string parameterID, string sbasename) { foreach (ConditionDetail cd in conditions.Where(cd => !cd.disabled && cd.condition == condition && cd.parameter == parameterID)) { LaunchSiteManager.setSiteOpenCloseState(sbasename, "Closed"); cd.disabled = true; } }
protected override void OnLoad(ConfigNode configNode) { foreach (ConfigNode child in configNode.GetNodes("CONDITION")) { ConditionDetail cd = new ConditionDetail(); cd.condition = ConfigNodeUtil.ParseValue <ConditionDetail.Condition>(child, "condition"); cd.parameter = ConfigNodeUtil.ParseValue <string>(child, "parameter", (string)null); cd.disabled = ConfigNodeUtil.ParseValue <bool>(child, "disabled"); conditions.Add(cd); } basename = ConfigNodeUtil.ParseValue <string>(configNode, "basename"); }
protected override void OnLoad(ConfigNode configNode) { foreach (ConfigNode child in configNode.GetNodes("CONDITION")) { ConditionDetail cd = new ConditionDetail(); cd.condition = ConfigNodeUtil.ParseValue<ConditionDetail.Condition>(child, "condition"); cd.parameter = ConfigNodeUtil.ParseValue<string>(child, "parameter", (string)null); cd.disabled = ConfigNodeUtil.ParseValue<bool>(child, "disabled"); conditions.Add(cd); } basename = ConfigNodeUtil.ParseValue<string>(configNode, "basename"); }
private async Task <PatientDetailForCreation> PreparePatientDetailAsync(AddPatientCommand message) { var patientDetail = new PatientDetailForCreation(message.FirstName, message.LastName, message.MiddleName, message.FacilityName, string.Empty, message.DateOfBirth, message.CohortGroupId, message.EnroledDate, message.EncounterTypeId, message.PriorityId, message.EncounterDate); patientDetail.CustomAttributes = _modelExtensionBuilder.BuildModelExtension <Patient>(); // Update patient custom attributes from source foreach (var newAttribute in message.Attributes) { var customAttribute = await _customAttributeRepository.GetAsync(ca => ca.Id == newAttribute.Key); if (customAttribute == null) { throw new KeyNotFoundException($"Unable to locate custom attribute {newAttribute.Key}"); } var attributeDetail = patientDetail.CustomAttributes.SingleOrDefault(ca => ca.AttributeKey == customAttribute.AttributeKey); if (attributeDetail == null) { throw new KeyNotFoundException($"Unable to locate custom attribute on patient {newAttribute.Key}"); } attributeDetail.Value = newAttribute.Value; } // Prepare primary condition var sourceTermFromRepo = await _terminologyMeddraRepository.GetAsync(tm => tm.Id == message.MeddraTermId); var conditionDetail = new ConditionDetail() { CustomAttributes = _modelExtensionBuilder.BuildModelExtension <PatientCondition>(), MeddraTermId = sourceTermFromRepo.Id, ConditionSource = sourceTermFromRepo.MedDraTerm, OnsetDate = message.StartDate, OutcomeDate = message.OutcomeDate, Comments = message.Comments, CaseNumber = message.CaseNumber }; patientDetail.Conditions.Add(conditionDetail); return(patientDetail); }
protected void LockABase(ConditionDetail.Condition condition, string sbasename) { if (conditions.Any(c => c.condition == condition)) LaunchSiteManager.setSiteLocked(sbasename); }
protected void DisplayMessages(ConditionDetail.Condition condition, MessageSystemButton.MessageButtonColor color = MessageSystemButton.MessageButtonColor.GREEN) { DisplayMessages(condition, "", color); }
protected void CloseABase(ConditionDetail.Condition condition, string sbasename) { if (conditions.Any(c => c.condition == condition)) LaunchSiteManager.setSiteOpenCloseState(sbasename, "Closed"); }