Ejemplo n.º 1
0
        public DeleteNoteByPatientIdDataResponse Delete(DeleteNoteByPatientIdDataRequest request)
        {
            DeleteNoteByPatientIdDataResponse response = new DeleteNoteByPatientIdDataResponse();

            try
            {
                RequireUserId(request);
                response         = Manager.DeleteNoteByPatientId(request);
                response.Version = request.Version;
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }
Ejemplo n.º 2
0
        public DeleteNoteByPatientIdDataResponse DeleteNoteByPatientId(DeleteNoteByPatientIdDataRequest request)
        {
            DeleteNoteByPatientIdDataResponse response = null;

            try
            {
                response = new DeleteNoteByPatientIdDataResponse();

                IMongoPatientNoteRepository   repo = Factory.GetRepository(RepositoryType.PatientNote);
                GetAllPatientNotesDataRequest getAllPatientNotesDataRequest = new GetAllPatientNotesDataRequest
                {
                    Context        = request.Context,
                    ContractNumber = request.ContractNumber,
                    PatientId      = request.PatientId,
                    UserId         = request.UserId,
                    Version        = request.Version
                };
                List <PatientNoteData> patientNotes = repo.FindByPatientId(getAllPatientNotesDataRequest) as List <PatientNoteData>;
                List <string>          deletedIds   = null;
                if (patientNotes != null)
                {
                    deletedIds = new List <string>();
                    patientNotes.ForEach(u =>
                    {
                        DeletePatientNoteDataRequest deletePatientNoteDataRequest = new DeletePatientNoteDataRequest
                        {
                            Context        = request.Context,
                            ContractNumber = request.ContractNumber,
                            Id             = u.Id,
                            PatientId      = request.PatientId,
                            UserId         = request.UserId,
                            Version        = request.Version
                        };
                        repo.Delete(deletePatientNoteDataRequest);
                        deletedIds.Add(deletePatientNoteDataRequest.Id);
                    });
                    response.DeletedIds = deletedIds;
                }
                response.Success = true;
                return(response);
            }
            catch (Exception ex) { throw ex; }
        }
Ejemplo n.º 3
0
        public void DeletePatientNoteByPatientId_Test()
        {
            double      version        = 1.0;
            string      contractNumber = "InHealth001";
            string      context        = "NG";
            string      patientId      = "5325db70d6a4850adcbba946";
            string      userId         = "000000000000000000000000";
            string      ddUrl          = "http://localhost:8888/PatientNote";
            IRestClient client         = new JsonServiceClient();

            // [Route("/{Context}/{Version}/{ContractNumber}/PatientNote/Patient/{PatientId}/Delete", "DELETE")]
            string url = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientNote/Patient/{4}/Delete",
                                                              ddUrl,
                                                              context,
                                                              version,
                                                              contractNumber,
                                                              patientId), userId);
            DeleteNoteByPatientIdDataResponse response = client.Delete <DeleteNoteByPatientIdDataResponse>(url);

            Assert.IsNotNull(response);
        }
Ejemplo n.º 4
0
 public void Execute()
 {
     try
     {
         //[Route("/{Context}/{Version}/{ContractNumber}/PatientNote/Patient/{PatientId}/Delete", "DELETE")]
         string pnUrl = Common.Helper.BuildURL(string.Format("{0}/{1}/{2}/{3}/PatientNote/Patient/{4}/Delete",
                                                             DDPatientNoteUrl,
                                                             "NG",
                                                             request.Version,
                                                             request.ContractNumber,
                                                             request.Id), request.UserId);
         DeleteNoteByPatientIdDataResponse pnDDResponse = client.Delete <DeleteNoteByPatientIdDataResponse>(pnUrl);
         if (pnDDResponse != null && pnDDResponse.Success)
         {
             deletedIds = pnDDResponse.DeletedIds;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("AD: PatientNoteCommand Execute::" + ex.Message, ex.InnerException);
     }
 }