浏览代码

fix:处理代码冲突 住院医保基金结算单打印

zzz 1 年之前
父节点
当前提交
c5dfb93895

+ 1 - 1
Business/IrisServices.cs

@@ -1773,7 +1773,7 @@ namespace PTMedicalInsurance.Business
             }
             catch (Exception ex)
             {
-                return JsonHelper.setExceptionJson(-1, "查询交易日志(冲正)异常:", ex.Message);
+                return JsonHelper.setExceptionJson(-1, "查询结算信息:", ex.Message);
             }
 
         }

+ 46 - 0
Common/CardReader.cs

@@ -26,6 +26,8 @@ using System.Text;
 using System.Threading.Tasks;
 using PTMedicalInsurance.Variables;
 using System.Windows.Forms;
+using Newtonsoft.Json.Linq;
+using PTMedicalInsurance.Helper;
 
 namespace PTMedicalInsurance.Common
 {
@@ -434,4 +436,48 @@ class CardReader_HLJ
         }
 
     }
+
+
+    #region【调用正版FastRepor打印】
+    class FastReportPrint
+    {
+        //医保结算单打印调用正版FastReport
+        [DllImport(@"C:\ProgramData\prykNT\prBrowser\bin\service\plugins\INSUNew\FastReportFrom.dll", EntryPoint = "Main",
+                   CharSet = CharSet.Ansi, ExactSpelling = false, CallingConvention = CallingConvention.StdCall)]
+        public static extern string FastReport(StringBuilder InData);
+
+        public int FastReport(string sInput, out string sOutInfo)
+        {
+            string errMsg;
+            sOutInfo = "";
+            int rtn = -1;
+            try
+            {
+                StringBuilder bInput = new StringBuilder(sInput);
+
+                sOutInfo = FastReport(bInput);
+                JObject joRetObj = JObject.Parse(sOutInfo);
+
+                if (JsonHelper.parseIrisRtnValue(joRetObj, out errMsg) != 0)
+                {
+                    errMsg = "调用FastReport打印失败!" + errMsg;
+                    return rtn;
+                }
+                else
+                {
+                    return 0;
+                }
+            }
+            catch (Exception ex)
+            {
+                sOutInfo = "FastReportPrint异常:" + ex.Message;
+                return rtn;
+            }
+            finally
+            {
+                Global.writeLog("调用FastReportPrint函数:", sInput, sOutInfo);
+            }
+        }
+    }
+#endregion
 }

+ 3 - 1
Common/Common.cs

@@ -608,7 +608,9 @@ namespace PTMedicalInsurance.Common
             return pyString;
         }
 
-        private static String[] WB = new String[] {
+
+
+            private static String[] WB = new String[] {
             "A鞴鞲鞣鞫鞯鞔鞒鞑鞅靼銎跫綦翳蛩颟鹳鹋鸫鸢慝觐觋贳瓯戡檠迓甙忒弋撖摁廾蘼蘖蘩蘅蘧藿藜藁藓薰薷薹薅薜薮蕹薏薇薨薤蕻蕲蕃瞢蕺蕞蕤蕨蕈蕙蓼蓿蔻蕖蔺蔟蔹蓰蔸甍蔌蓣蓥蒗蒴蒹蒡蓠蒺蒿蓊蓓蒽蓦蓐蓍蓁葭萱蒎蒌葶葩葆萼葸蒉葺蒈蒇葳葙葚葑葜菡菰萦菀菅菪菹菸萃萏菟菔萆萑萸萜菖菽菝萋萘堇菘菥萁菁莼莺莨莞莘荻莸荽莩莶荼莅莜莓莪莠莴莳荸莰荮荭荪荬荩茛荨荥荦茳茺茭荠茗荀荟荃荇荏茯荞莛茱茴茼莒茈荜荛荑茜苕苠茕茔茆茚茑苓苻茌苘苒苴苜茇茏苤苷茉苡芤苎苄芟芪芡芴芩苁苌苋芮芷芘苣苊苈芰芾芸芫芙芗芑芎芄芨芊芏艿艽艹鄞郾邛劐蒯赜匾匮匦叵匚廿茁著芝蒸斟蔗蘸藻葬匝蕴苑芋荧营萤莹英荫茵艺颐医药尧燕雅牙芽鸦薛靴蓄芯薪邪鞋萧巷项匣熙昔芜巫卧蔚萎苇藤萄苔蓑蒜苏斯薯蔬世式甚芍苫莎散萨若蕊茹荣蓉茸戎惹鹊颧区擎芹勤莲荔莉蕾勒劳蓝莱葵匡苦恐苛勘菌巨菊鞠敬警茎荆靳芥藉戒节蕉匠蒋荐茧荚蓟基惑或获荤茄切翘鞘巧蔷其七欺期蒲菩葡莆萍苹匹蓬藕殴鸥欧孽蔫匿慕募幕暮墓某莫蘑摹蔑藐苗蒙萌茂茅莽茫芒蔓落萝芦菱黄荒划花葫菏荷邯菇苟共贡汞巩恭功攻工葛革戈甘芬匪菲芳范藩贰董东蒂荡葱茨臣茶茬草藏苍蔡菜菠鞭蔽蓖苯薄苞靶芭鞍艾蔼",
             "B粜蚩颞聩聒聍聆聃耵骘孢孓孑屮隳凵勐鄹隰隗隍隈陴陲陬陧陟陔陉陂阼阽阪阱阡阢阝卺亟丞阻子孜坠职阵障陨院隅隐阴也耶阳逊限陷险隙卫陀陶孙祟隧随隋陕阮孺娶取了辽聊联孔聚阶降际聘陪聂陌孟陆陋陇隆陵函孩孤耿隔附防耳堕队陡耽聪除出耻承陈陛隘阿",
             "C鍪蟊蝥颡矜皴鹬鹜甬瞀怼炱毵骧骥骣骢骠骟骝骛骖骓骒骐骊骈骅骁骀驿驺驸驷驵婺逡迨迳巯畚弁厶邰刭驻骤蚤允驭豫预予又勇恿以矣验驯熊戏驼驮通台双驶圣骚桑叁柔劝驱垒骏驹颈劲骄艰鸡骑骗能难牟矛马骆骡驴欢骇观对叠邓怠驰骋叉参驳巴",

+ 229 - 0
Common/FastReportFunction.cs

@@ -0,0 +1,229 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using FastReport;
+
+namespace FastReport
+{
+    public class FastReportFunction
+    {
+
+
+        /// <summary>
+        /// 金额转换成中文大写金额
+        /// </summary>
+        /// <param name="LowerMoney">eg:10.74</param>
+        /// <returns></returns>
+        public static string MoneyToUpper(string LowerMoney)
+        {
+            string functionReturnValue = null;
+            bool IsNegative = false; // 是否是负数
+            if (LowerMoney.Trim().Substring(0, 1) == "-")
+            {
+                // 是负数则先转为正数
+                LowerMoney = LowerMoney.Trim().Remove(0, 1);
+                IsNegative = true;
+            }
+            string strLower = null;
+            string strUpart = null;
+            string strUpper = null;
+            int iTemp = 0;
+            // 保留两位小数 123.489→123.49  123.4→123.4
+            LowerMoney = Math.Round(double.Parse(LowerMoney), 2).ToString();
+            if (LowerMoney.IndexOf(".") > 0)
+            {
+                if (LowerMoney.IndexOf(".") == LowerMoney.Length - 2)
+                {
+                    LowerMoney = LowerMoney + "0";
+                }
+            }
+            else
+            {
+                LowerMoney = LowerMoney + ".00";
+            }
+            strLower = LowerMoney;
+            iTemp = 1;
+            strUpper = "";
+            while (iTemp <= strLower.Length)
+            {
+                switch (strLower.Substring(strLower.Length - iTemp, 1))
+                {
+                    case ".":
+                        strUpart = "圆";
+                        break;
+                    case "0":
+                        strUpart = "零";
+                        break;
+                    case "1":
+                        strUpart = "壹";
+                        break;
+                    case "2":
+                        strUpart = "贰";
+                        break;
+                    case "3":
+                        strUpart = "叁";
+                        break;
+                    case "4":
+                        strUpart = "肆";
+                        break;
+                    case "5":
+                        strUpart = "伍";
+                        break;
+                    case "6":
+                        strUpart = "陆";
+                        break;
+                    case "7":
+                        strUpart = "柒";
+                        break;
+                    case "8":
+                        strUpart = "捌";
+                        break;
+                    case "9":
+                        strUpart = "玖";
+                        break;
+                }
+
+                switch (iTemp)
+                {
+                    case 1:
+                        strUpart = strUpart + "分";
+                        break;
+                    case 2:
+                        strUpart = strUpart + "角";
+                        break;
+                    case 3:
+                        strUpart = strUpart + "";
+                        break;
+                    case 4:
+                        strUpart = strUpart + "";
+                        break;
+                    case 5:
+                        strUpart = strUpart + "拾";
+                        break;
+                    case 6:
+                        strUpart = strUpart + "佰";
+                        break;
+                    case 7:
+                        strUpart = strUpart + "仟";
+                        break;
+                    case 8:
+                        strUpart = strUpart + "万";
+                        break;
+                    case 9:
+                        strUpart = strUpart + "拾";
+                        break;
+                    case 10:
+                        strUpart = strUpart + "佰";
+                        break;
+                    case 11:
+                        strUpart = strUpart + "仟";
+                        break;
+                    case 12:
+                        strUpart = strUpart + "亿";
+                        break;
+                    case 13:
+                        strUpart = strUpart + "拾";
+                        break;
+                    case 14:
+                        strUpart = strUpart + "佰";
+                        break;
+                    case 15:
+                        strUpart = strUpart + "仟";
+                        break;
+                    case 16:
+                        strUpart = strUpart + "万";
+                        break;
+                    default:
+                        strUpart = strUpart + "";
+                        break;
+                }
+
+                strUpper = strUpart + strUpper;
+                iTemp = iTemp + 1;
+            }
+
+            strUpper = strUpper.Replace("零拾", "零");
+            strUpper = strUpper.Replace("零佰", "零");
+            strUpper = strUpper.Replace("零仟", "零");
+            strUpper = strUpper.Replace("零零零", "零");
+            strUpper = strUpper.Replace("零零", "零");
+            strUpper = strUpper.Replace("零角零分", "整");
+            strUpper = strUpper.Replace("零分", "整");
+            strUpper = strUpper.Replace("零角", "零");
+            strUpper = strUpper.Replace("零亿零万零圆", "亿圆");
+            strUpper = strUpper.Replace("亿零万零圆", "亿圆");
+            strUpper = strUpper.Replace("零亿零万", "亿");
+            strUpper = strUpper.Replace("零万零圆", "万圆");
+            strUpper = strUpper.Replace("零亿", "亿");
+            strUpper = strUpper.Replace("零万", "万");
+            strUpper = strUpper.Replace("零圆", "圆");
+            strUpper = strUpper.Replace("零零", "零");
+
+            // 对壹圆以下的金额的处理
+            if (strUpper.Substring(0, 1) == "圆")
+            {
+                strUpper = strUpper.Substring(1, strUpper.Length - 1);
+            }
+            if (strUpper.Substring(0, 1) == "零")
+            {
+                strUpper = strUpper.Substring(1, strUpper.Length - 1);
+            }
+            if (strUpper.Substring(0, 1) == "角")
+            {
+                strUpper = strUpper.Substring(1, strUpper.Length - 1);
+            }
+            if (strUpper.Substring(0, 1) == "分")
+            {
+                strUpper = strUpper.Substring(1, strUpper.Length - 1);
+            }
+            if (strUpper.Substring(0, 1) == "整")
+            {
+                strUpper = "零圆整";
+            }
+            functionReturnValue = strUpper;
+
+            if (IsNegative == true)
+            {
+                return "负" + functionReturnValue;
+            }
+            else
+            {
+                return functionReturnValue;
+            }
+        }
+
+            public static string moneyToChinese(string money)
+        {
+            /*
+             //将小写金额转换成大写金额          
+             double MyNumber = Convert.ToDouble(money);
+             string je= money.ToString();
+             String[] MyScale = { "分", "角", "元", "拾", "佰", "仟", "万", "拾", "佰", "仟", "亿", "拾", "佰", "仟", "兆", "拾", "佰", "仟" }; //定义单位字符串数组
+             String[] MyBase = { "零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖" }; //定义数字字符串数组
+             String M = "";
+             bool isPoint = false;
+             if (je.IndexOf(".") != -1)
+             {
+                 je = je.Remove(je.IndexOf("."), 1);
+                 isPoint = true;
+             }
+             for (int i = je.Length; i > 0; i--)
+             {
+                 int MyData = Convert.ToInt16(je[je.Length - i].ToString());//获取money中的数字,并转换为浮点型
+                 M += MyBase[MyData];//从mybase中取出同index的数字的汉字字符
+                 if (isPoint == true)
+                 {
+                     M += MyScale[i - 1];//获取单位
+                 }
+                 else
+                 {
+                     M += MyScale[i + 1];//获取单位
+                 }
+             }
+             return M; //返回转换的金额字符串*/
+            return "无语了";
+        }
+    }
+}

+ 367 - 51
Forms/SettlementChecklist.cs

@@ -16,6 +16,10 @@ using FastReport;
 using Newtonsoft.Json;
 using System.Threading;
 using PTMedicalInsurance.Business;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using FastReportFrom;
+using System.IO;
 
 namespace PTMedicalInsurance.Forms
 {
@@ -61,8 +65,8 @@ namespace PTMedicalInsurance.Forms
             }
             string sqlStr = "SELECT * FROM  BS_MedInsuSettlement WHERE Hospital_Dr=" + Global.inf.hospitalDr;
             sqlStr = sqlStr + " and SettlementID='" + setl_id + "'";
-
-            JObject joSqlStr = new JObject("sqlStr", sqlStr);
+            JObject joSqlStr = new JObject();
+            joSqlStr.Add("sqlStr", sqlStr);
             MIIrisServices mIS = new MIIrisServices();
             JObject joRtn = mIS.QuerySettlementInfo(joSqlStr);
             DataTable dt = (DataTable)joRtn["result"]["data"].ToObject(typeof(DataTable));
@@ -233,7 +237,13 @@ namespace PTMedicalInsurance.Forms
             try
             {
                 string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
-                FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
+              //  FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
+               // FastReport.Utils.RegisteredObjects.AddFunctionCategory("FastReport.FastReportFunction.moneyToChinese", "moneyToChinese");
+                //获取要注册的方法信息
+               MethodInfo methodInfo = typeof(FastReport.FastReportFunction).GetMethod("moneyToChinese");
+
+                // 注册函数目录为 FastReport MyFunction目录下 
+              //  FastReport.Utils.RegisteredObjects.AddFunction(methodInfo, "MyFunction");
 
                 JObject joSettleCheckList = getPatCheckList();
                 string errMsg;
@@ -245,10 +255,11 @@ namespace PTMedicalInsurance.Forms
                 Report report = new Report();
                 try
                 {
+                    
                     var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
                     report.RegisterData(json.result.data.classification, "classification");
                     report.RegisterData(json.result.data.settlement, "settlement");
-                    report.RegisterData(json.result.data.reginfo, "reginfo");
+                    report.RegisterData(json.result.data.reginfo, "reginfo"); 
                     report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
                 }
                 catch (Exception ex)
@@ -256,7 +267,7 @@ namespace PTMedicalInsurance.Forms
                     MessageBox.Show(ex.Message);
                     return;
                 }
-                report.Load(Global.curEvt.path + "\\frx\\云南昆明结算单.frx");
+                report.Load(Global.curEvt.path + "\\frx\\合肥瑶海普瑞医院.frx");
                 PrintDesign pf = new PrintDesign();
                 pf.designerControl1.Report = report;
 
@@ -273,41 +284,70 @@ namespace PTMedicalInsurance.Forms
         [STAThread]
         private void print()
         {
-       
-            string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
-            FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
+            /*
+             string chineseSimpleFrl = Global.curEvt.path + @"\Chinese (Simplified).frl";
+            // FastReport.Utils.Res.LoadLocale(chineseSimpleFrl);
+
+             JObject joSettleCheckList = getPatCheckList();
+             string errMsg;
+             if (JsonHelper.parseIrisRtnValue(joSettleCheckList, out errMsg) != 0)
+             {
+                 MessageBox.Show("查询结算信息异常:" + errMsg);
+                 return;
+             }
+             Report report = new Report();
+             try
+             {
+                 var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
+                 report.RegisterData(json.result.data.classification, "classification");
+                 report.RegisterData(json.result.data.settlement, "settlement");
+                 report.RegisterData(json.result.data.reginfo, "reginfo");
+                 report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
+             }
+             catch (Exception ex)
+             {
+                 MessageBox.Show(ex.Message);
+                 return;
+             }
+             //report.Design();
+             report.Load(Global.curEvt.path + "\\frx\\合肥瑶海普瑞医院.frx");
+             this.ShowInTaskbar = true;
+             PrintPreview pf = new PrintPreview();
+             report.Preview = pf.previewControl1;
+
+             report.Show();
+             pf.WindowState = FormWindowState.Maximized;
+             pf.ShowDialog();*/
 
-            JObject joSettleCheckList = getPatCheckList();
-            string errMsg;
-            if (JsonHelper.parseIrisRtnValue(joSettleCheckList, out errMsg) != 0)
-            {
-                MessageBox.Show("查询结算信息异常:" + errMsg);
-                return;
-            }
-            Report report = new Report();
             try
             {
-                var json = JsonConvert.DeserializeObject<Root>(getPatCheckList().ToString());
-                report.RegisterData(json.result.data.classification, "classification");
-                report.RegisterData(json.result.data.settlement, "settlement");
-                report.RegisterData(json.result.data.reginfo, "reginfo");
-                report.RegisterData(json.result.data.patinsuinfo, "patinsuinfo");
+                int i = dgvSettlRecord.CurrentRow.Index;
+                DataTable dt = (DataTable)dgvSettlRecord.DataSource;
+                string AdmID = dt.Rows[i]["AdmID"].ToString();
+                string SettlementID = dt.Rows[i]["SettlementID"].ToString();
+                string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
+                string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
+
+                JObject joRtn = GetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag);
+                if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
+                {
+                    MessageBox.Show("获取FastReport入参失败:" + errMsg);
+                    return;
+                }
+
+                string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
+                if (FastReportPrint(sFastReportParam, out errMsg) != 0)
+                {
+                    MessageBox.Show("调用FastReport打印失败!" + errMsg);
+                    return;
+                }
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
                 return;
             }
-            //report.Design();
-            report.Load(Global.curEvt.path + "\\frx\\云南昆明结算单.frx");
-            this.ShowInTaskbar = true;
-            PrintPreview pf = new PrintPreview();
-            report.Preview = pf.previewControl1;
-
-            report.Show();
-            pf.WindowState = FormWindowState.Maximized;
-            pf.ShowDialog();
-       
+
         }
 
         [STAThread]
@@ -330,7 +370,7 @@ namespace PTMedicalInsurance.Forms
                 return;
             }
             //report.Design();
-            report.Load(Global.curEvt.path + "\\frx\\云南昆明结算单.frx");
+            report.Load(Global.curEvt.path + "\\frx\\合肥瑶海普瑞医院.frx");
             //report.Show();
             PrintPreview preview1 = new PrintPreview();
             preview1.Show();
@@ -349,38 +389,314 @@ namespace PTMedicalInsurance.Forms
 
         public void btnPrint_Click(object sender, EventArgs e)
         {
-    
+
             try
             {
-                Thread thread = new Thread(new ThreadStart(print));
-                thread.SetApartmentState(ApartmentState.STA); //重点
-                thread.Start();
-                thread.Join();
+                //Thread thread_print = new Thread(new ThreadStart(print));
+                //thread_print.SetApartmentState(ApartmentState.STA); //重点
+                //thread_print.Start();
+                //thread_print.Join();
+                print();
             }
             catch (Exception ex)
             {
-                Global.writeLog("结算单打印异常:" + ex.Message);
-                MessageBox.Show("打印异常:" + ex.Message);
+               Global.writeLog("结算单打印异常:" + ex.Message);
+               MessageBox.Show("打印异常:" + ex.Message);
             }
-       
 
-            //CardReader CardRead = new CardReader();
-            //string sOutPar;
-            //CardRead.FastReportPrint(out sOutPar);
-            //if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
-            //{
-            //    MessageBox.Show("调用FastReportDLL失败:" + sOutPar);
-            //    return;
-            //}
+
+            if (dgvSettlRecord.RowCount <= 0)
+            {
+                MessageBox.Show("请先查询结算数据!");
+                return;
+            }
+            /*
+            try
+            {
+                int i = dgvSettlRecord.CurrentRow.Index;
+                DataTable dt = (DataTable)dgvSettlRecord.DataSource;
+                string AdmID = dt.Rows[i]["AdmID"].ToString();
+                string SettlementID = dt.Rows[i]["SettlementID"].ToString();
+                string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
+                string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
+
+                JObject joRtn = GetFastReportParams("", AdmID, MdtrtID, SettlementID, ValidFlag);
+                if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
+                {
+                    MessageBox.Show("获取FastReport入参失败:" + errMsg);
+                    return;
+                }
+
+                string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
+                if (FastReportPrint(sFastReportParam, out errMsg) != 0)
+                {
+                    MessageBox.Show("调用FastReport打印失败!" + errMsg);
+                    return;
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+                return;
+            }*/
+        }
+
+        public int FastReportPrint(string InParams, out string OutMsg)
+        {
+            Global.writeLog("调用FastReport入参:" + InParams);
+            try
+            {
+                #region【调用正版FastReport打印】                
+                FastReportFrom.FastReportDll FrDll = new FastReportFrom.FastReportDll();
+                string sRtnFr = FrDll.FastReport(InParams);
+
+                JObject joRetObj = JObject.Parse(sRtnFr);
+
+                if (JsonHelper.parseIrisRtnValue(joRetObj, out string errMsg) != 0)
+                {
+                    OutMsg = "调用FastReport打印失败!" + errMsg;
+                    return -1;
+                }
+                else
+                {
+                    OutMsg = "";
+                    return 0;
+                }
+                #endregion
+            }
+            catch (Exception ex)
+            {
+                OutMsg = "调用FastReport打印失败!" + ex.Message;
+                return -1;
+            }
+        }
+
+        public JObject GetFastReportParams(string designFlag, string admID, string MdtrtID, string settlementID, string validFlag)
+        {
+            try
+            {
+                if (designFlag == "") { designFlag = "N"; }
+
+                #region【获取HIS医保结算信息】
+                JObject joSettel = new JObject();
+                joSettel.Add("HospitalDr", Global.inf.hospitalDr);
+                joSettel.Add("interfaceDr", Global.inf.interfaceDr);
+                joSettel.Add("admID", admID);
+                joSettel.Add("SettlementID", settlementID);
+                joSettel.Add("ValidFlag", validFlag);
+                joSettel.Add("MdtrtID", MdtrtID);
+
+                JObject joRtnSettle = invoker.invokeInsuService(JsonHelper.setIrisInpar("09010066", joSettel).ToString(), "获取结算单信息");
+
+
+                if (JsonHelper.parseIrisRtnValue(joRtnSettle, out string errMsg) != 0)
+                {
+                    JObject joRtnSet = new JObject();
+                    joRtnSet.Add("errorCode", -1);
+                    joRtnSet.Add("errorMessage", errMsg);
+                    joRtnSet.Add("result", "");
+
+                    return joRtnSet;
+                }
+                #endregion
+                #region【获取住院号】
+                JObject joTmp = new JObject();
+                joTmp.Add("admID", joRtnSettle["result"]["data"]["settlement"][0]["AdmID"]);
+                joTmp.Add("psn_no", joRtnSettle["result"]["data"]["settlement"][0]["PersonnelNO"]);
+
+                //JObject joRtn = invoker.invokeHISService(JsonHelper.setIrisInpar("05110001", joTmp).ToString(), "获取诊断信息");
+                JObject joRtnDiag = invoker.invokeHISService(JsonHelper.setIrisInpar("05110014", joTmp).ToString(), "获取诊断信息");
+                string medrcdno = "";
+                if (JsonHelper.parseIrisRtnValue(joRtnSettle, out  errMsg) == 0)
+                {
+                     medrcdno= joRtnDiag["mdtrtinfo"]["medrcdno"].ToString();
+                }
+                #endregion 
+                #region【数据转换】
+                if (joRtnSettle["result"]["data"]["settlement"][0]["Gender"].ToString() == "1")
+                {
+                    joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "男";
+                }
+                else
+                {
+                    joRtnSettle["result"]["data"]["settlement"][0]["Gender"] = "女";
+                }
+                
+
+                DateTime startDate = (DateTime)joRtnSettle["result"]["data"]["reginfo"][0]["RegDate"];
+                DateTime endDate = (DateTime)joRtnSettle["result"]["data"]["settlement"][0]["SettlementTime"];
+                int diffInDays = (int)(endDate - startDate).TotalDays;
+                if (diffInDays == 0)
+                {
+                    diffInDays = 1;
+                }
+
+                joRtnSettle["result"]["data"]["settlement"][0]["HospitalizationsDays"] = diffInDays;
+
+                string str = joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"].ToString();
+                if (str.Contains("."))
+                {
+                    joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str.Split('.')[0] + "岁";
+                }
+                else
+                {
+                    joRtnSettle["result"]["data"]["patinsuinfo"][0]["Age"] = str + "岁";
+                }
+
+                #endregion 
+
+
+                #region【组织FastReport调用入参】               
+                JArray jachargeItemLvFee = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.chargeItemLvFee"));
+                JArray jaClassification = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.classification"));
+                JArray jaSettlement = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement"));
+                JArray jaReginfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo"));
+                JArray japatinsuinfo = JArray.Parse(JsonHelper.getDestValue(joRtnSettle, "result.data.patinsuinfo"));
+
+                //转换金额大写
+               string Sumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].Sumamt").ToString());
+                string ActualPayDeductible = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].ActualPayDeductible").ToString());
+                string PersonCashPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].PersonCashPay").ToString());
+                string AccountPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountPaySumamt").ToString());
+                string FundPaySumamt = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].FundPaySumamt").ToString());
+                string LargeExpensesSupplementPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].LargeExpensesSupplementPay").ToString());
+                string SeriousIllnessPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].SeriousIllnessPay").ToString());
+                string CivilserviceAllowancePay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].CivilserviceAllowancePay").ToString());
+                string MedicalAssistPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].MedicalAssistPay").ToString());
+                string OtherPay = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].OtherPay").ToString());
+                string HospitalPartAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HospitalPartAmount").ToString());
+                string AccountMutualAidAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].AccountMutualAidAmount").ToString());
+                string InPolicyRangeAmount = FastReportFunction.MoneyToUpper(JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].InPolicyRangeAmount").ToString());
+                
+                //string BeginDate = JsonHelper.getDestValue(joRtnSettle, "result.data.reginfo[0].RegDate").ToString();
+                //string EndDate = JsonHelper.getDestValue(joRtnSettle, "result.data.settlement[0].HISDischargeTime").ToString();
+                //string InHosDays = FastReportFunction.DateDiff(Convert.ToDateTime(BeginDate), Convert.ToDateTime(EndDate));  
+
+                JObject jaAmountChiness = new JObject();
+                jaAmountChiness.Add("Sumamt", Sumamt);
+                jaAmountChiness.Add("ActualPayDeductible", ActualPayDeductible);
+                jaAmountChiness.Add("PersonCashPay", PersonCashPay);
+                jaAmountChiness.Add("AccountPaySumamt", AccountPaySumamt);
+                jaAmountChiness.Add("FundPaySumamt", FundPaySumamt);
+                jaAmountChiness.Add("LargeExpensesSupplementPay", LargeExpensesSupplementPay);
+                jaAmountChiness.Add("SeriousIllnessPay", SeriousIllnessPay);
+                jaAmountChiness.Add("CivilserviceAllowancePay", CivilserviceAllowancePay);
+                jaAmountChiness.Add("MedicalAssistPay", MedicalAssistPay);
+                jaAmountChiness.Add("OtherPay", OtherPay);
+                jaAmountChiness.Add("HospitalPartAmount", HospitalPartAmount);
+                jaAmountChiness.Add("AccountMutualAidAmount", AccountMutualAidAmount);
+                jaAmountChiness.Add("InPolicyRangeAmount", InPolicyRangeAmount); //合规费用
+                jaAmountChiness.Add("SettlOpter", Global.user.name);
+                jaAmountChiness.Add("medrcdno", medrcdno);                
+
+                JArray jachinessParams = new JArray();
+                jachinessParams.Add(jaAmountChiness);
+
+                JObject joDataResult = new JObject();
+                joDataResult.Add("SettlementInfo", jaSettlement);
+                joDataResult.Add("ChargeItemLvFee", jachargeItemLvFee);
+                joDataResult.Add("ClassificationInfo", jaClassification);
+                joDataResult.Add("RegInfo", jaReginfo);
+                joDataResult.Add("Patinsuinfo", japatinsuinfo);
+                joDataResult.Add("ChinessSummat", jachinessParams);
+
+                JObject joParams = new JObject();
+                joParams.Add("fastReportCode", "SP11"); //这个要从表取值
+                joParams.Add("hospID", Global.inf.hisHospitalDr.ToString());
+                joParams.Add("printCode", Global.inf.interfaceDr.ToString());
+                joParams.Add("templateID", "");
+
+                JArray jaParams = new JArray();
+                jaParams.Add(joParams);
+
+                JObject joReportParams = new JObject();
+                joReportParams.Add("params", jaParams);
+                joReportParams.Add("code", "01040306");
+
+                JObject joParam = new JObject();
+                joParam.Add("designFlag", designFlag);
+                joParam.Add("logFlag", "N");
+                joParam.Add("dataParams", "");
+                joParam.Add("pdfName", "");
+                joParam.Add("reportparams", joReportParams);
+                joParam.Add("dataResult", joDataResult);
+
+                JObject joDataURL = new JObject();
+                joDataURL.Add("dataIP", Global.hisConfig.ip);
+                joDataURL.Add("urlAddress", Global.hisConfig.url);
+                joDataURL.Add("authorization", Global.hisConfig.authorization);
+
+                joParam.Add("dataURL", joDataURL);
+
+                JArray jaParam = new JArray();
+                jaParam.Add(joParam);
+
+                JObject joInparam = new JObject();
+                joInparam.Add("params", JArray.FromObject(jaParam));
+                joInparam.Add("session", Global.curEvt.jaSession);
+                #endregion
+
+                JObject joRtn = new JObject();
+                joRtn.Add("errorCode", 0);
+                joRtn.Add("errorMessage", "");
+                joRtn.Add("result", joInparam.ToString());
+
+                return joRtn;
+            }
+            catch (Exception ex)
+            {
+                JObject joRtnEx = new JObject();
+                joRtnEx.Add("errorCode", -1);
+                joRtnEx.Add("errorMessage", ex.Message);
+                joRtnEx.Add("result", "");
+                return joRtnEx;
+            }
         }
 
         private void btnDesign_Click(object sender, EventArgs e)
         {
-   
+            /*
             thread_test = new Thread(new ThreadStart(design));
             thread_test.SetApartmentState(ApartmentState.STA); //重点
-            thread_test.Start();
-   
+            thread_test.Start();*/
+
+            if (dgvSettlRecord.RowCount <= 0)
+            {
+                MessageBox.Show("请先查询结算数据!");
+                return;
+            }
+
+            try
+            {
+                int i = dgvSettlRecord.CurrentRow.Index;
+                DataTable dt = (DataTable)dgvSettlRecord.DataSource;
+
+                string AdmID = dt.Rows[i]["AdmID"].ToString();
+                string SettlementID = dt.Rows[i]["SettlementID"].ToString();
+                string ValidFlag = dt.Rows[i]["ValidFlag"].ToString();
+                string MdtrtID = dt.Rows[i]["MdtrtID"].ToString();
+
+                JObject joRtn = GetFastReportParams("Y", AdmID, MdtrtID, SettlementID, ValidFlag);
+               
+                if (JsonHelper.parseIrisRtnValue(joRtn, out string errMsg) != 0)
+                {
+                    MessageBox.Show("获取FastReport入参失败:" + errMsg);
+                    return;
+                }
+
+                string sFastReportParam = JsonHelper.getDestValue(joRtn, "result");
+                if (FastReportPrint(sFastReportParam, out errMsg) != 0)
+                {
+                    MessageBox.Show("调用FastReport设计失败!" + errMsg);
+                    return;
+                }
+            }
+            catch (Exception ex)
+            {
+                MessageBox.Show(ex.Message);
+                return;
+            }
+
         }
 
         private void SettlementChecklist_FormClosed(object sender, FormClosedEventArgs e)

+ 12 - 4
HeFeiMI.csproj

@@ -9,7 +9,7 @@
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>AnHuiMI</RootNamespace>
     <AssemblyName>AnHuiMI</AssemblyName>
-    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
     <FileAlignment>512</FileAlignment>
     <Deterministic>true</Deterministic>
     <TargetFrameworkProfile />
@@ -35,10 +35,14 @@
     <Reference Include="BouncyCastle.Crypto, Version=1.9.0.0, Culture=neutral, PublicKeyToken=0e99375e54769942, processorArchitecture=MSIL">
       <HintPath>packages\Portable.BouncyCastle.1.9.0\lib\net40\BouncyCastle.Crypto.dll</HintPath>
     </Reference>
-    <Reference Include="FastReport, Version=2020.3.7.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
+    <Reference Include="FastReport, Version=2023.1.8.0, Culture=neutral, PublicKeyToken=db7e5ce63278458c, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>bin\Debug\FastReport.dll</HintPath>
     </Reference>
+    <Reference Include="FastReportFrom, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>bin\Debug\FastReportFrom.dll</HintPath>
+    </Reference>
     <Reference Include="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c, processorArchitecture=MSIL">
       <HintPath>packages\Microsoft.Office.Interop.Excel.15.0.4795.1001\lib\net20\Microsoft.Office.Interop.Excel.dll</HintPath>
       <EmbedInteropTypes>True</EmbedInteropTypes>
@@ -54,10 +58,10 @@
       <HintPath>..\..\..\..\C#练习\普天控件2\PTControl\PTControl\bin\Debug\PTControl.dll</HintPath>
     </Reference>
     <Reference Include="SunnyUI, Version=3.1.5.0, Culture=neutral, PublicKeyToken=27d7d2e821d97aeb, processorArchitecture=MSIL">
-      <HintPath>packages\SunnyUI.3.1.5\lib\net40\SunnyUI.dll</HintPath>
+      <HintPath>packages\SunnyUI.3.1.5\lib\net472\SunnyUI.dll</HintPath>
     </Reference>
     <Reference Include="SunnyUI.Common, Version=3.1.2.0, Culture=neutral, PublicKeyToken=5a271fb7ba597231, processorArchitecture=MSIL">
-      <HintPath>packages\SunnyUI.Common.3.1.2\lib\net40\SunnyUI.Common.dll</HintPath>
+      <HintPath>packages\SunnyUI.Common.3.1.2\lib\net472\SunnyUI.Common.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Core" />
@@ -87,6 +91,7 @@
     <Compile Include="Business\IrisServices.cs" />
     <Compile Include="Business\MobilePay.cs" />
     <Compile Include="Common\CardReader.cs" />
+    <Compile Include="Common\FastReportFunction.cs" />
     <Compile Include="Common\Common.cs" />
     <Compile Include="Common\ECTokenReader.cs" />
     <Compile Include="Common\Encrypt.cs" />
@@ -314,5 +319,8 @@
       <EmbedInteropTypes>True</EmbedInteropTypes>
     </COMReference>
   </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Connected Services\" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 29 - 25
InsuBusiness.cs

@@ -56,14 +56,21 @@ namespace PTMedicalInsurance
             try
             {
                 joInParam = JObject.Parse(inParam);
+                businessType = JsonHelper.getDestValue(joInParam, "businessType");
                 jaSession = JArray.Parse(JsonHelper.getDestValue(joInParam, "session"));
                 Global.curEvt.jaSession = jaSession;
-                jaParams = JArray.Parse(JsonHelper.getDestValue(joInParam, "params"));
-                joParam = JObject.FromObject(jaParams[0]);                
+                if (businessType == "Print")//当未print时HIS传入节点params为空,需判断处理
+                {
+                }
+                else
+                {
+                    jaParams = JArray.Parse(JsonHelper.getDestValue(joInParam, "params"));
+                    joParam = JObject.FromObject(jaParams[0]);
+                }                            
 
                 joInterface = JObject.Parse(JsonHelper.getDestValue(joInParam, "interfaceinfo"));
 
-                businessType = JsonHelper.getDestValue(joInParam, "businessType");
+                
                 if ((businessType == "M6") || (businessType == "M6C") || (businessType == "M6Confirm"))
                 {
                     Environment.CurrentDirectory = @"D:\HttpServerAPI\bin\libs";
@@ -1530,7 +1537,6 @@ namespace PTMedicalInsurance
                     rtnResult = JsonHelper.setExceptionJson(-1, "", errMsg).ToString();
                     return rtnResult;
                 }
-                
                 //BS架构调用方式问题,每次调用都需要重新初始化
                 if (init(InParam, out outParam) != 0)
                 {
@@ -1577,30 +1583,28 @@ namespace PTMedicalInsurance
                                 frmSettlList.ShowDialog();
                             }
                             else
-                            {
-                                JObject joInsuAdmObj = JObject.Parse(insuAdmObj);
-                                frmSettlList = new SettlementChecklist(joInsuAdmObj);
-
+                            {                               
+                                JObject joInsuAdmObj = JObject.Parse(insuAdmObj);                                
+                                frmSettlList = new SettlementChecklist(joInsuAdmObj); 
                                 string groupID = JsonHelper.getDestValue((JObject)Global.curEvt.jaSession[0], "groupID");
                                 DataTable dt = (DataTable)frmSettlList.dgvSettlRecord.DataSource;
-
-                                CardReader CardRead = new CardReader();
-                                string sOutPar;
-                                CardRead.FastReportPrint(out sOutPar);
-                                if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
-                                {
+                                frmSettlList.btnPrint_Click(null, null);
+                                //CardReader CardRead = new CardReader();
+                                //string sOutPar;
+                                //CardRead.FastReportPrint(out sOutPar);
+                                //if (JsonHelper.getDestValue(JObject.Parse(sOutPar), "code") != "0")
+                                //{
                             
-                                    return JsonHelper.setIrisReturnValue(0, "调用FastReportDLL失败", null).ToString();
-                                }
-
-                                if (dt.Rows.Count != 1)
-                                {
-                                    frmSettlList.ShowDialog();                   
-                                }
-                                else
-                                {
-                                    frmSettlList.btnPrint_Click(null, null);
-                                }
+                                //    return JsonHelper.setIrisReturnValue(0, "调用FastReportDLL失败", null).ToString();
+                                //}
+                                //if (dt.Rows.Count != 1)
+                                //{
+                                //    frmSettlList.ShowDialog();                   
+                                //}
+                                //else
+                                //{
+                                //    frmSettlList.btnPrint_Click(null, null);
+                                //}
                             }
 
                             return JsonHelper.setIrisReturnValue(0, "", null).ToString();

+ 1 - 1
Properties/Resources.Designer.cs

@@ -19,7 +19,7 @@ namespace AnHuiMI.Properties {
     // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
     // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
     // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
     [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
     internal class Resources {

+ 1 - 1
Properties/Settings.Designer.cs

@@ -12,7 +12,7 @@ namespace AnHuiMI.Properties {
     
     
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.10.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")]
     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
         
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

+ 1 - 1
app.config

@@ -11,4 +11,4 @@
       </dependentAssembly>
     </assemblyBinding>
   </runtime>
-<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1"/></startup></configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2"/></startup></configuration>

二进制
bin/Debug.zip


+ 2 - 2
packages.config

@@ -5,6 +5,6 @@
   <package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1001" targetFramework="net45" />
   <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net45" />
   <package id="Portable.BouncyCastle" version="1.9.0" targetFramework="net461" />
-  <package id="SunnyUI" version="3.1.5" targetFramework="net45" />
-  <package id="SunnyUI.Common" version="3.1.2" targetFramework="net45" />
+  <package id="SunnyUI" version="3.1.5" targetFramework="net472" />
+  <package id="SunnyUI.Common" version="3.1.2" targetFramework="net472" />
 </packages>