Exemplo n.º 1
0
        public ActionResult SearchPatientDocument(PatientDocumentModel model)
        {
            string        _returnValue  = string.Empty;
            HomeViewModel homeviewModel = new HomeViewModel();
            StringBuilder filterclause  = new StringBuilder();

            if (model.PATIENT_ID.ToString() != "")
            {
                filterclause.Append(" UPPER(trim(PATIENT_ID)) ='" + model.PATIENT_ID.Trim().ToUpper() + "' AND ");
            }
            if (model.TITLE != null)
            {
                filterclause.Append(" UPPER(trim(TITLE)) like'%" + model.TITLE.Trim().ToUpper() + "%' AND ");
            }
            if (model.NAME != null)
            {
                filterclause.Append(" UPPER(trim(Name)) like'%" + model.NAME.Trim().ToUpper() + "%' AND ");
            }
            if (model.DESCRIPTION != null)
            {
                filterclause.Append(" UPPER(trim(DESCRIPTION)) like'%" + model.DESCRIPTION.Trim().ToUpper() + "%' AND ");
            }
            if (model.DOC_CATEGORY_ID != 0)
            {
                filterclause.Append(" trim(DOC_CATEGORY_ID) =" + model.DOC_CATEGORY_ID + " AND ");
            }
            if (filterclause.Length > 0)
            {
                filterclause = filterclause.Remove(filterclause.Length - 4, 4);
            }
            PHICService.PatientData PatientData = new PHICService.PatientData();
            using (var service = new PHICService.PHICServiceSoapClient())
            {
                PatientData = service.SearchPatientDocument(filterclause.ToString());
            }
            if (PatientData.isValid)
            {
                homeviewModel.lstPatientDocument = Extension.ConvertToPatientDocumentList(PatientData.dt);
                ViewBag.CategoryID = model.DOC_CATEGORY_ID;
                _returnValue       = RenderPartialViewToString("_patientDocumentPartial", homeviewModel.lstPatientDocument);
            }
            return(Json(_returnValue));
        }
Exemplo n.º 2
0
        public ActionResult AddPatientDocument(Int64 MenuID, PatientDocumentModel _parameter, string LoginType)
        {
            var    _fileName  = string.Empty;
            string _Path      = string.Empty;
            string _Extension = string.Empty;

            byte[] byteData = null;
            if (Request.Files.Count > 0)
            {
                HttpFileCollectionBase files = Request.Files;
                string _imgname = string.Empty;
                if (System.Web.HttpContext.Current.Request.Files.AllKeys.Any())
                {
                    var pic = System.Web.HttpContext.Current.Request.Files["FileUpload"];
                    if (pic.ContentLength > 0)
                    {
                        _Extension = Path.GetExtension(pic.FileName);
                        string FileName = Path.GetFileNameWithoutExtension(pic.FileName);
                        _Path = Server.MapPath("/Upload/PHICDocument/") + FileName + DateTime.Now.ToString("yyyyMMddHH24MISS") + _Extension;
                        using (var binaryReader = new BinaryReader(System.Web.HttpContext.Current.Request.Files["FileUpload"].InputStream))
                        {
                            byteData = binaryReader.ReadBytes(System.Web.HttpContext.Current.Request.Files["FileUpload"].ContentLength);
                        }
                        MemoryStream ms = new MemoryStream();
                    }
                }
            }
            bool IsValid = false;
            List <PatientDocumentModel> model = new List <PatientDocumentModel>();
            string returnData = string.Empty;

            PHICService.paraPatientDocument parm = new PHICService.paraPatientDocument();

            parm.PatientDocumentID = _parameter.PATIENT_DOCUMENT_ID;
            parm.Name           = _parameter.NAME;
            parm.Title          = _parameter.TITLE;
            parm.Description    = _parameter.DESCRIPTION;
            parm.CategoryID     = _parameter.DOC_CATEGORY_ID;
            parm.ElectronicLink = _parameter.ELECTRONIC_LINK;
            parm.Path           = _Path;
            parm.Extension      = _Extension;
            parm.PatientID      = _parameter.PATIENT_ID;
            parm.attachement    = byteData;
            using (var service = new PHICService.PHICServiceSoapClient())
            {
                int Value = service.AddPatientDocument(MenuID, parm);
                if (Value > 0)
                {
                    IsValid = true;
                }
            }
            if (IsValid)
            {
                PHICService.PatientData data = new PHICService.PatientData();
                using (var service = new PHICService.PHICServiceSoapClient())
                {
                    if (LoginType == "Doctor")
                    {
                        data = service.GetPatientDocumentByCategoryID(MenuID, _parameter.PATIENT_ID);
                    }
                    else
                    {
                        data = service.GetPatientDocumentByPatientID(_parameter.PATIENT_ID);
                    }
                }
                if (data.isValid)
                {
                    model = Extension.ConvertToPatientDocumentList(data.dt);
                    ViewBag.CategoryID = MenuID;
                    ViewBag.LoginType  = LoginType;
                    returnData         = RenderPartialViewToString("_patientDocumentPartial", model);
                }
            }
            return(Json(returnData));
        }