| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711 |
- /******************************************************************************
- * 文件名称: CloudImageService.cs
- * 文件说明: 个人医保云(影像云)数据采集全量接口封装
- * 包含两套子系统共29个交易接口:
- * 1. 数据采集系统(11xxx系列): 患者信息/费用/病案/病历等 18个接口
- * 2. 医疗机构前置(12xxx系列): 检查检验/结算/预约挂号 9个+2个预留
- * 当前版本: V2.0
- * 创建日期: 2026-05-06
- * 更新日期: 2026-05-07 (补全数据采集系统全量接口)
- ******************************************************************************/
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using PTMedicalInsurance.Common;
- using PTMedicalInsurance.Helper;
- using PTMedicalInsurance.Variables;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Net;
- using System.Text;
- namespace PTMedicalInsurance.Business
- {
- /// <summary>
- /// 云影像(个人医保云影像云)数据采集服务封装类
- /// 对接两套子系统:数据采集系统 + 医疗机构前置
- /// </summary>
- public class CloudImageService
- {
- #region 配置参数
- /// <summary>
- /// 个人医保云(影像云)数据采集系统服务地址(IP:Port)
- /// 负责患者信息、费用、病案、病历等数据的采集
- /// 可配置,每家医院可能不同
- /// </summary>
- public string CollectServerUrl { get; set; } //= "http://10.188.1.44:8091";
- /// <summary>
- /// 医疗机构前置服务地址(IP:Port)
- /// 负责检查检验报告、影像文件、结算信息等的采集
- /// 可配置,每家医院可能不同
- /// </summary>
- public string MedPreServerUrl { get; set; } //= "http://172.25.6.33:5002";
- /// <summary>
- /// 医疗机构编码
- /// </summary>
- public string FixmedinsCode { get; set; } //= "H65010200152";
- /// <summary>
- /// 接口调用密钥
- /// </summary>
- public string ApiKey { get; set; }// = "XC0Em467BOw9NjpH3OrS";
- /// <summary>
- /// 接口版本号
- /// </summary>
- private const string INF_VER = "V1.0";
- /// <summary>
- /// 请求超时时间(毫秒)
- /// </summary>
- private const int TIMEOUT_MS = 60000;
- #endregion
- #region 接口URL映射字典(双系统)
- /// <summary>
- /// 交易编号与API目标系统的映射关系
- /// key: 交易编号(infno), value: (系统类型, API路径)
- /// 系统类型: "collect"=数据采集系统, "medpre"=医疗机构前置
- /// </summary>
- private static readonly Dictionary<string, Tuple<string, string>> ApiUrlMapping = new Dictionary<string, Tuple<string, string>>
- {
- // ========== 一、数据采集系统 (11xxx系列) ==========
- // 所有数据采集系统接口统一走 /collect/elecmedrcd
- // 来源:改造说明文档"个人医保云(影像云)数据采集系统"章节
- // --- 患者与就诊基础信息 ---
- { "11101", Tuple.Create("collect", "/collect/elecmedrcd") }, // 患者基本信息上传
- { "11102", Tuple.Create("collect", "/collect/elecmedrcd") }, // 患者费用明细信息上传
- { "11103", Tuple.Create("collect", "/collect/elecmedrcd") }, // 患者费用结算信息上传
- { "11201", Tuple.Create("collect", "/collect/elecmedrcd") }, // 住院病案首页上传
- { "11202", Tuple.Create("collect", "/collect/elecmedrcd") }, // 住院病历记录上传
- { "11301", Tuple.Create("collect", "/collect/elecmedrcd") }, // 门急诊诊疗记录上传
- { "11302", Tuple.Create("collect", "/collect/elecmedrcd") }, // 急诊留观手术及抢救信息上传
- { "11401", Tuple.Create("collect", "/collect/elecmedrcd") }, // 医嘱明细记录上传
- { "11402", Tuple.Create("collect", "/collect/elecmedrcd") }, // 输血信息上传
- { "11403", Tuple.Create("collect", "/collect/elecmedrcd") }, // 护理操作生命体征测量记录上传
- // --- 删除类 ---
- { "11104", Tuple.Create("collect", "/collect/elecmedrcd") }, // 患者基本信息删除
- { "11901", Tuple.Create("collect", "/collect/elecmedrcd") }, // 就诊业务数据删除
-
- //// --- 特殊信息类 --- 暂无对应编号
- //{ "11301", Tuple.Create("collect", "/collect/elecmedrcd") }, // 新生儿信息上传
- //{ "11302", Tuple.Create("collect", "/collect/elecmedrcd") }, // 死亡医学证明上传
- //{ "11401", Tuple.Create("collect", "/collect/elecmedrcd") }, // 透析治疗记录上传
- //{ "11402", Tuple.Create("collect", "/collect/elecmedrcd") }, // 预防接种记录上传
- //{ "11501", Tuple.Create("collect", "/collect/elecmedrcd") }, // 高危人群筛查记录上传
- //{ "11502", Tuple.Create("collect", "/collect/elecmedrcd") }, // 体检登记信息上传
- // ========== 二、医疗机构前置 (12xxx系列) ==========
- // 来源:改造说明文档"医疗机构前置"章节
- // --- 检查检验报告类 ---
- { "12101", Tuple.Create("medpre", "/api/uploadInspection") }, // 临床检验报告上传
- { "12102", Tuple.Create("medpre", "/api/uploadStudy") }, // 临床检查报告上传
- { "12103", Tuple.Create("medpre", "/api/uploadPath") }, // 病理检查报告上传
- { "12104", Tuple.Create("medpre", "/api/uploadBacterial") }, // 细菌培养报告上传
- { "12109", Tuple.Create("medpre", "/api/deleteReport") }, // 检验检查报告删除
- // --- 结算信息类 ---
- { "12201", Tuple.Create("medpre", "/api/uploadSettle") }, // 检查报告结算信息上传
- { "12209", Tuple.Create("medpre", "/api/deleteSettle") }, // 检查报告结算信息删除
- // --- 预约挂号类 ---
- { "12301", Tuple.Create("medpre", "/api/uploadAppoin") }, // 预约挂号信息上传
- { "12309", Tuple.Create("medpre", "/api/deleteAppoin") }, // 预约挂号信息删除
- //// --- 影像调阅(预留) --- AI自己加的?
- //{ "12401", Tuple.Create("medpre", "/api/queryImageIndex") }, // 影像索引查询(预留)
- //{ "12402", Tuple.Create("medpre", "/api/viewImage") }, // 影像调阅查看(预留)
- };
- #endregion
- #region 交易编号名称映射
- /// <summary>
- /// 交易编号与中文名称的映射(用于日志记录和错误提示)
- /// </summary>
- private static readonly Dictionary<string, string> InfNoNameMapping = new Dictionary<string, string>
- {
- // 数据采集系统 - 患者与就诊基础信息
- { "11101", "患者基本信息上传" },
- { "11102", "患者费用明细信息上传" },
- { "11103", "患者费用结算信息上传" },
- { "11201", "住院病案首页上传" },
- { "11202", "住院病历记录上传" },
- { "11301", "门急诊诊疗记录上传" },
- { "11302", "急诊留观手术及抢救信息上传" },
- { "11401", "医嘱明细记录上传" },
- { "11402", "输血信息上传" },
- { "11403", "护理操作生命体征测量记录上传" },
- // 数据采集系统 - 删除类
- { "11104", "患者基本信息删除" },
- { "11901", "就诊业务数据删除" },
- //// 数据采集系统 - 特殊信息类
- //{ "11301", "新生儿信息上传" },
- //{ "11302", "死亡医学证明上传" },
- //{ "11401", "透析治疗记录上传" },
- //{ "11402", "预防接种记录上传" },
- //{ "11501", "高危人群筛查记录上传" },
- //{ "11502", "体检登记信息上传" },
- // 医疗机构前置
- { "12101", "临床检验报告上传" },
- { "12102", "临床检查报告上传" },
- { "12103", "病理检查报告上传" },
- { "12104", "细菌培养报告上传" },
- { "12109", "检验检查报告删除" },
- { "12201", "检查报告结算信息上传" },
- { "12209", "检查报告结算信息删除" },
- { "12301", "预约挂号信息上传" },
- { "12309", "预约挂号信息删除" },
- //{ "12401", "影像索引查询(预留)" },
- //{ "12402", "影像调阅查看(预留)" },
- };
- #endregion
- #region 公开方法 - 统一入口
- /// <summary>
- /// 执行云影像交易(统一入口)
- /// HIS端只需传入交易编号和input入参,外层报文头由本类自动组装
- /// 根据交易编号自动路由到对应的数据采集系统或医疗机构前置
- /// </summary>
- /// <param name="infno">交易编号(如11101患者基本信息, 12101临床检验等)</param>
- /// <param name="input">HIS传入的交易入参(input部分),JSON字符串或JObject</param>
- /// <returns>统一格式的返回JSON</returns>
- public JObject Execute(string infno, object input)
- {
- string errMsg;
- JObject joRtn = new JObject();
- string outPut = "";
- try
- {
- Global.writeLog($"[CloudImage] 开始执行交易: {infno} ({GetInfNoName(infno)})");
- // 1. 校验交易编号是否有效
- if (!ApiUrlMapping.ContainsKey(infno))
- {
- errMsg = $"不支持的交易编号: {infno},当前支持的交易编号范围: 11101~11502(数据采集), 12101~12402(医疗机构前置)";
- Global.writeLog($"[CloudImage] {errMsg}");
- return JsonHelper.setExceptionJson(-1, errMsg, errMsg);
- }
- // 2. 构造完整请求报文
- JObject joRequest = BuildRequest(infno, input);
- Global.writeLog($"[CloudImage] 请求报文: {JsonHelper.Compress(joRequest.ToString())}");
- // 3. 发送HTTP POST请求(自动路由到对应系统)
- string responseStr = SendRequest(infno, joRequest.ToString());
- Global.writeLog($"[CloudImage] 响应报文: {JsonHelper.Compress(responseStr)}");
- // 4. 解析返回结果
- joRtn = ParseResponse(responseStr);
- Global.writeLog($"[CloudImage] 交易 {infno} 执行完成");
- outPut = joRtn.ToString();
- return joRtn;
- }
- catch (Exception ex)
- {
- errMsg = $"[CloudImage] 交易 {infno} 异常: {ex.Message}";
- Global.writeLog(errMsg);
- outPut = JsonHelper.setExceptionJson(-1, GetInfNoName(infno), ex.Message).ToString();
- return JsonHelper.setExceptionJson(-1, GetInfNoName(infno), ex.Message);
- }
- finally
- {
-
- }
- }
-
- #endregion
- #region 私有方法 - 报文构造
- /// <summary>
- /// 构造完整的请求报文
- /// 自动组装外层报文头(infno, msgid, infver, inf_time, fixmedins_code, key, rcd_num)
- /// HIS传入的数据作为input节点
- /// </summary>
- private JObject BuildRequest(string infno, object input)
- {
- JObject joInput = (JObject)input;
- int rcdNum = int.Parse(joInput["rcd_num"].ToString());
- joInput.Remove("rcd_num");
- return BuildRequest( infno, rcdNum, joInput);
- }
- private JObject BuildRequest(string infno,int rcdNum, object input)
- {
- JObject joRequest = new JObject();
- // 报文头信息
- joRequest.Add("infno", infno);
- joRequest.Add("msgid", GenerateMsgId());
- joRequest.Add("infver", INF_VER);
- joRequest.Add("inf_time", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
- joRequest.Add("fixmedins_code", FixmedinsCode);
- joRequest.Add("key", ApiKey);
- joRequest.Add("rcd_num", rcdNum);
- // 处理input部分
- if (input is string)
- {
- string inputStr = input as string;
- if (!string.IsNullOrEmpty(inputStr) && (inputStr.StartsWith("{") || inputStr.StartsWith("[")))
- {
- joRequest.Add("input", JObject.Parse(inputStr));
- }
- else
- {
- joRequest.Add("input", inputStr ?? "");
- }
- }
- else if (input is JObject)
- {
- joRequest.Add("input", input as JObject);
- }
- else if (input is JToken)
- {
- joRequest.Add("input", input as JToken);
- }
- else
- {
- joRequest.Add("input", input != null ? input.ToString() : "");
- }
- return joRequest;
- }
- /// <summary>
- /// 生成报文ID
- /// 格式:医疗机构编码 + 年月日时分秒 + 5位随机数
- /// 示例:H65010200152202605070003012345
- /// </summary>
- private string GenerateMsgId()
- {
- Random rnd = new Random();
- int randNum = rnd.Next(10000, 99999);
- return $"{FixmedinsCode}{DateTime.Now:yyyyMMddHHmmss}{randNum}";
- }
- #endregion
- #region 私有方法 - HTTP通信(双系统路由)
- /// <summary>
- /// 发送HTTP POST请求到对应的目标系统
- /// 根据交易编号自动选择:数据采集系统 或 医疗机构前置
- /// </summary>
- /// <param name="infno">交易编号</param>
- /// <param name="requestData">请求数据(JSON字符串)</param>
- /// <returns>响应内容</returns>
- //private string SendRequest(string infno, string requestData)
- //{
- // var targetInfo = ApiUrlMapping[infno];
- // string systemType = targetInfo.Item1; // "collect" 或 "medpre"
- // string apiPath = targetInfo.Item2;
- // // 根据系统类型选择服务器地址
- // string serverUrl;
- // if (systemType == "collect")
- // {
- // serverUrl = CollectServerUrl.TrimEnd('/');
- // }
- // else // medpre
- // {
- // serverUrl = MedPreServerUrl.TrimEnd('/');
- // }
- // string apiUrl = serverUrl + apiPath;
- // string systemName = systemType == "collect" ? "数据采集系统" : "医疗机构前置";
-
- // Global.writeLog($"[CloudImage] [{systemName}] 请求URL: {apiUrl}");
- // ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
- // ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
- // HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);
- // request.Method = "POST";
- // request.ContentType = "application/json; charset=utf-8";
- // request.Timeout = TIMEOUT_MS;
- // byte[] data = Encoding.UTF8.GetBytes(requestData);
- // request.ContentLength = data.Length;
- // using (Stream reqStream = request.GetRequestStream())
- // {
- // reqStream.Write(data, 0, data.Length);
- // }
- // using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
- // {
- // using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
- // {
- // return reader.ReadToEnd();
- // }
- // }
- //}
- private string SendRequest(string infno, string requestData)
- {
- var targetInfo = ApiUrlMapping[infno];
- string systemType = targetInfo.Item1; // "collect" 或 "medpre"
- string apiPath = targetInfo.Item2;
- // 根据系统类型选择服务器地址
- string serverUrl = systemType == "collect"
- ? CollectServerUrl.TrimEnd('/')
- : MedPreServerUrl.TrimEnd('/');
- string apiUrl = serverUrl + apiPath;
- string systemName = systemType == "collect" ? "数据采集系统" : "医疗机构前置";
- Global.writeLog($"[CloudImage] [{systemName}] 请求URL: {apiUrl}");
- string input = requestData;
- string output = "";
- string url = apiUrl; // 用于 finally 中的日志
- try
- {
- ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
- ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
- HttpWebRequest request = (HttpWebRequest)WebRequest.Create(apiUrl);
- request.Method = "POST";
- request.ContentType = "application/json; charset=utf-8";
- request.Timeout = TIMEOUT_MS;
- byte[] data = Encoding.UTF8.GetBytes(requestData);
- request.ContentLength = data.Length;
- using (Stream reqStream = request.GetRequestStream())
- {
- reqStream.Write(data, 0, data.Length);
- }
- using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
- using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
- {
- output = reader.ReadToEnd();
- return output;
- }
- }
- catch (Exception ex)
- {
- // 捕获异常,记录到 output 供日志使用
- output = $"[ERROR] {ex.Message} (StackTrace: {ex.StackTrace?.Substring(0, Math.Min(500, ex.StackTrace.Length))})";
- throw; // 重新抛出,保持原有异常行为
- }
- finally
- {
- // 统一日志:无论成功或失败都记录
- Global.writeLog($"{infno}:{url}", input, output);
- }
- }
- #endregion
- #region 私有方法 - 响应解析
- /// <summary>
- /// 解析响应报文并转换为统一返回格式
- /// 响应格式:{ infcode, msgid, refmsg_time, respond_time, err_msg, Output }
- /// </summary>
- private JObject ParseResponse(string responseStr)
- {
- try
- {
- JObject joResponse = JObject.Parse(responseStr);
- string infcode = JsonHelper.getDestValue(joResponse, "infcode");
- string err_msg = JsonHelper.getDestValue(joResponse, "err_msg");
- // infcode == "0" 表示成功
- if (infcode == "0")
- {
- JObject joRtn = new JObject();
- joRtn.Add("errorCode", 0);
- joRtn.Add("errorMessage", "");
-
- // 将Output节点作为result返回给HIS
- if (joResponse.ContainsKey("Output"))
- {
- joRtn.Add("result", joResponse["Output"]);
- }
- else
- {
- joRtn.Add("result", new JObject());
- }
-
- return joRtn;
- }
- else
- {
- // 返回错误信息
- return JsonHelper.setExceptionJson(-1, "云影像接口错误",
- !string.IsNullOrEmpty(err_msg) ? err_msg : "未知错误");
- }
- }
- catch (Exception ex)
- {
- return JsonHelper.setExceptionJson(-1, "解析响应异常", ex.Message);
- }
- }
- /// <summary>
- /// 获取交易名称(用于日志)
- /// </summary>
- private string GetInfNoName(string infno)
- {
- return InfNoNameMapping.ContainsKey(infno) ? InfNoNameMapping[infno] : "未知交易";
- }
- #endregion
- #region 公开方法 - 便捷方法(数据采集系统)
- /// <summary>
- /// 11101 患者基本信息上传
- /// </summary>
- public JObject UploadPatnBasInfo(object input) { return Execute("11101", input); }
- /// <summary>
- /// 11102 患者费用明细信息上传
- /// </summary>
- public JObject UploadPatnFeeDetail(object input) { return Execute("11102", input); }
- /// <summary>
- /// 11103 患者费用结算信息上传
- /// </summary>
- public JObject UploadPatnFeeSettle(object input) { return Execute("11103", input); }
- /// <summary>
- /// 11104 住院病案首页上传
- /// </summary>
- public JObject UploadInpMedRec(object input) { return Execute("11104", input); }
- /// <summary>
- /// 11105 住院病历记录上传
- /// </summary>
- public JObject UploadInpCaseRecord(object input) { return Execute("11105", input); }
- /// <summary>
- /// 11106 门急诊诊疗记录上传
- /// </summary>
- public JObject UploadOPEmrRecord(object input) { return Execute("11106", input); }
- /// <summary>
- /// 11107 急诊留观手术及抢救信息上传
- /// </summary>
- public JObject UploadEmrgObsSurgery(object input) { return Execute("11107", input); }
- /// <summary>
- /// 11108 医嘱明细记录上传
- /// </summary>
- public JObject UploadMedOrderDetail(object input) { return Execute("11108", input); }
- /// <summary>
- /// 11109 输血信息上传
- /// </summary>
- public JObject UploadBloodTransfusion(object input) { return Execute("11109", input); }
- /// <summary>
- /// 11110 护理操作生命体征测量记录上传
- /// </summary>
- public JObject UploadNursingVitalsign(object input) { return Execute("11110", input); }
- /// <summary>
- /// 11201 患者基本信息删除
- /// </summary>
- public JObject DeletePatnBasInfo(object input) { return Execute("11201", input); }
- /// <summary>
- /// 11202 就诊业务数据删除
- /// </summary>
- public JObject DeleteVisitBizData(object input) { return Execute("11202", input); }
- /// <summary>
- /// 11301 新生儿信息上传
- /// </summary>
- public JObject UploadNewbornInfo(object input) { return Execute("11301", input); }
- /// <summary>
- /// 11302 死亡医学证明上传
- /// </summary>
- public JObject UploadDeathCert(object input) { return Execute("11302", input); }
- /// <summary>
- /// 11401 透析治疗记录上传
- /// </summary>
- public JObject UploadDialysisRecord(object input) { return Execute("11401", input); }
- /// <summary>
- /// 11402 预防接种记录上传
- /// </summary>
- public JObject UploadVaccinationRecord(object input) { return Execute("11402", input); }
- /// <summary>
- /// 11501 高危人群筛查记录上传
- /// </summary>
- public JObject UploadHighRiskScreening(object input) { return Execute("11501", input); }
- /// <summary>
- /// 11502 体检登记信息上传
- /// </summary>
- public JObject UploadHealthExamReg(object input) { return Execute("11502", input); }
- #endregion
- #region 公开方法 - 便捷方法(医疗机构前置)
- /// <summary>
- /// 12101 临床检验报告上传
- /// </summary>
- public JObject UploadInspection(object input) { return Execute("12101", input); }
- /// <summary>
- /// 12102 临床检查报告上传(云影像核心接口)
- /// </summary>
- public JObject UploadStudy(object input) { return Execute("12102", input); }
- /// <summary>
- /// 12103 病理检查报告上传
- /// </summary>
- public JObject UploadPathology(object input) { return Execute("12103", input); }
- /// <summary>
- /// 12104 细菌培养报告上传
- /// </summary>
- public JObject UploadBacterial(object input) { return Execute("12104", input); }
- /// <summary>
- /// 12105 检验检查报告删除
- /// </summary>
- public JObject DeleteReport(object input) { return Execute("12105", input); }
- /// <summary>
- /// 12201 检查报告结算信息上传
- /// </summary>
- public JObject UploadSettle(object input) { return Execute("12201", input); }
- /// <summary>
- /// 12202 检查报告结算信息删除
- /// </summary>
- public JObject DeleteSettle(object input) { return Execute("12202", input); }
- /// <summary>
- /// 12301 预约挂号信息上传
- /// </summary>
- public JObject UploadAppointment(object input) { return Execute("12301", input); }
- /// <summary>
- /// 12302 预约挂号信息删除
- /// </summary>
- public JObject DeleteAppointment(object input) { return Execute("12302", input); }
- /// <summary>
- /// 12401 影像索引查询(预留)
- /// </summary>
- public JObject QueryImageIndex(object input) { return Execute("12401", input); }
- /// <summary>
- /// 12402 影像调阅查看(预留)
- /// </summary>
- public JObject ViewImage(object input) { return Execute("12402", input); }
- #endregion
- #region 配置方法
- /// <summary>
- /// 从外部设置数据采集系统服务器地址(支持运行时动态配置)
- /// </summary>
- /// <param name="serverUrl">完整的服务器地址,如 http://192.168.1.100:8091</param>
- public void SetCollectServerUrl(string serverUrl)
- {
- if (!string.IsNullOrWhiteSpace(serverUrl))
- {
- CollectServerUrl = serverUrl.TrimEnd('/');
- }
- }
- /// <summary>
- /// 从外部设置医疗机构前置服务器地址(支持运行时动态配置)
- /// </summary>
- /// <param name="serverUrl">完整的服务器地址,如 http://192.168.1.100:5002</param>
- public void SetMedPreServerUrl(string serverUrl)
- {
- if (!string.IsNullOrWhiteSpace(serverUrl))
- {
- MedPreServerUrl = serverUrl.TrimEnd('/');
- }
- }
- /// <summary>
- /// 从外部设置APIKEY
- /// </summary>
- /// <param name="apikey"></param>
- public void SetAPIKey(string apikey)
- {
- if (!string.IsNullOrWhiteSpace(apikey))
- {
- ApiKey = apikey;
- }
- }
- /// <summary>
- /// 从外部设置APIKEY
- /// </summary>
- /// <param name="apikey"></param>
- public void SetFixmedinsCode(string fixmedinsCode)
- {
- if (!string.IsNullOrWhiteSpace(fixmedinsCode))
- {
- FixmedinsCode = fixmedinsCode;
- }
- }
- /// <summary>
- /// 获取所有支持的交易编号列表
- /// </summary>
- public List<string> GetSupportedInfNos()
- {
- return new List<string>(ApiUrlMapping.Keys);
- }
- /// <summary>
- /// 获取指定系统类型的交易编号列表
- /// </summary>
- /// <param name="systemType">"collect"=数据采集系统, "medpre"=医疗机构前置</param>
- public List<string> GetInfNosBySystem(string systemType)
- {
- List<string> result = new List<string>();
- foreach (var kv in ApiUrlMapping)
- {
- if (kv.Value.Item1 == systemType)
- {
- result.Add(kv.Key);
- }
- }
- return result;
- }
- #endregion
- }
- }
|