示例#1
0
 public void StartObserving(GameObject go, ParticipationController data, Competitor <GameObject> competitor)
 {
     if (!Observed.ContainsKey(go))
     {
         Observed[go] = new ObservationData(data, competitor);
     }
 }
示例#2
0
        public PutUpdatePatientObservationsDataResponse UpdatePatientObservations(PutUpdatePatientObservationsDataRequest request)
        {
            try
            {
                PutUpdatePatientObservationsDataResponse response       = new PutUpdatePatientObservationsDataResponse();
                List <PatientObservationData>            returnDataList = null;
                bool result = false;
                IPatientObservationRepository repo = Factory.GetRepository(request, RepositoryType.PatientObservation);

                // update
                if (request.PatientObservationsRecordData != null && request.PatientObservationsRecordData.Count != 0)
                {
                    returnDataList = new List <PatientObservationData>();
                    foreach (PatientObservationRecordData poData in request.PatientObservationsRecordData)
                    {
                        if (!string.IsNullOrEmpty(poData.Id))
                        {
                            PutUpdateObservationDataRequest putUpdateObservationDataRequest = new PutUpdateObservationDataRequest {
                                Context                = request.Context,
                                ContractNumber         = request.ContractNumber,
                                PatientId              = request.PatientId,
                                PatientObservationData = poData,
                                UserId  = request.UserId,
                                Version = request.Version
                            };
                            result = (bool)repo.Update(putUpdateObservationDataRequest);
                            //fetch & return the update object.
                            PatientObservationData pod = (PatientObservationData)repo.FindByID(poData.Id, true);
                            returnDataList.Add(pod);
                        }
                    }
                    IPatientObservationRepository observationRepo = Factory.GetRepository(request, RepositoryType.Observation);
                    List <ObservationData>        observations    = (List <ObservationData>)observationRepo.GetActiveObservations();
                    if (observations != null && observations.Count > 0)
                    {
                        List <string> distinctObservations = returnDataList.Select(a => a.ObservationId).Distinct().ToList();
                        // added this to take care of composite observations like BP
                        distinctObservations.ForEach(o => CombineCompositeObservations(o, returnDataList));
                        returnDataList.ForEach(r =>
                        {
                            ObservationData odata = observations.Where(x => x.Id == r.ObservationId).FirstOrDefault();
                            if (odata != null)
                            {
                                r.TypeId   = odata.ObservationTypeId;
                                r.Name     = odata.CommonName == null ? odata.Description : odata.CommonName;
                                r.Standard = odata.Standard;
                            }
                        });
                    }
                }
                response.PatientObservationsData = returnDataList;
                response.Result = result;
                return(response);
            }
            catch (Exception ex)
            {
                throw new Exception("DD.DataPatientObservationManager:UpdatePatientObservations()::" + ex.Message, ex.InnerException);
            }
        }
示例#3
0
 private void OnTriggerEnter(Collider other)
 {
     if ((other.gameObject.CompareTag("Player") || other.gameObject.CompareTag("RemotePlayer") || other.gameObject.CompareTag("DummyPlayer")) && Observed.ContainsKey(other.gameObject))
     {
         ObservationData observationData = Observed[other.gameObject];
         observationData.IsValid = true;
     }
 }
示例#4
0
        private void Add(ObservationTypeId observationTypeId)
        {
            try
            {
                using (WaitCursor wc = new WaitCursor())
                {
                    DataRow  dr       = GetPrevObservationRow(observationTypeId);
                    DateTime prevTime = dr != null ? (DateTime)dr["Time"] : patient.admissionDate;
                    DateTime dt       = App.DepartmentConfig.GetNextObservationTime(observationTypeId, patient.patientTypeId, prevTime, dr == null);

                    if (patient.dischargeDate != DateTime.MinValue && dt > patient.dischargeDate)
                    {
                        FormUtils.MessageExcl("Время наблюдения не должно быть позднее времени выписки.");
                        return;
                    }

                    Observation     observation = new Observation(observationTypeId);
                    HandbookGroupId hgId        = Observation.GetHandbookGroupId(observationTypeId);
                    if (dr != null)
                    {
                        observation.description = ObservationData.Create(dr["Description"] as string);
                    }
                    else
                    {
                        observation.description.Init(App.Config[hgId], patient.patientDescription);
                    }
                    observation.time      = dt;
                    observation.patientId = patient.Id;
                    observation.doctorId  = App.Instance.UserId;
                    ObservationForm form = new ObservationForm(observation, patientName);
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        DataRow newRow = dataTable.NewRow();
                        dataTable.Rows.Add(newRow);
                        UpdateRow(newRow, observation);
                        newRow["ObservationTypeId"]   = (int)observationTypeId;
                        newRow["ObservationTypeName"] = observationTypes[observationTypeId];
                        GridViewUtils.SetCurrentRow(gridView, newRow);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Exception(ex);
            }
        }
示例#5
0
        private void OnTriggerExit(Collider other)
        {
            if (isBeingDestroyed || base.gameObject.IsDestroyed() || !(other != null) || other.gameObject.IsDestroyed() || !Observed.ContainsKey(other.gameObject) || (!other.gameObject.CompareTag("Player") && !other.gameObject.CompareTag("RemotePlayer") && !other.gameObject.CompareTag("DummyPlayer")))
            {
                return;
            }
            ObservationData observationData = Observed[other.gameObject];

            if (observationData.Competitor != null && !observationData.Competitor.Value.IsDestroyed())
            {
                observationData.IsValid = false;
                if (this.ObserverExit != null)
                {
                    this.ObserverExit(observationData.Competitor, other.gameObject, this);
                }
            }
        }
        public ReportsDataSet.ReacardDescriptionsDataTable GetReacardDescriptionsTable(ConnectionFactory factory)
        {
            // aux data
            DateTime startTime = reacard.date.Date + TimeSpan.FromHours(10);
            DateTime endTime   = startTime + TimeSpan.FromHours(24);
            Dictionary <DateTime, ObservationData> dict0 = ObservationsReportBuilder.GetObservationData(factory, patient.Id, ObservationTypeId.Diary, startTime, endTime);
            Dictionary <int, ObservationData>      dict  = new Dictionary <int, ObservationData>();

            foreach (KeyValuePair <DateTime, ObservationData> pair in dict0)
            {
                TimeSpan ts  = pair.Key - startTime;
                int      col = ((int)ts.TotalHours) / 2 + 1;
                if (col > 0 && col <= 12)
                {
                    if (!dict.ContainsKey(col))
                    {
                        dict.Add(col, pair.Value);
                    }
                }
            }

            // data
            ReportsDataSet.ReacardDescriptionsDataTable dtReacardDescriptions = new ReportsDataSet.ReacardDescriptionsDataTable();
            CreateRow(dtReacardDescriptions, "");
            CreateRow(dtReacardDescriptions, "ÀÄ");
            CreateRow(dtReacardDescriptions, "Ïóëüñ");
            CreateRow(dtReacardDescriptions, "×ÑÑ");
            CreateRow(dtReacardDescriptions, "×ÄÄ");
            CreateRow(dtReacardDescriptions, "ÖÂÄ");
            CreateRow(dtReacardDescriptions, "Òåìïåðàòóðà");

            foreach (KeyValuePair <int, ObservationData> pair in dict)
            {
                int             col = pair.Key;
                ObservationData od  = pair.Value;
                int             row = 1;
                dtReacardDescriptions[row++][col] = od["SystolicBloodPressure"] + "/" + od["DiastolicBloodPressure"];
                dtReacardDescriptions[row++][col] = od["Pulse"];
                dtReacardDescriptions[row++][col] = od["HeartRate"];
                dtReacardDescriptions[row++][col] = od["RespiratoryRate"];
                dtReacardDescriptions[row++][col] = od["ÑentralVenousPressure"];
                dtReacardDescriptions[row++][col] = od["Temperature"];
            }
            return(dtReacardDescriptions);
        }
示例#7
0
        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; }
        }
示例#8
0
        public object FindByID(string entityID)
        {
            ObservationData odL = null;

            try
            {
                using (PatientObservationMongoContext ctx = new PatientObservationMongoContext(_dbName))
                {
                    List <IMongoQuery> queries = new List <IMongoQuery>();
                    queries.Add(Query.EQ(MEObservation.IdProperty, ObjectId.Parse(entityID)));
                    IMongoQuery mQuery = Query.And(queries);

                    MEObservation o = ctx.Observations.Collection.Find(mQuery).FirstOrDefault();

                    if (o != null)
                    {
                        odL = new ObservationData
                        {
                            CodingSystem                                            = o.CodingSystemId.ToString(),
                            CodingSystemCode                                        = o.Code,
                            DeleteFlag                                              = o.DeleteFlag,
                            Description                                             = o.Description,
                            GroupId                                                 = o.GroupId != null?o.GroupId.ToString() : null,
                                                                  LowValue          = o.LowValue,
                                                                  HighValue         = o.HighValue,
                                                                  Id                = o.Id.ToString(),
                                                                  LastUpdatedOn     = o.LastUpdatedOn,
                                                                  ObservationTypeId = o.ObservationTypeId.ToString(),
                                                                  Order             = o.Order,
                                                                  Source            = o.Source,
                                                                  Standard          = o.Standard,
                                                                  Status            = (int)o.Status,
                                                                  TTLDate           = o.TTLDate,
                                                                  Units             = o.Units,
                                                                  UpdatedBy         = o.UpdatedBy.ToString(),
                                                                  Version           = o.Version,
                                                                  CommonName        = o.CommonName
                        };
                    }
                }
                return(odL);
            }
            catch (Exception) { throw; }
        }
示例#9
0
        public GetAdditionalObservationDataItemResponse GetAdditionalObservationItemById(GetAdditionalObservationDataItemRequest request)
        {
            try
            {
                GetAdditionalObservationDataItemResponse result = new GetAdditionalObservationDataItemResponse();
                IPatientObservationRepository            repo   = Factory.GetRepository(request, RepositoryType.Observation);

                ObservationData        od  = (ObservationData)repo.FindByID(request.ObservationId);
                PatientObservationData pod = MakeAdditionalObservation(request, repo, od);

                result.Observation = pod;

                return(result);
            }
            catch (Exception ex)
            {
                throw new Exception("DD.DataPatientObservationManager:GetAdditionalObservationItemById()::" + ex.Message, ex.InnerException);
            }
        }
示例#10
0
        public PatientObservationData MakeAdditionalObservation(GetAdditionalObservationDataItemRequest request, IPatientObservationRepository repo, ObservationData od)
        {
            try
            {
                PatientObservationData pod = CreatePatientObservationData(request, od);
                ObservationValueData   ovd = InitializePatientObservation(request, request.PatientId, pod.Values, od, request.SetId);

                // account for composite BP observation
                if (pod.GroupId != null && pod.GroupId.Equals("530cb50dfe7a591ee4a58c51"))
                {
                    string observationId = string.Empty;
                    observationId = od.Id.Equals("530c26fcfe7a592f64473e37") ? "530c270afe7a592f64473e38" : "530c26fcfe7a592f64473e37";
                    ObservationData        od2  = (ObservationData)repo.FindByID(observationId);
                    PatientObservationData pod2 = CreatePatientObservationData(request, od2);
                    ObservationValueData   ovd2 = InitializePatientObservation(request, request.PatientId, pod.Values, od2, request.SetId);
                }
                return(pod);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#11
0
        public PatientObservationData CreatePatientObservationData(GetAdditionalObservationDataItemRequest request, ObservationData od)
        {
            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
            };

            return(pod);
        }
示例#12
0
        public ObservationValueData InitializePatientObservation(IDataDomainRequest request, string patientId, List <ObservationValueData> list, ObservationData od, string initSetId)
        {
            try
            {
                IPatientObservationRepository repo = Factory.GetRepository(request, RepositoryType.PatientObservation);

                PutInitializeObservationDataRequest req = new PutInitializeObservationDataRequest
                {
                    PatientId      = patientId,
                    ObservationId  = od.Id,
                    Context        = request.Context,
                    ContractNumber = request.ContractNumber,
                    UserId         = request.UserId,
                    Version        = request.Version,
                    SetId          = initSetId
                };

                ObservationValueData ovd = new ObservationValueData();

                // get last value for each observation data
                GetPreviousValuesForObservation(ovd, patientId, od.Id, request);

                PatientObservationData pod = (PatientObservationData)repo.Initialize(req);

                ovd.Id    = pod.Id;
                ovd.Text  = od.Description;
                ovd.Value = string.Empty; // changed to initialize the value.

                list.Add(ovd);

                return(ovd);
            }
            catch (Exception ex)
            {
                throw new Exception("DD.DataPatientObservationManager:InitializePatientObservation()::" + ex.Message, ex.InnerException);
            }
        }
示例#13
0
 public ObservationService()
 {
     dataAccess = new ObservationData();
 }