浏览代码

印江门诊一张纸互认问题时,多单修改互认过程

zackhua 6 月之前
父节点
当前提交
77bfc16674
共有 4 个文件被更改,包括 104 次插入32 次删除
  1. 58 12
      LisPacs_MR_Bll.cs
  2. 1 1
      Properties/AssemblyInfo.cs
  3. 16 0
      Tools.cs
  4. 29 19
      clsPlugin.cs

+ 58 - 12
LisPacs_MR_Bll.cs

@@ -473,10 +473,11 @@ namespace ZLPlugin_MR.ServerImpl
         /// <param name="listpacs"></param>
         /// <param name="lis_id"></param>
         /// <param name="pacs_id"></param>
-        public static void SaveDataNew(Results result, long lngPatientID, long lngClinicID, string no, List<Codes> listlis, List<Codes> listpacs, out long lis_id, out long pacs_id)
+        public static void SaveDataNew(Results result, long lngPatientID, long lngClinicID, string no, List<Codes> listlis, List<Codes> listpacs, out List<long> lis_ids, out List<long> pacs_ids)
         {
-            lis_id = -1;
-            pacs_id = -1;
+
+            lis_ids = new List<long>();
+            pacs_ids = new List<long>();
             var lis = result.ResultText[0].LIS;
             var pacs = result.ResultText[0].PACS;
             if (lis != null)
@@ -489,10 +490,7 @@ namespace ZLPlugin_MR.ServerImpl
                     int res = InsertLis(lis[i], lngPatientID, lngClinicID, date, no, xgid);
                     if (res > 0)
                     {
-                        if (lis_id == -1)
-                        {
-                            lis_id = long.Parse(xgid);
-                        }
+                        lis_ids.Add(long.Parse(xgid));
                         for (int k = 0; k < lis[i].ItemList.Count; k++)
                         {
                             InsertLisItem(lis[i].ItemList[k], lis[i].LisCheckReportId, lngPatientID, lngClinicID, date);
@@ -505,7 +503,7 @@ namespace ZLPlugin_MR.ServerImpl
                 long id = long.Parse(listpacs[0].id);
                 for (int i = 0; i < pacs.Count; i++)
                 {
-
+                    id = long.Parse(listpacs[i].id);
                     foreach (var items in listpacs)
                     {
                         if (pacs[i].reportTypeCode == items.type)
@@ -518,10 +516,7 @@ namespace ZLPlugin_MR.ServerImpl
                     int res = InsertPacs(pacs[i], lngPatientID, lngClinicID, no, id);
                     if (res > 0)
                     {
-                        if (pacs_id == -1)
-                        {
-                            pacs_id = id;
-                        }
+                        pacs_ids.Add(id);
                     }
                 }
 
@@ -675,6 +670,57 @@ namespace ZLPlugin_MR.ServerImpl
             return list;
         }
 
+
+        public static void CancelYzzNew(long 病人id, long 主医嘱id, int lis, int pacs)
+        {
+            string sql = @"select  c.no ,wm_concat(c.id) FEE_IDS
+                              from 病人医嘱记录 a, 病人医嘱发送 b, 门诊费用记录 c
+                             where b.医嘱id = a.id
+                               and c.医嘱序号 = b.医嘱id
+                               and a.病人id = {0}
+                               and (a.id = {1} or a.相关id = {1})
+                               group by c.no
+";
+            sql = string.Format(sql, 病人id, 主医嘱id);
+            Recordset recordset = new Recordset();
+            Tools.QueryTable(sql, out recordset);
+            string json = "{\"input\":{\"operator_name\":\"\",\"operator_code\":\"\",\"operator_time\":\"\",\"del_list\":[";
+            while (!recordset.EOF)
+            {
+                string no = recordset.Fields["NO"].Value.ToString();
+                string fee_ids = recordset.Fields["FEE_IDS"].Value.ToString();
+                json += "{\"fee_source\":1,\"fee_bill_type\":1,\"fee_no\":\"" + no + "\",\"del_type\":1,\"serial_num\":\"\",\"exe_sta_nums\":\"\",\"fee_ids\":\""+ fee_ids +"\"},";
+                recordset.MoveNext();
+            }
+            json = json.Substring(0, json.Length - 1);
+            json += "]}}";
+            //原始调用过程没有作用 改用数据处理平台中转
+            //Tools.ExecuteStoredProc(病人id, 主医嘱id, json, lis, pacs);
+            int lisMessage = 0;
+            int pacsMessage = 0;
+            if (lis > 0)
+            {
+                lisMessage = 1;
+            }
+            if (pacs > 0)
+            {
+                pacsMessage = 1;
+            }
+            YZZCancelDTO zZCancelDTO = new YZZCancelDTO();
+            zZCancelDTO.patientId = 病人id.ToString();
+            zZCancelDTO.medicalOrderId = 主医嘱id.ToString();
+            zZCancelDTO.jsonIn = json;
+            zZCancelDTO.lisMessage = lisMessage.ToString();
+            zZCancelDTO.pacsMessage = pacsMessage.ToString();
+            string url = "http://172.30.0.66:7000/cancelMedicalForYzz";
+            getUrlYzzCancelMedical(out url);
+            Log.Info("url=" + url);
+            string body = JSON.ObjectToJson<YZZCancelDTO>(zZCancelDTO, Encoding.UTF8);
+            Log.Info("body==" + body);
+            string resultString = HttpUtils.WSCenterData(url, body);
+            Log.Info("resultString==" + resultString);
+        }
+
         /// <summary>
         /// 作废医嘱
         /// </summary>

+ 1 - 1
Properties/AssemblyInfo.cs

@@ -5,7 +5,7 @@ using System.Runtime.InteropServices;
 // General Information about an assembly is controlled through the following 
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
-[assembly: AssemblyTitle("互认金额版本新加,多单项目问题解决")]
+[assembly: AssemblyTitle("一张纸开多单问题解决")]
 [assembly: AssemblyDescription("ZLPlugin_MR")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]

+ 16 - 0
Tools.cs

@@ -20,9 +20,25 @@ namespace ZLPlugin_MR.Domain.Units
                 rng.GetBytes(buffer);
             }
             long longValue = BitConverter.ToInt64(buffer, 0);
+            Log.Info("Generate16CharUUID="+longValue);
             return longValue.ToString("X").Substring(0, 16);
         }
 
+        public static string Generate16CharGUID()
+        {
+            // 生成Guid
+            Guid guid = Guid.NewGuid();
+
+            // 将Guid转换为字符串并截取前16位
+            string randomString = guid.ToString().Substring(0, 16);
+            Log.Info("Generate16CharGUID=" + randomString);
+            return randomString;
+        }
+
+        
+
+
+
         public static string GetHostIp()
         {
             string hostName = Dns.GetHostName();

+ 29 - 19
clsPlugin.cs

@@ -106,7 +106,8 @@ namespace ZLPlugin_MR
                     return true;
                 }
                 List<YZData> ss_list = LisPacs_MR_Bll.GetYZList(lngSendID);
-                string hisApplyId = Tools.Generate16CharUUID();
+
+                string hisApplyId = Tools.Generate16CharGUID();
 
                 string patientSource = "1"; //病人来源
 
@@ -257,6 +258,12 @@ namespace ZLPlugin_MR
                 {
                     return true;
                 }
+                string str = Tools.GetAdviceSaveData(rsAdvice);
+                Log.Info("保存前医嘱:" + str);
+                if (str == "")
+                {
+                    return true;
+                }
                 if (yzzState == 1)
                 {
                     #region 仅印江人民医院使用,仅支持住院,因为一张纸发送医嘱后也会触发此方法
@@ -266,14 +273,9 @@ namespace ZLPlugin_MR
                     }
                     #endregion
                 }
-                string str = Tools.GetAdviceSaveData(rsAdvice);
-                Log.Info("保存前医嘱:" + str);
-                if (str == "")
-                {
-                    return true;
-                }
+
                 List<YZData> ss_list = JSON.JsonToObject<List<YZData>>(Tools.FormatStr(str), Encoding.UTF8);
-                string hisApplyId = Tools.Generate16CharUUID();
+                string hisApplyId = Tools.Generate16CharGUID();
                 Log.Info("hisApplyId==" + hisApplyId);
                 string patientSource = ""; //病人来源
 
@@ -466,27 +468,35 @@ namespace ZLPlugin_MR
                 return true;
             }
             //Log.Info(SocketClient.Message);
-            long lisId;
-            long pacsId;
+
+            List<long> lisIds = new List<long>();
+            List<long> pacsIds = new List<long>();
             Log.Info("Domain.Infos.UserInfo.编号 = " + Domain.Infos.UserInfo.编号);
-            LisPacs_MR_Bll.SaveDataNew(result, lngPatientID, lngClinicID, Domain.Infos.UserInfo.编号, listlis, listpacs, out lisId, out pacsId);
-            Log.Info("state:"+ state + "  lisId"+ lisId);
+            LisPacs_MR_Bll.SaveDataNew(result, lngPatientID, lngClinicID, Domain.Infos.UserInfo.编号, listlis, listpacs, out lisIds, out pacsIds);
+            Log.Info("state:"+ state + "  lisId"+ lisIds.Count);
             if (state < 1)
             {
                 return true;
             }
             //仅发送医嘱后执行
-            if (lisId > 0)
+            if (lisIds.Count > 0)
             {
-                Log.Info("CancelYz  lisId");
-                LisPacs_MR_Bll.CancelYz(lngPatientID, lisId, 1, 0);
-                Log.Info("CancelYz  end");
+                lisIds.ForEach(xgid =>
+                {
+                    Log.Info("CancelYz  lisId="+ xgid);
+                    LisPacs_MR_Bll.CancelYzzNew(lngPatientID, xgid, 1, 0);
+                    Log.Info("CancelYz  end");
+                });
 
             }
-            if (pacsId > 0)
+            if (pacsIds.Count > 0)
             {
-                Log.Info("CancelYz  pacsId");
-                LisPacs_MR_Bll.CancelYz(lngPatientID, pacsId, 0, 1);
+                pacsIds.ForEach(xgid =>
+                {
+                    Log.Info("CancelYz  pacsId=" + xgid);
+                    LisPacs_MR_Bll.CancelYzzNew(lngPatientID, xgid, 0, 1);
+                    Log.Info("CancelYz  end");
+                });
             }
             return true;
         }