Exemplo n.º 1
0
        public List <MedicationMapData> DeleteMedicationMaps(PutDeleteMedMapDataRequest request)
        {
            try
            {
                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.MedicationMapping);

                if (request.MedicationMaps != null)
                {
                    request.MedicationMaps.ForEach(m =>
                    {
                        string id = (string)repo.Find(m);
                        if (!string.IsNullOrEmpty(id))
                        {
                            m.Id = id;
                            repo.Delete(id);
                        }
                    });
                }
                return(request.MedicationMaps);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public PatientMedSuppData SavePatientMedSupps(PutPatientMedSuppDataRequest request)
        {
            try
            {
                PatientMedSuppData result = null;
                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp);

                if (request.PatientMedSuppData != null)
                {
                    if (request.Insert)
                    {
                        string id = (string)repo.Insert(request);
                        if (!string.IsNullOrEmpty(id))
                        {
                            result = (PatientMedSuppData)repo.FindByID(id);
                        }
                    }
                    else
                    {
                        bool status = (bool)repo.Update(request);
                        if (status)
                        {
                            result = (PatientMedSuppData)repo.FindByID(request.PatientMedSuppData.Id);
                        }
                    }
                }
                return(result);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 3
0
 public MedicationMapData InitializeMedicationMap(PutInitializeMedicationMapDataRequest request)
 {
     try
     {
         var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.MedicationMapping);
         return((MedicationMapData)repo.Initialize(request));
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 4
0
 public bool BulkInsertMedications(List <DTO.MedicationData> meds, PutBulkInsertMedicationsRequest request)
 {
     try
     {
         var repo   = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.Medication);
         var result = (Boolean)repo.InsertAll(meds.ToList <object>());
         return(result);
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 5
0
 public List <MedicationMapData> GetMedicationMap(GetMedicationMapDataRequest request)
 {
     try
     {
         List <MedicationMapData> result = null;
         var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.MedicationMapping);
         result = repo.Search(request) as List <MedicationMapData>;
         return(result);
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 6
0
        //public MedicationDataManager(IMongoMedicationRepository repository)
        //{
        //    MedicationRepository = repository;
        //}

        public List <DTO.MedicationData> GetMedicationList(GetAllMedicationsRequest request)
        {
            try
            {
                List <DTO.MedicationData> result = null;
                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.Medication);
                result = repo.SelectAll().Cast <DTO.MedicationData>().ToList <DTO.MedicationData>();
                return(result);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 7
0
 public List <PatientMedFrequencyData> GetPatientMedFrequencies(GetPatientMedFrequenciesDataRequest request)
 {
     try
     {
         List <PatientMedFrequencyData> result = null;
         var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedFrequency);
         result = repo.FindByPatientId(request) as List <PatientMedFrequencyData>;
         return(result);
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 8
0
 public int GetPatientMedSuppsCount(GetPatientMedSuppsCountDataRequest request)
 {
     try
     {
         int count = 0;
         {
             var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp);
             count = (int)repo.Search(request);
         }
         return(count);
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 9
0
 public List <PatientMedSuppData> GetPatientMedSupps(GetPatientMedSuppsDataRequest request)
 {
     try
     {
         List <PatientMedSuppData> result = null;
         //PatientMedSuppRepository.UserId = request.UserId;
         if (request.PatientId != null)
         {
             var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp);
             result = repo.FindByPatientId(request) as List <PatientMedSuppData>;
         }
         return(result);
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 10
0
        public DTO.MedicationMapData InsertMedicationMap(PostMedicationMapDataRequest request)
        {
            MedicationMapData result = null;

            try
            {
                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.MedicationMapping);
                if (request.MedicationMapData != null)
                {
                    result = repo.Insert(request as object) as MedicationMapData;
                }
                return(result);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 11
0
        public DeletePatientMedSuppDataResponse Delete(DeletePatientMedSuppDataRequest request)
        {
            DeletePatientMedSuppDataResponse response = null;

            try
            {
                response = new DeletePatientMedSuppDataResponse();
                if (!string.IsNullOrEmpty(request.Id))
                {
                    var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp);
                    repo.Delete(request);
                }
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 12
0
        public MedicationMapData UpdateMedicationMap(PutMedicationMapDataRequest request)
        {
            try
            {
                MedicationMapData result = null;
                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.MedicationMapping);

                if (request.MedicationMapData != null)
                {
                    bool status = (bool)repo.Update(request);
                    if (status)
                    {
                        result = (MedicationMapData)repo.FindByID(request.MedicationMapData.Id);
                    }
                }
                return(result);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 13
0
        public DeleteMedSuppsByPatientIdDataResponse DeletePatientMedSupps(DeleteMedSuppsByPatientIdDataRequest request)
        {
            DeleteMedSuppsByPatientIdDataResponse response = null;

            try
            {
                response = new DeleteMedSuppsByPatientIdDataResponse();

                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp);
                GetPatientMedSuppsDataRequest getAllPatientMedSuppsDataRequest = new GetPatientMedSuppsDataRequest
                {
                    Context        = request.Context,
                    ContractNumber = request.ContractNumber,
                    PatientId      = request.PatientId,
                    UserId         = request.UserId,
                    Version        = request.Version
                };
                List <PatientMedSuppData> patientMedSupps = repo.FindByPatientId(getAllPatientMedSuppsDataRequest) as List <PatientMedSuppData>;
                List <string>             deletedIds      = null;
                if (patientMedSupps != null)
                {
                    deletedIds = new List <string>();
                    patientMedSupps.ForEach(u =>
                    {
                        DeletePatientMedSuppDataRequest deletePMSDataRequest = new DeletePatientMedSuppDataRequest
                        {
                            Context        = request.Context,
                            ContractNumber = request.ContractNumber,
                            Id             = u.Id,
                            UserId         = request.UserId,
                            Version        = request.Version
                        };
                        repo.Delete(deletePMSDataRequest);
                        deletedIds.Add(deletePMSDataRequest.Id);
                    });
                    response.DeletedIds = deletedIds;
                }
                response.Success = true;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 14
0
        public string InsertPatientMedFrequency(PostPatientMedFrequencyDataRequest request)
        {
            string id = null;

            try
            {
                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedFrequency);
                if (request.PatientMedFrequencyData != null)
                {
                    // Check if frequency by the same name exists before inserting the new one.
                    id = repo.FindByName(request) as string;
                    if (string.IsNullOrEmpty(id))
                    {
                        id = repo.Insert(request) as string;
                    }
                }
                return(id);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 15
0
        public UndoDeletePatientMedSuppsDataResponse UndoDeletePatientMedSupps(UndoDeletePatientMedSuppsDataRequest request)
        {
            UndoDeletePatientMedSuppsDataResponse response = null;

            try
            {
                response = new UndoDeletePatientMedSuppsDataResponse();

                var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.PatientMedSupp);
                if (request.Ids != null && request.Ids.Count > 0)
                {
                    request.Ids.ForEach(u =>
                    {
                        request.PatientMedSuppId = u;
                        repo.UndoDelete(request);
                    });
                }
                response.Success = true;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
Exemplo n.º 16
0
 public void DeleteMedicationMaps(DeleteMedicationMapsDataRequest request)
 {
     try
     {
         if (!string.IsNullOrEmpty(request.Ids))
         {
             var      repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.MedicationMapping);
             string[] Ids  = request.Ids.Split(',');
             foreach (string id in Ids)
             {
                 DeleteMedicationMapsDataRequest deleteReq = new DeleteMedicationMapsDataRequest
                 {
                     Id             = id.Trim(),
                     Context        = request.Context,
                     ContractNumber = request.ContractNumber,
                     UserId         = request.UserId,
                     Version        = request.Version
                 };
                 repo.Delete(deleteReq);
             }
         }
     }
     catch (Exception ex) { throw ex; }
 }
Exemplo n.º 17
0
 public GetMedicationNDCsDataResponse GetMedicationNDCs(GetMedicationNDCsDataRequest request)
 {
     try
     {
         GetMedicationNDCsDataResponse result = new GetMedicationNDCsDataResponse();
         var repo = MedicationRepositoryFactory.GetMedicationRepository(request, RepositoryType.Medication);
         List <MEMedication> meMeds = repo.FindNDCCodes(request) as List <MEMedication>;
         if (meMeds != null && meMeds.Count > 0)
         {
             List <string> ndcs = new List <string>();
             // Get list of unique NDC codes.
             meMeds.ForEach(m =>
             {
                 if (!ndcs.Contains(m.NDC))
                 {
                     ndcs.Add(m.NDC);
                 }
             });
             result.NDCcodes = ndcs;
         }
         return(result);
     }
     catch (Exception ex) { throw ex; }
 }