public PersetujuanTindakanResponse GetPatientPenjaminData(long patientId) { var response = new PersetujuanTindakanResponse { }; var patient = _unitOfWork.PatientRepository.GetById(patientId); var patientData = Mapper.Map <Patient, PatientModel>(patient); response.Entity = new PersetujuanTindakanModel(); response.Entity.EmployeeData = new EmployeeModel(); response.Entity.PatientData = patientData; var umurPasien = CommonUtils.GetPatientAge(response.Entity.PatientData.BirthDate); var SAPNoPatient = new PersetujuanTindakanHandler(_unitOfWork).GetSAPBasedEmpId(response.Entity.PatientData.EmployeeID); response.Entity.SAPPatient = SAPNoPatient; response.Entity.UmurPatient = umurPasien; //get penjamin var employeePenjamin = new EmployeeModel { }; if (patientData.EmployeeID != 0) { var qryPenjamin = _unitOfWork.EmployeeRepository.GetById(patientData.EmployeeID); employeePenjamin = Mapper.Map <Employee, EmployeeModel>(qryPenjamin); response.Entity.EmployeeData = employeePenjamin; response.Entity.UmurPenjamin = CommonUtils.GetPatientAge(employeePenjamin.Birthdate); } return(response); }
public PersetujuanTindakanResponse GetDetailPersetujuanTindakan(long idLetter) { var _qryLetter = _unitOfWork.LetterRepository.GetById(idLetter); var response = new PersetujuanTindakanResponse(); if (response.Entity == null) { response.Entity = new PersetujuanTindakanModel(); } if (_qryLetter != null) { response.Entity.Action = _qryLetter.Action; response.Entity.PenjaminData = JsonConvert.DeserializeObject <PenjaminModel>(_qryLetter.ResponsiblePerson); response.Entity.Treatment = _qryLetter.Treatment; response.Entity.Decision = _qryLetter.Decision; response.Entity.NoSurat = $"{ _qryLetter.AutoNumber}/Klinik/{DateTime.Now.Year.ToString()}/{DateTime.Now.Month.ToString()}"; } var _qryPatient = _unitOfWork.PatientRepository.GetById(_qryLetter.ForPatient); if (_qryPatient != null) { response.Entity.PatientData = Mapper.Map <Patient, PatientModel>(_qryPatient); var umurPasien = CommonUtils.GetPatientAge(response.Entity.PatientData.BirthDate); var SAPNoPatient = new PersetujuanTindakanHandler(_unitOfWork).GetSAPBasedEmpId(response.Entity.PatientData.EmployeeID); response.Entity.SAPPatient = SAPNoPatient; response.Entity.UmurPatient = umurPasien; } return(response); }
public PersetujuanTindakanResponse Validate(PersetujuanTindakanRequest request) { bool isHavePrivilege = true; var response = new PersetujuanTindakanResponse(); if (request.Data.ForPatient == 0) { errorFields.Add("Patient ID"); } if (errorFields.Any()) { response.Status = false; response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields)); } isHavePrivilege = IsHaveAuthorization(CREATE_SURAT_RUJUKAN_PRIVILEGE_, request.Data.Account.Privileges.PrivilegeIDs); if (!isHavePrivilege) { response.Status = false; response.Message = Messages.UnauthorizedAccess; } if (response.Status) { response = new PersetujuanTindakanHandler(_unitOfWork).GetPatientPenjaminData(request.Data.ForPatient); } return(response); }
public PersetujuanTindakanResponse ValidateBeforeSave(PersetujuanTindakanRequest request) { bool isHavePrivilege = true; var response = new PersetujuanTindakanResponse(); if (request.Data.ForPatient == 0) { errorFields.Add("Patient ID"); } if (request.Data.Decision == null || string.IsNullOrWhiteSpace(request.Data.Decision)) { errorFields.Add("Pernyataan"); } if (request.Data.Action == null || string.IsNullOrWhiteSpace(request.Data.Action)) { errorFields.Add("Tindakan"); } if (request.Data.Treatment == null || string.IsNullOrWhiteSpace(request.Data.Treatment)) { errorFields.Add("Treatment"); } if (errorFields.Any()) { response.Status = false; response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields)); } isHavePrivilege = IsHaveAuthorization(CREATE_SURAT_RUJUKAN_PRIVILEGE_, request.Data.Account.Privileges.PrivilegeIDs); if (!isHavePrivilege) { response.Status = false; response.Message = Messages.UnauthorizedAccess; } if (response.Status) { response = new PersetujuanTindakanHandler(_unitOfWork).SavePersetujuanTindakan(request); } return(response); }