コード例 #1
0
        /// <summary>
        /// Calls PatientSystem data domain to insert bulk Engage System records for the provided patient ids.
        /// </summary>
        /// <param name="request">IDataDomainRequest object</param>
        /// <returns>List of ids of the engage patient systems inserted.</returns>
        private List <string> insertBatchEngagePatientSystem(List <string> patientIds, IDataDomainRequest request)
        {
            List <string> ids = null;

            try
            {
                if (patientIds != null && patientIds.Count > 0)
                {
                    InsertBatchEngagePatientSystemsDataRequest psRequest = new InsertBatchEngagePatientSystemsDataRequest
                    {
                        PatientIds     = patientIds,
                        Context        = request.Context,
                        ContractNumber = request.ContractNumber,
                        UserId         = Constants.SystemContactId,// the requirement says that the engage Id should have createdby user as 'system'.
                        Version        = request.Version
                    };

                    string      DDPatientSystemServiceUrl = ConfigurationManager.AppSettings["DDPatientSystemServiceUrl"];
                    IRestClient client = new JsonServiceClient();
                    //[Route("/{Context}/{Version}/{ContractNumber}/Batch/Engage/PatientSystems", "POST")]
                    string url = Helpers.BuildURL(string.Format("{0}/{1}/{2}/{3}/Batch/Engage/PatientSystems", DDPatientSystemServiceUrl, psRequest.Context, psRequest.Version, psRequest.ContractNumber), psRequest.UserId);
                    InsertBatchEngagePatientSystemsDataResponse dataDomainResponse = client.Post <InsertBatchEngagePatientSystemsDataResponse>(url, psRequest as object);
                    if (dataDomainResponse != null && dataDomainResponse.Result != null)
                    {
                        ids = dataDomainResponse.Result.ProcessedIds;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(ids);
        }
コード例 #2
0
        public InsertBatchEngagePatientSystemsDataResponse Post(InsertBatchEngagePatientSystemsDataRequest request)
        {
            InsertBatchEngagePatientSystemsDataResponse response = new InsertBatchEngagePatientSystemsDataResponse();

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