public void GetCurrentPatientObservations_Test() { // Arrange string userId = string.Empty; string contractNumber = "InHealth001"; string context = "NG"; string patientId = "5325d9f3d6a4850adcbba4ce"; GetCurrentPatientObservationsDataRequest request = new GetCurrentPatientObservationsDataRequest { PatientId = patientId, Context = context, ContractNumber = contractNumber, UserId = userId, Version = 1 }; PatientObservationDataManager cm = new PatientObservationDataManager { Factory = new PatientObservationRepositoryFactory() }; GetCurrentPatientObservationsDataResponse response = cm.GetCurrentPatientObservations(request); Assert.IsNotNull(response); }
public GetCurrentPatientObservationsDataResponse Get(GetCurrentPatientObservationsDataRequest request) { GetCurrentPatientObservationsDataResponse response = new GetCurrentPatientObservationsDataResponse(); try { if (string.IsNullOrEmpty(request.UserId)) { throw new UnauthorizedAccessException("PatientObservationDD:Get()::Unauthorized Access"); } response = Omgr.GetCurrentPatientObservations(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); }
public GetCurrentPatientObservationsDataResponse GetCurrentPatientObservations(GetCurrentPatientObservationsDataRequest request) { try { GetCurrentPatientObservationsDataResponse result = new GetCurrentPatientObservationsDataResponse(); IPatientObservationRepository poRepo = Factory.GetRepository(request, RepositoryType.PatientObservation); List <PatientObservationData> patientObservations = poRepo.FindObservationIdByPatientId(request.PatientId) as List <PatientObservationData>; List <PatientObservationData> currentPOs = null; if (patientObservations != null && patientObservations.Count > 0) { currentPOs = new List <PatientObservationData>(); IPatientObservationRepository observationRepo = Factory.GetRepository(request, RepositoryType.Observation); List <ObservationData> observations = (List <ObservationData>)observationRepo.GetActiveObservations(); if (observations != null && observations.Count > 0) { List <string> distinctObservations = patientObservations.Select(a => a.ObservationId).Distinct().ToList(); // added this to take care of composite observations like BP distinctObservations.ForEach(o => CombineCompositeObservations(o, patientObservations)); distinctObservations.ForEach(a => { PatientObservationData current = getCurrentPO(patientObservations.Where(s => s.ObservationId == a).ToList()); if (current != null) { ObservationData odata = observations.Where(x => x.Id == a).FirstOrDefault(); if (odata != null) { current.TypeId = odata.ObservationTypeId; current.Name = odata.CommonName == null ? odata.Description : odata.CommonName; current.Standard = odata.Standard; currentPOs.Add(current); } } }); } } result.PatientObservationsData = currentPOs; return(result); } catch (Exception ex) { throw ex; } }