示例#1
0
        private readonly string _ddPatientNotesServiceUrl = ProcConstants.DdPatientNoteUrl; //ConfigurationManager.OpenExeConfiguration(Assembly.GetExecutingAssembly().Location).AppSettings.Settings["DDPatientNoteUrl"].Value; //ConfigurationManager.AppSettings[""];

        public object Save <T>(T patientNotes, string contract)
        {
            LoggerDomainEvent.Raise(new LogStatus {
                Message = "5) Sending insert PatientNotes DD request.", Type = LogType.Debug
            });
            var l = patientNotes as List <PatientNoteData>;

            if (l != null)
            {
                LogUtil.LogExternalRecordId("Save", l.Cast <IAppData>().ToList());
            }

            var userid = ProcConstants.UserId; // need to find a valid session id.

            try
            {
                IRestClient client = new JsonServiceClient();
                //[Route("/{Context}/{Version}/{ContractNumber}/Batch/PatientNotes", "POST")]
                var url =
                    Helper.BuildURL(
                        string.Format("{0}/{1}/{2}/{3}/Batch/PatientNotes/", _ddPatientNotesServiceUrl, "NG", 1,
                                      contract), userid);

                InsertBatchPatientNotesDataResponse response = client.Post <InsertBatchPatientNotesDataResponse>(url,
                                                                                                                 new InsertBatchPatientNotesDataRequest
                {
                    Context          = "NG",
                    ContractNumber   = contract,
                    PatientNotesData = patientNotes as List <PatientNoteData>,
                    UserId           = userid,
                    Version          = 1
                });

                //new Helpers().SerializeObject<List<PatientNoteData>>(patientNotes as List<PatientNoteData>, Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\PatientNotesExample.txt");
                //var lPsd = Helpers.DeserializeObject<List<PatientSystemData>>(System.Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\PatientsSystemExample.txt");

                LoggerDomainEvent.Raise(new LogStatus {
                    Message = "5) Success", Type = LogType.Debug
                });
                return(response.Responses);
            }
            catch (Exception ex)
            {
                LoggerDomainEvent.Raise(new LogStatus {
                    Message = "PatientNoteDataDomain:Save(): " + ex.Message, Type = LogType.Error
                });
                throw new ArgumentException("PatientNoteDataDomain:Save(): " + ex.Message);
            }
        }
示例#2
0
        public InsertBatchPatientNotesDataResponse Post(InsertBatchPatientNotesDataRequest request)
        {
            InsertBatchPatientNotesDataResponse response = new InsertBatchPatientNotesDataResponse();

            try
            {
                RequireUserId(request);
                response.Responses = Manager.InsertBatchPatientNotes(request);
                response.Version   = request.Version;
            }
            catch (Exception ex)
            {
                RaiseException(response, ex);
            }
            return(response);
        }