コード例 #1
0
        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)));
            }
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
 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));
         }
     }
 }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
        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);
                }
            }
            //

            //
        }
コード例 #6
0
 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));
 }