private IenResult SaveDsioObservation(DsioObservation observation) { IenResult result = new IenResult(); DsioSaveObservationCommand command = new DsioSaveObservationCommand(this.broker); // *** Add entry date if new *** if (string.IsNullOrWhiteSpace(observation.Ien)) { observation.ExamDate = DateTime.Now.ToString(VistaDates.VistADateFormatFour); } command.AddCommandArguments(observation); RpcResponse response = command.Execute(); result.Success = response.Status == RpcResponseStatus.Success; result.Message = response.InformationalMessage; if (result.Success) { result.Ien = command.Ien; } return(result); }
public BrokerOperationResult SaveObservations(List <Observation> observationList) { BrokerOperationResult result = new BrokerOperationResult(); // *** Create the command *** DsioSaveObservationCommand command = new DsioSaveObservationCommand(this.broker); // *** Set some loop values *** bool okToContinue = true; int i = 0; // *** Loop through the observations *** while ((i < observationList.Count) && (okToContinue)) { // *** Get the current *** DsioObservation observation = ObservationUtility.GetDsioObservation(observationList[i]); // *** Add the command arguments *** command.AddCommandArguments(observation); // *** Execute the command *** RpcResponse response = command.Execute(); // *** Set the return response *** result.Success = (response.Status == RpcResponseStatus.Success); result.Message = response.InformationalMessage; // *** Continue if successful *** okToContinue = result.Success; // *** Set index to next *** i++; } return(result); }
public BrokerOperationResult SavePregnancyHistory(string patientDfn, PregnancyHistory pregnancyHistory) { // *** Save new pregnancy history observations *** BrokerOperationResult result = new BrokerOperationResult(); List <DsioObservation> observationsToSave = GetObservationsToSave(patientDfn, pregnancyHistory); // *** If there's something to save *** if (observationsToSave.Count > 0) { // *** Create the command *** DsioSaveObservationCommand command = new DsioSaveObservationCommand(this.broker); // *** Set some loop values *** bool okToContinue = true; int i = 0; // TODO: Simplify and shorten... // *** Loop through the observations *** while ((i < observationsToSave.Count) && (okToContinue)) { // *** Get the current *** DsioObservation observation = observationsToSave[i]; // *** Set the patient dfn *** observation.PatientDfn = patientDfn; // *** Set the date/time *** observation.ExamDate = DateTime.Now.ToString(VistaDates.VistADateFormatFour); // *** Add the command arguments *** command.AddCommandArguments(observation); // *** Execute the command *** RpcResponse response = command.Execute(); // *** Set the return response *** result.Success = (response.Status == RpcResponseStatus.Success); result.Message = response.InformationalMessage; // *** Continue if successful *** okToContinue = result.Success; // *** Set index to next *** i++; } if (okToContinue) { // *** Save G&P Summary *** DsioObservation observation = new DsioObservation(); observation.Code.CodeSystemName = "NONE"; observation.Code.Code = "GravidaParaSummary"; observation.Category = "Pregnancy History"; observation.Code.DisplayName = "Gravida & Para Summary"; // *** Set the patient dfn *** observation.PatientDfn = patientDfn; // *** Set the date/time *** observation.ExamDate = DateTime.Now.ToString(VistaDates.VistADateFormatFour); // *** Add the value *** observation.Value = pregnancyHistory.GravidaPara; // *** Add the command arguments *** command.AddCommandArguments(observation); // *** Execute the command *** RpcResponse response = command.Execute(); // *** Set the return response *** result.Success = (response.Status == RpcResponseStatus.Success); result.Message = response.InformationalMessage; // *** Continue if successful *** okToContinue = result.Success; } } else { result.Success = true; result.Message = "Nothing to save"; } return(result); }