public IActionResult GetExaminationsByID(int patientId, int exmiantionId)
        {
            if (!_patientInfoRepository.PatientExists(patientId))
            {
                _logger.LogInformation("Patient not exist PatientID: " + patientId);
                return(NotFound());
            }

            var examination = _patientInfoRepository.GetExamination(patientId, exmiantionId);

            var examinationDetail = _patientInfoRepository.GetExaminationDetail(patientId, exmiantionId);

            ExaminationDetailDTO examinationResult = new ExaminationDetailDTO();

            examinationResult.Description = examination.ExaminationType;

            if (examination == null)
            {
                return(NotFound());
            }

            if (examinationDetail is SpOData)
            {
                examinationResult.SPOValue = (examinationDetail as SpOData).SPOValue;
                return(Ok(examinationResult));
            }
            if (examinationDetail is BloodPressureData)
            {
                examinationResult.MeanBloodPressure = (examinationDetail as BloodPressureData).MeanBloodPressure;
                examinationResult.PulseRate         = (examinationDetail as BloodPressureData).PulseRate;
                examinationResult.SystolicValue     = (examinationDetail as BloodPressureData).SystolicValue;
                examinationResult.DiastolicValue    = (examinationDetail as BloodPressureData).DiastolicValue;
                return(Ok(examinationResult));
            }
            if (examinationDetail is BodyTemperatureData)
            {
                examinationResult.TemperatureValue = (examinationDetail as BodyTemperatureData).TemperatureValue;
                return(Ok(examinationResult));
            }

            return(NotFound());
        }
        public IActionResult HL7messageSendToServer(int exmiantionId)
        {
            try
            {
                var examination = _patientInfoRepository.GetExamination(exmiantionId);

                if (examination == null)
                {
                    return(NotFound());
                }

                var patient = _patientInfoRepository.GetPatient(examination.PatientId);

                if (patient == null)
                {
                    return(NotFound());
                }

                var examDetail = _patientInfoRepository.GetExaminationDetail(patient.Id, examination.Id);

                if (examDetail == null)
                {
                    return(NotFound());
                }

                Message msg = CreateHL7Message(examination, "2.3", patient, examDetail);

                string           hl7msg = msg.Serialize();
                HL7RequestInfo   info   = hL7CommunicationService.ParseHL7RawMessage(hl7msg, "Http");
                SimpleMLLPClient client = new SimpleMLLPClient("localhost", 2021);
                //MLLPSession session = new MLLPSession();
                var result = client.SendHL7Message(info.Message);
                _patientInfoRepository.UpdateExaminationStatus(exmiantionId, true);

                return(Ok());
            }
            catch (Exception ex)
            {
                return(StatusCode(500, "Internal Server Error"));
            }
        }