Ejemplo n.º 1
0
        /// <summary>
        /// 下载药品目录
        /// </summary>
        /// <returns></returns>
        public static DownLoadCenterItemResult DownLoadDrugListInfo(DownLoadItem hisData)
        {
            string strParameter = Newtonsoft.Json.JavaScriptConvert.SerializeObject(hisData);

            Message recieveMsg = new Message();

            recieveMsg.DES          = false;
            recieveMsg.GZipCompress = false;
            recieveMsg.dataContent  = strParameter;

            Message retMsg = new Message();

            try
            {
                retMsg = ncmsInterface.downLoadCenterItem(recieveMsg);
                if (retMsg.DES)
                {
                    retMsg.dataContent = NccmFunction.decrypt(retMsg.dataContent, sKey);
                }
                if (retMsg.GZipCompress)
                {
                    retMsg.dataContent = NccmFunction.gZipDeCompress(retMsg.dataContent);
                }

                Type type = typeof(DownLoadCenterItemResult);
                DownLoadCenterItemResult result = (DownLoadCenterItemResult)Newtonsoft.Json.JavaScriptConvert.DeserializeObject(retMsg.dataContent, type);

                return(result);
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Ejemplo n.º 2
0
        public void DownLoad_Items_Add(DownLoadItem downLoadEntity)
        {
            try
            {
                //this.downLoadDataGrid.Items.Add(downLoadEntity);

                //this.downLoadEntityList.Add(downLoadEntity);

                this.DownLoadItemCollection.Add(downLoadEntity);
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 资源下载
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Resource_DownLoad()
        {
            try
            {
                System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();

                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    //bool downloadWindowisShow = false;
                    foreach (var item in this.SpaceListViewItemList)
                    {
                        if (item.BookType == BookType.File)
                        {
                            MainWindow._MainWindow.Open_DownLoad_View();

                            string fileNameAboutExtention = item.Title + "." + item.FileType;

                            DownLoadItem downLoadEntity = new DownLoadItem()
                            {
                                FileUri         = item.Uri,
                                FileName        = fileNameAboutExtention,
                                WebClientHelper = new WebClientManage(),
                                AllSize         = 100,
                                AllSize_MB      = item.SizeDisplay,
                                Style           = MainWindow.DownLoad_Item_Style,
                                Length          = item.Self_File.Length
                            };

                            MainWindow._MainWindow.DownLoad_Items_Add(downLoadEntity);
                        }
                    }
                    MainWindow._MainWindow.Begin_Resource_DownLoad(dialog.SelectedPath);
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 下载病人费用
        /// </summary>
        /// <param name="hashtable"></param>
        /// <returns></returns>
        public object DownloadzyPatFee(System.Collections.Hashtable hashtable)
        {
            DownLoadItem hisData = new DownLoadItem();

            JoinArea joinArea = new JoinArea();

            joinArea.code = JOIN_AREA_CODE;
            joinArea.name = JOIN_AREA_NAME;

            DataType dataType = new DataType();

            dataType.dataTypeName  = "住院数据";
            dataType.dataTypeValue = "2";


            Condition CARD_ID = new Condition();        //合作医疗证号

            CARD_ID.condition_displayname = "合作医疗证号";
            CARD_ID.condition_name        = "SN";
            CARD_ID.condition_value       = zyPatlist.Nccm_NO; //"20090408" ;
            Condition[] conditions = new Condition[] { CARD_ID };

            hisData.uploadorg  = MED_ORG_CODE;
            hisData.dataType   = dataType;
            hisData.joinArea   = joinArea;
            hisData.conditions = conditions;
            RecieveDetailFeeResult rdf = NccmInterfaces.DownLoadDetailFee(hisData);

            if (rdf.resultId)
            {
                return(ConvertDT(rdf.feeDetail));
            }
            else
            {
                throw new Exception("农合接口调用失败:" + rdf.resultString);
            }
        }
Ejemplo n.º 5
0
        private void DownLoad_Delete_Click_CallBack(DownLoadItem obj)
        {
            try
            {
                if (this.DownLoadItemCollection.Contains(obj))
                {
                    this.DownLoadItemCollection.Remove(obj);

                    this.DownLoad_AllCount--;
                    if (obj.IsCompleate_DownLoad)
                    {
                        this.DownLoad_CompleateCount--;
                    }

                    obj.WebClientHelper.Dispose();

                    if (obj.IsDownLoading_Now)
                    {
                        this.All_DownloadNowValue -= obj.Recieve_Bytes;
                    }
                    else if (obj.IsCompleate_DownLoad)
                    {
                        this.All_DownloadNowValue -= obj.Length;
                    }

                    this.All_DownloadMaxValue -= obj.Length;
                }
            }
            catch (Exception ex)
            {
                LogManage.WriteLog(this.GetType(), ex);
            }
            finally
            {
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 下载农合药品目录到本地数据库
        /// </summary>
        public static void DownLoadAndSaveNcmsDrug()
        {
            try
            {
                //药品列表容器
                List <Drug> drugList = new List <Drug>();
                //定义入口参数
                DownLoadItem hisData  = new DownLoadItem();
                JoinArea     joinArea = new JoinArea();
                joinArea.code = CURRENT_JOINAREA_CODE;
                joinArea.name = CURRENT_JOINAREA_NAME;

                DataType dataType = new DataType();
                dataType.dataTypeName  = NcmsDataType.门诊数据.ToString();
                dataType.dataTypeValue = ((int)NcmsDataType.门诊数据).ToString();

                //项目类型 [1(所有目录)[2(药品目录),3(诊疗项目目录)]
                Condition condition = new Condition();
                condition.condition_name  = "CONTENT_TYPE";
                condition.condition_value = ((int)DownLoadItemType.DRUG).ToString();
                //要下载的页码 整数
                int       current_page = 1;
                Condition condition1   = new Condition();
                condition1.condition_name  = "CURRENT_PAGE";
                condition1.condition_value = current_page.ToString();
                //要下载的每页大小
                Condition condition2 = new Condition();
                condition2.condition_name  = "PAGE_SIZE";
                condition2.condition_value = "100";

                hisData.uploadorg = "23423";
                hisData.dataType  = dataType;
                hisData.joinArea  = joinArea;

                Condition[] conditions = new Condition[3];
                conditions[0]      = condition;
                conditions[1]      = condition1;
                conditions[2]      = condition2;
                hisData.conditions = conditions;
                //下载第一页并取得页面相关信息
                DownLoadCenterItemResult result = NccmInterfaces.DownLoadDrugListInfo(hisData);
                if (result.resultId)
                {
                    drugList = result.drug.ToList <Drug>();

                    int totalPage = result.drugPageInfo.totalPageNo;

                    current_page = 2;

                    while (current_page <= totalPage)
                    {
                        //重新指定要下载的页
                        hisData.conditions[1].condition_value = current_page.ToString();

                        result = NccmInterfaces.DownLoadDrugListInfo(hisData);

                        if (result.resultId)
                        {
                            //追加到List
                            for (int i = 0; i < result.drug.Length; i++)
                            {
                                drugList.Add(result.drug[i]);
                            }
                        }
                        else
                        {
                            throw new Exception(result.resultString);
                        }
                        current_page++;
                    }
                    //将药品信息保存到数据库
                    try
                    {
                        oleDb.BeginTransaction();
                        HIS.SYSTEM.Core.BindEntity <Model.NCMS_DRUG_CATALOG> .CreateInstanceDAL(oleDb).Delete("");

                        foreach (Drug drug in drugList)
                        {
                            Model.NCMS_DRUG_CATALOG model = new HIS.Model.NCMS_DRUG_CATALOG();
                            #region .......
                            model.DRUG_ALIAS            = drug.drug_alias;
                            model.DRUG_CODE             = drug.drug_code;
                            model.DRUG_CODE2            = drug.drug_code2;
                            model.DRUG_FORM             = drug.drug_form;
                            model.DRUG_NAME             = drug.drug_name;
                            model.DRUG_TYPE             = drug.drug_type;
                            model.DRUGCLASS_CODE        = drug.drugclass_code;
                            model.LIMIT_DEPT            = drug.limit_dept;
                            model.LIMIT_DESC            = drug.limit_desc;
                            model.LIMIT_DISEASE         = drug.limit_disease;
                            model.LIMIT_DOCTOR          = drug.limit_doctor;
                            model.LIMIT_FORM            = drug.limit_form;
                            model.LIMIT_HOSPITAL        = drug.limit_hospital;
                            model.LIMIT_LINE            = drug.limit_line;
                            model.LIMIT_MAKER           = drug.limit_maker;
                            model.LIMIT_PRICE           = drug.limit_price.ToString();
                            model.LIMIT_PRICEFIELDSPECI = drug.limit_priceSpecified.ToString();
                            model.LIMIT_UNIT_NAME       = drug.limit_unit_name;
                            model.LIMIT_UNIT_NUM        = drug.limit_unit_num;
                            model.MARK      = drug.mark;
                            model.USE_LEVEL = drug.use_level;
                            #endregion

                            HIS.SYSTEM.Core.BindEntity <Model.NCMS_DRUG_CATALOG> .CreateInstanceDAL(oleDb).Add(model);
                        }
                        oleDb.CommitTransaction();
                    }
                    catch (Exception err)
                    {
                        oleDb.RollbackTransaction();
                        throw err;
                    }
                }
                else
                {
                    throw new Exception(result.resultString);
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 下载匹配信息
        /// </summary>
        public static void DownLoadAndSaveMatchInfo()
        {
            List <ItemMatchInfo> matchList = new List <ItemMatchInfo>();

            DownLoadItem hisData = new DownLoadItem();

            JoinArea joinArea = new JoinArea();

            joinArea.code = CURRENT_JOINAREA_CODE;
            joinArea.name = CURRENT_JOINAREA_NAME;


            DataClass dataClass = new DataClass();

            dataClass.dataClassName  = NcmsDataClass.新农合数据.ToString();
            dataClass.dataClassValue = ((int)NcmsDataClass.新农合数据).ToString();

            DataType dataType = new DataType();

            dataType.dataTypeName  = NcmsDataType.收费项目.ToString();
            dataType.dataTypeValue = ((int)NcmsDataType.收费项目).ToString();

            OperType operType = new OperType();

            operType.operTypeName  = NcmsOperType.查询.ToString();
            operType.operTypeValue = ((int)NcmsOperType.查询).ToString();

            Condition Content_type   = new Condition();
            Condition Approve_status = new Condition();
            Condition Current_page   = new Condition();
            Condition Page_size      = new Condition();

            Content_type.condition_displayname = "项目类型";
            Content_type.condition_name        = "CONTENT_TYPE";
            Content_type.condition_value       = "1";

            Approve_status.condition_displayname = "审核状态";
            Approve_status.condition_name        = "APPROVE_STATUS";
            Approve_status.condition_value       = "4";

            int current_page = 1;

            Current_page.condition_displayname = "要下载的页码";
            Current_page.condition_name        = "CURRENT_PAGE";
            Current_page.condition_value       = current_page.ToString();

            int pageSize = 100;

            Page_size.condition_displayname = "页面大小";
            Page_size.condition_name        = "PAGE_SIZE";
            Page_size.condition_value       = pageSize.ToString();

            Condition[] cond = new Condition[] { Content_type, Approve_status, Current_page, Page_size };

            hisData.joinArea   = joinArea;
            hisData.dataClass  = dataClass;
            hisData.dataType   = dataType;
            hisData.operType   = operType;
            hisData.conditions = cond;
            hisData.uploadorg  = "400866951";

            try
            {
                RecieveHospitalMatchInfoResult result = NccmInterfaces.DownLoadMatchInfo(hisData);

                if (result.resultId)
                {
                    matchList = result.itemMatchInfo.ToList <ItemMatchInfo>();

                    current_page = 2;

                    while (1 == 1)
                    {
                        //重新指定要下载的页
                        hisData.conditions[2].condition_value = current_page.ToString();

                        result = NccmInterfaces.DownLoadMatchInfo(hisData);
                        if (result.itemMatchInfo == null)
                        {
                            break;
                        }

                        if (result.resultId)
                        {
                            //追加到List
                            for (int i = 0; i < result.itemMatchInfo.Length; i++)
                            {
                                matchList.Add(result.itemMatchInfo[i]);
                            }
                        }
                        else
                        {
                            throw new Exception(result.resultString);
                        }
                        current_page++;
                    }
                    //保存到数据库
                    try
                    {
                        oleDb.BeginTransaction();

                        HIS.SYSTEM.Core.BindEntity <Model.NCMS_MATCH_CATALOG> .CreateInstanceDAL(oleDb).Delete("");

                        foreach (ItemMatchInfo match in matchList)
                        {
                            Model.NCMS_MATCH_CATALOG model = new HIS.Model.NCMS_MATCH_CATALOG();
                            model.APPROVE_STATUS = match.approve_status;
                            model.APPROVETIME    = match.approveTime;
                            model.HOSPITAL_CODE  = match.hospital_code;
                            model.IF_EQUAL       = match.if_equal;
                            model.MEDORG_CODE    = match.medorg_code;
                            model.NCMS_CODE      = match.ncms_code;
                            model.REGION_CODE    = match.region_code;
                            model.STATUS         = match.status;
                            model.TYPE           = match.type;
                            model.UPLOAD_TIME    = match.upload_time;
                            model.UPLOADER       = match.uploader;

                            HIS.SYSTEM.Core.BindEntity <Model.NCMS_MATCH_CATALOG> .CreateInstanceDAL(oleDb).Add(model);
                        }
                        oleDb.CommitTransaction();
                    }
                    catch (Exception err)
                    {
                        oleDb.RollbackTransaction();
                        throw err;
                    }
                }
            }
            catch (Exception err)
            {
                throw new Exception(err.Message);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 下载诊疗服务项目
        /// </summary>
        public static void DownLoadAndSavNcmsTherapy()
        {
            try
            {
                //药品列表容器
                List <Therapy> theraypList = new List <Therapy>();
                //定义入口参数
                DownLoadItem hisData  = new DownLoadItem();
                JoinArea     joinArea = new JoinArea();
                joinArea.code = CURRENT_JOINAREA_CODE;
                joinArea.name = CURRENT_JOINAREA_NAME;

                DataType dataType = new DataType();
                dataType.dataTypeName  = NcmsDataType.门诊数据.ToString();
                dataType.dataTypeValue = ((int)NcmsDataType.门诊数据).ToString();

                //项目类型 [1(所有目录)[2(药品目录),3(诊疗项目目录)]
                Condition condition = new Condition();
                condition.condition_name  = "CONTENT_TYPE";
                condition.condition_value = ((int)DownLoadItemType.THERAPY).ToString();
                //要下载的页码 整数
                int       current_page = 1;
                Condition condition1   = new Condition();
                condition1.condition_name  = "CURRENT_PAGE";
                condition1.condition_value = current_page.ToString();
                //要下载的每页大小
                Condition condition2 = new Condition();
                condition2.condition_name  = "PAGE_SIZE";
                condition2.condition_value = "100";

                hisData.uploadorg = "23423";
                hisData.dataType  = dataType;
                hisData.joinArea  = joinArea;

                Condition[] conditions = new Condition[3];
                conditions[0]      = condition;
                conditions[1]      = condition1;
                conditions[2]      = condition2;
                hisData.conditions = conditions;
                //下载第一页并取得页面相关信息
                DownLoadCenterItemResult result = NccmInterfaces.DownLoadDrugListInfo(hisData);
                if (result.resultId)
                {
                    theraypList = result.therapy.ToList <Therapy>();

                    int totalPage = result.therapyPageInfo.totalPageNo;

                    current_page = 2;

                    while (current_page <= totalPage)
                    {
                        //重新指定要下载的页
                        hisData.conditions[1].condition_value = current_page.ToString();

                        result = NccmInterfaces.DownLoadTherapyListInfo(hisData);

                        if (result.resultId)
                        {
                            //追加到List
                            for (int i = 0; i < result.therapy.Length; i++)
                            {
                                theraypList.Add(result.therapy[i]);
                            }
                        }
                        else
                        {
                            throw new Exception(result.resultString);
                        }
                        current_page++;
                    }
                    //将药品信息保存到数据库
                    try
                    {
                        oleDb.BeginTransaction();
                        HIS.SYSTEM.Core.BindEntity <Model.NCMS_THERAPY_CATALOG> .CreateInstanceDAL(oleDb).Delete("");

                        foreach (Therapy therapy in theraypList)
                        {
                            Model.NCMS_THERAPY_CATALOG model = new HIS.Model.NCMS_THERAPY_CATALOG();
                            #region .......
                            model.EXCLUDE_CONTENT = therapy.exclude_content;
                            model.FINANCE_TYPE    = therapy.finance_type;
                            model.ITEM_CODE       = therapy.item_code;
                            model.ITEM_CONTENT    = therapy.item_content;
                            model.ITEM_NAME       = ConvertSpeciString(therapy.item_name);
                            model.MARK            = therapy.mark;
                            model.MEDCLASS_CODE   = therapy.medclass_code;
                            model.PRICE1          = therapy.price1;
                            model.PRICE2          = therapy.price2;
                            model.PRICE3          = therapy.price3;
                            model.SPECS           = therapy.specs;
                            model.UNIT            = therapy.unit;
                            #endregion

                            HIS.SYSTEM.Core.BindEntity <Model.NCMS_THERAPY_CATALOG> .CreateInstanceDAL(oleDb).Add(model);
                        }
                        oleDb.CommitTransaction();
                    }
                    catch (Exception err)
                    {
                        oleDb.RollbackTransaction();
                        throw err;
                    }
                }
                else
                {
                    throw new Exception(result.resultString);
                }
            }
            catch (Exception err)
            {
                throw err;
            }
        }
Ejemplo n.º 9
0
 //递归遍历查找不同/不存在的xml节点,以检查版本;
 private static void CheckForDifferItems(XElement elem,
                                         string localAbPath,
                                         string localRlaPath,
                                         string remoteAbPath,
                                         string remoteRlaPath,
                                         List <DownLoadItem> items, bool isRoot = false)
 {
     try {
         #region 迭代文件内文件目录;
         var folders = elem.Elements(XName.Get("Folder"));
         if (folders.Count() != 0)
         {
             foreach (var item in folders)
             {
                 var name = item.GetAttribute("Name");
                 //若为根级目录将进行特殊处理;对共有(Shared)私有模块进行分别处理;
                 if (isRoot)
                 {
                     if (name == "Shared" || name == VersionBranch)
                     {
                         CheckForDifferItems(item,
                                             localAbPath,
                                             localRlaPath,
                                             remoteAbPath,
                                             remoteRlaPath + name + "/",
                                             items);
                     }
                 }
                 else
                 {
                     CheckForDifferItems(item,
                                         localAbPath,
                                         localRlaPath + name + "/",
                                         remoteAbPath,
                                         remoteRlaPath + name + "/",
                                         items);
                 }
             }
         }
         #endregion
         //new StringBuilder(remotePtPath);
         #region 对文件进行遍历检查;
         var files = elem.Elements(XName.Get("File"));
         if (files.Count() != 0)
         {
             foreach (var item in files)
             {
                 var name = item.GetAttribute("Name");
                 //若存在对应文件,则检查文件哈希;
                 if (File.Exists(localAbPath + localRlaPath + name))
                 {
                     MD5CryptoServiceProvider provider = new MD5CryptoServiceProvider();
                     var           fs     = File.OpenRead(localAbPath + localRlaPath + name);
                     var           retVal = provider.ComputeHash(fs);
                     StringBuilder sb     = new StringBuilder();
                     for (int i = 0; i < retVal.Length; i++)
                     {
                         sb.Append(retVal[i].ToString("X2"));
                     }
                     var hash = sb.ToString().ToUpper();
                     //若哈希不同,则记录进文件集;
                     if (hash != item.GetAttribute("MD5"))
                     {
                         var dwItem = new DownLoadItem {
                             Name            = name,
                             Size            = long.Parse(item.GetAttribute("Size")),
                             MD5             = item.GetAttribute("MD5"),
                             RemotePreAbPath = remoteAbPath,
                             RemoteRlaPath   = remoteRlaPath,
                             LocalRlaPath    = localRlaPath
                         };
                         items?.Add(dwItem);
                     }
                 }
                 else
                 {
                     var dwItem = new DownLoadItem {
                         Name            = name,
                         Size            = long.Parse(item.GetAttribute("Size")),
                         MD5             = item.GetAttribute("MD5"),
                         LocalRlaPath    = localRlaPath,
                         RemotePreAbPath = remoteAbPath,
                         RemoteRlaPath   = remoteRlaPath
                     };
                     items?.Add(dwItem);
                 }
             }
         }
         #endregion
     }
     catch {
     }
 }