public PatientConsultationForm(PatientConsultation patientConsultation, Patient patient) { InitializeComponent(); this.patientConsultation = patientConsultation; this.patient = patient; FormUtils.Init(this); }
private PatientConsultation GetPatientConsultation() { using (GmConnection conn = App.CreateConnection()) { return(PatientConsultation.GetPatientConsultation(conn, SelectedId)); } }
public Response <PatientConsultationDto> DeleteCheck(PatientConsultationDto patientConsultationDto) { Response <PatientConsultationDto> response = new Response <PatientConsultationDto>(); if (patientConsultationDto == null || patientConsultationDto.PatientConsultationId == null || patientConsultationDto.PatientConsultationId.Value == int.MinValue) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { ErrorMessage = "The entry you trying to delete does not exist." }); return(response); } using (UnitOfWork unitOfWork = new UnitOfWork()) { PatientConsultation patientConsultation = unitOfWork.PatientConsultationRepository.GetByID(p => p.PatientConsultationId == patientConsultationDto.PatientConsultationId.Value, "Patient, Doctor"); if (patientConsultation == null) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { ErrorMessage = "The entry you trying to delete does not exist." }); return(response); } } return(response); }
private void ucSelectReport_OnShowReport(object sender, HospitalDepartment.UserControls.SelectReportEventArgs e) { PatientConsultation patientConsultation = GetPatientConsultation(); if (patientConsultation != null) { switch (BaseReportBuilder.GetReportBuilderId(e.Report.ReportBuilderId)) { case ReportBuilderId.ConsultationRequest: e.ReportBuilder = new ConsultationRequestReportBuilder(App.ConnectionFactory, App.Config, patient, patientConsultation); break; } } }
public void MapToPatientConsultation(PatientConsultation patientConsultation, PatientConsultationDto patientConsultationDto) { if (patientConsultationDto == null) { return; } patientConsultation = patientConsultation ?? new PatientConsultation(); patientConsultation.DoctorId = patientConsultationDto.DoctorId; patientConsultation.PatientId = patientConsultationDto.PatientId; patientConsultation.ConsultationStatus = patientConsultationDto.ConsultationStatus; patientConsultation.StartDate = patientConsultationDto.StartDate.Value; patientConsultation.EndDate = patientConsultationDto.EndDate.Value; }
private void btnAdd_Click(object sender, EventArgs e) { try { PatientConsultation patientConsultation = new PatientConsultation(patient.Id); PatientConsultationForm form = new PatientConsultationForm(patientConsultation, patient); if (form.ShowDialog() == DialogResult.OK) { DataRow newRow = dataTable.NewRow(); dataTable.Rows.Add(newRow); UpdateRow(newRow, patientConsultation); } } catch (Exception ex) { Log.Exception(ex); } }
public PatientConsultationDto MapToPatientConsultationDto(PatientConsultation patientConsultation) { if (patientConsultation == null) { return(null); } PatientConsultationDto patientConsultationDto = new PatientConsultationDto(); patientConsultationDto.PatientConsultationId = patientConsultation.PatientConsultationId; patientConsultationDto.DoctorId = patientConsultation.DoctorId; patientConsultationDto.PatientId = patientConsultation.PatientId; patientConsultationDto.ConsultationStatus = patientConsultation.ConsultationStatus; patientConsultationDto.StartDate = patientConsultation.StartDate; patientConsultationDto.EndDate = patientConsultation.EndDate; return(patientConsultationDto); }
private void Open() { try { PatientConsultation patientConsultation = GetPatientConsultation(); if (patientConsultation != null) { PatientConsultationForm form = new PatientConsultationForm(patientConsultation, patient); if (form.ShowDialog() == DialogResult.OK) { UpdateRow(SelectedRow, patientConsultation); } } } catch (Exception ex) { Log.Exception(ex); } }
private PatientConsultationDto Create(PatientConsultationDto patientConsultationDto) { PatientConsultationDto addedPatientConsultationDto = null; PatientConsultation patientConsultation = new PatientConsultation(); _PatientConsultationMapper.MapToPatientConsultation(patientConsultation, patientConsultationDto); using (TransactionScope scope = new TransactionScope()) { using (UnitOfWork unitOfWork = new UnitOfWork()) { unitOfWork.PatientConsultationRepository.Insert(patientConsultation); unitOfWork.Save(); addedPatientConsultationDto = _PatientConsultationMapper.MapToPatientConsultationDto(unitOfWork.PatientConsultationRepository.GetByID(p => p.PatientConsultationId == patientConsultation.PatientConsultationId)); } scope.Complete(); } return(addedPatientConsultationDto); }
private PatientConsultationDto Update(PatientConsultationDto patientConsultationDto) { PatientConsultationDto updatedPatientConsultationDto = null; using (TransactionScope scope = new TransactionScope()) { using (UnitOfWork unitOfWork = new UnitOfWork()) { PatientConsultation patientConsultation = unitOfWork.PatientConsultationRepository.GetByID(p => p.PatientConsultationId == patientConsultationDto.PatientConsultationId); _PatientConsultationMapper.MapToPatientConsultation(patientConsultation, patientConsultationDto); unitOfWork.PatientConsultationRepository.Update(patientConsultation); unitOfWork.Save(); updatedPatientConsultationDto = _PatientConsultationMapper.MapToPatientConsultationDto(unitOfWork.PatientConsultationRepository.GetByID(p => p.PatientConsultationId == patientConsultation.PatientConsultationId)); } scope.Complete(); } return(updatedPatientConsultationDto); }
public ConsultationRequestReportBuilder(ConnectionFactory factory, Config config, Patient patient, PatientConsultation patientConsultation) : base(ReportBuilderId.ConsultationRequest) { using (GmConnection conn = factory.CreateConnection()) { AddParameter("Age", patient.GetAgeStr(conn)); AddParameter("PatientName", patient.GetPatientName(conn)); AddParameter("DoctorName", patient.GetDoctorName(conn)); AddParameter("ChiefName", patient.GetChiefName(conn)); AddParameter("WardNumber", patient.GetWardNumber(conn)); } AddHandbooksInfo(patientConsultation.consultationData, config[HandbookGroupId.ConsultationData]); AddHandbooksInfo(patient.patientData, config[HandbookGroupId.PatientData]); AddParameter("DepartmentName", config.departmentConfig.departmentName); AddParameter("RequestDate", patientConsultation.requestDate, "dd.MM.yy"); AddParameter("ExecutionDate", patientConsultation.executionDate, "dd.MM.yy HH:mm"); }
private void UpdateRow(DataRow dr, PatientConsultation patientConsultation) { dr["Id"] = patientConsultation.Id; dr["RequestDate"] = patientConsultation.requestDate; dr["ExecutionDate"] = DateTimeUtils.GetNullableTime(patientConsultation.executionDate); }
public Response <PatientConsultationDto> UpdateCheck(PatientConsultationDto patientConsultationDto) { Response <PatientConsultationDto> response = new Response <PatientConsultationDto>(); if (patientConsultationDto == null || patientConsultationDto.PatientConsultationId == null || patientConsultationDto.PatientConsultationId.Value == int.MinValue) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { ErrorMessage = "The entry you trying to update does not exist." }); return(response); } if (string.IsNullOrEmpty(patientConsultationDto.ConsultationStatus)) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { FieldName = "ConsultationStatus", ErrorMessage = "Status is requeired." }); } if (patientConsultationDto.StartDate == DateTime.MinValue) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { FieldName = "StartDate", ErrorMessage = "Start Date is required." }); } if (patientConsultationDto.EndDate == DateTime.MinValue) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { FieldName = "EndDate", ErrorMessage = "End Date is required." }); } if (response.HasErrors) { return(response); } using (UnitOfWork unitOfWork = new UnitOfWork()) { PatientConsultation patientConsultation = unitOfWork.PatientConsultationRepository.GetByID(p => p.PatientConsultationId == patientConsultationDto.PatientConsultationId.Value, "Patient, Doctor"); if (patientConsultation == null) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { ErrorMessage = "The entry you trying to update does not exist." }); return(response); } if (patientConsultation.Patient == null) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { ErrorMessage = "There is no corresponding patient for the consultation." }); return(response); } if (patientConsultation.Doctor == null) { response.HasErrors = true; response.FieldErrors.Add(new FieldError() { ErrorMessage = "There is no corresponding doctor for the consultation." }); return(response); } } return(response); }