LisPacs_MR_Bll.cs 26 KB

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