コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        public ActionResult ExportSuratPersetujuanTindakan2Pdf(string letterId)
        {
            var response = new PersetujuanTindakanResponse();

            response = new PersetujuanTindakanHandler(_unitOfWork).GetDetailPersetujuanTindakan(Convert.ToInt64(letterId));
            // return View(response.Entity);
            return(new PartialViewAsPdf(response.Entity)
            {
                PageOrientation = Orientation.Portrait,
                PageSize = Size.Folio,

                FileName = "SuratPersetujuanTindakan.pdf"
            });
        }
コード例 #4
0
        public PersetujuanTindakanResponse SavePersetujuanTindakan(PersetujuanTindakanRequest request)
        {
            int _resultAffected = 0;

            request.Data.LetterType = LetterEnum.MedicalAcceptanceLetter.ToString();
            request.Data.AutoNumber = GetLatestAutoNoSurat(LetterEnum.MedicalAcceptanceLetter.ToString()) + 1;
            request.Data.Year       = DateTime.Now.Year;

            var response = new PersetujuanTindakanResponse {
            };

            try
            {
                var _entity = Mapper.Map <PersetujuanTindakanModel, Letter>(request.Data);
                _entity.ResponsiblePerson = JsonConvert.SerializeObject(request.Data.PenjaminData);
                _entity.CreatedBy         = request.Data.Account.UserName;
                _entity.CreatedDate       = DateTime.Now;
                _unitOfWork.LetterRepository.Insert(_entity);
                _resultAffected = _unitOfWork.Save();
                var letterId = _entity.Id;

                //get detail patient
                var _pasien = _unitOfWork.PatientRepository.GetById(request.Data.ForPatient);

                response.Entity             = new PersetujuanTindakanModel();
                response.Entity.PatientData = new PatientModel();
                response.Entity.PatientData = Mapper.Map <Patient, PatientModel>(_pasien);


                response.Entity.Id = letterId;
                response.Status    = true;
            }
            catch (Exception ex)
            {
                response.Status  = false;
                response.Message = ex.Message.ToString();
            }
            return(response);
        }
コード例 #5
0
        public JsonResult CreateSuratPersetujuanTindakan()
        {
            var _model = new PersetujuanTindakanModel {
            };

            if (Request.Form["forPatient"] != null)
            {
                _model.ForPatient = Request.Form["forPatient"].ToString() == "" ? 0 : long.Parse(Request.Form["forPatient"].ToString());
            }
            if (Session["UserLogon"] != null)
            {
                _model.Account = (AccountModel)Session["UserLogon"];
            }
            _model.CreatedDate = DateTime.Now;
            var request = new PersetujuanTindakanRequest
            {
                Data = _model
            };
            var response = new PersetujuanTindakanResponse {
            };

            response = new PersetujuanTimdakanValidator(_unitOfWork).Validate(request);

            return(Json(new
            {
                Status = response.Status,
                Message = response.Message,
                PatientName = response.Entity.PatientData.Name,
                UmurPatient = $"{ response.Entity.UmurPatient} / {response.Entity.PatientData.BirthDateStr}",
                SAPPatient = response.Entity.SAPPatient,
                NamaPenjamin = response.Entity.EmployeeData.EmpName,
                Gender = response.Entity.EmployeeData.Gender,
                PhonePenjamin = response.Entity.EmployeeData.HPNumber,
                UmurPenjamin = response.Entity.UmurPenjamin == null ? "" : $"{response.Entity.UmurPenjamin} / {response.Entity.EmployeeData.BirthdateStr}",
                SAPPenjamin = response.Entity.EmployeeData.EmpID
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #6
0
        public JsonResult SaveAndPreviewPersetujuanTindakan()
        {
            var _model         = new PersetujuanTindakanModel();
            var _penjaminModel = new PenjaminModel();

            if (Request.Form["NamaPenjamin"] != null)
            {
                _penjaminModel.Nama = Request.Form["NamaPenjamin"].ToString();
            }
            if (Request.Form["RolePenjamin"] != null)
            {
                _penjaminModel.Sebagai = Request.Form["RolePenjamin"].ToString();
            }

            if (Request.Form["GenderPenjamin"] != null)
            {
                _penjaminModel.Gender = Request.Form["GenderPenjamin"].ToString();
            }

            if (Request.Form["UmurPenjamin"] != null)
            {
                _penjaminModel.Umur = Request.Form["UmurPenjamin"].ToString();
            }

            if (Request.Form["PhonePenjamin"] != null)
            {
                _penjaminModel.Telepon = Request.Form["PhonePenjamin"].ToString();
            }
            if (Request.Form["SAPPenjamin"] != null)
            {
                _penjaminModel.SapId = Request.Form["SAPPenjamin"].ToString();
            }
            if (Request.Form["AddrPenjamin"] != null)
            {
                _penjaminModel.Alamat = Request.Form["AddrPenjamin"].ToString();
            }

            if (Request.Form["DecisionPenjamin"] != null)
            {
                _model.Decision = Request.Form["DecisionPenjamin"].ToString();
            }
            if (Request.Form["DescTindakan"] != null)
            {
                _model.Treatment = Request.Form["DescTindakan"].ToString();
            }

            if (Request.Form["Action"] != null)
            {
                _model.Action = Request.Form["Action"].ToString();
            }
            if (Request.Form["forPatient"] != null)
            {
                _model.ForPatient = long.Parse(Request.Form["forPatient"].ToString());
            }
            if (Session["UserLogon"] != null)
            {
                _model.Account = (AccountModel)Session["UserLogon"];
            }
            if (_model.PenjaminData == null)
            {
                _model.PenjaminData = new PenjaminModel();
            }
            _model.PenjaminData = _penjaminModel;

            var request = new PersetujuanTindakanRequest
            {
                Data = _model
            };

            var response = new PersetujuanTindakanResponse();

            response = new PersetujuanTimdakanValidator(_unitOfWork).ValidateBeforeSave(request);
            return(Json(new
            {
                Status = response.Status,
                LetterId = response.Entity.Id
            }));
        }