123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285 |
- /******************************************************************************
- * 文件名称: HisBusiness.cs
- * 文件说明: HIS业务的封装
- * 当前版本: V1.0
- * 创建日期: 2022-04-14
- *
- * 2020-04-14: 增加 SingleDownload 方法
- * 2020-04-14: 增加 AutoDownload 方法
- ******************************************************************************/
- using Newtonsoft.Json.Linq;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using PTMedicalInsurance.Helper;
- using System.Windows.Forms;
- namespace PTMedicalInsurance.Business
- {
- class HisBusiness
- {
- /// <summary>
- /// 目录查询信息下载
- /// </summary>
- /// <param name="directoryType"></param>
- /// <param name="errorMessage"></param>
- /// <returns></returns>
- public int InsuMedQuery(JObject joData, string funNo, out string Outpar)
- {
- string errorMessage = "";
- Outpar = "";
- int iResult = -1;
- try
- {
- CenterBusiness centerBusiness = new CenterBusiness();
- JObject joRtn = centerBusiness.InvokeMedicalInsuranceInquiry(funNo, joData);
- if (JsonHelper.parseIrisRtnValue(joRtn, out errorMessage) == 0)
- {
- iResult = 0;
- Outpar = joRtn.ToString();
- return 0;
- }
- else
- {
- GlobalVariables.writeLog(joRtn.ToString());
- errorMessage = "调用交易"+ funNo + "出现错误,请查看日志!"; //joImportRtn["errorMessage"].ToString();
- return iResult;
- }
-
- }
- catch (Exception ex)
- {
- errorMessage = "InvokeMedicalInsuranceInquiry提示:" + ex.Message;
- return iResult;
- }
- }
- public int MedicalInstitutionSave(string sInput,string Code,out string errMsg)
- {
- string OutMsg = "";
- int iResult = -1;
- errMsg = "";
- try
- {
- DataImoport bus = new DataImoport();
- JObject joImportRtn = bus.importDataToIrisByJson(sInput, Code);
- if (JsonHelper.parseBusinessJson(joImportRtn, out OutMsg) == 0)
- {
- iResult = 0;
- }
- else
- {
- GlobalVariables.writeLog(joImportRtn.ToString());
- OutMsg = "导入医疗机构数据出现错误,请查看日志!";//joImportRtn["errorMessage"].ToString();
- errMsg = OutMsg;
- return iResult;
- }
- return iResult;
- }
- catch (Exception ex)
- {
- errMsg = ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 医保目录单个版本号的下载
- /// </summary>
- /// <param name="ver"></param>
- /// <param name="directoryType"></param>
- /// <param name="uiProcessBar"></param>
- /// <param name="errorMessage"></param>
- /// <returns></returns>
- public int SingleDownload(string ver, int directoryType,Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
- {
- string txtPath = string.Empty;
- errorMessage = "";
- int iResult = -1;
- string funNo = "";
- switch (directoryType)
- {
- case 0://西药中成药目录下载
- {
- funNo = "1301";
- break;
- }
- case 1://医疗服务项目目录下载
- {
- funNo = "1305";
- break;
- }
- case 2://医用耗材目录下载
- {
- funNo = "1306";
- break;
- }
- case 3://疾病与诊断目录下载
- {
- funNo = "1307";
- break;
- }
- case 4://手术操作目录下载
- {
- funNo = "1308";
- break;
- }
- case 5://门诊慢特病种目录下载
- {
- funNo = "1309";
- break;
- }
- case 6://按病种付费病种目录下载
- {
- funNo = "1310";
- break; ;
- }
- case 7://日间手术治疗病种目录下载
- {
- funNo = "1311";
- break;
- }
- case 8://字典表 1901
- {
- break;
- }
- case 9://中药饮片目录下载
- {
- funNo = "1302";
- break;
- }
- case 10://医疗机构制剂
- {
- funNo = "1303";
- break;
- }
- case 11://肿瘤形态学
- {
- funNo = "1313";
- break;
- }
- case 12://中医疾病
- {
- funNo = "1314";
- break;
- }
- case 13://中医证候
- {
- funNo = "1315";
- break;
- }
- }
- try
- {
- CenterBusiness centerBusiness = new CenterBusiness();
- JObject joRtn = centerBusiness.DownDirecotry(funNo, ver);
- if (JsonHelper.parseBusinessJson(joRtn, out errorMessage) == 0)
- {
- txtPath = joRtn["filePath"].ToString();
- DataImoport bus = new DataImoport();
- JObject joImportRtn = bus.importDataToIrisByTxt(txtPath, 50, directoryType + 1, uiProcessBar);
- if (JsonHelper.parseBusinessJson(joImportRtn, out errorMessage) == 0)
- {
- iResult = 0;
- }
- else
- {
- GlobalVariables.writeLog(joImportRtn.ToString());
- errorMessage = "导入数据出现错误,请查看日志!";//joImportRtn["errorMessage"].ToString();
- }
- }
- return iResult;
- }
- catch (Exception ex)
- {
- errorMessage = "SingleDownload提示:" + ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 医保目录单个版本号的下载
- /// </summary>
- /// <param name="ver"></param>
- /// <param name="directoryType"></param>
- /// <param name="uiProcessBar"></param>
- /// <param name="errorMessage"></param>
- /// <returns></returns>
- public int downloadDicionary(JObject joData, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
- {
- errorMessage = "";
- int iResult = -1;
- try
- {
- CenterBusiness centerBusiness = new CenterBusiness();
- JObject joRtn = centerBusiness.DownDictionay(joData);
- if (JsonHelper.parseCenterJson(joRtn, out errorMessage) == 0)
- {
- DataImoport bus = new DataImoport();
- JArray jaList = JArray.Parse(JsonHelper.getJsonValue(joRtn,"output.list"));
- //MessageBox.Show(jaList.ToString());
- JObject joImportRtn = bus.importDictinary(uiProcessBar,jaList);
- if (JsonHelper.parseBusinessJson(joImportRtn, out errorMessage) == 0)
- {
- iResult = 0;
- }
- else
- {
- GlobalVariables.writeLog(joImportRtn.ToString());
- errorMessage = "导入数据出现错误,请查看日志!";
- }
- }
- return iResult;
- }
- catch (Exception ex)
- {
- errorMessage = "downloadDicionary提示:" + ex.Message;
- return -1;
- }
- }
- /// <summary>
- /// 自动下载医保目录,直到最新版本(返回报错)
- /// </summary>
- /// <param name="directoryType"></param>
- /// <param name="uiProcessBar"></param>
- /// <param name="errorMessage"></param>
- /// <returns></returns>
- public int AutoDownload(int directoryType, Sunny.UI.UIProcessBar uiProcessBar, out string errorMessage)
- {
- int iResult = 0;
- errorMessage = "";
- try
- {
-
- while (iResult == 0)
- {
- IrisInterfaceService irisBus = new IrisInterfaceService();
- JObject joMaxVerNO = irisBus.getDirectoryMaxVersionNO(directoryType);
- string ver = joMaxVerNO["result"]["MaxVersionNO"].ToString();
- iResult = JsonHelper.parseBusinessJson(joMaxVerNO, out errorMessage);
- iResult = SingleDownload(ver, directoryType,uiProcessBar, out errorMessage);
- }
- return iResult;
- }
- catch (Exception ex)
- {
- errorMessage = ex.Message;
- return -1;
- }
- }
- }
- }
|