/// <summary> /// Get patient with specific resource /// </summary> /// <param name="patientID">int</param> /// <param name="resourcesID">int</param> /// <returns>Patient DTO</returns> public async Task <PatientsDTO> GetSpecificResourcesforOnePatient(int patientID, int resourcesID) { var patient = await _context.Patient.FindAsync(patientID); PatientsDTO pDTO = ConvertToDTO(patient); var patientResources = await _context.PatientResources.Where(x => x.PatientID == patientID) .Include(x => x.Resources) .Where(x => x.ResourcesID == resourcesID) .ToListAsync(); List <ResourcesDTO> patientRes = new List <ResourcesDTO>(); foreach (var pr in patientResources) { ResourcesDTO rdto = new ResourcesDTO { ResourcesType = pr.Resources.ResourcesType, Name = pr.Resources.Name, Description = pr.Resources.Description, ID = pr.ResourcesID }; patientRes.Add(rdto); } pDTO.Resources = patientRes; return(pDTO); }
public Appointments_medicalDTO() { Status = nStatus.Pendiente; Log = new LogActualizacionDTO(); Medic = new MedicDTO(); Patient = new PatientsDTO(); Attacheds = new List <Appointments_attachedDTO>(); }
/// <summary> /// Saves the specified ems head do. /// </summary> /// <param name="emsHeadDO">The ems head do.</param> /// <param name="emsType">Type of the ems.</param> /// Author:admin /// Date:2015-09-28 public void Save(EmsUIDTO emsHeadDO, EmsType emsType, PatientsDTO patDo) { if (emsHeadDO == null) { return; } //老孟版本的 数据转换 //ordMaintainService.SaveCiEmsDTO(new OrDataConvert().UIEmsToEms(emsHeadDO)); return; }
public PatientsDTO GetID([FromBody] PatientsDTO value) { Data.ControlCenter.Model.Patients u; PatientsDTO uDTO = new PatientsDTO(); u = uR.GetById(value.EntityID, false); uDTO = AutoMapper.Mapper.Map <Data.ControlCenter.Model.Patients, PatientsDTO>(u); return(uDTO); }
/// <summary> /// Convert patients object to DTO and get all resources from database /// </summary> /// <returns>list patients DTO</returns> public async Task <List <PatientsDTO> > GetAllPatients() { List <Patient> patients = await _context.Patient.ToListAsync(); List <PatientsDTO> pDTO = new List <PatientsDTO>(); foreach (var patient in patients) { PatientsDTO PDTO = ConvertToDTO(patient); pDTO.Add(PDTO); } return(pDTO); }
/// <summary> /// Convert To DTOs /// </summary> /// <param name="patient">patient object</param> /// <returns>Patient DTO</returns> public PatientsDTO ConvertToDTO(Patient patient) { PatientsDTO pDTO = new PatientsDTO() { ID = patient.ID, Name = patient.Name, Birthday = patient.Birthday, CheckIn = patient.CheckIn, Status = patient.Status }; return(pDTO); }
public ResponseDTO CrearRegistro([FromBody] PatientsDTO value) { var Response = new ResponseDTO(); Data.ControlCenter.Model.Patients u = new Data.ControlCenter.Model.Patients(); u = AutoMapper.Mapper.Map <PatientsDTO, Data.ControlCenter.Model.Patients>(value); FuncionLogActualizaciones L = new FuncionLogActualizaciones(); L.LogCreacion(u.Log); uR.SaveOrUpdate(u); if (u.EntityID > 0) { Response.Success = true; Response.Message = "Creado"; } return(Response); }
public ResponseDTO UpdateRegistro([FromBody] PatientsDTO value) { var Response = new ResponseDTO(); Data.ControlCenter.Model.Patients u; u = uR.GetById(value.EntityID, false); u = AutoMapper.Mapper.Map(value, u); FuncionLogActualizaciones L = new FuncionLogActualizaciones(); L.LogModificacion(u.Log); uR.SaveOrUpdate(u); uR.CommitChanges(); Response.Success = true; Response.Message = "Actualizado"; return(Response); }