LisPacs_MR_Bll.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. using ADODB;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Reflection;
  5. using ZLPlugin_LisPacs_MR.Domain.Units;
  6. using ZLPlugin_LisPacs_MR.Model;
  7. namespace ZLPlugin_LisPacs_MR
  8. {
  9. public class LisPacs_MR_Bll
  10. {
  11. /// <summary>
  12. /// lis是否有互认项目
  13. /// </summary>
  14. /// <returns></returns>
  15. public static void IsLisProject(string zlid, out string code, out int total)
  16. {
  17. code = "";
  18. total = 0;
  19. string sql = @"Select to_char(Replace(wm_concat(distinct(l.医保编码)),',','#')) Code,Count(1) total
  20. From 诊疗项目目录 x,诊疗收费关系 y,收费项目目录 z,保险支付项目 m,ZLLPMR.互认项目清单 l
  21. Where y.诊疗项目id = x.Id
  22. And z.Id = y.收费项目id
  23. And m.收费细目id = z.Id
  24. And l.医保通用编码 = m.项目编码
  25. And m.险类 = 111
  26. and x.类别 = 'C'
  27. And x.Id = {0}";
  28. sql = string.Format(sql, zlid);
  29. //Log.Info("sql1:" + sql);
  30. Recordset rd = new Recordset();
  31. Tools.QueryTable(sql, out rd);
  32. if (!rd.EOF)
  33. {
  34. rd.MoveFirst();
  35. code = rd.Fields["CODE"].Value.ToString();
  36. total = int.Parse(rd.Fields["TOTAL"].Value.ToString());
  37. }
  38. }
  39. public static void IsPacsProject(string zlid, out int total,out string type)
  40. {
  41. total = 0;
  42. type = "";
  43. string sql = @"Select Count(1) As total,b.代码 code From 诊疗项目目录 a,ZLLPMR.字典对码表 b
  44. Where 分类 ='检查互认项目'
  45. and a.类别 = 'D' And b.编码 = '{0}'
  46. group by b.代码";
  47. sql = string.Format(sql, zlid);
  48. Log.Info("sql2:" + sql);
  49. Recordset rd = new Recordset();
  50. Tools.QueryTable(sql, out rd);
  51. if (!rd.EOF)
  52. {
  53. rd.MoveFirst();
  54. total = int.Parse(rd.Fields["TOTAL"].Value.ToString());
  55. type = rd.Fields["CODE"].Value.ToString();
  56. }
  57. }
  58. public static void HandleYzData(List<YZData> list, long patientId,long limit_day ,out string message)
  59. {
  60. Log.Info("enter HandleYzData = "+ list.Count);
  61. message = "";
  62. //存在互认的医嘱
  63. int existHuRemYz = 0;
  64. for (var i = 0; i < list.Count; i++)
  65. {
  66. if (list[i].诊疗类别 == "C" && list[i].相关ID != "0.0")
  67. {
  68. LisPacs_MR_Bll.GetHuRenYzData(patientId, list[i].诊疗项目ID, list[i].诊疗类别, limit_day,out existHuRemYz);
  69. if (existHuRemYz>=1)
  70. {
  71. message = list[i].医嘱内容;
  72. //return message;
  73. }
  74. }
  75. else if (list[i].诊疗类别 == "D" && list[i].相关ID == "0.0")
  76. {
  77. LisPacs_MR_Bll.GetHuRenYzData(patientId, list[i].诊疗项目ID, list[i].诊疗类别, limit_day, out existHuRemYz);
  78. if (existHuRemYz >= 1)
  79. {
  80. message = list[i].医嘱内容;
  81. //return message;
  82. }
  83. }
  84. }
  85. Log.Info("end HandleYzData = " + message);
  86. //return message;
  87. }
  88. /// <summary>
  89. /// 返回诊疗项目ID
  90. /// </summary>
  91. /// <param name="rsAdvice"></param>
  92. /// <returns></returns>
  93. public static void GetTreatmentId(List<YZData> list,out string codeNo,out List<Codes> listlis, out List<Codes> listPacs)
  94. {
  95. //lis = "";
  96. //lis_id = "";
  97. //pacs = "";
  98. //pacs_id = "";
  99. codeNo = "";
  100. listlis = new List<Codes>();
  101. listPacs = new List<Codes>();
  102. for (var i = 0; i < list.Count; i++)
  103. {
  104. if (list[i].诊疗类别 == "C" && list[i].相关ID != "0.0")
  105. {
  106. string code = "";
  107. int total = 0;
  108. IsLisProject(list[i].诊疗项目ID, out code, out total);
  109. if (total > 0)
  110. {
  111. Codes codes = new Codes();
  112. codes.id = list[i].相关ID; //原先是 取id 不行
  113. codes.code = code;
  114. listlis.Add(codes);
  115. //lis += list[i].诊疗项目ID + ",";
  116. //lis_id += list[i].ID + ",";
  117. codeNo += code + "#";
  118. }
  119. }
  120. else if (list[i].诊疗类别 == "D" && list[i].相关ID != "0.0")
  121. {
  122. //pacs = list[i].诊疗项目ID + ",";
  123. //pacs_id = list[i].ID + ",";
  124. int total = 0;
  125. string type = "";
  126. //IsPacsProject(list[i].诊疗项目ID, out total, out type);
  127. String param = list[i].诊疗项目ID + "_" + list[i].标本部位 + "_" + list[i].检查方法;
  128. IsPacsProject(param, out total, out type);
  129. if (total >0)
  130. {
  131. Codes codes = new Codes();
  132. codes.id = list[i].相关ID;
  133. codes.type = type;
  134. listPacs.Add(codes);
  135. codeNo += type + "#";
  136. }
  137. }
  138. }
  139. //lis = lis.Length > 0 ? lis.Substring(0, lis.Length - 1) : lis;
  140. codeNo = codeNo.Length > 0 ? codeNo.Substring(0, codeNo.Length - 1) : codeNo;
  141. //pacs = pacs.Length > 0 ? pacs.Substring(0, pacs.Length - 1) : pacs;
  142. //lis_id = lis_id.Length > 0 ? lis_id.Substring(0, lis_id.Length - 1) : lis_id;
  143. //pacs_id = pacs_id.Length > 0 ? pacs_id.Substring(0, pacs_id.Length - 1) : pacs_id;
  144. }
  145. /// <summary>
  146. /// 住院
  147. /// </summary>
  148. /// <param name="lngPatientID"></param>
  149. /// <param name="ZYID"></param>
  150. /// <param name="standardItemId"></param>
  151. /// <returns></returns>
  152. public static Recordset GetZYPostJson(long lngPatientID, long ZYID, string no,int type)
  153. {
  154. string sql = @"Select distinct a.姓名 ""PatientName"",
  155. b.身份证号 ""PatientIdCard"",
  156. e.机构编码 ""jzOrgCode"",
  157. e.机构名称 ""jzOrgName"",
  158. c.编号 ""jzDoctorCode"",
  159. c.姓名 ""jzDoctorName"",
  160. d.编码 ""jzDeptCode"",
  161. d.名称 ""jzDeptName"",
  162. a.住院号 ""businessNumber"",
  163. '{2}' ""standardItemId"",
  164. '' ""reportStartTime"",
  165. '' ""reportEndTime"",
  166. '{3}' ""hrType""
  167. From 病案主页 a,病人信息 b, 人员表 c,部门表 d,ZLLPMR.互认配置表 e
  168. Where b.病人id = a.病人id
  169. And c.姓名 = a.住院医师
  170. And d.Id = a.入院科室id
  171. And a.病人id = {0} And a.主页id = {1}";
  172. sql = string.Format(sql, lngPatientID, ZYID, no,type);
  173. Recordset rd = new Recordset();
  174. Tools.QueryTable(sql, out rd);
  175. return rd;
  176. }
  177. /// <summary>
  178. /// 门诊
  179. /// </summary>
  180. /// <param name="lngPatientID"></param>
  181. /// <param name="ZYID"></param>
  182. /// <param name="standardItemId"></param>
  183. /// <returns></returns>
  184. public static Recordset GetMZPostJson(long ZYID, string no,int type)
  185. {
  186. string sql = @"Select distinct a.姓名 ""PatientName"",
  187. b.身份证号 ""PatientIdCard"",
  188. e.机构编码 ""jzOrgCode"",
  189. e.机构名称 ""jzOrgName"",
  190. c.编号 ""jzDoctorCode"",
  191. c.姓名 ""jzDoctorName"",
  192. d.编码 ""jzDeptCode"",
  193. d.名称 ""jzDeptName"",
  194. a.门诊号 ""businessNumber"",
  195. '{1}' ""standardItemId"",
  196. '' ""reportStartTime"",
  197. '' ""reportEndTime"",
  198. '{2}' ""hrType""
  199. From 病人挂号记录 a,病人信息 b, 人员表 c,部门表 d,ZLLPMR.互认配置表 e
  200. Where b.病人id = a.病人id
  201. And c.姓名 = a.执行人
  202. And d.Id = a.执行部门id
  203. And a.id = {0}";
  204. sql = string.Format(sql, ZYID, no,type);
  205. Recordset rd = new Recordset();
  206. Tools.QueryTable(sql, out rd);
  207. return rd;
  208. }
  209. /// <summary>
  210. /// 判断之前是否开个互认医嘱
  211. /// </summary>
  212. /// <param name="patientId"></param>
  213. /// <param name="zlId"></param>
  214. /// <param name="zlType"></param>
  215. /// <param name="limitDay"></param>
  216. /// <param name="existHuRemYz"></param>
  217. public static void GetHuRenYzData( long patientId ,string zlId,string zlType, long limitDay,out int existHuRemYz)
  218. {
  219. Log.Info("GetHuRenYzData");
  220. existHuRemYz = 0;
  221. try
  222. {
  223. string sql = @"Select count(1) count
  224. From 病人医嘱记录 where 病人id={0} and 诊疗项目id = {1} and 诊疗类别 ='{2}' and 开嘱时间 > sysdate -{3} and 医嘱内容 like '%【互认】' ";
  225. sql = string.Format(sql, patientId, zlId, zlType, limitDay);
  226. Log.Info(sql);
  227. Recordset rd = new Recordset();
  228. Tools.QueryTable(sql, out rd);
  229. if (!rd.EOF)
  230. {
  231. rd.MoveFirst();
  232. existHuRemYz = int.Parse(rd.Fields["count"].Value.ToString());
  233. }
  234. }catch(Exception ex)
  235. {
  236. Log.Info("GetHuRenYzData Exception" + ex.Message);
  237. existHuRemYz = 0;
  238. }
  239. }
  240. public static int InsertLis(LISItem lis, long lngPatientID, long lngClinicID, string date, string no,long yzid)
  241. {
  242. string sql = @"Insert Into ZLLPMR.互认_LIS(LISCHECKREPORTID,REPORTNAME,ORGNAME,REPORTTIME,病人ID,主页ID,TIME,OPERATORNO,医嘱id)
  243. Values('{0}','{1}','{2}',to_date('{3}','yyyy/mm/dd hh24:mi:ss'),{4},{5},to_date('{6}','yyyy/mm/dd hh24:mi:ss'),'{7}',{8})";
  244. sql = string.Format(sql, lis.LisCheckReportId, lis.ReportName, lis.OrgName, lis.ReportTime, lngPatientID, lngClinicID, date, no, yzid);
  245. Log.Info("InsertLis:" + sql);
  246. int res = Tools.ExecuteSql(sql);
  247. return res;
  248. }
  249. public static void InsertLisItem(ItemListItem item, string id, long lngPatientID, long lngClinicID, string date)
  250. {
  251. string sql = @"Insert Into ZLLPMR.互认_LISITEMS(LISCHECKREPORTID,ITEMCODE,ITEMNAME,RESULT,UNIT,HINT,RANGE,STANDARDITEMID,TIME)
  252. Values('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}',to_date('{8}','yyyy/mm/dd hh24:mi:ss'))";
  253. sql = string.Format(sql, id, item.ItemCode, item.ItemName, item.Result, item.Unit, item.Hint, item.Range, item.StandardItemId, date);
  254. //Log.Info("InsertLisItem:" + sql);
  255. Tools.ExecuteSql(sql);
  256. }
  257. public static int InsertPacs(PACSItem item, long lngPatientID, long lngClinicID, string no,long yzid)
  258. {
  259. string sql = @"Insert Into ZLLPMR.互认_PACS(PACSCHECKREPORTID,ITEMNAME,REPORTTIME,CHECKTYPENAME,POSITIONNAME,STANDARDITEMID,DIAGNOSRESULT,ORGNAME,病人ID,主页ID,TIME,OPERATORNO,医嘱id,REPORTTYPECODE)
  260. Values('{0}','{1}',to_date('{2}','yyyy/mm/dd hh24:mi:ss'),'{3}','{4}','{5}','{6}','{7}',{8},{9},sysdate,'{10}','{11}','{12}')";
  261. //var lis = result.ResultText[0].LIS[0];
  262. sql = string.Format(sql, item.PacsCheckReportId, item.ItemName, item.ReportTime, item.CheckTypeName, item.PositionName, item.StandardItemId, Tools.FormatStr(item.DiagnosResult), item.OrgName, lngPatientID, lngClinicID, no, yzid, item.reportTypeCode);
  263. Log.Info("InsertPacs==>"+sql);
  264. return Tools.ExecuteSql(sql);
  265. }
  266. public static int GetLis(string id)
  267. {
  268. int total = 0;
  269. string sql = @"Select Count(1) as TOTAL From ZLLPMR.互认_LIS Where LISCHECKREPORTID = '{0}'";
  270. sql = string.Format(sql, id);
  271. Recordset rd = new Recordset();
  272. Tools.QueryTable(sql, out rd);
  273. if (!rd.EOF)
  274. {
  275. rd.MoveFirst();
  276. total = int.Parse(rd.Fields["TOTAL"].Value.ToString());
  277. }
  278. return total;
  279. }
  280. public static void SaveData(Results result, long lngPatientID, long lngClinicID, string no, List<Codes> listlis, List<Codes> listpacs,out long lis_id,out long pacs_id)
  281. {
  282. lis_id = -1;
  283. pacs_id = -1;
  284. //Log.Info("666");
  285. var lis = result.ResultText[0].LIS;
  286. var pacs = result.ResultText[0].PACS;
  287. bool state = true;
  288. if (lis != null)
  289. {
  290. //Log.Info("777");
  291. for (int i = 0; i < lis.Count; i++)
  292. {
  293. //long yzid = null;
  294. //string code = lis[i].ItemList[0].StandardItemId;
  295. for (int j = 0; j < lis[i].ItemList.Count; j++)
  296. {
  297. //Log.Info("state:" + state);
  298. if (!state)
  299. {
  300. break;
  301. }
  302. foreach (var items in listlis)
  303. {
  304. //Log.Info("state666");
  305. // if (items.code.Contains(lis[i].ItemList[j].StandardItemId))
  306. //{
  307. // Log.Info("items.code:" + items.code);
  308. //Log.Info("items.id:" + items.id);
  309. string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
  310. //Log.Info("items.code:" + items.code);
  311. //Log.Info("items.id:" + items.id);
  312. int res = InsertLis(lis[i], lngPatientID, lngClinicID, date, no, long.Parse(items.id));
  313. //Log.Info("res:" + res);
  314. if (res > 0)
  315. {
  316. if (lis_id == -1)
  317. {
  318. lis_id = long.Parse(items.id);
  319. }
  320. //Log.Info("res1");
  321. for (int k = 0; k < lis[i].ItemList.Count; k++)
  322. {
  323. //Log.Info("8888");
  324. InsertLisItem(lis[i].ItemList[k], lis[i].LisCheckReportId, lngPatientID, lngClinicID, date);
  325. }
  326. }
  327. state = false;
  328. // }
  329. }
  330. }
  331. }
  332. }
  333. if (pacs != null)
  334. {
  335. long id =long.Parse(listpacs[0].id);
  336. for (int i = 0; i < pacs.Count; i++)
  337. {
  338. foreach (var items in listpacs)
  339. {
  340. if (pacs[i].reportTypeCode == items.type)
  341. {
  342. id = long.Parse(items.id);
  343. break;
  344. }
  345. }
  346. int res = InsertPacs(pacs[i], lngPatientID, lngClinicID, no, id);
  347. if (res > 0)
  348. {
  349. if (pacs_id == -1)
  350. {
  351. pacs_id = id;
  352. }
  353. }
  354. }
  355. }
  356. }
  357. /// <summary>
  358. /// 是否互认
  359. /// </summary>
  360. /// <returns></returns>
  361. public static void IsAgree(out int res,out int date,out int yzzState)
  362. {
  363. res = 1;
  364. date = 20000;
  365. yzzState = 0;
  366. try
  367. {
  368. string sql = @"Select 互认 As AGREE,WAITINGDATE,一张纸 From zllpmr.互认配置表";
  369. Recordset rd = new Recordset();
  370. Tools.QueryTable(sql, out rd);
  371. if (!rd.EOF)
  372. {
  373. rd.MoveFirst();
  374. res = int.Parse(rd.Fields["AGREE"].Value.ToString());
  375. date = int.Parse(rd.Fields["WAITINGDATE"].Value.ToString());
  376. yzzState = int.Parse(rd.Fields["一张纸"].Value.ToString());
  377. }
  378. }
  379. catch (Exception ex)
  380. {
  381. Log.Info(ex.Message);
  382. Log.Info(ex.StackTrace);
  383. }
  384. }
  385. public static void getUrlYzzCancelMedical(out string url)
  386. {
  387. url = "";
  388. try
  389. {
  390. string sql = @"Select 一张纸URL From zllpmr.互认配置表";
  391. Recordset rd = new Recordset();
  392. Tools.QueryTable(sql, out rd);
  393. if (!rd.EOF)
  394. {
  395. rd.MoveFirst();
  396. url = int.Parse(rd.Fields["一张纸URL"].Value.ToString());
  397. }
  398. }
  399. catch (Exception ex)
  400. {
  401. Log.Info(ex.Message);
  402. Log.Info(ex.StackTrace);
  403. }
  404. }
  405. /// <summary>
  406. /// 是否互认
  407. /// </summary>
  408. /// <returns></returns>
  409. public static void ExistHuRemYz(out long limit_day)
  410. {
  411. limit_day = 1;
  412. try
  413. {
  414. string sql = @"Select limit_day From zllpmr.互认配置表";
  415. Recordset rd = new Recordset();
  416. Tools.QueryTable(sql, out rd);
  417. if (!rd.EOF)
  418. {
  419. rd.MoveFirst();
  420. limit_day = long.Parse(rd.Fields["limit_day"].Value.ToString());
  421. }
  422. }
  423. catch (Exception ex)
  424. {
  425. Log.Info(ex.Message);
  426. Log.Info(ex.StackTrace);
  427. }
  428. }
  429. /// <summary>
  430. /// 仅一张纸使用,查询发送的医嘱
  431. /// </summary>
  432. /// <param name="ZYID"></param>
  433. /// <param name="no"></param>
  434. /// <param name="type"></param>
  435. /// <returns></returns>
  436. public static List<YZData> GetYZList(long fsh)
  437. {
  438. string sql = @"select
  439. to_char(b.ID) as id ,
  440. decode(b.相关id,null,'0.0',to_char(b.相关id)) as 相关id,
  441. to_char(b.前提id ) as 前提id,
  442. to_char(b.病人来源 ) as 病人来源,
  443. to_char(b.病人id )as 病人id,
  444. to_char(b.主页id )as 主页id,
  445. to_char(b.挂号单 )as 挂号单,
  446. to_char(b.婴儿 )as 婴儿,
  447. to_char(b.姓名 )as 姓名,
  448. to_char(b.性别 )as 性别,
  449. to_char(b.年龄 )as 年龄,
  450. to_char(b.病人科室id )as 病人科室id,
  451. to_char(b.序号 )as 序号,
  452. to_char(b.医嘱状态 )as 医嘱状态,
  453. to_char(b.医嘱期效 )as 医嘱期效,
  454. to_char(b.诊疗类别 )as 诊疗类别,
  455. to_char(b.诊疗项目ID )as 诊疗项目ID,
  456. to_char(b.标本部位 )as 标本部位,
  457. to_char(b.检查方法 )as 检查方法,
  458. to_char(b.收费细目id )as 收费细目id,
  459. to_char(b.天数 )as 天数,
  460. to_char(b.单次用量 )as 单次用量,
  461. to_char(b.总给予量 )as 总给予量,
  462. to_char(b.医嘱内容 )as 医嘱内容,
  463. to_char(b.医生嘱托 )as 医生嘱托,
  464. to_char(b.执行科室ID )as 执行科室ID,
  465. to_char(b.执行频次 )as 执行频次,
  466. to_char(b.频率次数 )as 频率次数,
  467. to_char(b.频率间隔 )as 频率间隔,
  468. to_char(b.间隔单位 )as 间隔单位,
  469. to_char(b.执行时间方案 )as 执行时间方案,
  470. to_char(b.计价特性 )as 计价特性,
  471. to_char(b.执行性质 )as 执行性质,
  472. to_char(b.执行标记 )as 执行标记,
  473. to_char(b.可否分零 )as 可否分零,
  474. to_char(b.紧急标志 )as 紧急标志,
  475. to_char(b.开始执行时间,'yyyy-mm-dd hh24:mi:ss' )as 开始执行时间,
  476. to_char(b.执行终止时间 ,'yyyy-mm-dd hh24:mi:ss' )as 执行终止时间,
  477. to_char(b.开嘱科室ID )as 开嘱科室ID,
  478. to_char(b.开嘱医生 )as 开嘱医生,
  479. to_char(b.开嘱时间 ,'yyyy-mm-dd hh24:mi:ss' )as 开嘱时间,
  480. to_char(b.摘要) as 摘要
  481. from 病人医嘱发送 a,病人医嘱记录 b
  482. where b.id = a.医嘱id and 发送号 = {0} and 诊疗类别 in('D','C')
  483. and NOT EXISTS(select 1 from 病人医嘱记录 where id = b.id and 诊疗类别 = 'D' and 相关id is not null)";
  484. sql = string.Format(sql, fsh);
  485. Recordset recordset = new Recordset();
  486. Tools.QueryTable(sql, out recordset);
  487. List<YZData> list = new List<YZData>();
  488. while (!recordset.EOF)
  489. {
  490. YZData yz = new YZData();
  491. yz.ID = recordset.Fields["ID"].Value.ToString();
  492. yz.相关ID = recordset.Fields["相关ID"].Value.ToString();// yz.3767642yz.,
  493. yz.前提ID = recordset.Fields["前提ID"].Value.ToString();// yz.0.0yz.,
  494. yz.病人来源 = recordset.Fields["病人来源"].Value.ToString();// yz.2yz.,
  495. yz.病人ID = recordset.Fields["病人ID"].Value.ToString();// yz.46688yz.,
  496. yz.主页ID = recordset.Fields["主页ID"].Value.ToString();// yz.1yz.,
  497. yz.挂号单 = recordset.Fields["挂号单"].Value.ToString();// yz.yz.,
  498. yz.婴儿 = recordset.Fields["婴儿"].Value.ToString();// yz.0.0yz.,
  499. yz.姓名 = recordset.Fields["姓名"].Value.ToString();// yz.王少清yz.,
  500. yz.性别 = recordset.Fields["性别"].Value.ToString();// yz.男yz.,
  501. yz.年龄 = recordset.Fields["年龄"].Value.ToString();// yz.86yz.,
  502. yz.病人科室ID = recordset.Fields["病人科室ID"].Value.ToString();// yz.232yz.,
  503. yz.序号 = recordset.Fields["序号"].Value.ToString();// yz.87yz.,
  504. yz.医嘱状态 = recordset.Fields["医嘱状态"].Value.ToString();// yz.-1yz.,
  505. yz.医嘱期效 = recordset.Fields["医嘱期效"].Value.ToString();// yz.1yz.,
  506. yz.诊疗类别 = recordset.Fields["诊疗类别"].Value.ToString();// yz.Cyz.,
  507. yz.诊疗项目ID = recordset.Fields["诊疗项目ID"].Value.ToString();// yz.1890yz.,
  508. yz.标本部位 = recordset.Fields["标本部位"].Value.ToString();// yz.静脉血yz.,
  509. yz.检查方法 = recordset.Fields["检查方法"].Value.ToString();// yz.yz.,
  510. yz.收费细目ID = recordset.Fields["收费细目ID"].Value.ToString();// yz.0.0yz.,
  511. yz.天数 = recordset.Fields["天数"].Value.ToString();// yz.0.0yz.,
  512. yz.单次用量 = recordset.Fields["单次用量"].Value.ToString();// yz.0.0yz.,
  513. yz.总给予量 = recordset.Fields["总给予量"].Value.ToString();// yz.1yz.,
  514. yz.医嘱内容 = recordset.Fields["医嘱内容"].Value.ToString();// yz.肝功能yz.,
  515. yz.医生嘱托 = recordset.Fields["医生嘱托"].Value.ToString();// yz.yz.,
  516. yz.执行科室ID = recordset.Fields["执行科室ID"].Value.ToString();// yz.167yz.,
  517. list.Add(yz);
  518. recordset.MoveNext();
  519. }
  520. return list;
  521. }
  522. /// <summary>
  523. /// 作废医嘱
  524. /// </summary>
  525. public static void CancelYz(long 病人id, long 主医嘱id, int lis, int pacs)
  526. {
  527. string sql = @"select distinct c.no
  528. from 病人医嘱记录 a, 病人医嘱发送 b, 门诊费用记录 c
  529. where b.医嘱id = a.id
  530. and c.医嘱序号 = b.医嘱id
  531. and a.病人id = {0}
  532. and (a.id = {1} or a.相关id = {1})";
  533. sql = string.Format(sql, 病人id, 主医嘱id);
  534. Recordset recordset = new Recordset();
  535. Tools.QueryTable(sql, out recordset);
  536. string json = "{\"input\":{\"operator_name\":\"\",\"operator_code\":\"\",\"operator_time\":\"\",\"del_list\":[";
  537. while (!recordset.EOF)
  538. {
  539. string no = recordset.Fields["NO"].Value.ToString();
  540. json += "{\"fee_source\":1,\"fee_bill_type\":1,\"fee_no\":\""+ no + "\",\"del_type\":2,\"serial_num\":\"\",\"exe_sta_nums\":\"\",\"fee_ids\":\"\"},";
  541. recordset.MoveNext();
  542. }
  543. json = json.Substring(0,json.Length - 1);
  544. json += "]}}";
  545. //原始调用过程没有作用 改用数据处理平台中转
  546. //Tools.ExecuteStoredProc(病人id, 主医嘱id, json, lis, pacs);
  547. int lisMessage = 0;
  548. int pacsMessage = 0;
  549. //调有 http
  550. Dictionary<string, string> body = new Dictionary<string, string>();
  551. body.Add("patientId", 病人id.ToString());
  552. body.Add("medicalOrderId", 主医嘱id.ToString());
  553. body.Add("jsonIn", json);
  554. if (lis>0)
  555. {
  556. lisMessage = 1;
  557. }
  558. if (pacs>0)
  559. {
  560. pacsMessage = 1;
  561. }
  562. body.Add("lisMessage", lisMessage.ToString());
  563. body.Add("pacsMessage", pacsMessage.ToString());
  564. string url = "http://172.30.0.66:7000/cancelMedicalForYzz";
  565. getUrlYzzCancelMedical(out url);
  566. Log.Info("url="+ url);
  567. string resultString = HttpUtils.WSCenterData(url, body.ToString());
  568. Log.Info("resultString==" + resultString);
  569. }
  570. }
  571. }