示例#1
0
        public POCT()
        {
            _decoder = new POCTDecoderA();
            string  strHELR01 = Helpers.GetStringFromFile(@"CategoryA\SampleMessages\POCT_HELR01.xml");
            string  strOBSR01 = Helpers.GetStringFromFile(@"CategoryA\SampleMessages\POCT_OBSR01.xml");
            OBSR01  _obsr01   = Serialization.DeserializeObject <OBSR01>(strOBSR01);
            Service _svc      = _obsr01.services[0];

            _message = new POCTMessage
            {
                svc    = _svc,
                helr01 = strHELR01
            };
            _deviceMessage = new DeviceMessage
            {
                ClientId        = ClientId,
                DeviceCategory  = "A",
                SendingFacility = SendingFacility,
                MessageType     = "POCT",
                ContentsList    = new List <string> {
                    strOBSR01, strHELR01
                }
            };
            _processor = new POCTMessageProcessor(_decoder);
        }
        public List <PatientDiagnosticRecord> ProcessMessage(DeviceMessage deviceMessage)
        {
            List <PatientDiagnosticRecord> records = new List <PatientDiagnosticRecord>();

            try
            {
                string strOBSR01 = deviceMessage.ContentsList[0];
                string strHELR01 = deviceMessage.ContentsList[1];

                OBSR01         _obsr01    = Serialization.DeserializeObject <OBSR01>(strOBSR01);
                Service[]      services   = _obsr01.services;
                List <Service> lstService = services.OfType <Service>().ToList();

                foreach (Service svc in lstService)
                {
                    POCTMessage message = new POCTMessage
                    {
                        svc    = svc,
                        helr01 = strHELR01
                    };

                    records = Helpers.GetPatientDiagnosticRecords <POCTMessage>(
                        _messageDecoder,
                        message,
                        deviceMessage);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }

            return(records);
        }