public IActionResult CreateWorkFlow(int patientId, string userName, string wfName) { WorkFlow workFlow = new WorkFlow(); var patientFound = _patientInfoRepository.GetPatient(patientId, false); if (patientFound == null) { return(NotFound()); } workFlow.Patient = patientFound; var userFound = _patientInfoRepository.GetUserByName(userName); if (userFound == null) { return(NotFound()); } workFlow.Username = userFound.Username; workFlow.WorkFlowName = wfName; int?workflowID = _patientInfoRepository.CreateWorkFlow(workFlow); if (workflowID == null) { return(NotFound()); } var workflowResult = Mapper.Map <WorkFlowDTO>(workFlow); return(Ok(workflowResult)); }
public PatientController(ILogger <ExaminationController> logger, IPatientInfoRepository patientInfoRepository) { _logger = logger; try { _logger.LogInformation("Create patient controller."); _patientInfoRepository = patientInfoRepository; _logger.LogInformation("Patient controller created." + patientInfoRepository.GetPatient(1)); } catch (Exception ex) { _logger.LogError("PatientController init error: " + ex.Message.ToString()); } }
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")); } }
public IActionResult GetPatient(int id, bool includeExaminations = true) { var patient = _patientInfoRepository.GetPatient(id, includeExaminations); if (patient == null) { return(NotFound()); } if (includeExaminations) { var patientResult = Mapper.Map <PatientDTO>(patient); return(Ok(patientResult)); } else { var patientResult = Mapper.Map <PatientWithoutExaminationDTO>(patient); return(Ok(patientResult)); } }