123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227 |
- using Newtonsoft.Json.Linq;
- using PTMedicalInsurance.Common;
- using PTMedicalInsurance.Helper;
- using PTMedicalInsurance.Variables;
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Xml.Linq;
- namespace PTMedicalInsurance.Business.HIS
- {
- /// <summary>
- /// HIS下载业务
- /// </summary>
- class DownLoad
- {
- private PTMedicalInsurance.Business.Center.DownLoad cDL = new PTMedicalInsurance.Business.Center.DownLoad();
- private PTMedicalInsurance.Business.MI.DataImport mDI = new PTMedicalInsurance.Business.MI.DataImport();
- /// <summary>
- /// 根据指定版本号下载医保目录
- /// </summary>
- /// <param name="ver"></param>
- /// <param name="directoryType"></param>
- /// <param name="uiProcessBar"></param>
- /// <param name="errorMessage"></param>
- /// <returns></returns>
- public int DownloadMIDiretoryBySpecifyVerNO(string ver, int directoryType, Control uiProcessBar, out string errMsg, out string currentMaxVerNO )
- {
- string txtPath = string.Empty;
- currentMaxVerNO = "";
- errMsg = "";
- int iResult = -1;
- string funNo = "";
- XElement xe = new XElement("input","") ;
- string fileName = DateTime.Now.ToString("yyyyMMddHHmmssffff");
- switch (directoryType)
- {
- case 0://医保目录
- {
- funNo = "91A"; //"1301";
- xe = new XElement("input",
- new XElement("prm_aaalsh", ver),
- new XElement("prm_outputfile", Global.curEvt.path + "\\DownLoad\\" + fileName + "_" + funNo + ".txt"));
- break;
- }
- case 1://ICD10
- {
- funNo = "61";
- xe = new XElement("input",
- new XElement("prm_aaalsh", ver),
- new XElement("prm_outputfile", Global.curEvt.path + "\\DownLoad\\" + fileName + "_" + funNo + ".txt"));
- break;
- }
- case 2://字典
- {
- funNo = "57";
- break;
- }
- case 3://国家医生编码
- {
- funNo = "GB001";
- xe = new XElement("input",
- new XElement("prm_akb020", Global.inf.hospitalNO),
- new XElement("page_num",1),
- new XElement("page_size", 999),
- new XElement("prm_outputfile", Global.curEvt.path + "\\DownLoad\\" + fileName + "_" + funNo + ".txt"));
- break;
- }
- case 4://国家护士编码
- {
- funNo = "GB002";
- xe = new XElement("input",
- new XElement("prm_akb020", Global.inf.hospitalNO),
- new XElement("page_num", 1),
- new XElement("page_size", 999),
- new XElement("prm_outputfile", Global.curEvt.path + "\\DownLoad\\" + fileName + "_" + funNo + ".txt"));
- break;
- }
- case 5://国家医院机构信息
- {
- funNo = "GB003";
- xe = new XElement("input",
- new XElement("prm_akb020", Global.inf.hospitalNO),
- new XElement("prm_outputfile", Global.curEvt.path + "\\DownLoad\\" + fileName + "_" + funNo + ".txt"));
- break;
- }
- case 6://自付比例
- {
- funNo = "91C"; //"1301";
- xe = new XElement("input",
- new XElement("prm_aaalsh", ver),
- new XElement("prm_outputfile", Global.curEvt.path + "\\DownLoad\\" + fileName + "_" + funNo + ".txt"));
- break;
- }
- case 7://医保限价
- {
- funNo = "91B"; //"1301";
- xe = new XElement("input",
- new XElement("prm_aaalsh", ver),
- new XElement("prm_outputfile", Global.curEvt.path + "\\DownLoad\\" + fileName + "_" + funNo + ".txt"));
- break;
- }
- }
- try
- {
- JObject joRtn = new JObject();
- if (directoryType == 2)
- joRtn = cDL.DownloadDictionary(funNo, xe);
- else
- joRtn = cDL.DownloadDirectory(funNo,xe);
- if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) == 0)
- {
- JObject joImportRtn = new JObject();
- switch (directoryType)
- {
- case 0://医保目录 导入目录表
- {
- txtPath = JsonHelper.getDestValue(joRtn, "result.input.prm_outputfile");
- joImportRtn = mDI.insertDirectoryToMIIrisByTxt(txtPath, 50, directoryType, (Sunny.UI.UIProcessBar)uiProcessBar,out currentMaxVerNO );
- break;
- }
- case 1://ICD10 导入目录表
- {
- txtPath = JsonHelper.getDestValue(joRtn, "result.input.prm_outputfile");
- joImportRtn = mDI.insertDirectoryToMIIrisByTxt(txtPath, 50, directoryType, (Sunny.UI.UIProcessBar)uiProcessBar, out currentMaxVerNO);
- break;
- }
- case 2://字典 导入字典表
- {
- JArray jaList = JArray.Parse(JsonHelper.getDestValue(joRtn, "result.output.sqldata.row"));
- joImportRtn = mDI.importDictionary((Sunny.UI.UIProcessBar)uiProcessBar, jaList);
- break;
- }
- case 3://国家医生编码 前台展示
- {
- try
- {
- txtPath = JsonHelper.getDestValue(joRtn, "result.input.prm_outputfile");
- DataTable dt = TxtHelper.ToDataTable(txtPath, 16);
- PTMedicalInsurance.Forms.BasicDatas.FormSetter fs = new Forms.BasicDatas.FormSetter();
- fs.SetHeaderTextOfDownloadDoctorInfo((DataGridView)uiProcessBar);
- ((DataGridView)uiProcessBar).DataSource = dt;
- joImportRtn = JsonHelper.setIrisReturnValue(0,"",null);
- }
- catch (Exception subEx)
- {
- joImportRtn = JsonHelper.setIrisReturnValue(0, subEx.Message, null);
- }
- break;
- }
- case 4://国家护士编码 前台展示
- {
- try
- {
- txtPath = JsonHelper.getDestValue(joRtn, "result.input.prm_outputfile");
- DataTable dt = TxtHelper.ToDataTable(txtPath, 14);
- PTMedicalInsurance.Forms.BasicDatas.FormSetter fs = new Forms.BasicDatas.FormSetter();
- fs.SetHeaderTextOfDownloadNurseInfo((DataGridView)uiProcessBar);
- ((DataGridView)uiProcessBar).DataSource = dt;
- joImportRtn = JsonHelper.setIrisReturnValue(0, "", null);
- }
- catch (Exception subEx)
- {
- joImportRtn = JsonHelper.setIrisReturnValue(0, subEx.Message, null);
- }
- break;
- }
- case 5://国家医院机构信息 前台展示
- {
- try
- {
- txtPath = JsonHelper.getDestValue(joRtn, "result.input.prm_outputfile");
- DataTable dt = TxtHelper.ToDataTable(txtPath, 32);
- PTMedicalInsurance.Forms.BasicDatas.FormSetter fs = new Forms.BasicDatas.FormSetter();
- fs.SetHeaderTextOfDownloadHospitalInfo((DataGridView)uiProcessBar);
- ((DataGridView)uiProcessBar).DataSource = dt;
- joImportRtn = JsonHelper.setIrisReturnValue(0, "", null);
- }
- catch (Exception subEx)
- {
- joImportRtn = JsonHelper.setIrisReturnValue(0, subEx.Message, null);
- }
- break;
- }
- case 6://医保目录自付比例 导入目录表
- {
- txtPath = JsonHelper.getDestValue(joRtn, "result.input.prm_outputfile");
- joImportRtn = mDI.insertDirectoryToMIIrisByTxt(txtPath, 50, directoryType, (Sunny.UI.UIProcessBar)uiProcessBar, out currentMaxVerNO);
- break;
- }
- case 7://医保限价 导入目录表
- {
- txtPath = JsonHelper.getDestValue(joRtn, "result.input.prm_outputfile");
- joImportRtn = mDI.insertDirectoryToMIIrisByTxt(txtPath, 50, directoryType, (Sunny.UI.UIProcessBar)uiProcessBar, out currentMaxVerNO);
- break;
- }
- }
-
- if (JsonHelper.parseIrisRtnValue(joImportRtn, out errMsg) == 0)
- {
- iResult = 0;
- }
- else
- {
- errMsg = "导入数据出现错误,请查看日志!" + errMsg;//joImportRtn["errorMessage"].ToString();
- }
- }
- return iResult;
- }
- catch (Exception ex)
- {
- errMsg = "PTMedicalInsurance.Business.HIS.DownLoad.DownloadMIDiretoryBySpecifyVerNO提示:" + ex.Message;
- return -1;
- }
- }
- }
- }
|