add_mzzyreq.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. //@ sourceURL=user_manage.js
  2. var LODOP; //声明为全局变量
  3. //默认打印机下标
  4. var printIndex = -1;
  5. $(function () {
  6. $("input").each(function () {
  7. this.onkeydown = function (e) { // 监听键盘事件
  8. var theEvent = window.event || e;
  9. var code = theEvent.keyCode || theEvent.which;
  10. if (code == 13) {//回车事件
  11. $("#btn_search").click(); //触发搜索按钮点击事件
  12. }
  13. }
  14. });
  15. //角色保存按钮点击事件
  16. $("#btn_save").click(function (t) {
  17. var validatorResult = validator.checkAll($("#editForm"));
  18. if (validatorResult) {
  19. saveData();
  20. }
  21. });
  22. $("#icdCodeForm").click(function (t) {
  23. $("#diagModal").modal();
  24. diagResetSearch()
  25. getDiagData()
  26. });
  27. //初始化表格数据
  28. getAllPatient();
  29. initListDeptSelect();
  30. iniAdmissStatus();
  31. initZySelect();
  32. });
  33. /**
  34. * 清空入院证输入框
  35. */
  36. function clearZyReq() {
  37. $("#inpatientWardBeHospitalized").selectpicker('val', null);
  38. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  39. $("#smallWardBeHospitalized").selectpicker('val', null);
  40. $('#smallWardBeHospitalized').selectpicker('refresh');
  41. $("#admissStatus").selectpicker('val', null);
  42. $('#admissStatus').selectpicker('refresh');
  43. $("#conditionCode").selectpicker('val', null);
  44. $('#conditionCode').selectpicker('refresh');
  45. $("#routeOfAdmission").selectpicker('val', null);
  46. $('#routeOfAdmission').selectpicker('refresh');
  47. $("#totalBedNum").val(null);
  48. $("#freeBedNum").val(null);
  49. $("#occupationBedNum").val(null);
  50. $("#icdCodeForm").val(null);
  51. $("#icdTextForm").val(null);
  52. initSmallDeptByDept();
  53. }
  54. function diagResetSearch() {
  55. $("#diagParamSearch").val(null);
  56. }
  57. /**
  58. * 获取诊断数据
  59. */
  60. function getDiagData() {
  61. $('#diag_tb_table').bootstrapTable("destroy");
  62. $('#diag_tb_table').bootstrapTable({
  63. url: '/thmz/queryIcdCodePage', //请求后台的URL(*)
  64. method: 'post', //请求方式(*)
  65. toolbar: '#toolbar', //工具按钮用哪个容器
  66. striped: true, //是否显示行间隔色
  67. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  68. pagination: true, //是否显示分页(*)
  69. sortable: true, //是否启用排序
  70. sortOrder: "asc", //排序方式
  71. queryParams: diagQueryParams, //传递参数(*)
  72. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  73. pageNumber: 1, //初始化加载第一页,默认第一页
  74. pageSize: 10, //每页的记录行数(*)
  75. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  76. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  77. strictSearch: true,
  78. showColumns: false, //是否显示所有的列
  79. showRefresh: false, //是否显示刷新按钮
  80. minimumCountColumns: 2, //最少允许的列数
  81. clickToSelect: true, //是否启用点击选中行
  82. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  83. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  84. cardView: false, //是否显示详细视图
  85. detailView: false,
  86. //rowStyle:rowStyle,//通过自定义函数设置行样式
  87. ajaxOptions: {
  88. headers: {
  89. 'Accept': 'application/json',
  90. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  91. }
  92. },
  93. columns: [
  94. {
  95. title: '操作',
  96. align: "center",
  97. valign: 'middle',
  98. formatter: function (value, row, index) {
  99. // var rowData = JSON.stringify(row);
  100. var str = '<button type="button" class="btn btn-primary btn-sm" onclick="xuanZheDiag(\'' + row.code + '\',\'' + row.name + '\')">选中</button>';
  101. return str;
  102. }
  103. },
  104. {
  105. field: 'code',
  106. title: '诊断编码',
  107. align: "center",
  108. valign: 'middle'
  109. },
  110. {
  111. field: 'name',
  112. title: '诊断名称',
  113. align: "center",
  114. valign: 'middle'
  115. }
  116. ],
  117. responseHandler: function (res) {
  118. if (res == '401' || res == 401) {
  119. window.location.href = '/thmz/login/view'
  120. return;
  121. }
  122. var ress = eval(res);
  123. if (ress.code == -1) {
  124. if (ress.message != null && ress.message != '') {
  125. new PNotify({
  126. title: '错误提示',
  127. text: ress.message,
  128. type: 'error',
  129. hide: true,
  130. styling: 'bootstrap3'
  131. });
  132. }
  133. return {
  134. "total": 0,//总页数
  135. "rows": {} //数据
  136. };
  137. }
  138. return {
  139. "total": ress.total,//总页数
  140. "rows": ress.data //数据
  141. };
  142. },
  143. });
  144. }
  145. //选择诊断
  146. function xuanZheDiag(code,name) {
  147. $("#icdCodeForm").val(code)
  148. $("#icdTextForm").val(name)
  149. $("#diagModal").modal("hide");
  150. }
  151. //初始化科室下拉
  152. function initDeptSelect() {
  153. //科室列表
  154. $.ajax({
  155. type: "GET",
  156. url: '/thmz/allUnitCode',
  157. dataType: "json",
  158. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  159. success: function (data) {
  160. if (data == '401' || data == 401) {
  161. window.location.href = '/thmz/login/view'
  162. return;
  163. }
  164. let html = '';
  165. $.each(data.data, function (commentIndex, comment) {
  166. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  167. });
  168. $('#deptNoManagerDept').empty();
  169. $('#deptNoManagerDept').html(html);
  170. $('#deptNoManagerDept').selectpicker('refresh');
  171. }
  172. });
  173. }
  174. /**
  175. * 保存用户数据
  176. */
  177. function saveData() {
  178. var s_data = {
  179. "patientId": $("#patientId").val(),
  180. "reqDept": $("#inpatientWardBeHospitalized").val(),
  181. "smallDept": $("#smallWardBeHospitalized").val(),
  182. "admissStatus": $("#admissStatus").val(),
  183. "conditionCode":$("#conditionCode").val(),
  184. "routeOfAdmission":$("#routeOfAdmission").val(),
  185. "icdCode":$("#icdCodeForm").val(),
  186. "icdText":$("#icdTextForm").val()
  187. }
  188. $.ajax({
  189. type: "POST",
  190. url: '/thmz/banLiZyReq',
  191. contentType: "application/json;charset=UTF-8",
  192. dataType: "json",
  193. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  194. data: JSON.stringify(s_data),
  195. success: function (res) {
  196. if (res == '401' || res == 401) {
  197. window.location.href = '/thmz/login/view'
  198. return;
  199. }
  200. if (res.code == 0) {
  201. $("#editModal").modal("hide");
  202. clearZyReq();
  203. //successMesage(res);
  204. printZyReq($("#patientId").val(),1)
  205. } else {
  206. errorMesage(res);
  207. }
  208. }
  209. });
  210. }
  211. /**
  212. * 查询病人信息
  213. */
  214. function getAllPatient() {
  215. $('#tb_table').bootstrapTable("destroy");
  216. $('#tb_table').bootstrapTable({
  217. url: '/thmz/getPatientMiPage', //请求后台的URL(*)
  218. method: 'post', //请求方式(*)
  219. toolbar: '#toolbar', //工具按钮用哪个容器
  220. striped: true, //是否显示行间隔色
  221. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  222. pagination: true, //是否显示分页(*)
  223. sortable: true, //是否启用排序
  224. sortOrder: "asc", //排序方式
  225. queryParams: queryParams, //传递参数(*)
  226. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  227. pageNumber: 1, //初始化加载第一页,默认第一页
  228. pageSize: 10, //每页的记录行数(*)
  229. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  230. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  231. strictSearch: true,
  232. showColumns: false, //是否显示所有的列
  233. showRefresh: false, //是否显示刷新按钮
  234. minimumCountColumns: 2, //最少允许的列数
  235. clickToSelect: true, //是否启用点击选中行
  236. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  237. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  238. cardView: false, //是否显示详细视图
  239. detailView: false,
  240. //rowStyle:rowStyle,//通过自定义函数设置行样式
  241. ajaxOptions: {
  242. headers: {
  243. 'Accept': 'application/json',
  244. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  245. }
  246. },
  247. columns: [
  248. {
  249. title: '操作',
  250. align: "center",
  251. valign: 'middle',
  252. formatter: function (value, row, index) {
  253. // var rowData = JSON.stringify(row);
  254. var str = '<button type="button" class="btn btn-primary btn-sm" onclick="editAdd(\'' + row.patientId + '\')">办理住院证</button>';
  255. return str;
  256. }
  257. },
  258. {
  259. field: 'patientId',
  260. title: '门诊号',
  261. align: "center",
  262. valign: 'middle'
  263. },
  264. {
  265. field: 'name',
  266. title: '姓名',
  267. align: "center",
  268. valign: 'middle'
  269. }, {
  270. field: 'sex',
  271. title: '性别',
  272. align: "center",
  273. valign: 'middle',
  274. formatter: function (value, row, index) {
  275. return value == 1 ? "男":"女";
  276. }
  277. },
  278. {
  279. field: 'birthDayStr',
  280. title: '出生日期',
  281. align: "center",
  282. valign: 'middle'
  283. },
  284. {
  285. field: 'socialNo',
  286. title: '身份证号码',
  287. align: "center",
  288. valign: 'middle'
  289. }
  290. ],
  291. responseHandler: function (res) {
  292. if (res == '401' || res == 401) {
  293. window.location.href = '/thmz/login/view'
  294. return;
  295. }
  296. var ress = eval(res);
  297. if (ress.code == -1) {
  298. if (ress.message != null && ress.message != '') {
  299. new PNotify({
  300. title: '错误提示',
  301. text: ress.message,
  302. type: 'error',
  303. hide: true,
  304. styling: 'bootstrap3'
  305. });
  306. }
  307. return {
  308. "total": 0,//总页数
  309. "rows": {} //数据
  310. };
  311. }
  312. return {
  313. "total": ress.total,//总页数
  314. "rows": ress.data //数据
  315. };
  316. },
  317. });
  318. }
  319. /**
  320. * 构建列表查询参数
  321. * @param params
  322. * @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
  323. */
  324. function queryParams(params) {
  325. var temp = {
  326. pageSize: params.limit,
  327. offset: params.offset,
  328. patientId: $("#patientIdSearch").val() == "" ? null : $("#patientIdSearch").val(),
  329. name: $("#nameSearch").val() == "" ? null : $("#nameSearch").val(),
  330. socialNo: $("#socialNoSearch").val() == "" ? null : $("#socialNoSearch").val()
  331. };
  332. return temp;
  333. };
  334. function diagQueryParams(params) {
  335. var temp = {
  336. pageSize: params.limit,
  337. pageIndex: params.offset / params.limit,
  338. name: $("#diagParamSearch").val() == "" ? null : $("#diagParamSearch").val(),
  339. };
  340. return temp;
  341. };
  342. function initZySelect() {
  343. //入院病情
  344. var conditionCode = '<option value="1">有</option><option value="2">临床未确定</option><option value="3">情况不明</option><option value="4">无</option>';
  345. $('#conditionCode').html(conditionCode);
  346. $('#conditionCode').selectpicker('refresh');
  347. //入院途径
  348. initRouteOfAdmission()
  349. }
  350. /**
  351. * 初始化入院途径
  352. */
  353. function initRouteOfAdmission() {
  354. getAjaxRequst("/thmz/queryRouteOfAdmission",{},true,function (res) {
  355. if (res == '401' || res == 401) {
  356. window.location.href = '/thmz/login/view'
  357. return;
  358. }
  359. let html = '';
  360. $.each(res.data, function (commentIndex, comment) {
  361. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  362. });
  363. $('#routeOfAdmission').empty();
  364. $('#routeOfAdmission').html(html);
  365. $('#routeOfAdmission').selectpicker('refresh');
  366. })
  367. }
  368. /**
  369. * 所有的入院状态
  370. */
  371. function iniAdmissStatus() {
  372. $.ajax({
  373. type: "GET",
  374. url: '/thmz/getAdmissStatus',
  375. dataType: "json",
  376. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  377. success: function (res) {
  378. if (res == '401' || res == 401) {
  379. window.location.href = '/thmz/login/view'
  380. return;
  381. }
  382. let html = '';
  383. $.each(res.data, function (commentIndex, comment) {
  384. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  385. });
  386. $('#admissStatus').empty();
  387. $('#admissStatus').html(html);
  388. $('#admissStatus').selectpicker('refresh');
  389. }
  390. });
  391. }
  392. /**
  393. * 入院登记的病区列表
  394. */
  395. function initListDeptSelect() {
  396. //科室列表
  397. $.ajax({
  398. type: "GET",
  399. url: '/thmz/allInpatientWard',
  400. dataType: "json",
  401. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  402. success: function (data) {
  403. if (data == '401' || data == 401) {
  404. window.location.href = '/thmz/login/view'
  405. return;
  406. }
  407. var html = '';
  408. $.each(data.data, function (commentIndex, comment) {
  409. if(comment.code != '8000020'){
  410. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  411. }
  412. });
  413. $('#inpatientWardBeHospitalized').empty();
  414. $('#inpatientWardBeHospitalized').html(html);
  415. $('#inpatientWardBeHospitalized').selectpicker('refresh');
  416. initSmallDeptByDept();
  417. }
  418. });
  419. }
  420. /**
  421. * 小科室列表
  422. */
  423. function initSmallDeptByDept() {
  424. let code = escape($('#inpatientWardBeHospitalized').val()).replace(/\+/g, '%2B');
  425. //小科室列表
  426. $.ajax({
  427. type: "GET",
  428. url: '/thmz/getSmallDeptByDept?code=' + code,
  429. dataType: "json",
  430. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  431. success: function (res) {
  432. if (res == '401' || res == 401) {
  433. window.location.href = '/thmz/login/view'
  434. return;
  435. }
  436. var html = '';
  437. $.each(res.data, function (commentIndex, comment) {
  438. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  439. });
  440. $('#smallWardBeHospitalized').empty();
  441. $('#smallWardBeHospitalized').html(html);
  442. $('#smallWardBeHospitalized').selectpicker('destroy').selectpicker('refresh');
  443. }
  444. });
  445. //病床数
  446. $.ajax({
  447. type: "GET",
  448. url: '/thmz/getBedStatusNumByDept?code=' + code,
  449. dataType: "json",
  450. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  451. success: function (res) {
  452. if (res == '401' || res == 401) {
  453. window.location.href = '/thmz/login/view'
  454. return;
  455. }
  456. if (res.code == 0) {
  457. var data = res.data;
  458. if (data == null) {
  459. $("#totalBedNum").val(0);
  460. $("#freeBedNum").val(0);
  461. $("#occupationBedNum").val(0);
  462. } else {
  463. $("#totalBedNum").val(data.total);
  464. $("#freeBedNum").val(data.free);
  465. $("#occupationBedNum").val(data.occupation);
  466. }
  467. } else {
  468. errorMesage(res);
  469. }
  470. }
  471. });
  472. }
  473. /**
  474. * 打开编辑窗口
  475. * @param row
  476. */
  477. function editAdd(patientId) {
  478. $("#patientId").val(patientId)
  479. clearZyReq();
  480. $("#editModal").modal();
  481. }
  482. /**
  483. * 重置查询表单
  484. */
  485. function resetSearch() {
  486. $("#patientIdSearch").val(null);
  487. $("#nameSearch").val(null);
  488. $("#socialNoSearch").val(null);
  489. }
  490. /**
  491. * 打印入院通知单
  492. * @param patientId
  493. * @param times
  494. * @param clnicId
  495. * @param payMark
  496. * @param printType 打印模式 1 预览打印 2 打印设置
  497. */
  498. function printZyReq(patientId, printType) {
  499. $.ajax({
  500. type: "GET",
  501. url: '/thmz/printZyReq?patientId=' + patientId,
  502. contentType: "application/json;charset=UTF-8",
  503. dataType: "json",
  504. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  505. success: function (res) {
  506. if (res == '401' || res == 401) {
  507. window.location.href = '/thmz/login/view'
  508. return;
  509. }
  510. if (res.code == 0) {
  511. setPrint();
  512. LODOP = getLodop();
  513. LODOP.PRINT_INITA(6, 0, "148mm", "210mm", "长沙泰和医院入院通知单");
  514. LODOP.SET_PRINT_STYLE("FontSize", 9); //字体大小
  515. //设置默认打印机
  516. LODOP.SET_PRINTER_INDEX(printIndex);
  517. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "148mm");
  518. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", "210mm");
  519. LODOP.SET_PRINT_PAGESIZE(1, "148mm", "210mm", "CreateCustomPage");
  520. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "入院通知单");//对新建的纸张重命名
  521. //intDispMode:预览比例,数字型,0-适高 1-正常大小 2-适宽
  522. //intToolMode:工具条和按钮,数字型 0-显示(上方)工具栏 1-显示(下方)按钮栏 2-两个都显示 3-两个都不显示
  523. //blDirectPrint: 打印按钮是否“直接打印” 1-是 0-否(弹出界面“选机打印”)
  524. //intWidth,intHeight 窗口的宽和高,整数型,单位是px
  525. //strTitleButtonCaptoin 预览窗口和打印按钮的名称组合,字符型,用“点”分隔
  526. //LODOP.SET_PREVIEW_WINDOW(intDispMode,intToolMode,blDirectPrint,intWidth,intHeight,strTitleButtonCaptoin)
  527. LODOP.SET_PREVIEW_WINDOW(0, 2, 0, 700, 900, "");
  528. //LODOP.SET_PRINT_STYLE("FontSize", 8); //字体大小
  529. var strStyle = "<style>table{width: 96%;} table,td,th {}</style>";
  530. var mzPatientMi = res.mzPatientMi;
  531. var mzZyReq = res.mzZyReq;
  532. $("#patientIdZyReq").text(mzPatientMi.patientId);
  533. $("#patientNameZyReq").text(mzPatientMi.name);
  534. $("#patientGenderZyReq").text(mzPatientMi.gender);
  535. $("#patientAgeZyReq").text(mzPatientMi.ageString);
  536. $("#sfzZyReq").text(mzPatientMi.socialNo);
  537. $("#birthDateZyReq").text(format(mzPatientMi.birthDay, "yyyy-MM-dd"));
  538. $("#phoneZyReq").text(mzPatientMi.phoneNo);
  539. $("#responseTypeZyReq").text(mzPatientMi.responseTypeName);
  540. $("#addressZyReq").text(mzPatientMi.address);
  541. if (mzZyReq.icdCode == null || mzZyReq.icdCode == "" || mzZyReq.icdCode.length == 0) {
  542. $("#icsCodeZyReq").html("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
  543. $("#icsTextZyReq").text(mzZyReq.icdText);
  544. } else {
  545. $("#icsCodeZyReq").text(mzZyReq.icdCode);
  546. $("#icsTextZyReq").text(mzZyReq.icdText);
  547. }
  548. $("#reqDeptZyReq").text(mzZyReq.reqWardName);
  549. $("#smallDeptZyReq").text(mzZyReq.smallDeptName);
  550. $("#routeOfAdmissionName").text(mzZyReq.routeOfAdmissionName);
  551. //$("#admissStatusZyReq").text(mzZyReq.admissStatus);
  552. // $("input:checkbox[value='" + mzZyReq.admissStatus + "']").prop('checked', true);
  553. $("input:checkbox[name='admissStatusZyReq']").each(function (i, e) {
  554. $(this).removeAttr("checked");
  555. if ($(this).val() ==Number(mzZyReq.admissStatus) ||$(this).val()==mzZyReq.admissStatus) {
  556. $(this).attr("checked",true)
  557. }
  558. });
  559. $("#visitDateZyReq").text(format(mzZyReq.visitDate, "yyyy-MM-dd HH:mm:ss"));
  560. $("#deptCodeZyReq").text(mzZyReq.deptName);
  561. $("#doctorCodeZyReq").text(mzZyReq.doctorName);
  562. LODOP.ADD_PRINT_HTM("0mm", "5mm", "140mm", "200mm", strStyle + document.getElementById("mz_zy_req_table").innerHTML);
  563. if (printType == 1) {
  564. LODOP.PREVIEW();
  565. } else if (printType == 2) {
  566. LODOP.PRINT_SETUP();
  567. }
  568. } else {
  569. errorMesage(res);
  570. }
  571. }
  572. });
  573. }
  574. /**
  575. * 查询默认打印机
  576. */
  577. function setPrint() {
  578. if (printIndex >= 0) {
  579. return;
  580. }
  581. $.ajax({
  582. type: "GET",
  583. url: '/thmz/getLastWindowsByCurrentUser',
  584. contentType: "application/json;charset=UTF-8",
  585. dataType: "json",
  586. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  587. async: false,
  588. success: function (res) {
  589. if (res == '401' || res == 401) {
  590. window.location.href = '/thmz/login/view'
  591. return;
  592. }
  593. if (res.code == 0) {
  594. printIndex = res.data.cgPrintIndex;
  595. } else {
  596. printIndex = -1;
  597. }
  598. }
  599. });
  600. }