public IActionResult GetWorkFlow(int workflowId)
        {
            var workflow = _patientInfoRepository.GetWorkFlow(workflowId);

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

            var workflowResult = Mapper.Map <PatientDTO>(workflow);

            return(Ok(workflowResult));
        }
        public IActionResult CreateExamination(int patientId, [FromBody] ExaminationCreationDTO examinationDTO, int workFlowID)
        {
            if (examinationDTO == null)
            {
                return(BadRequest());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            if (!_patientInfoRepository.PatientExists(patientId))
            {
                return(NotFound());
            }
            WorkFlow workFlow = _patientInfoRepository.GetWorkFlow(workFlowID);

            if (examinationDTO.Description == "Body temperature")
            {
                try
                {
                    Examination examToAddBDT = new Examination();
                    examToAddBDT.Description     = String.Empty;
                    examToAddBDT.Archived        = false;
                    examToAddBDT.PatientId       = patientId;
                    examToAddBDT.Value           = DateTime.Now.ToString();
                    examToAddBDT.ExaminationType = "Body temperature";
                    BodyTemperatureData newExamBTD = new BodyTemperatureData()
                    {
                        TemperatureValue = examinationDTO.TemperatureValue.Value
                    };
                    _patientInfoRepository.AddExaminationToPatient(patientId, examToAddBDT, ExaminationType.BodyTemperature, newExamBTD, workFlow);
                    return(Ok());
                }
                catch (Exception ex)
                {
                    _logger.LogCritical("CreateExamination() Error: " + ex.Message.ToString());
                    return(StatusCode(500, "Internal Server Error"));
                }
            }

            if (examinationDTO.Description == "Blood Pressure")
            {
                try
                {
                    Examination examToAddBDT = new Examination();
                    examToAddBDT.Description     = String.Empty;
                    examToAddBDT.Archived        = false;
                    examToAddBDT.PatientId       = patientId;
                    examToAddBDT.Value           = DateTime.Now.ToString();
                    examToAddBDT.ExaminationType = "BloodPressure";
                    BloodPressureData newExamBTD = new BloodPressureData()
                    {
                        SystolicValue     = examinationDTO.SystolicValue.Value,
                        DiastolicValue    = examinationDTO.DiastolicValue.Value,
                        PulseRate         = examinationDTO.PulseRate.Value,
                        MeanBloodPressure = examinationDTO.MeanBloodPressure.Value
                    };

                    _patientInfoRepository.AddExaminationToPatient(patientId, examToAddBDT, ExaminationType.BloodPressure, newExamBTD, workFlow);
                    return(Ok());
                }
                catch (Exception ex)
                {
                    _logger.LogCritical("CreateExamination() Error: " + ex.Message.ToString());
                    return(StatusCode(500, "Internal Server Error"));
                }
            }

            if (examinationDTO.Description == "SpO2")
            {
                try
                {
                    Examination examToAddBDT = new Examination();
                    examToAddBDT.Description     = String.Empty;
                    examToAddBDT.Archived        = false;
                    examToAddBDT.PatientId       = patientId;
                    examToAddBDT.Value           = DateTime.Now.ToString();
                    examToAddBDT.ExaminationType = "SpO2";
                    SpOData newExamBTD = new SpOData()
                    {
                        SPOValue = examinationDTO.SPOValue.Value
                    };

                    _patientInfoRepository.AddExaminationToPatient(patientId, examToAddBDT, ExaminationType.BloodSpO2, newExamBTD, workFlow);
                    return(Ok());
                }
                catch (Exception ex)
                {
                    _logger.LogCritical("CreateExamination() Error: " + ex.Message.ToString());
                    return(StatusCode(500, "Internal Server Error"));
                }
            }

            return(NotFound());
        }