コード例 #1
0
ファイル: RadiologiHandler.cs プロジェクト: adityawa/Klinik
        public RadiologiResponse GetLabForInput(RadiologiRequest request)
        {
            List <FormExamineLabModel> lists = new List <FormExamineLabModel>();
            dynamic qry             = null;
            var     searchPredicate = PredicateBuilder.New <FormExamineLab>(true);

            var _getQueuePoliData = _unitOfWork.RegistrationRepository.GetById(request.Data.LoketData.Id);

            searchPredicate = searchPredicate.And(x => x.FormMedicalID == _getQueuePoliData.FormMedicalID && (x.LabType == Constants.NameConstant.Radiologi || x.LabType == Constants.NameConstant.Radiology));
            qry             = _unitOfWork.FormExamineLabRepository.Get(searchPredicate, null);

            foreach (var item in qry)
            {
                var prData = Mapper.Map <FormExamineLab, FormExamineLabModel>(item);

                lists.Add(prData);
            }

            int totalRequest = lists.Count();
            var data         = lists;

            var response = new RadiologiResponse
            {
                Draw            = request.Draw,
                RecordsFiltered = totalRequest,
                RecordsTotal    = totalRequest,
                Data            = data
            };

            return(response);
        }
コード例 #2
0
        public ActionResult CreateItemLabRadiologi()
        {
            RadiologiResponse response = new RadiologiResponse();

            if (Request.QueryString["id"] != null)
            {
                var request = new RadiologiRequest
                {
                    Data = new FormExamineLabModel
                    {
                        LoketData = new LoketModel
                        {
                            Id = long.Parse(Request.QueryString["id"].ToString()),
                        },
                    }
                };
                if (Session["UserLogon"] != null)
                {
                    request.Data.Account = (AccountModel)Session["UserLogon"];
                }

                RadiologiResponse   resp   = new RadiologiHandler(_unitOfWork).GetDetailPatient(request.Data.LoketData.Id);
                FormExamineLabModel _model = resp.Entity;
                Session["QueuePoliId"] = resp.Entity.LoketData.Id;
                _model.LabItemsId      = RadiologiHandler.GetSelectedLabItem(request.Data.LoketData.Id);
                return(View(_model));
            }
            ViewBag.LabCategory = BindLabCategory(Constants.NameConstant.Laboratorium);
            return(View());
        }
コード例 #3
0
        public JsonResult AddLabRadiologiItem()
        {
            RadiologiResponse   response = new RadiologiResponse();
            FormExamineLabModel _model   = new FormExamineLabModel();

            if (Request.Form["FormMedicalID"] != null)
            {
                _model.FormMedicalID = Convert.ToInt64(Request.Form["FormMedicalID"].ToString());
            }
            if (Request.Form["LabItems"] != null)
            {
                _model.LabItemsId = JsonConvert.DeserializeObject <List <int> >(Request.Form["LabItems"]);
            }
            if (Session["UserLogon"] != null)
            {
                _model.Account = (AccountModel)Session["UserLogon"];
            }
            if (Session["QueuePoliId"] != null)
            {
                if (_model.LoketData == null)
                {
                    _model.LoketData = new LoketModel();
                }
                _model.LoketData.Id = Convert.ToInt64(Session["QueuePoliId"].ToString());
            }

            var request = new RadiologiRequest
            {
                Data = _model
            };

            new RadiologiValidator(_unitOfWork, _context).Validate(request, out response);
            return(Json(new { Status = response.Status, Message = response.Message }, JsonRequestBehavior.AllowGet));
        }
コード例 #4
0
ファイル: RadiologiValidator.cs プロジェクト: adityawa/Klinik
        public void Validate(RadiologiRequest request, out RadiologiResponse response)
        {
            bool isHavePrivilege = true;

            response = new RadiologiResponse();
            try
            {
                if (request.Data.FormMedicalID == 0)
                {
                    errorFields.Add("Form Medical ID");
                }

                if (request.Data.LabItemsId.Count == 0)
                {
                    errorFields.Add("Lab Item");
                }

                if (errorFields.Any())
                {
                    response.Status  = false;
                    response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields));
                }

                //cek is lab item inside form nedical Id already filled
                var _qryFormExamineLab = _unitOfWork.RegistrationRepository.GetFirstOrDefault(x => x.FormMedicalID == request.Data.FormMedicalID);
                if (_qryFormExamineLab != null)
                {
                    if (_qryFormExamineLab.Status == (int)RegistrationStatusEnum.Finish)
                    {
                        response.Status  = false;
                        response.Message = Messages.LabItemCannotChange;
                    }
                }

                isHavePrivilege = IsHaveAuthorization(ADD_PRIVILEGE_NAME, request.Data.Account.Privileges.PrivilegeIDs);
                if (!isHavePrivilege)
                {
                    response.Status  = false;
                    response.Message = Messages.UnauthorizedAccess;
                }
            }
            catch (Exception ex)
            {
                response.Status  = false;
                response.Message = ex.Message;
            }


            if (response.Status)
            {
                response = new RadiologiHandler(_unitOfWork, _context).CreateOrEdit(request);
            }
        }
コード例 #5
0
ファイル: RadiologiHandler.cs プロジェクト: adityawa/Klinik
        public RadiologiResponse GetDataExamine(long poliID)
        {
            var response          = new RadiologiResponse {
            };
            var _getformMedicalId = _unitOfWork.RegistrationRepository.GetById(poliID);
            var _qry = _unitOfWork.FormExamineRepository.Get(x => x.FormMedicalID == _getformMedicalId.FormMedicalID).FirstOrDefault();

            if (_qry != null)
            {
                if (response.Entity == null)
                {
                    response.Entity = new FormExamineLabModel();
                }
                response.Entity.FormExamine = Mapper.Map <FormExamine, FormExamineModel>(_qry);
            }

            return(response);
        }
コード例 #6
0
ファイル: RadiologiValidator.cs プロジェクト: adityawa/Klinik
        public void ValidateAddResult(RadiologiRequest request, out RadiologiResponse response)
        {
            bool isHavePrivilege = true;

            response = new RadiologiResponse();
            try
            {
                if (request.Data.FormMedicalID == 0)
                {
                    errorFields.Add("Form Medical ID");
                }

                if (request.Data.LabItemCollsJs.Count == 0)
                {
                    errorFields.Add("Lab Radiologi Result");
                }

                if (errorFields.Any())
                {
                    response.Status  = false;
                    response.Message = string.Format(Messages.ValidationErrorFields, String.Join(",", errorFields));
                }



                isHavePrivilege = IsHaveAuthorization(ADD_RESULT_PRIVILEGE_NAME, request.Data.Account.Privileges.PrivilegeIDs);
                if (!isHavePrivilege)
                {
                    response.Status  = false;
                    response.Message = Messages.UnauthorizedAccess;
                }
            }
            catch (Exception ex)
            {
                response.Status  = false;
                response.Message = ex.Message;
            }


            if (response.Status)
            {
                response = new RadiologiHandler(_unitOfWork, _context).CreateLabResult(request);
            }
        }
コード例 #7
0
ファイル: RadiologiHandler.cs プロジェクト: adityawa/Klinik
        public RadiologiResponse GetDetailPatient(long IdQueuePoli)
        {
            var qry_poli    = _unitOfWork.RegistrationRepository.GetById(IdQueuePoli);
            var LabResponse = new RadiologiResponse {
            };

            if (qry_poli != null)
            {
                if (LabResponse.Entity == null)
                {
                    LabResponse.Entity = new FormExamineLabModel();
                }
                LabResponse.Entity.PatientData   = Mapper.Map <Patient, PatientModel>(qry_poli.Patient);
                LabResponse.Entity.FormMedicalID = qry_poli.FormMedicalID.Value;
                if (LabResponse.Entity.LoketData == null)
                {
                    LabResponse.Entity.LoketData = new LoketModel();
                }
                LabResponse.Entity.LoketData.Id = IdQueuePoli;
            }
            return(LabResponse);
        }
コード例 #8
0
        public ActionResult InputRadiologiResult()
        {
            RadiologiResponse response = new RadiologiResponse();
            var _model = new FormExamineLabModel {
            };

            if (Request.QueryString["id"] != null)
            {
                var request = new RadiologiRequest
                {
                    Data = new FormExamineLabModel
                    {
                        LoketData = new LoketModel
                        {
                            Id = long.Parse(Request.QueryString["id"].ToString()),
                        },
                    }
                };
                if (Session["UserLogon"] != null)
                {
                    request.Data.Account = (AccountModel)Session["UserLogon"];
                }

                RadiologiResponse resp = new RadiologiHandler(_unitOfWork).GetDetailPatient(request.Data.LoketData.Id);
                _model = resp.Entity;
                RadiologiResponse resp2 = new RadiologiHandler(_unitOfWork).GetDataExamine(request.Data.LoketData.Id);
                if (_model.FormExamine == null)
                {
                    _model.FormExamine = new FormExamineModel();
                }
                _model.FormExamine.Result   = resp2.Entity.FormExamine.Result;
                _model.FormExamine.DoctorID = resp2.Entity.FormExamine.DoctorID;
                Session["QueuePoliId"]      = resp.Entity.LoketData.Id;
            }
            ViewBag.DoctorList = BindDropDownDokter();
            return(View(_model));
        }
コード例 #9
0
ファイル: RadiologiHandler.cs プロジェクト: adityawa/Klinik
        public RadiologiResponse CreateOrEdit(RadiologiRequest request)
        {
            int result          = 0;
            var response        = new RadiologiResponse {
            };
            var _getDataLabPoli = _unitOfWork.LabItemRepository.Get(x => x.RowStatus == 0);

            #region ::DELETE FIRST::
            var _deleteFormExamineLab = _unitOfWork.FormExamineLabRepository.Get(x => x.FormMedicalID == request.Data.FormMedicalID && (x.LabType == Constants.NameConstant.Radiologi || x.LabType == Constants.NameConstant.Radiology));
            foreach (var item1 in _deleteFormExamineLab)
            {
                _unitOfWork.FormExamineLabRepository.Delete(item1.ID);
            }

            var poliId             = PoliHandler.GetPoliIDBasedOnName(Constants.NameConstant.Radiologi);
            var _deleteFormExamine = _unitOfWork.FormExamineRepository.GetFirstOrDefault(x => x.FormMedicalID == request.Data.FormMedicalID && x.PoliID == poliId);
            if (_deleteFormExamine != null)
            {
                _unitOfWork.FormExamineRepository.Delete(_deleteFormExamine.ID);
            }

            int deleteResult = _unitOfWork.Save();
            #endregion

            //insert to Form Examine
            try
            {
                var _formExamine = new FormExamine
                {
                    FormMedicalID = request.Data.FormMedicalID,
                    PoliID        = PoliHandler.GetPoliIDBasedOnName(Constants.NameConstant.Radiologi),
                    TransDate     = DateTime.Now,
                    CreatedBy     = request.Data.Account.UserName,
                    CreatedDate   = DateTime.Now
                };

                _unitOfWork.FormExamineRepository.Insert(_formExamine);

                foreach (var _id in request.Data.LabItemsId)
                {
                    var _formExamineLabEntity = new FormExamineLab
                    {
                        FormMedicalID = request.Data.FormMedicalID,
                        LabType       = _getDataLabPoli.Where(x => x.ID == _id).FirstOrDefault().LabItemCategory.LabType,
                        LabItemID     = (Int32)_id,
                        CreatedBy     = request.Data.Account.UserName,
                        CreatedDate   = DateTime.Now
                    };

                    _unitOfWork.FormExamineLabRepository.Insert(_formExamineLabEntity);
                }

                result = _unitOfWork.Save();
                if (result > 0)
                {
                    var _editQueuePoli = _unitOfWork.RegistrationRepository.GetById(request.Data.LoketData.Id);
                    if (_editQueuePoli != null)
                    {
                        _editQueuePoli.Status       = (int)RegistrationStatusEnum.Hold;
                        _editQueuePoli.ModifiedBy   = request.Data.Account.UserName;
                        _editQueuePoli.ModifiedDate = DateTime.Now;
                        _unitOfWork.RegistrationRepository.Update(_editQueuePoli);
                        _unitOfWork.Save();
                    }
                }
                response.Status  = true;
                response.Message = string.Format(Messages.LabItemAdded, result, request.Data.FormMedicalID);
            }
            catch
            {
                response.Status  = false;
                response.Message = Messages.GeneralError;
            }

            return(response);
        }
コード例 #10
0
ファイル: RadiologiHandler.cs プロジェクト: adityawa/Klinik
        public RadiologiResponse CreateLabResult(RadiologiRequest request)
        {
            var response = new RadiologiResponse {
            };
            FormExamineLabModel model = new FormExamineLabModel();

            if (model.LabItemColls == null)
            {
                model.LabItemColls = new List <FormExamineLabModel>();
            }
            try
            {
                foreach (var item in request.Data.LabItemCollsJs.Where(x => x.name.StartsWith("Result_")))
                {
                    string[] temp = item.name.Split('_');
                    if (temp[0].ToLower() == "result")
                    {
                        //pertama Id FormExLab kedua Lab Item
                        string[] _ids = temp[1].Split('|');

                        long   _Id              = Convert.ToInt64(_ids[0]);
                        int    _LabItemID       = Convert.ToInt32(_ids[1]);
                        string _result          = item.value;
                        string _resultIndicator = request.Data.LabItemCollsJs.Where(x => x.name == "ResultIndicator_" + temp[1]).FirstOrDefault().value;

                        var _existing = _unitOfWork.FormExamineLabRepository.Get(x => x.ID == _Id && x.LabItemID == _LabItemID).FirstOrDefault();
                        if (_existing != null)
                        {
                            _existing.Result          = _result;
                            _existing.ResultIndicator = _resultIndicator;
                            _existing.ModifiedBy      = request.Data.Account.UserName;
                            _existing.ModifiedDate    = DateTime.Now;
                            _unitOfWork.FormExamineLabRepository.Update(_existing);
                        }
                    }
                }

                var _existingExam = _unitOfWork.FormExamineRepository.GetFirstOrDefault(x => x.FormMedicalID == request.Data.FormMedicalID);
                if (_existingExam != null)
                {
                    _existingExam.Result       = request.Data.FormExamine.Result;
                    _existingExam.DoctorID     = request.Data.FormExamine.DoctorID;
                    _existingExam.ModifiedBy   = request.Data.Account.UserName;
                    _existingExam.ModifiedDate = DateTime.Now;
                    _unitOfWork.FormExamineRepository.Update(_existingExam);
                }


                var _editQueuePoli = _unitOfWork.RegistrationRepository.GetById(request.Data.LoketData.Id);
                if (_editQueuePoli != null)
                {
                    _editQueuePoli.Status       = (int)RegistrationStatusEnum.Finish;
                    _editQueuePoli.ModifiedBy   = request.Data.Account.UserName;
                    _editQueuePoli.ModifiedDate = DateTime.Now;
                    _unitOfWork.RegistrationRepository.Update(_editQueuePoli);
                }

                int result_affected = _unitOfWork.Save();
                if (result_affected > 0)
                {
                    response.Status  = true;
                    response.Message = Messages.LabResultUpdated;
                }
            }
            catch
            {
                response.Status  = false;
                response.Message = Messages.GeneralError;
            }
            return(response);
        }