pharmacy-cell.js 5.6 KB

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