Exemplo n.º 1
0
        public async Task <IActionResult> PutPatientEHRAsync(Guid id, [FromBody] PatientEHR patient)
        {
            if (patient == null || id != patient.Id)
            {
                return(BadRequest());
            }

            PatientEHR pt = await _patientEHRRecordService.FindAsync(id);

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

            pt.ReasonForVisit       = patient.ReasonForVisit;
            pt.VisitDateTime        = patient.VisitDateTime;
            pt.DiagnosisCode        = patient.DiagnosisCode;
            pt.DiagnosisDescription = patient.DiagnosisDescription;
            pt.LabName     = patient.LabName;
            pt.LabValue    = patient.LabValue;
            pt.LabUnits    = patient.LabUnits;
            pt.LabDateTime = patient.LabDateTime;

            await _patientEHRRecordService.UpdateAsync(pt);

            return(new NoContentResult());
        }
Exemplo n.º 2
0
        public Task AddAsync(PatientEHR patientRecord)
        {
            patientRecord.Id = Guid.NewGuid();
            _context.PatientEHR.Add(patientRecord);
            _context.SaveChanges();

            return(Task.CompletedTask);
        }
Exemplo n.º 3
0
        public async Task <IActionResult> PostPatientEHRAsync([FromBody] PatientEHR patient)
        {
            if (patient == null)
            {
                return(BadRequest());
            }
            await _patientEHRRecordService.AddAsync(patient);

            return(CreatedAtRoute(nameof(GetPatientEHRByIdAsync),
                                  new { id = patient.Id }, patient));
        }
Exemplo n.º 4
0
        public Task UpdateAsync(PatientEHR patientRecord)
        {
            try
            {
                _context.PatientEHR.Update(patientRecord);
                _context.SaveChanges();
            }
            catch (Exception e) {
            }

            return(Task.CompletedTask);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> GetPatientEHRByIdAsync(Guid id)
        {
            PatientEHR patient = await _patientEHRRecordService.FindAsync(id);

            if (patient == null)
            {
                return(NotFound());
            }
            else
            {
                return(new ObjectResult(patient));
            }
        }