示例#1
0
        public ICommandResult GetMedicalRecords(Guid idExam)
        {
            var command = new CreateMedicalRecordsXMLCommand
            {
                IdExam = idExam
            };

            var result = (CommandResult)_handler.Handle(command);

            return(result);
        }
示例#2
0
        public ICommandResult Handle(CreateMedicalRecordsXMLCommand command)
        {
            var exam = _repository.GetExam(command.IdExam);

            if (exam == null)
            {
                return(new CommandResult(false, "Exame não encontrado", Notifications));
            }

            if (exam.Type != Enums.EExamType.Electrocardiography)
            {
                return(new CommandResult(false, "O exame deve ser do tipo Eletrocardiograma (ECG)", Notifications));
            }

            var patient = _repository.GetPatientByIdExam(command.IdExam);

            string xml = _openEhrService.CreateCompositionAsXml(patient, exam);

            return(new CommandResult(true, "Prontuário gerado com sucesso", xml));
        }