yj_item_entry.js 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839
  1. var rightData = [];
  2. var printIndex = -1;
  3. var hospitalName = '';
  4. $(function () {
  5. initClinicDeptNo();
  6. //初始频次下拉选
  7. initOrderFrequencys("orderFrequencyZl", true);
  8. initDayNum();
  9. initExecUnit();
  10. initSearchList('<div id="yjksPopoverContent"><table id="tb_table_yjksItem"></table></div>',
  11. 'yjksItem', 800, 400);
  12. $('#yjksItem').on('input focus', function (e) {
  13. loadItemTbale(null)
  14. });
  15. loadRightTable()
  16. getAjaxRequst("/thmz/queryHospitalName",{},true,function (res) {
  17. hospitalName = res.data
  18. $('.hospitalName').text(hospitalName)
  19. })
  20. });
  21. function deldata(index) {
  22. rightData.splice(index,1)
  23. jiSuanTotalCharge();
  24. loadRightTable()
  25. }
  26. function loadRightTable() {
  27. $('#dataTable').bootstrapTable('destroy');
  28. // 初始化表格
  29. $('#dataTable').bootstrapTable({
  30. data: rightData,
  31. toolbar: '#toolbar', //工具按钮用哪个容器
  32. striped: true,
  33. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  34. pagination: false, //是否显示分页(*)
  35. sortable: true, //是否启用排序
  36. sortOrder: "asc",
  37. pageNumber: 1, //初始化加载第一页,默认第一页
  38. pageSize: 5, //每页的记录行数(*)
  39. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  40. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  41. strictSearch: true,
  42. showColumns: false, //是否显示所有的列
  43. showRefresh: false, //是否显示刷新按钮
  44. minimumCountColumns: 2, //最少允许的列数
  45. clickToSelect: true, //是否启用点击选中行
  46. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  47. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  48. cardView: false, //是否显示详细视图
  49. detailView: false,
  50. columns: [
  51. {
  52. title: '操作',
  53. field: 'op',
  54. align: "center",
  55. valign: 'middle',
  56. formatter: function (value, row, index) {
  57. var str = '<button type="button" class="btn btn-primary btn-sm" onclick=deldata(' + index + ')>删除</button>';
  58. return [str].join('');
  59. }
  60. },
  61. {
  62. field: 'zlCode',
  63. title: '编码',
  64. align: "center",
  65. valign: 'middle',
  66. }, {
  67. field: 'name',
  68. title: '名称',
  69. align: "center",
  70. valign: 'middle',
  71. }
  72. , {
  73. field: 'zlItemPrice',
  74. title: '单价(元)',
  75. align: "center",
  76. valign: 'middle',
  77. },
  78. {
  79. field: 'itemQuantity',
  80. title: '单量',
  81. align: "center",
  82. valign: 'middle',
  83. },
  84. {
  85. field: 'descriptions',
  86. title: '规格',
  87. align: "center",
  88. valign: 'middle',
  89. },
  90. {
  91. field: 'chargeUnit',
  92. title: '单位',
  93. align: "center",
  94. valign: 'middle',
  95. },
  96. {
  97. field: 'dayZlNum',
  98. title: '天数',
  99. align: "center",
  100. valign: 'middle',
  101. },
  102. {
  103. field: 'orderFrequencyZl',
  104. title: '频次',
  105. align: "center",
  106. valign: 'middle',
  107. },
  108. {
  109. field: 'totalNumZl',
  110. title: '总量',
  111. align: "center",
  112. valign: 'middle',
  113. },
  114. {
  115. field: 'totalAmountZl',
  116. title: '总价(元)',
  117. align: "center",
  118. valign: 'middle',
  119. },
  120. {
  121. field: 'execUnitName',
  122. title: '执行科室',
  123. align: "center",
  124. valign: 'middle',
  125. },
  126. {
  127. field: 'remark',
  128. title: '备注',
  129. align: "center",
  130. valign: 'middle',
  131. }
  132. ],
  133. });
  134. }
  135. function loadItemTbale(event) {
  136. if (event != null) {
  137. if (event.keyCode == 38 || event.keyCode == 40 || event.keyCode == 13) {
  138. //上下键不刷新表格
  139. return;
  140. }
  141. }
  142. $('#yjksItem').webuiPopover('show');
  143. $('#tb_table_yjksItem').bootstrapTable('refresh');
  144. $('#tb_table_yjksItem').bootstrapTable({
  145. url: '/thmz/listZdChargeItem', //请求后台的URL(*)
  146. method: 'POST', //请求方式(*)
  147. toolbar: '#toolbar', //工具按钮用哪个容器
  148. striped: true, //是否显示行间隔色
  149. cache: true, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  150. pagination: false, //是否显示分页(*)
  151. sortable: true, //是否启用排序
  152. sortOrder: "asc", //排序方式
  153. queryParams: function () {
  154. var temp = {
  155. pageSize:50,
  156. pageIndex:0,
  157. zdChargeItem:{
  158. name: $("#yjksItem").val(),
  159. delFlag: 0
  160. }
  161. };
  162. return JSON.stringify(temp);
  163. }, //传递参数(*)
  164. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  165. pageNumber: 1, //初始化加载第一页,默认第一页
  166. pageSize: 5, //每页的记录行数(*)
  167. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  168. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  169. strictSearch: true,
  170. showColumns: false, //是否显示所有的列
  171. showRefresh: false, //是否显示刷新按钮
  172. minimumCountColumns: 2, //最少允许的列数
  173. clickToSelect: true, //是否启用点击选中行
  174. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  175. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  176. cardView: false, //是否显示详细视图
  177. detailView: false,
  178. //rowStyle:rowStyle,//通过自定义函数设置行样式
  179. ajaxOptions: {
  180. headers: {
  181. 'Accept': 'application/json',
  182. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  183. }
  184. },
  185. columns: [
  186. {
  187. field: 'code',
  188. title: '编码',
  189. align: "center",
  190. valign: 'middle',
  191. // sortable: true
  192. }, {
  193. field: 'name',
  194. title: '名称',
  195. align: "center",
  196. valign: 'middle',
  197. // sortable: true
  198. }
  199. , {
  200. field: 'execUnitName',
  201. title: '执行科室',
  202. align: "center",
  203. valign: 'middle',
  204. // sortable: true
  205. }
  206. , {
  207. field: 'chargeAmount',
  208. title: '价格',
  209. align: "center",
  210. valign: 'middle',
  211. // sortable: true
  212. formatter: function (value, row, index) {
  213. if (value == null) {
  214. return "0.00元";
  215. }
  216. return value.toFixed(2) + "元";
  217. }
  218. }, {
  219. field: 'descriptions',
  220. title: '规格',
  221. align: "center",
  222. valign: 'middle',
  223. // sortable: true
  224. }, {
  225. field: 'connotation',
  226. title: '医保说明',
  227. align: "center",
  228. valign: 'middle',
  229. // sortable: true
  230. }, {
  231. field: 'nationalCode',
  232. title: '医保编码',
  233. align: "left",
  234. valign: 'middle',
  235. // sortable: true
  236. }
  237. ],
  238. responseHandler: function (res) {
  239. if (res == '401' || res == 401) {
  240. window.location.href = '/thmz/login/view'
  241. return;
  242. }
  243. var ress = eval(res);
  244. if (ress.code == -1) {
  245. errorMesage(res);
  246. return {
  247. "total": 0,//总页数
  248. "rows": {} //数据
  249. };
  250. }
  251. $("#yjksPopoverContent").parent().css("background", "#EBEBE4");
  252. return {
  253. "total": ress.data.length,//总页数
  254. "rows": ress.data //数据
  255. };
  256. },
  257. onClickRow: function (row, $element) {
  258. $('#yjksItem').webuiPopover('hide');
  259. clearData();
  260. setItemData(row)
  261. return;
  262. }
  263. });
  264. }
  265. function setItemData(row) {
  266. $("#descriptions").val(row.descriptions)
  267. $("#yjksItem").val(row.name)
  268. $("#zlCode").val(row.code)
  269. $("#chargeUnit").val(row.chargeUnit)
  270. $("#zlItemPrice").val(row.chargeAmount)
  271. $("#itemQuantity").val("1")
  272. $("#dayZlNum").val(1)
  273. $('#dayZlNum').selectpicker('refresh');
  274. $("#orderFrequencyZl").val('ONCE')
  275. $('#orderFrequencyZl').selectpicker('refresh');
  276. $("#execUnit").val(row.execUnit)
  277. $('#execUnit').selectpicker('refresh');
  278. calculateTotal(false)
  279. }
  280. /**
  281. * 计算诊疗金额
  282. * @param flag true ,直接计算总价, false 还要计算总量
  283. */
  284. function calculateTotal(flag) {
  285. if (!flag) {
  286. var itemQuantity = $("#itemQuantity").val();
  287. if (itemQuantity == null) {
  288. return;
  289. }
  290. var dayZlNum = $("#dayZlNum").val();
  291. if (dayZlNum == null) {
  292. return;
  293. }
  294. //频率
  295. var times = $('#orderFrequencyZl').find("option:selected").attr('desc');
  296. if (times == null) {
  297. return;
  298. }
  299. var totalNumZl = Multiply(Multiply(itemQuantity, dayZlNum), times);
  300. $("#totalNumZl").val(totalNumZl);
  301. }
  302. //总量
  303. var totalNumZl = $("#totalNumZl").val();
  304. if (totalNumZl == null) {
  305. return;
  306. }
  307. //单价
  308. var zlItemPrice = $("#zlItemPrice").val();
  309. if (zlItemPrice == null) {
  310. return;
  311. }
  312. $("#totalAmountZl").val(Multiply(totalNumZl, zlItemPrice));
  313. }
  314. /**
  315. * 初始频次下拉选
  316. * @param id
  317. * @param async 是否是异步 true 异步 false 同步
  318. */
  319. function initOrderFrequencys(id, async) {
  320. $.ajax({
  321. type: "GET",
  322. url: '/thmz/getXyOrderFrequencys',
  323. dataType: "json",
  324. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  325. async: async,
  326. success: function (res) {
  327. if (res == '401' || res == 401) {
  328. window.location.href = '/thmz/login/view'
  329. return;
  330. }
  331. var html = '';
  332. $.each(res.data, function (commentIndex, comment) {
  333. html += '<option value="' + comment.code + '" desc="' + comment.times + '">' + comment.name + '(' + comment.code + ')' + '</option>';
  334. });
  335. $('#' + id).empty();
  336. $('#' + id).html(html);
  337. $('#' + id).selectpicker('refresh');
  338. }
  339. });
  340. }
  341. function initDayNum() {
  342. var html = '';
  343. for (var i = 1; i <= 112; i++) {
  344. html += '<option value="' + i + '">' + i + '</option>';
  345. }
  346. $('#dayZlNum').html(html);
  347. $('#dayZlNum').selectpicker('refresh');
  348. }
  349. function initExecUnit() {
  350. //父科室列表
  351. $.ajax({
  352. type: "GET",
  353. url: '/thmz/allUnitCode',
  354. dataType: "json",
  355. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  356. success: function (data) {
  357. if (data == '401' || data == 401) {
  358. window.location.href = '/thmz/login/view'
  359. return;
  360. }
  361. $('#execUnit').empty(); //清空resText里面的所有内容
  362. var html = '';
  363. $.each(data.data, function (commentIndex, comment) {
  364. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + '-' + comment.code + ')</option>';
  365. });
  366. $('#execUnit').html(html);
  367. $('#execUnit').selectpicker('refresh');
  368. }
  369. });
  370. }
  371. function clearData() {
  372. $("#payQrcodeYjEntry").html("")
  373. $("#yjksItem").val(null)
  374. $("#descriptions").val(null)
  375. $("#zlCode").val(null)
  376. $("#chargeUnit").val(null)
  377. $("#zlItemPrice").val(null)
  378. $("#itemQuantity").val(null)
  379. $("#dayZlNum").val(null)
  380. $('#dayZlNum').selectpicker('refresh');
  381. $("#orderFrequencyZl").val(null)
  382. $('#orderFrequencyZl').selectpicker('refresh');
  383. $("#totalNumZl").val(null)
  384. $("#totalAmountZl").val(null)
  385. $("#execUnit").val(null)
  386. $('#execUnit').selectpicker('refresh');
  387. $("#remark").val(null)
  388. }
  389. //保存右边数据
  390. function saveRightData() {
  391. let obj = {
  392. zlCode: $("#zlCode").val(),
  393. name: $("#yjksItem").val(),
  394. descriptions: $("#descriptions").val(),
  395. chargeUnit: $("#chargeUnit").val(),
  396. zlItemPrice: $("#zlItemPrice").val(),
  397. itemQuantity: $("#itemQuantity").val(),
  398. dayZlNum: $("#dayZlNum").val(),
  399. orderFrequencyZl: $("#orderFrequencyZl").val(),
  400. totalNumZl: $("#totalNumZl").val(),
  401. totalAmountZl: $("#totalAmountZl").val(),
  402. execUnit: $("#execUnit").val(),
  403. execUnitName: $('#execUnit option:selected').text(),
  404. remark: $("#remark").val(),
  405. }
  406. if(!stringNotBlank(obj.zlCode)){
  407. errorMesageSimaple('项目编码不能为空!')
  408. return
  409. }
  410. if(!stringNotBlank(obj.itemQuantity) || obj.itemQuantity <= 0){
  411. errorMesageSimaple('单量不能为空或单量必须大于0!')
  412. return
  413. }
  414. if(!stringNotBlank(obj.dayZlNum)){
  415. errorMesageSimaple('天数不能为空!')
  416. return
  417. }
  418. if(!stringNotBlank(obj.orderFrequencyZl)){
  419. errorMesageSimaple('频次不能为空!')
  420. return
  421. }
  422. if(checkCfData(obj)){
  423. errorMesageSimaple('已经开具了该项目,请不要重复开!')
  424. return
  425. }
  426. rightData.push(obj);
  427. loadRightTable();
  428. jiSuanTotalCharge();
  429. clearData();
  430. }
  431. function checkCfData(obj) {
  432. for (let i = 0; i <rightData.length ; i++) {
  433. if(rightData[i].zlCode === obj.zlCode){
  434. return true;
  435. }
  436. }
  437. return false;
  438. }
  439. /**
  440. * 保存
  441. */
  442. function saveYjItem() {
  443. if($("#patientIdText").text() == null){
  444. errorMesageSimaple('门诊号不能为空!')
  445. return
  446. }
  447. // rightData
  448. if(rightData.length === 0) {
  449. errorMesageSimaple('要保存的数据不能为空!')
  450. return
  451. }
  452. if(!confirm("请确认是否保存")){
  453. return
  454. }
  455. let mzChargeDetailList = []
  456. for (let i = 0; i <rightData.length ; i++) {
  457. let temp = {
  458. unitPrice:rightData[i].zlItemPrice,
  459. origPrice:rightData[i].zlItemPrice,
  460. chargeItemCode:rightData[i].zlCode,
  461. quantity:rightData[i].totalNumZl,
  462. drugQuan:rightData[i].itemQuantity,
  463. instructionText:rightData[i].remark,
  464. execDept:rightData[i].execUnit,
  465. frequency:rightData[i].orderFrequencyZl,
  466. orderDays:rightData[i].dayZlNum,
  467. paySelf:"0",
  468. drugWin:1,
  469. groupNo:"00",
  470. tryFlag:"0",
  471. }
  472. mzChargeDetailList.push(temp)
  473. }
  474. let paramData = {
  475. patientId: $("#patientIdText").text(),
  476. visitDeptCode: $("#clinicDeptNo").val(),
  477. mzChargeDetailList: mzChargeDetailList
  478. }
  479. postAjaxJsonHttpRequst("/thmz/saveYjItemEntry",paramData,true,function (res) {
  480. if(res.code == 0){
  481. successMesageSimaple('保存成功!')
  482. setPrintDetail(paramData.patientId,res.data);
  483. setTimeout(function () {
  484. clearData()
  485. clearPatient()
  486. $("#patientIdParam").val(null)
  487. $("#totalCharge").text(0)
  488. rightData = []
  489. loadRightTable()
  490. },2000)
  491. }else {
  492. errorMesage(res)
  493. }
  494. })
  495. }
  496. /**
  497. * 打开医技录入记录 yj_history_table
  498. */
  499. function openYjEntryHistoryModel() {
  500. $("#yjEntryModal").modal();
  501. initYjHistoryTable();
  502. }
  503. /**
  504. * 初始医技费用历史列表
  505. */
  506. function initYjHistoryTable() {
  507. $('#yj_history_table').bootstrapTable("destroy");
  508. $('#yj_history_table').bootstrapTable({
  509. url: '/thmz/queryYjEntryHistory', //请求后台的URL(*)
  510. method: 'post', //请求方式(*)
  511. toolbar: '#toolbar', //工具按钮用哪个容器
  512. striped: true, //是否显示行间隔色
  513. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  514. pagination: true, //是否显示分页(*)
  515. sortable: true, //是否启用排序
  516. sortOrder: "asc", //排序方式
  517. queryParams: {}, //传递参数(*)
  518. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  519. pageNumber: 1, //初始化加载第一页,默认第一页
  520. pageSize: 10, //每页的记录行数(*)
  521. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  522. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  523. strictSearch: true,
  524. showColumns: false, //是否显示所有的列
  525. showRefresh: false, //是否显示刷新按钮
  526. minimumCountColumns: 2, //最少允许的列数
  527. clickToSelect: true, //是否启用点击选中行
  528. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  529. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  530. cardView: false, //是否显示详细视图
  531. detailView: false,
  532. //rowStyle:rowStyle,//通过自定义函数设置行样式
  533. ajaxOptions: {
  534. headers: {
  535. 'Accept': 'application/json',
  536. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  537. }
  538. },
  539. columns: [
  540. {
  541. title: '操作',
  542. align: "center",
  543. valign: 'middle',
  544. formatter: function (value, row, index) {
  545. // var rowData = JSON.stringify(row);
  546. var str = '<button type="button" class="btn btn-primary btn-sm" onclick="chongPrint(\'' + row.patientId + '\',\'' + row.times + '\')">打印</button>';
  547. return str;
  548. }
  549. },
  550. {
  551. field: 'patientId',
  552. title: '门诊号',
  553. align: "center",
  554. valign: 'middle'
  555. },
  556. {
  557. field: 'times',
  558. title: '次数',
  559. align: "center",
  560. valign: 'middle'
  561. },
  562. {
  563. field: 'name',
  564. title: '姓名',
  565. align: "center",
  566. valign: 'middle'
  567. },
  568. {
  569. field: 'deptName',
  570. title: '科室',
  571. align: "center",
  572. valign: 'middle'
  573. },
  574. {
  575. field: 'doctorName',
  576. title: '医生',
  577. align: "center",
  578. valign: 'middle'
  579. },
  580. {
  581. field: 'visitDate',
  582. title: '时间',
  583. align: "center",
  584. valign: 'middle',
  585. formatter: function (value, row, index) {
  586. return format(value,'yyyy-MM-dd HH:mm:ss')
  587. }
  588. },
  589. {
  590. field: 'totalFee',
  591. title: '总金额(元)',
  592. align: "center",
  593. valign: 'middle'
  594. }
  595. ],
  596. responseHandler: function (res) {
  597. if (res == '401' || res == 401) {
  598. window.location.href = '/thmz/login/view'
  599. return;
  600. }
  601. var ress = eval(res);
  602. if (ress.code == -1) {
  603. if (ress.message != null && ress.message != '') {
  604. new PNotify({
  605. title: '错误提示',
  606. text: ress.message,
  607. type: 'error',
  608. hide: true,
  609. styling: 'bootstrap3'
  610. });
  611. }
  612. return {
  613. "total": 0,//总页数
  614. "rows": {} //数据
  615. };
  616. }
  617. return {
  618. "total": ress.data.length,//总页数
  619. "rows": ress.data //数据
  620. };
  621. },
  622. });
  623. }
  624. //查询病人信息
  625. function queryMzPatient() {
  626. //getByIcCardNo icCardNo
  627. getAjaxRequst("/thmz/getByIcCardNo",{icCardNo:$("#patientIdParam").val()},true,function (res) {
  628. if(res.code == 0){
  629. $("#patientIdText").text(res.data.patientId)
  630. $("#nameParam").text(res.data.name)
  631. $("#ageParam").text(res.data.ageString)
  632. $("#sexParam").text(res.data.sex == 1 ? '男' : '女')
  633. }else {
  634. errorMesage(res)
  635. }
  636. })
  637. }
  638. /**
  639. * 清空病人信息
  640. */
  641. function clearPatient() {
  642. $("#patientIdText").text(null)
  643. $("#nameParam").text(null)
  644. $("#ageParam").text(null)
  645. $("#sexParam").text(null)
  646. }
  647. /**
  648. * 初始化当前医生说书科室
  649. */
  650. function initClinicDeptNo() {
  651. $.ajax({
  652. type: "GET",
  653. url: '/thmz/getUnitCodeByCurrentUser',
  654. dataType: "json",
  655. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  656. success: function (res) {
  657. if (res == '401' || res == 401) {
  658. window.location.href = '/thmz/login/view'
  659. return;
  660. }
  661. var html = '';
  662. $.each(res.data, function (commentIndex, comment) {
  663. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  664. });
  665. $('#clinicDeptNo').empty();
  666. $('#clinicDeptNo').html(html);
  667. $('#clinicDeptNo').selectpicker('refresh');
  668. $('#clinicDeptNo').val(res.data[0].code);
  669. $('#clinicDeptNo').selectpicker('refresh');
  670. }
  671. });
  672. }
  673. /**
  674. * 打开科室选择页面
  675. */
  676. function selectDeptModal() {
  677. $("#selectDeptModal").modal("show");
  678. }
  679. function chongPrint(patientId,times) {
  680. setPrintDetail(patientId,times)
  681. $("#yjEntryModal").modal("hide");
  682. }
  683. /**
  684. * 加载搜索窗口
  685. */
  686. function initSearchList(content, searchTextIds, width, height) {
  687. var settings = {
  688. placement: 'bottom-right',//值: auto,top,right,bottom,left,top-right,top-left,bottom-right,bottom-left 要显示的位置
  689. trigger: 'click', //值:click,hover 触发方式
  690. content: '',//内容,内容可以是函数
  691. width: width,
  692. //arrow:false,//是否显示箭头
  693. multi: true,//在页面允许其他弹出层
  694. closeable: true,//显示关闭按钮
  695. style: '', //值:'',inverse
  696. delay: 300,//延迟时间, 悬浮属性才执行
  697. padding: true,//内容填充
  698. height: height,
  699. //offsetTop:10,
  700. cache: true,//如果缓存设置为false,则popover将销毁并重新创建
  701. content: content
  702. };
  703. if(Array.isArray(searchTextIds)){
  704. for (let i = 0; i < searchTextIds.length; i++) {
  705. $('#' + searchTextIds[i]).webuiPopover('destroy').webuiPopover(settings);
  706. }
  707. }else{
  708. $('#' + searchTextIds).webuiPopover('destroy').webuiPopover(settings);
  709. }
  710. }
  711. function setPrintDetail(patientId,times) {
  712. postAjaxJsonHttpRequst("/thmz/queryYjEntryPrintData",{patientId:patientId,times:times},true,function (res) {
  713. if(res.code == 0){
  714. $("#patientId_t").html("门诊号:"+ res.data.patientId)
  715. $("#name_t").html("姓名:"+ res.data.name)
  716. $("#date_t").html("日期:"+ format(res.data.visitDate,'yyyy-MM-dd'))
  717. $("#dept_t").html("科室:"+ res.data.deptName)
  718. $("#doctor_t").html("医生:"+ res.data.doctorName)
  719. let html = "";
  720. let mzChargeDetails = res.data.mzChargeDetails
  721. for (let i = 0; i <mzChargeDetails.length ; i++) {
  722. html += "<tr>";
  723. html += ' <td style="width: 17%;padding-left: 8px;padding-top: 4px;word-break:break-all;">' + mzChargeDetails[i].chargeItemCode + '</td>';
  724. html += ' <td style="width: 45%;padding-left: 8px;padding-top: 4px;word-break:break-all;">' + mzChargeDetails[i].tcName + '</td>';
  725. html += ' <td style="width: 10%;padding-left: 8px;padding-top: 4px;word-break:break-all;">' + mzChargeDetails[i].instructionText + '</td>';
  726. html += ' <td style="width: 10%;padding-left: 8px;padding-top: 4px;word-break:break-all;">' + mzChargeDetails[i].drugUnit + '</td>';
  727. html += ' <td style="width: 6%;padding-left: 8px;padding-top: 4px;word-break:break-all;">' + mzChargeDetails[i].unitPrice + '</td>';
  728. html += ' <td style="width: 6%;padding-left: 8px;padding-top: 4px;word-break:break-all;">' + mzChargeDetails[i].quantity + '</td>';
  729. html += ' <td style="width: 6%;padding-left: 8px;padding-top: 4px;word-break:break-all;">' + mzChargeDetails[i].amount + '</td>';
  730. html += "</tr>";
  731. }
  732. html += '<tr><td colspan="8"><div style="border:0;border-top:1px solid #000;overflow:hidden;font-size: 13px;"><div style="float: right;font-weight: 700;padding-top: 4px;padding-bottom: 4px;"><span>金额合计:</span><span id="total_count" style="margin-left: 50px;"></span></div></div></td></tr>';
  733. $("#fymx_table_body").html(html);
  734. $("#total_count").text(res.data.totalFee+' 元');
  735. setTimeout(printChargeDetail,500)
  736. }else {
  737. errorMesage(res)
  738. }
  739. })
  740. }
  741. function jiSuanTotalCharge() {
  742. let total = 0;
  743. for (let i = 0; i <rightData.length ; i++) {
  744. total += Number(rightData[i].totalAmountZl)
  745. }
  746. $("#totalCharge").text(total)
  747. }
  748. /**
  749. * 打印费用明细
  750. */
  751. function printChargeDetail() {
  752. setPrint();
  753. LODOP = getLodop();
  754. LODOP.PRINT_INITA(6, 0, "210mm", "297mm", "项目录入费用清单");
  755. //设置默认打印机
  756. LODOP.SET_PRINTER_INDEX(printIndex);
  757. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "297mm");
  758. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  759. LODOP.ADD_PRINT_TABLE(150, "5%", "90%", 800, document.getElementById("fymx_table").innerHTML);
  760. LODOP.SET_PRINT_STYLEA(0, "Vorient", 3);
  761. LODOP.ADD_PRINT_HTM(26, "5%", "90%", 109, document.getElementById("right_title").innerHTML);
  762. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  763. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  764. LODOP.ADD_PRINT_HTM(950, "5%", "90%", 120, document.getElementById("foot").innerHTML);
  765. LODOP.SET_PRINT_STYLEA(0, "ItemType", 1);
  766. LODOP.SET_PRINT_STYLEA(0, "LinkedItem", 1);
  767. // LODOP.PRINT();
  768. LODOP.PREVIEW();
  769. }
  770. /**
  771. * 查询默认打印机
  772. */
  773. function setPrint() {
  774. if (printIndex >= 0) {
  775. return;
  776. }
  777. $.ajax({
  778. type: "GET",
  779. url: '/thmz/getLastWindowsByCurrentUser',
  780. contentType: "application/json;charset=UTF-8",
  781. dataType: "json",
  782. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  783. async: false,
  784. success: function (res) {
  785. if (res == '401' || res == 401) {
  786. window.location.href = '/thmz/login/view'
  787. return;
  788. }
  789. if (res.code == 0) {
  790. printIndex = res.data.cgPrintIndex;
  791. } else {
  792. printIndex = -1;
  793. }
  794. }
  795. });
  796. }