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 UpdateRelationShips(string relationshipTypeId, Guid clientId, Guid otherClientId) { var exisitngRelationship = _clientRelationshipRepository.Find(relationshipTypeId, clientId, otherClientId); if (null == exisitngRelationship) { var newRelation = ClientRelationship.Create(relationshipTypeId, otherClientId, true, clientId, false); _clientRelationshipRepository.Save(newRelation); var state = RelationshipType.IsPartner(relationshipTypeId) ? LiveState.HtsPatlisted : LiveState.HtsFamlisted; _clientStateRepository.SaveOrUpdate(new ClientState(clientId, state)); } var exisitngRelationshipReverse = _clientRelationshipRepository.Find(relationshipTypeId, otherClientId, clientId); if (null == exisitngRelationshipReverse) { //otherClientId clientId var newRelationReverse = ClientRelationship.Create(relationshipTypeId, clientId, true, otherClientId, true); _clientRelationshipRepository.Save(newRelationReverse); var state = RelationshipType.IsPartner(relationshipTypeId) ? LiveState.PartnerListed : LiveState.FamilyListed; _clientStateRepository.SaveOrUpdate(new ClientState(otherClientId, state, clientId)); } }
public void SaveLinkage(ObsLinkage testResult, Guid clientId, bool referral = true) { _obsLinkageRepository.SaveOrUpdate(testResult); if (referral) { _clientStateRepository.SaveOrUpdate(new ClientState(clientId, testResult.EncounterId, LiveState.HtsReferred)); } else { _clientStateRepository.SaveOrUpdate(new ClientState(clientId, testResult.EncounterId, LiveState.HtsLinkedCare)); if (!string.IsNullOrWhiteSpace(testResult.EnrollmentId)) { _clientStateRepository.SaveOrUpdate(new ClientState(clientId, testResult.EncounterId, LiveState.HtsLinkedEnrolled)); } } }
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 SaveTest(ObsPartnerTraceResult testResult, Guid clientId, Guid indexClientId) { _obsTraceResultRepository.SaveOrUpdate(testResult); _clientStateRepository.SaveOrUpdate(new ClientState(clientId, testResult.EncounterId, ClientState.GetState(testResult.Outcome, "pat"), indexClientId)); }