Exemplo n.º 1
0
        public void HandlePatientProblemRegistration(PlanElementEventArg e, string userId, SpawnElement rse)
        {
            try
            {
                // check if problem code is already registered for patient
                var ppd = EndpointUtil.GetPatientProblem(rse.ElementId, e, userId);

                if (ppd != null)
                {
                    var uspc = new UpdateSpawnProblemCode(e, rse, ppd, true)
                    {
                        EndPointUtil = EndpointUtil
                    };
                    var updateSpawnProblemCode = new SpawnElementStrategy(uspc);
                    if (ppd.StateId != 2)
                    {
                        updateSpawnProblemCode.Evoke();
                    }
                }
                else
                {
                    var spc = new RegisterSpawnProblemCode(e, rse)
                    {
                        EndPointUtil = EndpointUtil
                    };
                    var registerSpawnProblemCode = new SpawnElementStrategy(spc);
                    registerSpawnProblemCode.Evoke();
                }

                // register new problem code with cohortpatientview
                PlanUtils.RegisterCohortPatientViewProblemToPatient(rse.ElementId, e.PatientId,
                                                                    e.DomainRequest);
            }
            catch (Exception ex)
            {
                throw new Exception("AD:StepPlanProcessor:HandlePatientProblemRegistration()::" + ex.Message,
                                    ex.InnerException);
            }
        }