Esempio n. 1
0
        public GetStandardObservationsResponse GetStandardObservationsByType(GetStandardObservationsRequest request)
        {
            try
            {
                GetStandardObservationsResponse result = new GetStandardObservationsResponse();

                // get list of observations
                IPatientObservationRepository repo = Factory.GetRepository(request, RepositoryType.Observation);

                List <ObservationData>        odl  = (List <ObservationData>)repo.GetObservationsByType(request.TypeId, true, true);
                List <PatientObservationData> podl = new List <PatientObservationData>();

                // load and initialize each observation
                string initSetId = ObjectId.GenerateNewId().ToString();
                foreach (ObservationData od in odl)
                {
                    PatientObservationData pod = new PatientObservationData
                    {
                        Id            = ObjectId.GenerateNewId().ToString(),
                        ObservationId = od.Id,
                        Name          = od.CommonName ?? od.Description,
                        Order         = od.Order,
                        Standard      = od.Standard,
                        GroupId       = od.GroupId,
                        Units         = od.Units,
                        Values        = new List <ObservationValueData>(),
                        TypeId        = od.ObservationTypeId,
                        PatientId     = request.PatientId,
                        Source        = od.Source
                    };

                    // do an insert here and get an id from mongo
                    ObservationValueData ovd = InitializePatientObservation(request, request.PatientId, pod.Values, od, initSetId);

                    if (od.GroupId != null)
                    {
                        if (Util.GroupExists(podl, od.GroupId))
                        {
                            Util.FindAndInsert(podl, od.GroupId, ovd);
                        }
                        else
                        {
                            podl.Add(pod);
                        }
                    }
                    else
                    {
                        podl.Add(pod);
                    }
                }

                result.StandardObservations = podl;

                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception("DD.DataPatientObservationManager:GetStandardObservationsByType()::" + ex.Message, ex.InnerException);
            }
        }
Esempio n. 2
0
        internal static List <PatientObservationData> GetStandardObservationsRequest(DTO.GetStandardObservationItemsRequest request)
        {
            try
            {
                List <PatientObservationData> result = null;
                IRestClient client = new JsonServiceClient();

                string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/Observation/?TypeId={4}&PatientId={5}",
                                                                  DDPatientObservationsServiceUrl,
                                                                  "NG",
                                                                  request.Version,
                                                                  request.ContractNumber,
                                                                  request.TypeId,
                                                                  request.PatientId), request.UserId);

                GetStandardObservationsResponse dataDomainResponse = client.Get <GetStandardObservationsResponse>(
                    url);

                if (dataDomainResponse != null)
                {
                    result = dataDomainResponse.StandardObservations;
                }

                return(result);
            }
            catch (WebServiceException ex)
            {
                throw new WebServiceException("AD:GetStandardObservationsRequest()::" + ex.Message, ex.InnerException);
            }
        }
Esempio n. 3
0
        public void Get_ObservationByTypeID()
        {
            string url = "http://localhost:8888/PatientObservation";
            //string url = "http://azurePhytel.cloudapp.net:59901/PatientObservation";
            string      TypeID         = "53067453fe7a591a348e1b66";
            string      patientId      = "531f2dcc072ef727c4d29e1a";
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            double      version        = 1.0;
            IRestClient client         = new JsonServiceClient();

            JsonServiceClient.HttpWebRequestFilter = x =>
                                                     x.Headers.Add(string.Format("{0}: {1}", "x-Phytel-UserID", "5331b06cd6a4850998e38975"));

            GetStandardObservationsResponse response = client.Get <GetStandardObservationsResponse>(
                string.Format("{0}/{1}/{2}/{3}/Observation/?TypeId={4}&PatientId={5}",
                              url,
                              context,
                              version,
                              contractNumber,
                              TypeID,
                              patientId));
        }
        public GetStandardObservationsResponse Get(GetStandardObservationsRequest request)
        {
            GetStandardObservationsResponse response = new GetStandardObservationsResponse();

            try
            {
                if (string.IsNullOrEmpty(request.UserId))
                {
                    throw new UnauthorizedAccessException("PatientObservationDD:Get()::Unauthorized Access");
                }

                response         = Omgr.GetStandardObservationsByType(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                CommonFormatter.FormatExceptionResponse(response, base.Response, ex);

                string aseProcessID = ConfigurationManager.AppSettings.Get("ASEProcessID") ?? "0";
                Common.Helper.LogException(int.Parse(aseProcessID), ex);
            }
            return(response);
        }