protected override void ProcessResponseInteraction(IInteraction interaction) { ResultsQueryResponse response = (ResultsQueryResponse)interaction; // Now we print out some of the response values... Console.WriteLine("Message ID (root):={0}\n", response.Id.Root); if (response.ControlActEvent.Subject.Count > 0) { foreach (RefersTo_1 <IResultInstancePayloadChoice> result in response.ControlActEvent.Subject) { IResultInstancePayloadChoice act = result.Act; Console.WriteLine("Result Payload Class = {0}\n", act.GetType().ToString()); if (typeof(ObservationReport) == act.GetType()) { this.ProcessObservationReport(act); } else if (typeof(ResultObservation) == act.GetType()) { //TODO - process result observation } else if (typeof(Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Polb_mt004000ca.BatteryEvent) == act.GetType()) { //TODO - process battery event } else if (typeof(Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Polb_mt004200ca.BatteryEvent) == act.GetType()) { //TODO - process other battery event } else if (typeof(Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Polb_mt004100ca.ReportHeader) == act.GetType()) { //TODO - process report header } else if (typeof(Ca.Infoway.Messagebuilder.Model.Pcs_mr2009_r02_04_02.Lab.Polb_mt004200ca.ReportHeader) == act.GetType()) { //TODO - process other report header } else if (typeof(DiagnosisOrInterpretationObservation) == act.GetType()) { //TODO - process diagnosis/interpretation observation } } } }
private void ProcessObservationReport(IResultInstancePayloadChoice payloadChoice) { // Observation Report Lab Result. ObservationReport report = (ObservationReport)payloadChoice; // id = Report ID [1..1] Console.WriteLine("Report ID = (root={0}, extension={1})\n", report.Id.Root, report.Id.Extension); // ObservationLabReportType code [1..1] // FIXME - TM: the raw code value below is not the correct type and throws a ClassCastException // String reportTypeCode = report.Code.CodeValue; // String reportTypeCodeSystem = report.Code.CodeSystem; // Console.WriteLine("Report Type: = (code={0}, codeSystem={1})\n", reportTypeCode, reportTypeCodeSystem); // title [1..1] Console.WriteLine("Report Title:= {0}\n", report.Title); // text [0..1] specialization = ED.DOCORREF //TODO - Uncomment the next two lines once CR5 release is provided //EncapsulatedData ed = report.getRenderedReport(); //Console.WriteLine("Report Text:= {0}\n", ed.getContent().toString()); // statusCode Console.WriteLine("Report Status:= {0}\n", report.StatusCode.ToString()); //effectiveTime Console.WriteLine("Report Date:= {0}\n", report.EffectiveTime.ToString()); //confidentialityCode [0..2] // Who requested this lab test? foreach (IFulfillmentChoice choice in report.InFulfillmentOfFulfillmentChoice) { Console.WriteLine("fulfillmentChoice is {0}\n", choice.GetType().Name); if (typeof(ObservationRequest) == choice.GetType()) { ObservationRequest observationRequest = (ObservationRequest)choice; Identifier ii = observationRequest.Id; Console.WriteLine("infulfillmentOf/observationRequest/id:= (root={0} extension={1})\n", ii.Root, ii.Extension); } } }