Beispiel #1
0
 public Patient Map(IncomingTransferPatientModel patient)
 {
     return(new Patient()
     {
         PatientName = patient.PatientName,
         Status = "Pending",
         Requester = patient.Requester,
         RequestDate = DateTime.Now,
         NhsNumber = patient.NhsNumber
     });
 }
Beispiel #2
0
 public string AddPatientToTransfers([FromBody] IncomingTransferPatientModel patient)
 {
     try
     {
         return(_repo.AddPatient(patient));
     }
     catch (Exception e)
     {
         _logger.Log(LogLevel.Error, e.Message);
         throw;
     }
 }
        public string AddPatient(IncomingTransferPatientModel patient)
        {
            if (_context.Patients.Any(p => p.NhsNumber == patient.NhsNumber))
            {
                return("Patient already queued for transfer");
            }

            var mappedPatient = _mapper.Map(patient);

            _context.Add(mappedPatient);
            _context.SaveChanges();

            return(JsonSerializer.Serialize(mappedPatient));
        }
Beispiel #4
0
        public void Map_WhenProvidedWithLegitIncomingPatient_MapsToPatient()
        {
            var testTransfer = new IncomingTransferPatientModel()
            {
                NhsNumber   = "1",
                PatientName = "wibble",
                Ods         = "blah",
                Requester   = "wobble"
            };

            var sut = new IncomingTransferPatientMapper();

            var result = sut.Map(testTransfer);

            result.PatientName.Equals("wibble");
            result.NhsNumber.Equals("1");
            result.Requester.Equals("wobble");
            result.RequestDate.Equals(DateTime.Now.Date);
            result.Status.Equals("Pending");
        }