pharmacy-cell.js 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. //@ sourceURL=pharmacy-cell.js
  2. //待取药队列
  3. var fullscreen = false;//浏览器全屏状态
  4. //药房编号
  5. var groupNo = 71;
  6. $(function () {
  7. openSocket("PD");
  8. this.onkeydown = function (e) { // 监听键盘事件
  9. var theEvent = window.event || e;
  10. var code = theEvent.keyCode || theEvent.which;
  11. if (code == 122) {//捕捉F11键盘动作
  12. e.preventDefault(); //阻止F11默认动作
  13. fullScreen('fulldiv');
  14. }
  15. };
  16. $("#patientId").bind("input propertychange", function () {
  17. if($(this).val().split("-").length === 2 && $(this).val().split("-")[1] !== ""){
  18. let data = {
  19. patientId: $("#patientId").val()
  20. };
  21. // if(lineUpList){
  22. // data.lineUpList = lineUpList
  23. // }
  24. $.ajax({
  25. type: "POST",
  26. url: '/thmz/mzLineUp',
  27. data: JSON.stringify(data),
  28. contentType: "application/json;charset=UTF-8",
  29. dataType: "json",
  30. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  31. success: function (res) {
  32. if (res == '401' || res == 401) {
  33. window.location.href = '/thmz/login/view';
  34. return;
  35. }
  36. if (res.code == 0) {
  37. $("#showSuccessModal").modal("show");
  38. hideModelTimeout('showSuccessModal',3000);
  39. window.localStorage["lineUpList"] = JSON.stringify(res.data);
  40. lineUpList = res.data;
  41. } else {
  42. $("#errorText").text(res.message);
  43. $("#showErrorModal").modal("show");
  44. hideModelTimeout('showErrorModal',3000);
  45. }
  46. $("#showModal").modal("hide");
  47. },
  48. error: function(err){
  49. console.log(err)
  50. $("#showModal").modal("hide");
  51. }
  52. });
  53. }
  54. });
  55. $(".selectpicker").selectpicker({
  56. dropuAuto: false
  57. });
  58. fullScreen('fulldiv');
  59. //调用函数,执行一次
  60. currentTime();
  61. //调用setInterval函数,实现始终计时
  62. setInterval(currentTime, 1000);
  63. setHeightForTable();
  64. $(window).resize(function () {
  65. //设置页面宽度
  66. setHeightForTable();
  67. });
  68. $("#btn_med_in_cert").click(function (t) {
  69. readcardRequest({
  70. method: 'get',
  71. data: {
  72. // param: 'qrcode_01302'
  73. param: 'jiangsu_qrcode_01302'
  74. }
  75. }).then((res)=>{
  76. console.log(res.data);
  77. let data = {
  78. socialNo: res.data.idNo
  79. };
  80. // if(lineUpList){
  81. // console.log("------------" + lineUpList);
  82. // data.lineUpList = lineUpList
  83. // }
  84. $.ajax({
  85. type: "POST",
  86. url: '/thmz/mzLineUp',
  87. data: JSON.stringify(data),
  88. contentType: "application/json;charset=UTF-8",
  89. dataType: "json",
  90. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  91. success: function (res) {
  92. if (res.code == 0) {
  93. $("#showSuccessModal").modal("show");
  94. hideModelTimeout('showSuccessModal',3000);
  95. window.localStorage["lineUpList"] = JSON.stringify(res.data);
  96. lineUpList = res.data;
  97. } else {
  98. $("#errorText").text("排队失败,未找到待取药的处方");
  99. $("#showErrorModal").modal("show");
  100. hideModelTimeout('showErrorModal',3000);
  101. }
  102. $("#showModal").modal("hide");
  103. }
  104. });
  105. });
  106. });
  107. $("#btn_patient_id").click(function (t) {
  108. $("#showModal").modal("show");
  109. });
  110. $("#showModal").on('shown.bs.modal', function (t) {
  111. $("#patientId").focus();
  112. $("#patientId").val("");
  113. });
  114. });
  115. /**
  116. *医保电子凭证读卡
  117. * @param bizType 电子凭证数据类型
  118. */
  119. function siReadCard(bizType) {
  120. $.ajax({
  121. type: "GET",
  122. // url: "http://localhost:8321/readcard/entry?param=qrcode_" + bizType,
  123. url: "http://localhost:8321/api/entry?param=jiangsu_qrcode_" + bizType,
  124. contentType: "application/json;charset=UTF-8",
  125. dataType: "json",
  126. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  127. success: function (res) {
  128. if (res == '401' || res == 401) {
  129. window.location.href = '/thmz/login/view';
  130. return;
  131. }
  132. if (res.code == 200) {
  133. successMesage(res);
  134. } else {
  135. errorMesage(res);
  136. }
  137. }
  138. });
  139. }
  140. /**
  141. * 设置页面宽度
  142. */
  143. function setHeightForTable() {
  144. var height = $(window).height() - 320;
  145. var realHeight = height / 7;
  146. if (realHeight < 75) {
  147. realHeight = 75;
  148. }
  149. $("#tableList tr").css("height", realHeight + "px");
  150. }
  151. function currentTime(){
  152. //获取时间保存到date变量
  153. var date = new Date();
  154. //将星期日~星期一保存到数组
  155. var week = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
  156. //获取date中的小时,如果小于9,则在前面拼接一个0
  157. var hours = date.getHours()>9?date.getHours():'0'+date.getHours();
  158. //获取date中的分钟,如果小于9,则在前面拼接一个0
  159. var minutes = date.getMinutes()>9?date.getMinutes():'0'+date.getMinutes();
  160. //获取date中的秒,如果小于9,则在前面拼接一个0
  161. var seconds = date.getSeconds()>9?date.getSeconds():'0'+date.getSeconds();
  162. //获取date中的年、月、日
  163. var dates = date.getFullYear()+'年'+(date.getMonth()+1)+'月'+date.getDate()+'日';
  164. //拼接时分秒, 拼接星期
  165. var times = hours+':'+minutes+':'+seconds+' '+week[date.getDay()];
  166. //向dateNow节点添加dates(年、月、日, 星期)
  167. $("#dateNow").html(dates);
  168. //向timeNow节点添加timess(时、分、秒)
  169. $("#timeNow").html(times);
  170. }