public void RemoveRelationShipInState(Guid clientId, Guid otherClientId, bool isFamily = true) { var remainingReleations = _clientRelationshipRepository.GetRelationships(clientId).ToList(); if (isFamily) { var famRelations = remainingReleations.Where(x => x.IsFamilyRelation()).ToList(); if (famRelations.Count == 0) { _clientStateRepository.DeleteState(clientId, null, LiveState.HtsFamlisted); } _clientStateRepository.DeleteState(otherClientId, null, LiveState.FamilyListed, clientId); } else { var patRelations = remainingReleations.Where(x => x.IsPartnerRelation()).ToList(); if (patRelations.Count == 0) { _clientStateRepository.DeleteState(clientId, null, LiveState.HtsPatlisted); } _clientStateRepository.DeleteState(otherClientId, null, LiveState.PartnerListed, clientId); } }
public void SaveFinalTest(ObsFinalTestResult testResult) { var test = _obsFinalTestResultRepository.Get(testResult.Id); if (null != test) { test.ResultGiven = testResult.ResultGiven; test.CoupleDiscordant = testResult.CoupleDiscordant; test.SelfTestOption = testResult.SelfTestOption; test.PnsDeclined = testResult.PnsDeclined; test.Remarks = testResult.Remarks; _obsFinalTestResultRepository.SaveOrUpdate(test); _clientStateRepository.DeleteState(test.ClientId, test.EncounterId); if (null != test.SelfTestOption && test.SelfTestOption.Value == new Guid("b25eccd4-852f-11e7-bb31-be2e44b06b34")) { _clientStateRepository.SaveOrUpdate(new ClientState(test.ClientId, test.EncounterId, LiveState.HtsPnsAcceptedYes)); } else { _clientStateRepository.SaveOrUpdate(new ClientState(test.ClientId, test.EncounterId, LiveState.HtsPnsAcceptedNo)); } _clientStateRepository.SaveOrUpdate(new ClientState(test.ClientId, test.EncounterId, ClientState.GetState(test.FinalResult.Value))); } }
public void SaveMemberScreening(ObsMemberScreening testResult, Guid clientId, Guid indexClientId) { _obsMemberScreeningRepository.SaveOrUpdate(testResult); _clientStateRepository.SaveOrUpdate(new ClientState(clientId, testResult.EncounterId, LiveState.FamilyScreened, indexClientId)); _clientStateRepository.DeleteState(clientId, testResult.EncounterId, LiveState.FamilyEligibileYes, indexClientId); _clientStateRepository.DeleteState(clientId, testResult.EncounterId, LiveState.FamilyEligibileNo, indexClientId); if (testResult.Eligibility == new Guid("b25eccd4-852f-11e7-bb31-be2e44b06b34")) { _clientStateRepository.SaveOrUpdate(new ClientState(clientId, testResult.EncounterId, LiveState.FamilyEligibileYes, indexClientId)); } else { _clientStateRepository.SaveOrUpdate(new ClientState(clientId, testResult.EncounterId, LiveState.FamilyEligibileNo, indexClientId)); } }
public void SaveResponse(Guid encounterId, Guid clientId, Guid questionId, object response, bool validated = false) { var liveResponse = new Response(encounterId, clientId); var question = _manifest.GetQuestion(questionId); liveResponse.SetQuestion(question); liveResponse.SetObs(encounterId, clientId, questionId, question.Concept.ConceptTypeId, response); if (validated) { if (_validationEngine.Validate(liveResponse)) { _obsRepository.SaveOrUpdate(liveResponse.Obs); UpdateManifest(encounterId); } } else { _obsRepository.SaveOrUpdate(liveResponse.Obs); UpdateManifest(encounterId); } // check consent if (questionId == new Guid("b2603dc6-852f-11e7-bb31-be2e44b06b34")) { // if (null != liveResponse.Obs.ValueCoded && liveResponse.Obs.ValueCoded.Value == new Guid("b25eccd4-852f-11e7-bb31-be2e44b06b34")) { _clientStateRepository.SaveOrUpdate(new ClientState(clientId, encounterId, LiveState.HtsConsented)); } else { _clientStateRepository.DeleteState(clientId, encounterId, LiveState.HtsConsented); } } // // }
public void DeleteTest(ObsPartnerTraceResult testResult, Guid clientId, Guid indexClientId) { _obsTraceResultRepository.Delete(testResult.Id); _clientStateRepository.DeleteState(clientId, testResult.EncounterId, ClientState.GetState(testResult.Outcome, "pat"), indexClientId); }
public void DeleteTest(ObsTraceResult testResult, Guid clientId) { _obsTraceResultRepository.Delete(testResult.Id); _clientStateRepository.DeleteState(clientId, testResult.EncounterId, ClientState.GetState(testResult.Outcome)); }