|
@@ -8,12 +8,13 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using System.Windows.Forms;
|
|
|
|
|
|
namespace PTMedicalInsurance.Business
|
|
|
{
|
|
|
class LocalMedDirDownloadProcess : AbstractProcess
|
|
|
{
|
|
|
- double maxNo = 0;
|
|
|
+ int maxNo = 0;
|
|
|
/// <summary>
|
|
|
/// 药品、诊疗目录
|
|
|
/// </summary>
|
|
@@ -24,17 +25,24 @@ namespace PTMedicalInsurance.Business
|
|
|
// sbjgbh传需要查询的社保局编号,济南医疗传370100(或37010101),工伤传37019L(或37019L01)省医保37000000
|
|
|
if(!string.IsNullOrEmpty(input["ver"].Text()))
|
|
|
{
|
|
|
- maxNo = double.Parse(input["ver"].Text());
|
|
|
+ maxNo = int.Parse(input["ver"].Text());
|
|
|
}
|
|
|
bool hasMore = true;
|
|
|
+
|
|
|
while (hasMore)
|
|
|
{
|
|
|
- var ret = FetchDirectory(TradeEnum.DirectoryDownload,"yyxm_ds");
|
|
|
+
|
|
|
+ var ret = FetchDirectory(TradeEnum.DirectoryDownloadCore, "ylxm_ds", "sxzfbl_ds", "xj_ds");
|
|
|
+
|
|
|
hasMore = ret.hasMore;
|
|
|
+
|
|
|
updateDirectory(ret.data);
|
|
|
+
|
|
|
+ updateLimitPrice(ret.limitData);
|
|
|
// 多自费项目
|
|
|
- updateSelfPercent(ret.data);
|
|
|
+ updateSelfPercent(ret.percentData);
|
|
|
}
|
|
|
+
|
|
|
return IrisReturn("更新成功!", null);
|
|
|
}
|
|
|
|
|
@@ -65,7 +73,7 @@ namespace PTMedicalInsurance.Business
|
|
|
try
|
|
|
{
|
|
|
|
|
|
- joIn.Add(new JProperty("params", data));
|
|
|
+ joIn.Add("params", JArray.Parse(JsonHelper.toJsonString(data)));
|
|
|
joIn.Add("code", "09010035");
|
|
|
joIn.Add("updateUserID", Global.user.ID);
|
|
|
InvokeHelper invoker = new InvokeHelper();
|
|
@@ -82,22 +90,40 @@ namespace PTMedicalInsurance.Business
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private (bool hasMore, JArray data, JArray percentData, JArray limitData) FetchDirectory(TradeEnum trade, string dsName)
|
|
|
+ {
|
|
|
+ return FetchDirectory(trade,dsName,null,null);
|
|
|
+ }
|
|
|
|
|
|
- private (bool hasMore, JArray data) FetchDirectory(TradeEnum trade, string dsName)
|
|
|
+ private (bool hasMore, JArray data,JArray percentData,JArray limitData) FetchDirectory(TradeEnum trade, string dsName,string percentName,string limitName)
|
|
|
{
|
|
|
JObject joInput = new JObject();
|
|
|
- joInput["p_sxh"] = maxNo; //全量下载0,后面传最大
|
|
|
+ joInput["p_sxh"] = maxNo.ToString(); //全量下载0,后面传最大
|
|
|
Global.pat.insuplc_admdvs = "370100";
|
|
|
JObject joRtn = invoker.invokeCenterService(trade, joInput);
|
|
|
if ("0".Equals(JsonHelper.getDestValue(joRtn, "resultcode")))
|
|
|
{
|
|
|
// 是否还有数据
|
|
|
- bool hasMore = Boolean.Parse(JsonHelper.getDestValue(joRtn, "sfjxxz"));
|
|
|
+ bool hasMore = "1".Equals(JsonHelper.getDestValue(joRtn, "sfjxxz"));
|
|
|
JArray data = JArray.Parse(JsonHelper.getDestValue(joRtn, dsName));
|
|
|
- return (hasMore, data);
|
|
|
+ JArray percent = new JArray();
|
|
|
+ if (!string.IsNullOrEmpty(percentName))
|
|
|
+ {
|
|
|
+ percent = JArray.Parse(JsonHelper.getDestValue(joRtn, percentName));
|
|
|
+ }
|
|
|
+ JArray limit = new JArray();
|
|
|
+ if (!string.IsNullOrEmpty(limitName))
|
|
|
+ {
|
|
|
+ limit = JArray.Parse(JsonHelper.getDestValue(joRtn, limitName));
|
|
|
+ }
|
|
|
+ return (hasMore, data, percent, limit);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ MessageBox.Show(JsonHelper.getDestValue(joRtn, "err_msg"));
|
|
|
}
|
|
|
|
|
|
- return (false, new JArray());
|
|
|
+ return (false, new JArray(), new JArray(), new JArray());
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -110,12 +136,12 @@ namespace PTMedicalInsurance.Business
|
|
|
//sbjgbh传需要查询的社保局编号,济南医疗传370100(或37010101),工伤传37019L(或37019L01)
|
|
|
if (!string.IsNullOrEmpty(input["ver"].Text()))
|
|
|
{
|
|
|
- maxNo = double.Parse(input["ver"].Text());
|
|
|
+ maxNo = int.Parse(input["ver"].Text());
|
|
|
}
|
|
|
bool hasMore = true;
|
|
|
while (hasMore)
|
|
|
{
|
|
|
- var ret = FetchDirectory(TradeEnum.DiseaseDownload, "ybjb_ds");
|
|
|
+ var ret = FetchDirectory(TradeEnum.DirectoryDownloadCore, "ybjb_ds");
|
|
|
hasMore = ret.hasMore;
|
|
|
List<HBMedInsuDirectory> list = new List<HBMedInsuDirectory>();
|
|
|
foreach (var d in ret.data)
|
|
@@ -148,48 +174,55 @@ namespace PTMedicalInsurance.Business
|
|
|
{
|
|
|
string hisType = obj["ypbz"].Text() ?? "2";
|
|
|
string hisTypeName = hisType.Equals("1") ? "药品" : "诊疗"; HBMedInsuDirectory insu = new HBMedInsuDirectory();
|
|
|
+
|
|
|
+ maxNo = Math.Max(maxNo, int.Parse(obj["sxh"].ToString()));
|
|
|
insu.ID = "";
|
|
|
insu.updateUserID = Global.user.ID;
|
|
|
insu.HospitalDr = Global.inf.hospitalDr;
|
|
|
insu.InterfaceDr = Global.inf.interfaceDr;
|
|
|
- insu.Code = obj["yyxmbm"].Text();
|
|
|
- insu.Name = obj["yyxmmc"].Text();
|
|
|
+ insu.Code = obj["ylxmbm"].Text();
|
|
|
+ insu.Name = obj["ylxmbzmc"].Text();
|
|
|
insu.NationalCode = obj["gbxmbm"].Text();
|
|
|
insu.NationalName = obj["gbxmmc"].Text();
|
|
|
insu.HisType = hisType;
|
|
|
insu.HisTypeName = hisTypeName;
|
|
|
- insu.LocateCode = obj["ylxmbm"].Text();
|
|
|
- insu.LocateName = "";
|
|
|
+ insu.LocateCode = obj["pms_id"].Text();
|
|
|
+ insu.LocateName = obj["pms_name"].Text();
|
|
|
insu.DosageFormCode = obj["jxm"].Text();
|
|
|
insu.DosageFormName = obj["jxm"].Text();
|
|
|
- insu.CategoryCode = obj["yltclb"].Text();
|
|
|
+ insu.CategoryCode = obj["listtype"].Text();
|
|
|
insu.CategoryName = "";
|
|
|
+ // 规格
|
|
|
insu.Specification = obj["bzgg"].Text();
|
|
|
insu.SpecificationCode = obj["gg"].Text();
|
|
|
insu.UnitOfPackag = obj["dw"].Text();
|
|
|
- insu.UnitOfValuation = "";
|
|
|
- insu.StartDate = obj["qsrq"].Text();
|
|
|
- insu.EndDate = obj["zzrq"].Text();
|
|
|
- insu.PinyinSearchCode = "";
|
|
|
- insu.Instructions = obj["sm"].Text();
|
|
|
- insu.ExceptContent = "";
|
|
|
- insu.Connotation = "";
|
|
|
+ insu.UnitOfValuation = obj["ms_charge_unit"].Text();
|
|
|
+ //insu.StartDate = obj["qsrq"].Text();
|
|
|
+ //insu.EndDate = obj["zzrq"].Text();
|
|
|
+ insu.PinyinSearchCode = obj["py"].Text();
|
|
|
+ insu.Instructions = obj["ms_explain"].Text();
|
|
|
+ insu.ExceptContent = obj["cwnr"].Text();
|
|
|
+ insu.Connotation = obj["xmnh"].Text();
|
|
|
insu.ValidFlag = obj["spbz"].Int();
|
|
|
insu.Note = "";
|
|
|
insu.VersionNO = obj["sxh"].Text();
|
|
|
insu.VersionName = obj["sxh"].Text();
|
|
|
- insu.UseFlag = 1;
|
|
|
- insu.DrugSafetyStandardCode = "";
|
|
|
- insu.ApprovalNO = "";
|
|
|
+ string cancelFlag = obj["zxbz"].Text();
|
|
|
+ insu.UseFlag = "1".Equals(cancelFlag)?0:1;
|
|
|
+ insu.DrugSafetyStandardCode = obj["ypbwm"].Text();
|
|
|
+ insu.ApprovalNO = obj["bzwh"].Text(); ;
|
|
|
//insu.SpecialFlag = obj[""].Int();
|
|
|
//insu.LimitFlag = obj[""].Int();
|
|
|
//insu.LimitRange = obj[""].Text();
|
|
|
- //insu.UniqueRecordNO = obj[""].Text();
|
|
|
+ insu.UniqueRecordNO = obj["sxh"].Text();
|
|
|
insu.Manufacturers = obj["scqy"].Text();
|
|
|
insu.SelfPercent = obj["zfbl"].Text();
|
|
|
- //insu.ChargeItemLevelName = obj[""].Text();
|
|
|
- insu.MinPackagingQuantity = obj["bzsl"].Text();
|
|
|
- insu.MinPackagingUnit = obj["zxgg"].Text();
|
|
|
+ insu.ChargeItemLevelName = obj["mldj"].Text();
|
|
|
+ insu.MinPackagingQuantity = obj["zxbzsl"].Text();
|
|
|
+ insu.MinPackagingUnit = obj["gjjzxbzdw"].Text();
|
|
|
+
|
|
|
+ insu.UpdateTime = obj["gxsj"].Text();
|
|
|
+
|
|
|
if (insu.SelfPercent == "100")
|
|
|
{
|
|
|
insu.ChargeItemLevel = "01";
|
|
@@ -208,6 +241,48 @@ namespace PTMedicalInsurance.Business
|
|
|
|
|
|
return insu;
|
|
|
}
|
|
|
+
|
|
|
+ private int updateLimitPrice(JArray data)
|
|
|
+ {
|
|
|
+ if (data?.Count < 1) return 0;
|
|
|
+ string errMsg = "";
|
|
|
+ JArray joArray = new JArray();
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ foreach (var dir in data)
|
|
|
+ {
|
|
|
+ dynamic joTmp = new JObject();
|
|
|
+ joTmp.HospitalDr = Global.inf.hospitalDr;
|
|
|
+ joTmp.InterfaceDr = Global.inf.interfaceDr;
|
|
|
+ joTmp.updateUserID = Global.user.ID;
|
|
|
+ joTmp.Code = dir["ylxmbm"].Text();
|
|
|
+ joTmp.PersonnelType = dir["rqlb"].Text(); //人群类别
|
|
|
+ joTmp.LimitType = dir["yltclb"].Text(); //限价类型(统筹类别)
|
|
|
+ joTmp.BeginDate = Utils.ConvertShortDate(dir["qsrq"].Text());
|
|
|
+ joTmp.EndDate = Utils.ConvertShortDate(dir["zzrq"].Text());
|
|
|
+ joTmp.UpLimitAmount = dir["xj"].Text(); //限价
|
|
|
+ joArray.Add(joTmp);
|
|
|
+ }
|
|
|
+ JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010084", joArray).ToString(), "更新限价信息");
|
|
|
+
|
|
|
+ if (JsonHelper.parseIrisRtnValue(joRtn, out errMsg) != 0)
|
|
|
+ {
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ outParam = joRtn.ToString();
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+ outParam = "更新项目自费比例:" + ex.Message;
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 如果存在同一个目录多个比例,则保存在比例扩展表
|
|
|
/// </summary>
|
|
@@ -223,18 +298,16 @@ namespace PTMedicalInsurance.Business
|
|
|
{
|
|
|
foreach (var dir in data)
|
|
|
{
|
|
|
- double rowNo = Double.Parse(dir["sxh"].ToString());
|
|
|
- maxNo = Math.Max(maxNo, rowNo);
|
|
|
-
|
|
|
dynamic joTmp = new JObject();
|
|
|
joTmp.HospitalDr = Global.inf.hospitalDr;
|
|
|
joTmp.InterfaceDr = Global.inf.interfaceDr;
|
|
|
joTmp.updateUserID = Global.user.ID;
|
|
|
- joTmp.Code = dir["yyxmbm"];
|
|
|
- joTmp.Name = dir["yyxmmc"];
|
|
|
- joTmp.PersonnelType = dir["rqlb"]; //人群类别
|
|
|
- joTmp.ProportionType = dir["yltclb"]; //自费类型(统筹类别)
|
|
|
- joTmp.Proportion = dir["zfbl"];
|
|
|
+ joTmp.Code = dir["ylxmbm"].Text();
|
|
|
+ joTmp.PersonnelType = "C";
|
|
|
+ joTmp.ProportionType = "6"; //自费类型(统筹类别)
|
|
|
+ joTmp.BeginDate = Utils.ConvertShortDate(dir["qsrq"].Text());
|
|
|
+ joTmp.EndDate = Utils.ConvertShortDate(dir["zzrq"].Text());
|
|
|
+ joTmp.Proportion = dir["sxzfbl"].Text();
|
|
|
joArray.Add(joTmp);
|
|
|
}
|
|
|
JObject joRtn = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010085", joArray).ToString(), "更新项目自费比例");
|