Exemplo n.º 1
0
        private PatientUtilizationData MapPatientUtilizationData(MEPatientUtilization meN)
        {
            var data = new PatientUtilizationData
            {
                Id               = meN.Id.ToString(),
                PatientId        = meN.PatientId.ToString(),
                AdmitDate        = meN.AdmitDate,
                DischargeDate    = meN.DischargeDate,
                DispositionId    = meN.Disposition.ToString(),
                LocationId       = meN.Location.ToString(),
                OtherDisposition = Helper.TrimAndLimit(meN.OtherDisposition, 100),
                OtherLocation    = Helper.TrimAndLimit(meN.OtherLocation, 100),
                OtherType        = Helper.TrimAndLimit(meN.OtherType, 100),
                DataSource       = Helper.TrimAndLimit(meN.DataSource, 50),
                Reason           = Helper.TrimAndLimit(meN.Reason, 5000),
                VisitTypeId      = (meN.VisitType == null) ? null : meN.VisitType.ToString(),
                ProgramIds       = Helper.ConvertToStringList(meN.ProgramIds),
                SourceId         = (meN.SourceId == null) ? null : meN.SourceId.ToString(),
                TypeId           = (meN.NoteType == null) ? null : meN.NoteType.ToString(),
                CreatedById      = meN.RecordCreatedBy.ToString(),
                CreatedOn        = meN.RecordCreatedOn,
                Admitted         = meN.Admitted,
                UpdatedById      = (meN.UpdatedBy == null) ? null : meN.UpdatedBy.ToString(),
                UpdatedOn        = meN.LastUpdatedOn
            };

            return(data);
        }
Exemplo n.º 2
0
 public PatientUtilizationData UpdatePatientUtilization(PatientUtilizationData data)
 {
     try
     {
         var repository = Factory.GetRepository(RepositoryType.Utilization);
         var result     = repository.Update(data);
         return(result as PatientUtilizationData);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public PatientUtilizationData InsertPatientUtilization(PatientUtilizationData data)
 {
     try
     {
         var repository = Factory.GetRepository(RepositoryType.Utilization);
         var pUtil      = repository.Insert(data) as PatientUtilizationData;
         return(pUtil);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 4
0
        public static void AssemblyInit(TestContext context)
        {
            PatientUtilizationData = new PatientUtilizationData
            {
                AdmitDate        = DateTime.UtcNow,
                DischargeDate    = DateTime.UtcNow,
                DispositionId    = "disposition",
                LocationId       = "location",
                OtherDisposition = "other disp",
                OtherLocation    = "testotherlocation",
                OtherType        = "12345678912ertyudjgkanh4",
                PatientId        = "sjfhgry478290erhy7482911",
                ProgramIds       = new List <string> {
                    "sjfhgry478298988y7482911"
                },
                Reason      = "test reason",
                SourceId    = "783945768910123erhgy547f",
                DataSource  = "Engage",
                VisitTypeId = "89rhty7857ty7745tueiop33"
            };

            var timestamp = DateTime.Now.TimeOfDay.Hours.ToString() + DateTime.Now.TimeOfDay.Minutes.ToString() +
                            DateTime.Now.TimeOfDay.Milliseconds.ToString();

            NewPatientUtilizationData = new PatientUtilizationData
            {
                AdmitDate        = DateTime.UtcNow,
                DischargeDate    = DateTime.UtcNow,
                DispositionId    = "disposition" + timestamp,
                LocationId       = "location" + timestamp,
                OtherDisposition = "other disp" + timestamp,
                OtherLocation    = "testotherlocation" + timestamp,
                OtherType        = "12345678912ertyudjgkanh4",
                PatientId        = "sjfhgry478290erhy7482911",
                ProgramIds       = new List <string> {
                    "sjfhgry478298988y7482911"
                },
                Reason      = "test reason" + timestamp,
                SourceId    = "783945768910123erhgy547f",
                DataSource  = "Engage",
                VisitTypeId = "89rhty7857ty7745tueiop33"
            };
        }
Exemplo n.º 5
0
        public object FindByID(string entityID)
        {
            PatientUtilizationData utilData = null;

            try
            {
                using (PatientNoteMongoContext ctx = new PatientNoteMongoContext(ContractDBName))
                {
                    List <IMongoQuery> queries = new List <IMongoQuery>();
                    queries.Add(MB.Query.EQ(MEPatientUtilization.IdProperty, ObjectId.Parse(entityID)));
                    queries.Add(MB.Query.EQ(MEPatientUtilization.DeleteFlagProperty, false));
                    IMongoQuery          mQuery = MB.Query.And(queries);
                    MEPatientUtilization meN    = ctx.PatientUtilizations.Collection.Find(mQuery).FirstOrDefault();
                    if (meN != null)
                    {
                        utilData = MapPatientUtilizationData(meN);
                    }
                }
                return(utilData);
            }
            catch (Exception) { throw; }
        }
Exemplo n.º 6
0
 public PatientUtilizationData InsertPatientUtilization(PatientUtilizationData data)
 {
     return(new PatientUtilizationData());
 }
Exemplo n.º 7
0
 public PatientUtilizationData UpdatePatientUtilization(PatientUtilizationData data)
 {
     return(new PatientUtilizationData());
 }
Exemplo n.º 8
0
        public object Update(object entity)
        {
            PatientUtilizationData pn = entity as PatientUtilizationData;

            try
            {
                PatientUtilizationData result;
                using (PatientNoteMongoContext ctx = new PatientNoteMongoContext(ContractDBName))
                {
                    var q = MB.Query <MEPatientUtilization> .EQ(b => b.Id, ObjectId.Parse(pn.Id));

                    var uv = new List <MB.UpdateBuilder>();
                    uv.Add(MB.Update.Set(MEPatientUtilization.UpdatedByProperty, ObjectId.Parse(this.UserId)));
                    uv.Add(MB.Update.Set(MEPatientUtilization.LastUpdatedOnProperty, DateTime.UtcNow));

                    uv.Add(MB.Update.Set(MEPatientUtilization.AdmittedProperty, pn.Admitted));
                    if (pn.OtherType != null)
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.OtherTypeProperty, Trim(pn.OtherType, 100)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.OtherTypeProperty, BsonNull.Value));
                    }

                    if (pn.OtherLocation != null)
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.OtherLocationProperty, Trim(pn.OtherLocation, 100)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.OtherLocationProperty, BsonNull.Value));
                    }

                    if (pn.Reason != null)
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.ReasonProperty, Trim(pn.Reason, 5000)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.ReasonProperty, BsonNull.Value));
                    }

                    if (pn.OtherDisposition != null)
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.OtherDispositionProperty, Trim(pn.OtherDisposition, 100)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.OtherDispositionProperty, BsonNull.Value));
                    }

                    if (pn.DataSource != null)
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.DataSourceProperty, Trim(pn.DataSource, 50)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.DataSourceProperty, BsonNull.Value));
                    }

                    if (pn.AdmitDate != null && !pn.AdmitDate.Equals(new DateTime()))
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.AdmitDateProperty, pn.AdmitDate));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.AdmitDateProperty, BsonNull.Value));
                    }

                    if (pn.DischargeDate != null && !pn.DischargeDate.Equals(new DateTime()))
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.DischargeDateProperty, pn.DischargeDate));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.DischargeDateProperty, BsonNull.Value));
                    }

                    if (!string.IsNullOrEmpty(pn.PatientId))
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.PatientIdProperty, ObjectId.Parse(pn.PatientId)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.PatientIdProperty, BsonNull.Value));
                    }

                    if (!string.IsNullOrEmpty(pn.VisitTypeId))
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.VisitTypeProperty, ObjectId.Parse(pn.VisitTypeId)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.VisitTypeProperty, BsonNull.Value));
                    }

                    if (!string.IsNullOrEmpty(pn.LocationId))
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.LocationProperty, ObjectId.Parse(pn.LocationId)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.LocationProperty, BsonNull.Value));
                    }

                    if (!string.IsNullOrEmpty(pn.DispositionId))
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.DispositionProperty, ObjectId.Parse(pn.DispositionId)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.DispositionProperty, BsonNull.Value));
                    }

                    if (!string.IsNullOrEmpty(pn.SourceId))
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.SourceIdProperty, ObjectId.Parse(pn.SourceId)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.SourceIdProperty, BsonNull.Value));
                    }

                    if (!string.IsNullOrEmpty(pn.TypeId))
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.NoteTypeProperty, ObjectId.Parse(pn.TypeId)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.NoteTypeProperty, BsonNull.Value));
                    }

                    if (pn.ProgramIds != null && pn.ProgramIds.Count > 0)
                    {
                        uv.Add(MB.Update.SetWrapped <List <ObjectId> >(MEPatientUtilization.ProgramsProperty,
                                                                       Helper.ConvertToObjectIdList(pn.ProgramIds)));
                    }
                    else
                    {
                        uv.Add(MB.Update.Set(MEPatientUtilization.ProgramsProperty, BsonNull.Value));
                    }


                    IMongoUpdate update = MB.Update.Combine(uv);
                    ctx.PatientUtilizations.Collection.Update(q, update);

                    AuditHelper.LogDataAudit(this.UserId,
                                             MongoCollectionName.PatientUtilization.ToString(),
                                             pn.Id,
                                             DataAuditType.Update,
                                             ContractDBName);

                    result = FindByID(pn.Id) as PatientUtilizationData;
                }
                return(result as object);
            }
            catch (Exception)
            {
                throw;
            }
        }