registration.js 79 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232
  1. //@ sourceURL=registration.js
  2. var $dataTableHot;
  3. //判断病人列表是否在加载中,防止重复加载
  4. var msg_list_loading = false;
  5. //挂号卡片列表页面下标
  6. var pageIndex = 0;
  7. var LODOP; //声明为全局变量
  8. //默认打印机下标
  9. var printIndex = -1;
  10. var TableInit = function () {
  11. var oTableInit = new Object();
  12. //初始化Table
  13. oTableInit.Init = function () {
  14. $dataTableHot = $('#tb_fee_info').bootstrapTable({
  15. url: '', //请求后台的URL(*)
  16. method: 'post', //请求方式(*)
  17. toolbar: '#toolbar', //工具按钮用哪个容器
  18. striped: true, //是否显示行间隔色
  19. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  20. pagination: false, //是否显示分页(*)
  21. sortable: true, //是否启用排序
  22. sortOrder: "asc", //排序方式
  23. //queryParams: oTableInit.queryParams,//传递参数(*)
  24. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  25. pageNumber: 1, //初始化加载第一页,默认第一页
  26. pageSize: 10, //每页的记录行数(*)
  27. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  28. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  29. strictSearch: true,
  30. showColumns: false, //是否显示所有的列
  31. showRefresh: false, //是否显示刷新按钮
  32. minimumCountColumns: 2, //最少允许的列数
  33. clickToSelect: true, //是否启用点击选中行
  34. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  35. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  36. cardView: false, //是否显示详细视图
  37. detailView: false,
  38. ajaxOptions: {
  39. headers: {
  40. 'Accept': 'application/json',
  41. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  42. }
  43. },
  44. columns: [
  45. // {
  46. // checkbox: true
  47. // },
  48. {
  49. field: 'name',
  50. title: '名称',
  51. align: "center",
  52. valign: 'middle',
  53. //sortable: true
  54. }, {
  55. field: 'money',
  56. title: '金额(元)',
  57. align: "center",
  58. valign: 'middle',
  59. //sortable: true
  60. }, {
  61. field: 'moneyReceived',
  62. title: '实收金额(元)',
  63. align: "center",
  64. valign: 'middle',
  65. // sortable: true
  66. }],
  67. responseHandler: function (res) {
  68. if (res == '401' || res == 401) {
  69. window.location.href = '/thmz/login/view'
  70. return;
  71. }
  72. var ress = eval(res);
  73. if (ress.code == -1) {
  74. new PNotify({
  75. title: '错误提示',
  76. text: ress.message,
  77. type: 'error',
  78. hide: true,
  79. styling: 'bootstrap3'
  80. });
  81. return {
  82. "total": 0,//总页数
  83. "rows": {} //数据
  84. };
  85. }
  86. return {
  87. "total": ress.pageViewVO.total,//总页数
  88. "rows": ress.pageViewVO.data //数据
  89. };
  90. },
  91. });
  92. };
  93. return oTableInit;
  94. };
  95. $(function () {
  96. initGenderSelect();
  97. initResponceTypeSelect();
  98. initCertificateTypeSelect();
  99. init_daterangepicker();
  100. //1.初始化Table
  101. var oTable = new TableInit();
  102. oTable.Init();
  103. formatCheck();
  104. //默认光标在卡号输入框
  105. $("#cardNo").focus();
  106. //根据病人姓名输入框内容动态加载病人列表
  107. //initUserList();
  108. //卡号输入改变事件
  109. cardNoChange();
  110. //病人姓名输入改变事件
  111. // userNameChange();
  112. //数据校验
  113. init_validator();
  114. //时间区间
  115. initMzWorkTime();
  116. //初始门诊收银方式下拉选
  117. initChequeType("payType");
  118. //初始化省份
  119. initProvince(1);
  120. /**
  121. * 创建核酸检查处方并保存
  122. */
  123. $("#saveNucleicAcid").on("click", function (t) {
  124. saveNucleicAcid();
  125. });
  126. /**
  127. * 跳转到缴费界面
  128. */
  129. $("#chargeFeeNucleicAcid").on("click", function (t) {
  130. chargeFeeNucleicAcid();
  131. });
  132. /**
  133. * 创建核酸检查(混检)处方并保存
  134. */
  135. $("#saveHybridTest").on("click", function (t) {
  136. saveHybridTest();
  137. });
  138. /**
  139. * 跳转到(混检)缴费界面
  140. */
  141. $("#chargeFeeHybridTest").on("click", function (t) {
  142. chargeFeeHybridTest();
  143. });
  144. /**
  145. * 医保电子凭证读卡
  146. */
  147. $("#siReadCard").on("click", function (t) {
  148. siReadCard("qrcode_01101");
  149. });
  150. /**
  151. * 医保刷脸
  152. */
  153. $("#siReadCardFace").on("click", function (t) {
  154. siReadCard("face_01101");
  155. });
  156. /**
  157. * 清空
  158. */
  159. $("#clearRegistration").on("click", function (t) {
  160. clearRegistration();
  161. });
  162. /**
  163. * 增加收款方式按钮事件
  164. */
  165. $("#addPayType").on("click", function (t) {
  166. var payTypeIndex = $("#payTypeIndex").val();
  167. var payTypeId = "payType_" + payTypeIndex;
  168. var html = '<div class="item form-group"><div class="col-md-12 col-sm-12 col-xs-12"><div class="col-md-2 col-sm-2 col-xs-12"></div><label class="col-md-3 col-sm-3 col-xs-12"><select class="form-control selectpicker show-tick" required="true" id="' + payTypeId + '"></select></label><div class="col-md-3 col-sm-3 col-xs-12"><input class="form-control col-md-5 col-xs-12" type="number" data-placement="bottom-right" min="0"></div><a style="line-height: 34px;cursor: pointer;" onclick="closeThisParent(this)"><i class="fa fa-close"></i></a></div></div>';
  169. $("#changeAmountParent").before(html);
  170. initChequeType(payTypeId)
  171. payTypeIndex = payTypeIndex + 1;
  172. $("#payTypeIndex").val(payTypeIndex);
  173. });
  174. // //当ic卡号输入框失去光标后,重置光标到卡号输入框
  175. // $("#cardNo").blur(function () {
  176. // var focus = !($("#userName").is(":focus") || $("#age").is(":focus") || $("#birthDay").is(":focus") || $("#phoneNum").is(":focus") || $("#idCard").is(":focus") || $("#address").is(":focus"));
  177. // if (focus && $("#cardNo").val() == null || $("#cardNo").val() == "") {
  178. // //默认光标在卡号输入框
  179. // $("#cardNo").focus();
  180. // }
  181. // });
  182. /**
  183. * 保存挂号信息
  184. */
  185. $("#saveConfirmFee").on("click", function (t) {
  186. $("#saveConfirmFee").attr("disabled", true);
  187. var cash = $("#cash").val();
  188. if (cash == null || cash == "") {
  189. new PNotify({
  190. title: '错误提示',
  191. text: "金额不能为空!",
  192. type: 'error',
  193. hide: false,
  194. styling: 'bootstrap3'
  195. });
  196. $("#saveConfirmFee").attr("disabled", false);
  197. return;
  198. }
  199. var realMoney = parseFloat($("#realMoney").val());
  200. realMoney = realMoney.toFixed(2);
  201. if (parseFloat(cash) < realMoney) {
  202. $("#saveConfirmFee").attr("disabled", false);
  203. return;
  204. }
  205. var patientId = $("#patientId").val();
  206. if (patientId == null || patientId == "") {
  207. savePatient(1);
  208. } else {
  209. saveMzyReqrec();
  210. }
  211. });
  212. //每隔三秒读一次身份证
  213. readIcCard();
  214. // setInterval(function () {
  215. // new Device().startFun();
  216. // }, 3000);
  217. /**
  218. * 患者信息修改
  219. */
  220. $("#saveEditUser").on("click", function (t) {
  221. modifyPatient();
  222. });
  223. /**
  224. * 挂号列表中的科室和医生列表初始化
  225. */
  226. initListSelect();
  227. // $("#editPrint").on("click", function (t) {
  228. // CreatePrinterList();
  229. // $("#editPrintModal").modal();
  230. // });
  231. // $("#birthDay").keypress(function () { // keypress:输入框每获取一个字符,就触发一次该事件。
  232. // var birthDay= $("#birthDay").val();
  233. // birthDay='19880613';
  234. //
  235. // });
  236. $("#birthDay").change(function (e) {
  237. setAge();
  238. $("#age").blur();
  239. });
  240. $("#editUserBirthDay").change(function (e) {
  241. var editUserBirthDay = $("#editUserBirthDay").val();
  242. if (editUserBirthDay.length == 8 && editUserBirthDay.indexOf("-") <= 0) {
  243. editUserBirthDay = editUserBirthDay.substring(0, 4) + "-" + editUserBirthDay.substring(4, 6) + "-" + editUserBirthDay.substring(6);
  244. $("#editUserBirthDay").val(editUserBirthDay);
  245. }
  246. var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
  247. if (!dateFormat.test(editUserBirthDay)) {
  248. errorMesageSimaple("生日日期错误");
  249. }
  250. var arr = editUserBirthDay.split("-");
  251. if (!checkDate(arr[0], arr[1], arr[2])) {
  252. errorMesageSimaple("生日日期错误");
  253. }
  254. var returnAge = jsGetAge(editUserBirthDay);
  255. $("#editUserAge").val(returnAge);
  256. });
  257. $("#idCard").change(function (e) {
  258. queryUserInfoBySocialNo();
  259. });
  260. $("#editUserIdCard").change(function (e) {
  261. var editUserIdCard = $("#editUserIdCard").val();
  262. if (editUserIdCard == null || editUserIdCard == "") {
  263. return;
  264. }
  265. var birthday = editUserIdCard.substring(6, 14);
  266. birthday = birthday.substring(0, 4) + "-" + birthday.substring(4, 6) + "-" + birthday.substring(6);
  267. $("#editUserBirthDay").val(birthday);
  268. var returnAge = jsGetAge(birthday);
  269. $("#editUserAge").val(returnAge);
  270. var gender = editUserIdCard.substring(16, 17);
  271. if (gender % 2 == 0) {
  272. $("#editUserGender").val(2);
  273. } else {
  274. $("#editUserGender").val(1);
  275. }
  276. $('#editUserGender').selectpicker('refresh');
  277. });
  278. $("#phoneNum").change(function (e) {
  279. queryUserInfoByphoneNo();
  280. });
  281. $("#userName").change(function (e) {
  282. queryUserInfoByName();
  283. });
  284. setTimeout(function () {
  285. getLodop();
  286. }, 800);
  287. /**
  288. * 刷卡/扫码
  289. */
  290. $("#consume").on("click", function (t) {
  291. consume();
  292. });
  293. });
  294. /**
  295. * 刷新列表,解决越来越快的问题
  296. */
  297. function readIcCard() {
  298. //clearInterval要放在方法开始,不然的话,下面的代码还没运行到clearInterval,又开始了循环了。
  299. clearInterval(readIcCardTimerForRegistration);
  300. new Device().startFun();
  301. readIcCardTimerForRegistration = setInterval(() => {
  302. readIcCard()
  303. }, 3000);
  304. }
  305. // function CreatePageList() {
  306. // LODOP = getLodop();
  307. // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
  308. // //获取纸张大小数,用于进行遍历
  309. // var strPageSizeList = LODOP.GET_PAGESIZES_LIST($('#printSelect').val(), "\n");
  310. // var html = "";
  311. // var arr = strPageSizeList.split("\n");
  312. // for (var i = 0; i < arr.length; i++) {
  313. // html += "<option value='" + arr[i] + "'>" + arr[i] + "</option>";
  314. // }
  315. // $('#pageSelect').html(html);
  316. // $('#pageSelect').selectpicker('refresh');
  317. // }
  318. /**
  319. * 初始化性别下拉选
  320. */
  321. function initGenderSelect() {
  322. $(".selectpicker").selectpicker({
  323. //设置菜单的上浮或者下浮
  324. dropuAuto: false
  325. });
  326. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  327. $('#gender').html(gender);
  328. $('#gender').selectpicker('refresh');
  329. $('#editUserGender').html(gender);
  330. $('#editUserGender').selectpicker('refresh');
  331. }
  332. /**
  333. * 初始化病人身份类别下拉选
  334. */
  335. function initResponceTypeSelect() {
  336. $(".selectpicker").selectpicker({
  337. dropuAuto: false
  338. });
  339. $.ajax({
  340. type: "GET",
  341. url: '/thmz/getMzResponceType',
  342. contentType: "application/json;charset=UTF-8",
  343. dataType: "json",
  344. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  345. success: function (res) {
  346. if (res == '401' || res == 401) {
  347. window.location.href = '/thmz/login/view'
  348. return;
  349. }
  350. if (res.code == 0) {
  351. res.data.forEach(function (item, index) {
  352. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  353. $('#patientsNature').append(html);
  354. $('#editUserPatientsNature').append(html);
  355. });
  356. $('#patientsNature').selectpicker('refresh');
  357. $('#editUserPatientsNature').selectpicker('refresh');
  358. } else {
  359. errorMesage(res);
  360. }
  361. }
  362. });
  363. }
  364. /**
  365. * 初始化证件类型下拉选
  366. */
  367. function initCertificateTypeSelect() {
  368. $.ajax({
  369. type: "GET",
  370. url: '/thmz/listCertificateType',
  371. contentType: "application/json;charset=UTF-8",
  372. dataType: "json",
  373. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  374. success: function (res) {
  375. if (res == '401' || res == 401) {
  376. window.location.href = '/thmz/login/view'
  377. return;
  378. }
  379. if (res.code == 0) {
  380. res.data.forEach(function (item, index) {
  381. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  382. $('#certificateType').append(html);
  383. $('#editUserCertificateType').append(html);
  384. });
  385. $('#certificateType').selectpicker('refresh');
  386. $('#editUserCertificateType').selectpicker('refresh');
  387. $('#certificateType').selectpicker('val', '01');
  388. $('#certificateType').selectpicker('refresh');
  389. } else {
  390. errorMesage(res);
  391. }
  392. }
  393. });
  394. }
  395. /**
  396. * 初始科室下拉选
  397. * @param ampm 时间段区间
  398. * @param type
  399. */
  400. function initDeptPlus(type) {
  401. var ampm = $("#ampm").val();
  402. if (type == 1) {
  403. setAmTimes(ampm);
  404. }
  405. $("#deptNo").selectpicker({
  406. size: 10
  407. });
  408. var apTimes = $("#apTimes").val();
  409. //科室列表
  410. $.ajax({
  411. type: "GET",
  412. url: '/thmz/getUnitCodeByRequestDay?ampm=' + ampm + "&apTimes=" + apTimes,
  413. dataType: "json",
  414. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  415. success: function (data) {
  416. if (data == '401' || data == 401) {
  417. window.location.href = '/thmz/login/view'
  418. return;
  419. }
  420. var html = '';
  421. $.each(data.data, function (commentIndex, comment) {
  422. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  423. });
  424. $('#deptNo').empty();
  425. $('#deptNo').html(html);
  426. $('#deptNo').selectpicker('refresh');
  427. $('#chargeType').empty();
  428. $('#chargeType').selectpicker('refresh');
  429. emptyInput();
  430. }
  431. });
  432. }
  433. /**
  434. * 初始医生下拉选
  435. * @param ampm 时间段区间
  436. */
  437. function initEmployee() {
  438. $("#doctor").selectpicker({
  439. size: 10
  440. });
  441. //医生列表
  442. $.ajax({
  443. type: "GET",
  444. url: '/thmz/getDoctorCodeByRequestDay?unitCode=' + $('#deptNo').val() + "&ampm=" + $("#ampm").val() + "&chargeType=" + $("#chargeType").val() + "&apTime=" + $("#apTimes").val(),
  445. dataType: "json",
  446. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  447. success: function (res) {
  448. if (res == '401' || res == 401) {
  449. window.location.href = '/thmz/login/view'
  450. return;
  451. }
  452. var html = '';
  453. var defaultCode = null;
  454. $.each(res.data, function (commentIndex, comment) {
  455. var employeeName = comment.employee.employeeName;
  456. if (comment.leftNum != null) {
  457. employeeName = employeeName + " 余号(" + comment.leftNum + ")"
  458. }
  459. html += '<option value="' + comment.employee.employeeCode + '" data-chargeType="' + comment.chargeType + '" data-checkFee="' + comment.checkFee + '" data-mzyRequestId="' + comment.mzyRequestId + '">' + employeeName + '</option>';
  460. if (res.data.length == 1) {
  461. //如果只有一个号别,默认选中
  462. defaultCode = comment.employee.employeeCode;
  463. }
  464. });
  465. $('#doctor').empty();
  466. $('#doctor').html(html);
  467. $('#doctor').selectpicker('refresh');
  468. //validator.checkAll($("#regi_form"));
  469. if (defaultCode != null) {
  470. //如果有无需选择医生的选项,默认选择
  471. $('#doctor').selectpicker('val', defaultCode);
  472. $('#doctor').selectpicker('refresh');
  473. fitFee();
  474. }
  475. }
  476. });
  477. }
  478. /**
  479. * 设置时间下拉选
  480. * @param ampm
  481. */
  482. function setAmTimes(ampm) {
  483. if (ampm == "a" || ampm == "p") {
  484. $("#apTimesDiv").removeClass("hide").addClass("in");
  485. $("#doctorDiv").css("margin-top", "10px");
  486. var timeHtml = null;
  487. var defaultTime = null;
  488. if (ampm == "a") {
  489. if (range(paseToFullTime("00:00"), paseToFullTime("08:30"))) {
  490. defaultTime = "a1";
  491. timeHtml = '<option value="a1">08:00-08:30</option><option value="a2">08:30-09:00</option><option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  492. } else if (range(paseToFullTime("08:30"), paseToFullTime("09:00"))) {
  493. defaultTime = "a2";
  494. timeHtml = '<option value="a2">08:30-09:00</option><option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  495. } else if (range(paseToFullTime("09:00"), paseToFullTime("09:30"))) {
  496. defaultTime = "a3";
  497. timeHtml = '<option value="a3">09:00-09:30</option><option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  498. } else if (range(paseToFullTime("09:30"), paseToFullTime("10:00"))) {
  499. defaultTime = "a4";
  500. timeHtml = '<option value="a4">09:30-10:00</option><option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  501. } else if (range(paseToFullTime("10:00"), paseToFullTime("10:30"))) {
  502. defaultTime = "a5";
  503. timeHtml = '<option value="a5">10:00-10:30</option><option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  504. } else if (range(paseToFullTime("10:30"), paseToFullTime("11:00"))) {
  505. defaultTime = "a6";
  506. timeHtml = '<option value="a6">10:30-11:00</option><option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  507. } else if (range(paseToFullTime("11:00"), paseToFullTime("11:30"))) {
  508. defaultTime = "a7";
  509. timeHtml = '<option value="a7">11:00-11:30</option><option value="a8">11:30-12:00</option>';
  510. } else if (range(paseToFullTime("11:30"), paseToFullTime("12:00"))) {
  511. defaultTime = "a8";
  512. timeHtml = '<option value="a8">11:30-12:00</option>';
  513. }
  514. } else {
  515. if (range(paseToFullTime("00:00"), paseToFullTime("14:30"))) {
  516. defaultTime = "p1";
  517. timeHtml = '<option value="p1">14:00-14:30</option><option value="p2">14:30-15:00</option><option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  518. } else if (range(paseToFullTime("14:30"), paseToFullTime("15:00"))) {
  519. defaultTime = "p2";
  520. timeHtml = '<option value="p2">14:30-15:00</option><option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  521. } else if (range(paseToFullTime("15:00"), paseToFullTime("15:30"))) {
  522. defaultTime = "p3";
  523. timeHtml = '<option value="p3">15:00-15:30</option><option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  524. } else if (range(paseToFullTime("15:30"), paseToFullTime("16:00"))) {
  525. defaultTime = "p4";
  526. timeHtml = '<option value="p4">15:30-16:00</option><option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  527. } else if (range(paseToFullTime("16:00"), paseToFullTime("16:30"))) {
  528. defaultTime = "p5";
  529. timeHtml = '<option value="p5">16:00-16:30</option><option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  530. } else if (range(paseToFullTime("16:30"), paseToFullTime("17:00"))) {
  531. defaultTime = "p6";
  532. timeHtml = '<option value="p6">16:30-17:00</option><option value="p7">17:00-17:30</option>';
  533. }else if (range(paseToFullTime("17:00"), paseToFullTime("17:30"))) {
  534. defaultTime = "p7";
  535. timeHtml = '<option value="p7">17:00-17:30</option>';
  536. }
  537. }
  538. $('#apTimes').html(timeHtml);
  539. $('#apTimes').selectpicker('refresh');
  540. $("#apTimes").selectpicker('val', defaultTime);
  541. $('#apTimes').selectpicker('refresh');
  542. } else {
  543. $("#apTimes").selectpicker('val', null);
  544. $('#apTimes').selectpicker('refresh');
  545. $("#apTimesDiv").removeClass("in").addClass("hide");
  546. $("#doctorDiv").css("margin-top", "0px");
  547. }
  548. }
  549. /**
  550. * 初始门诊时间区间下拉选
  551. */
  552. function initMzWorkTime() {
  553. $("#ampm").selectpicker({
  554. size: 10
  555. });
  556. $.ajax({
  557. type: "GET",
  558. url: '/thmz/getMzWorkTimeCanUsed',
  559. dataType: "json",
  560. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  561. success: function (res) {
  562. if (res == '401' || res == 401) {
  563. window.location.href = '/thmz/login/view'
  564. return;
  565. }
  566. var html = '';
  567. var ampm = null;
  568. $.each(res.data, function (commentIndex, comment) {
  569. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  570. if (ampm == null || (ampm != "a" && ampm != "p")) {
  571. var startTime = paseToFullTime(comment.startTime);
  572. var endTime = paseToFullTime(comment.endTime);
  573. if (range(startTime, endTime)) {
  574. ampm = comment.code;
  575. setAmTimes(ampm);
  576. }
  577. }
  578. });
  579. $('#ampm').empty(); //清空resText里面的所有内容
  580. $('#ampm').html(html);
  581. $('#ampm').selectpicker('refresh');
  582. $("#ampm").selectpicker('val', ampm);
  583. $('#ampm').selectpicker('refresh');
  584. initDeptPlus(1);
  585. }
  586. });
  587. }
  588. /**
  589. * 初始门诊号别下拉选
  590. */
  591. function initChargeType() {
  592. $.ajax({
  593. type: "GET",
  594. url: '/thmz/getChargeTypeByRequestDay?unitCode=' + $('#deptNo').val() + "&ampm=" + $("#ampm").val() + "&apTime=" + $("#apTimes").val(),
  595. dataType: "json",
  596. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  597. success: function (res) {
  598. if (res == '401' || res == 401) {
  599. window.location.href = '/thmz/login/view'
  600. return;
  601. }
  602. var html = '';
  603. var defaultCode = null;
  604. $.each(res.data, function (commentIndex, comment) {
  605. if (res.data.length == 1) {
  606. //如果只有一个号别,默认选中
  607. defaultCode = comment.code;
  608. }
  609. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  610. });
  611. $('#chargeType').empty(); //清空resText里面的所有内容
  612. $('#chargeType').html(html);
  613. $('#chargeType').selectpicker('refresh');
  614. if (defaultCode != null) {
  615. //如果有默认选项,默认选择
  616. $('#chargeType').selectpicker('val', defaultCode);
  617. $('#chargeType').selectpicker('refresh');
  618. initEmployee();
  619. }
  620. validator.checkAll($("#regi_form"));
  621. emptyInput();
  622. }
  623. });
  624. }
  625. /**
  626. * 设置挂号费等费用
  627. */
  628. function fitFee() {
  629. var mzyRequestId = $('#doctor').find("option:selected").attr('data-mzyRequestId');
  630. var checkFee = $('#doctor').find("option:selected").attr('data-checkFee');
  631. if (checkFee == undefined || checkFee == null) {
  632. checkFee = 0;
  633. }else {
  634. checkFee=parseFloat(checkFee);
  635. }
  636. //诊疗卡是否选择
  637. var zlkCheckbox = $("#zlkCheckbox").prop("checked");
  638. //病历本是否选择
  639. var blbCheckbox = $("#blbCheckbox").prop("checked");
  640. //诊疗卡和病历本费用
  641. var checkBoxFee = 0;
  642. if (zlkCheckbox) {
  643. checkBoxFee = checkBoxFee + 1;
  644. }
  645. if (blbCheckbox) {
  646. checkBoxFee = checkBoxFee + 1;
  647. }
  648. var totalFee = checkFee + checkBoxFee;
  649. $("#checkFee").val(totalFee);
  650. $("#amountMoney").text(totalFee);
  651. $("#amountMoneyConfirm").text(totalFee);
  652. $("#realMoney").val(totalFee);
  653. $("#cash").val(totalFee);
  654. $("#changeAmount").val(0);
  655. $.ajax({
  656. type: "GET",
  657. url: '/thmz/getMzChargeTypeByMzyRequestId?mzyRequestId=' + mzyRequestId + "&birthDay=" + $("#birthDay").val() + "&patientId=",
  658. dataType: "json",
  659. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  660. success: function (res) {
  661. if (res == '401' || res == 401) {
  662. window.location.href = '/thmz/login/view'
  663. return;
  664. }
  665. $("#registrationFee").val(res.data.reqFee);
  666. $("#hospitalFee").val(res.data.clinicFee);
  667. $("#othFee").val(parseFloat(res.data.othFee) - parseFloat(checkFee));
  668. var tempFee = parseFloat(res.data.reqFee) + parseFloat(res.data.clinicFee) + parseFloat(res.data.othFee);
  669. totalFee = tempFee + checkBoxFee;
  670. $("#amountMoney").text(totalFee);
  671. $("#amountMoneyConfirm").text(totalFee);
  672. $("#realMoney").val(totalFee);
  673. $("#cash").val(totalFee);
  674. validator.checkAll($("#regi_form"));
  675. }
  676. });
  677. }
  678. /**
  679. * 初始门诊收银方式下拉选
  680. */
  681. function initChequeType(payType) {
  682. $.ajax({
  683. type: "GET",
  684. url: '/thmz/getAllZdChequeTypeForMz',
  685. dataType: "json",
  686. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  687. success: function (res) {
  688. if (res == '401' || res == 401) {
  689. window.location.href = '/thmz/login/view'
  690. return;
  691. }
  692. var html = '';
  693. $.each(res.data, function (commentIndex, comment) {
  694. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  695. });
  696. $('#' + payType).empty();
  697. $('#' + payType).html(html);
  698. $('#' + payType).selectpicker('refresh');
  699. if (res.data.length == 1) {
  700. $('#' + payType).selectpicker('val', 'Y');
  701. } else {
  702. $('#' + payType).selectpicker('val', 'O');
  703. }
  704. $('#' + payType).selectpicker('refresh');
  705. }
  706. });
  707. }
  708. /**
  709. * 日期值改变修改年龄字段
  710. * @param ev
  711. */
  712. function changeDate(ev) {
  713. }
  714. /**
  715. * 列表类型按钮切换事件
  716. * @param object
  717. */
  718. function titleButtonChange(object) {
  719. $("#regi_List_btn_group").find("button").each(function (index, element) {
  720. if ($(element).hasClass("btn-primary")) {
  721. $(element).removeClass("btn-primary").addClass("btn-default");
  722. }
  723. });
  724. $(object).removeClass("btn-default").addClass("btn-primary");
  725. loadRegistrationList(true);
  726. }
  727. /**
  728. * 表格类型切换事件 卡片展示或者列表形式
  729. */
  730. function listTypeChange(object) {
  731. //var indexNum = 0;
  732. $("#regi_List_type").find("button").each(function (index, element) {
  733. if ($(element).hasClass("btn-primary")) {
  734. $(element).removeClass("btn-primary").addClass("btn-default");
  735. }
  736. // if (object == element) {
  737. // indexNum = index;
  738. // }
  739. });
  740. $(object).removeClass("btn-default").addClass("btn-primary");
  741. loadRegistrationList(true);
  742. }
  743. /**
  744. * 打开编辑用户信息窗口
  745. * @param data
  746. */
  747. function editUserModal(data) {
  748. $("#editUserModal").modal();
  749. if (data == null) {
  750. data = $("#patientId").val();
  751. }
  752. $.ajax({
  753. type: "GET",
  754. url: '/thmz/getByPatientId?patientId=' + data,
  755. contentType: "application/json;charset=UTF-8",
  756. dataType: "json",
  757. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  758. success: function (res) {
  759. if (res == '401' || res == 401) {
  760. window.location.href = '/thmz/login/view'
  761. return;
  762. }
  763. if (res.code == 0) {
  764. if (res.data != null) {
  765. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  766. setTimeout(function () {
  767. fillPlusPatinet(res.data);
  768. }, 400);
  769. }
  770. } else {
  771. errorMesage(res);
  772. }
  773. }
  774. });
  775. }
  776. /**
  777. * 打开打印内容窗口
  778. * @param data
  779. */
  780. function printModal(data) {
  781. $("#printOrPreviewModal").modal("hide");
  782. $("#printModal").modal();
  783. }
  784. /**
  785. * 打开收费窗口
  786. * @param data
  787. */
  788. function confirmFeeModal() {
  789. var validatorResult = validator.checkAll($("#regi_form"));
  790. if (!validatorResult) {
  791. return;
  792. }
  793. $.ajax({
  794. type: "POST",
  795. url: '/thmz/validFurtherVisit',
  796. contentType: "application/json;charset=UTF-8",
  797. dataType: "json",
  798. data: JSON.stringify({
  799. "patientId": $("#patientId").val(),
  800. "visitDept": $("#deptNo").val(),
  801. "chargeType": $("#chargeType").val()
  802. }),
  803. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  804. success: function (res) {
  805. if (res == '401' || res == 401) {
  806. window.location.href = '/thmz/login/view'
  807. return;
  808. }
  809. if (res.code != 0) {
  810. errorMesage(res)
  811. }else {
  812. var payTypeList = $("#payType").children();
  813. if (payTypeList.length == 1) {
  814. $('#payType').selectpicker('val', 'Y');
  815. } else {
  816. $('#payType').selectpicker('val', 1);
  817. }
  818. //$('#payType').selectpicker('val', 1);
  819. $('#payType').selectpicker('refresh');
  820. var prevAll = $("#changeAmountParent").prevAll();
  821. while (prevAll.length > 2) {
  822. $("#changeAmountParent").prev().remove();
  823. prevAll = $("#changeAmountParent").prevAll();
  824. }
  825. $("#realMoney").val($("#amountMoneyConfirm").text());
  826. $("#cash").val($("#amountMoneyConfirm").text());
  827. //$("#cash").val(null);
  828. $("#confirmFeeModal").modal();
  829. sendPriceMessage($("#amountMoneyConfirm").text(), 0.0, 0.0, $("#patientId").val());
  830. }
  831. }
  832. });
  833. }
  834. /**
  835. * checkBox样式
  836. */
  837. function formatCheck() {
  838. if ($("input.flat")[0]) {
  839. $(document).ready(function () {
  840. $('input.flat').iCheck({
  841. checkboxClass: 'icheckbox_flat-blue',
  842. radioClass: 'iradio_flat-blue'
  843. });
  844. });
  845. }
  846. }
  847. /**
  848. * 卡号有变化后查询病人信息
  849. */
  850. function queryUserInfoByCardNo() {
  851. var cardNo = $("#cardNo").val();
  852. var index = cardNo.indexOf("-");
  853. if ((index > 0 && index == cardNo.length - 2) || (cardNo.length == 8 && index <= 0)) {
  854. $("#cardNo").attr("title", cardNo);
  855. $.ajax({
  856. type: "GET",
  857. url: '/thmz/getByIcCardNo?icCardNo=' + cardNo,
  858. contentType: "application/json;charset=UTF-8",
  859. dataType: "json",
  860. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  861. success: function (res) {
  862. if (res == '401' || res == 401) {
  863. window.location.href = '/thmz/login/view'
  864. return;
  865. }
  866. if (res.code == 0) {
  867. if (res.data != null) {
  868. extracted(res);
  869. } else {
  870. $("#saveUser").show();
  871. $("#newCardModal").modal();
  872. $(document).keydown(function (event) { //监听键盘按下时的事件
  873. if (event.keyCode == 13) {
  874. //回车键
  875. $('#newCardModal').modal('hide');
  876. }
  877. });
  878. }
  879. } else {
  880. errorMesage(res);
  881. }
  882. }
  883. });
  884. }
  885. }
  886. /**
  887. * 卡号输入改变事件
  888. */
  889. function cardNoChange() {
  890. if (window.ActiveXObject || "ActiveXObject" in window) {
  891. $("#cardNo").on('input propertychange', function () {
  892. queryUserInfoByCardNo();
  893. });
  894. } else {
  895. $("#cardNo").on('input οninput', function () {
  896. queryUserInfoByCardNo();
  897. });
  898. }
  899. }
  900. /**
  901. * 病人姓名输入改变事件
  902. */
  903. function userNameChange() {
  904. if (window.ActiveXObject || "ActiveXObject" in window) {
  905. $("#userName").on('input propertychange', function () {
  906. refeshPatinetList(true);
  907. });
  908. } else {
  909. $("#userName").on('input οninput', function () {
  910. refeshPatinetList(true);
  911. });
  912. }
  913. }
  914. /**
  915. * 校验收款金额
  916. */
  917. function checkFee() {
  918. var cash = parseFloat($("#cash").val());
  919. var realMoney = parseFloat($("#realMoney").val());
  920. realMoney = realMoney.toFixed(2);
  921. $("#realMoney").val(realMoney)
  922. if (cash < realMoney) {
  923. errorMesageSimaple("收款金额不能少于实收金额!");
  924. return;
  925. } else if (cash > realMoney) {
  926. if ($("#payType").val() == 1) {
  927. var changeAmount = cash - realMoney;
  928. $("#changeAmount").val(changeAmount.toFixed(2));
  929. sendPriceMessage(realMoney, cash, changeAmount.toFixed(2), $("#patientId").val());
  930. } else {
  931. errorMesageSimaple("非现金收款金额不能大于实收金额!");
  932. return;
  933. }
  934. } else {
  935. $("#changeAmount").val(0.00);
  936. sendPriceMessage(realMoney, cash, 0.00, $("#patientId").val());
  937. }
  938. //计算和设置折扣比例
  939. var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());
  940. var discount = 100;
  941. if (realMoney < amountMoneyConfirm) {
  942. discount = realMoney / amountMoneyConfirm * 100;
  943. }
  944. $("#discount").text(discount.toFixed(2))
  945. }
  946. /**
  947. * 根据病人姓名输入框内容动态加载病人列表
  948. */
  949. function initUserList() {
  950. //var width=$("#userName").css("width");
  951. var settings = {
  952. trigger: 'click',
  953. content: '',
  954. width: 170,
  955. multi: true,
  956. closeable: false,
  957. style: '',
  958. delay: 300,
  959. padding: true,
  960. height: 300
  961. };
  962. var webuiPopover = $('#userName').webuiPopover('destroy').webuiPopover(settings);
  963. //用户姓名选中事件
  964. $("#userName").on("click", function (t) {
  965. if ($(webuiPopover).css("display") == "block") {
  966. refeshPatinetList(true);
  967. }
  968. });
  969. }
  970. /**
  971. * 刷新病人列表
  972. */
  973. function refeshPatinetList(flag) {
  974. //如果是重新加载病人列表,需要重置下标
  975. if (flag) {
  976. //重置下标
  977. pageIndex = 0;
  978. msg_list_loading = true;
  979. }
  980. var userName = $('#userName').val();
  981. if (!(userName == null || userName == "" || isChinese(userName))) {
  982. return;
  983. }
  984. $.ajax({
  985. type: "GET",
  986. url: '/thmz/getPatientMiByName?name=' + userName + "&pageIndex=" + pageIndex,
  987. contentType: "application/json;charset=UTF-8",
  988. dataType: "json",
  989. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  990. success: function (res) {
  991. if (res == '401' || res == 401) {
  992. window.location.href = '/thmz/login/view'
  993. return;
  994. }
  995. if (res.code == 0) {
  996. if (res.data != null && res.data.length > 0) {
  997. $("#webuiPopover0").css("display", "block");
  998. var html = '<div class="list-group">';
  999. for (var i = 0; i < res.data.length; i++) {
  1000. var mzPatientMi = res.data[i];
  1001. html += '<a href="#" class="list-group-item list-group-item-action" onclick="fillPatinet(\'' + mzPatientMi.patientId + '\')">';
  1002. var sex = "未知";
  1003. if (mzPatientMi.sex == 1) {
  1004. html += '<img src="/thmz/images/boy.png"/>'
  1005. sex = "男";
  1006. } else if (mzPatientMi.sex == 2) {
  1007. html += '<img src="/thmz/images/girl.png"/>'
  1008. sex = "女";
  1009. } else if (mzPatientMi.sex == 0 || mzPatientMi.sex == null) {
  1010. html += '<img src="/thmz/images/girl_or_boy.png"/>'
  1011. sex = "未知";
  1012. }
  1013. html += '<div>' + mzPatientMi.name + '&nbsp;' + sex + '&nbsp;';
  1014. html += mzPatientMi.ageString;
  1015. if (mzPatientMi.phoneNo != null && mzPatientMi.phoneNo != "") {
  1016. html += '<span>' + mzPatientMi.phoneNo + '</span>';
  1017. }
  1018. html += '</div></a>';
  1019. }
  1020. html += '</div>';
  1021. if (flag) {
  1022. $("div.webui-popover-content").html("");
  1023. }
  1024. $("div.webui-popover-content").append(html);
  1025. $("div.arrow").css("left", "23px");
  1026. refeshPatinetListScrollEvent();
  1027. } else {
  1028. $("#webuiPopover0").css("display", "none");
  1029. }
  1030. }
  1031. //查询完成,设置加载完成
  1032. msg_list_loading = false;
  1033. }
  1034. });
  1035. }
  1036. /**
  1037. * 病人下拉列表滚动条滚动到底部时继续加载新纪录
  1038. */
  1039. function refeshPatinetListScrollEvent() {
  1040. $('.webui-popover-content').scroll(function (event) {
  1041. var top = $(this).scrollTop();
  1042. var height = $(this).height();
  1043. var scrollHeight = $(this).get(0).scrollHeight;
  1044. if (scrollHeight <= top + height) {
  1045. if (!msg_list_loading) {
  1046. msg_list_loading = true;
  1047. pageIndex = pageIndex + 1;
  1048. refeshPatinetList(false);
  1049. }
  1050. }
  1051. });
  1052. }
  1053. /**
  1054. * 按照病人id查询病人信息
  1055. * @param patientId
  1056. */
  1057. function fillPatinet(patientId) {
  1058. if (patientId == null || patientId == "") {
  1059. return;
  1060. }
  1061. $.ajax({
  1062. type: "GET",
  1063. url: '/thmz/getByPatientId?patientId=' + patientId,
  1064. contentType: "application/json;charset=UTF-8",
  1065. dataType: "json",
  1066. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1067. success: function (res) {
  1068. if (res == '401' || res == 401) {
  1069. window.location.href = '/thmz/login/view'
  1070. return;
  1071. }
  1072. if (res.code == 0) {
  1073. if (res.data != null) {
  1074. extracted(res);
  1075. }
  1076. } else {
  1077. errorMesage(res);
  1078. }
  1079. }
  1080. });
  1081. }
  1082. function extracted(res) {
  1083. $("#cardNo").val(res.data.icCardNo);
  1084. $("#cardNo").attr("title", res.data.icCardNo);
  1085. $("#cardNo").blur();
  1086. $("#userName").val(res.data.name);
  1087. $("#userName").blur();
  1088. $("#userNameReadOnly").val(res.data.name);
  1089. $("#age").val(res.data.age);
  1090. $("#age").blur();
  1091. $("#gender").selectpicker('val', res.data.sex);
  1092. $("#gender").selectpicker('refresh');
  1093. $("#gender").blur();
  1094. $("#birthDayReadonly").val(res.data.birthDayStr);
  1095. $("#birthDayReadonly").attr("title", res.data.birthDayStr);
  1096. $("#birthDayReadonly").blur();
  1097. $("#birthDay").val(res.data.birthDayStr);
  1098. $("#birthDay").blur();
  1099. $("#phoneNum").val(res.data.phoneNo);
  1100. $("#phoneNum").attr("title", res.data.phoneNo);
  1101. $("#phoneNum").blur();
  1102. $("#patientsNature").selectpicker('val', res.data.responseType);//默认选中
  1103. $('#patientsNature').selectpicker('refresh');
  1104. $("#patientsNature").blur();
  1105. $('#certificateType').selectpicker('val', res.data.certificateType);
  1106. $('#certificateType').selectpicker('refresh');
  1107. $("#idCard").val(res.data.socialNo);
  1108. $("#idCard").attr("title", res.data.socialNo);
  1109. $("#idCard").blur();
  1110. $('#provinceCode').selectpicker('val', res.data.provinceCode);
  1111. $('#provinceCode').selectpicker('refresh');
  1112. initCity(1, res.data.cityCode);
  1113. initDistrict(1, res.data.cityCode, res.data.districtCode);
  1114. $("#detail").val(res.data.detail);
  1115. $("#detail").blur();
  1116. $("#patientId").val(res.data.patientId);
  1117. setAge();
  1118. $("#age").blur();
  1119. if (res.data.icCardNo != null && res.data.icCardNo != "") {
  1120. $("#clearIcCardNo").show();
  1121. }
  1122. if (res.data.patientId != null && res.data.patientId != "") {
  1123. $("#nucleicAcid").show();
  1124. $("#hybridTest").show();
  1125. $("#editUser").show();
  1126. }
  1127. readonlyOrNot(true);
  1128. $("#saveUser").hide();
  1129. }
  1130. /**
  1131. * 将病人信息填入患者信息修改form
  1132. * @param patinet
  1133. */
  1134. function fillPlusPatinet(patinet) {
  1135. if (patinet != null) {
  1136. $("#editUserCode").val(patinet.patientId);
  1137. $("#editUserName").val(patinet.name);
  1138. $("#editUserName").blur();
  1139. $("#editUserAge").val(patinet.age);
  1140. $("#editUserAge").blur();
  1141. $("#editUserGender").selectpicker('val', patinet.sex);
  1142. $("#editUserGender").selectpicker('refresh');
  1143. $("#editUserGender").blur();
  1144. $("#editUserBirthDay").val(patinet.birthDayStr);
  1145. $("#editUserBirthDay").blur();
  1146. $('#editUserCertificateType').selectpicker('val', patinet.certificateType);
  1147. $('#editUserCertificateType').selectpicker('refresh');
  1148. $("#editUserCardNo").val(patinet.icCardNo);
  1149. $("#editUserCardNo").attr("title", patinet.icCardNo);
  1150. $("#editUserCardNo").blur();
  1151. $("#editUserPhoneNum").val(patinet.phoneNo);
  1152. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  1153. $("#editUserPhoneNum").blur();
  1154. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  1155. $('#editUserPatientsNature').selectpicker('refresh');
  1156. $("#editUserPatientsNature").blur();
  1157. $("#editUserIdCard").val(patinet.socialNo);
  1158. $("#editUserIdCard").attr("title", patinet.socialNo);
  1159. $("#editUserIdCard").blur();
  1160. $('#editUserProvinceCode').selectpicker('val', patinet.provinceCode);
  1161. $('#editUserProvinceCode').selectpicker('refresh');
  1162. initCity(2, patinet.cityCode);
  1163. initDistrict(2, patinet.cityCode, patinet.districtCode);
  1164. $("#editUserDetail").val(patinet.detail);
  1165. $("#editUserDetail").blur();
  1166. $("#editUserContact").val(patinet.relName);
  1167. $("#editUserContactPhone").val(patinet.contractName);
  1168. }
  1169. }
  1170. /**
  1171. * 将病人信息修改域置空
  1172. * @param patinet
  1173. */
  1174. function clearPlusPatinet() {
  1175. $("#editUserCode").val(null);
  1176. $("#editUserName").val(null);
  1177. $("#editUserAge").val(null);
  1178. $("#editUserGender").selectpicker('val', '1');
  1179. $("#editUserGender").selectpicker('refresh');
  1180. $("#editUserBirthDay").val(null);
  1181. $('#editUserCertificateType').selectpicker('val', '01');
  1182. $('#editUserCertificateType').selectpicker('refresh');
  1183. $("#editUserCardNo").val(null);
  1184. $("#editUserCardNo").attr("title", null);
  1185. $("#editUserPhoneNum").val(null);
  1186. $("#editUserPhoneNum").attr("title", null);
  1187. $("#editUserPatientsNature").selectpicker('val', '01');//默认选中
  1188. $('#editUserPatientsNature').selectpicker('refresh');
  1189. $("#editUserIdCard").val(null);
  1190. $("#editUserIdCard").attr("title", null);
  1191. $('#editUserProvinceCode').selectpicker('val', null);
  1192. $('#editUserProvinceCode').selectpicker('refresh');
  1193. $('#editCityCode').selectpicker('val', null);
  1194. $('#editCityCode').selectpicker('refresh');
  1195. $('#editUserDistrictCode').selectpicker('val', null);
  1196. $('#editUserDistrictCode').selectpicker('refresh');
  1197. $("#editUserDetail").val(null);
  1198. $("#editUserContact").val(null);
  1199. $("#editUserContactPhone").val(null);
  1200. }
  1201. /**
  1202. * 关闭当前这个付款方式
  1203. */
  1204. function closeThisParent(obj) {
  1205. $(obj).parent().parent().remove();
  1206. }
  1207. /**
  1208. * 科室与时间区间下拉选改变时清空输入框内容
  1209. */
  1210. function emptyInput() {
  1211. $('#doctor').empty();
  1212. $('#doctor').selectpicker('refresh');
  1213. $("#registrationFee").val(0.00);
  1214. $("#hospitalFee").val(0.00);
  1215. $("#checkFee").val(0.00);
  1216. $("#amountMoney").text(0.00);
  1217. $("#amountMoneyConfirm").text(0.00);
  1218. $("#realMoney").val(0.00);
  1219. }
  1220. /**
  1221. * 给某些域增加title或者清除title
  1222. * @param obj
  1223. */
  1224. function clearTextOrTitle(obj) {
  1225. if ($(obj).val() == null || $(obj).val().length == 0) {
  1226. $(obj).attr("title", null);
  1227. } else {
  1228. $(obj).attr("title", $(obj).val());
  1229. if ($(obj).attr("id") == "birthDay") {
  1230. $(obj).blur()
  1231. }
  1232. }
  1233. }
  1234. /**
  1235. * 当按照卡号查询时,病人信息输入框不可编辑,当清空输入框时可编辑
  1236. * @param flag
  1237. */
  1238. function readonlyOrNot(flag) {
  1239. if (flag) {
  1240. $("#cardNo").attr("readonly", "readonly");
  1241. $("#userName").attr("readonly", "readonly");
  1242. $("#age").attr("readonly", "readonly");
  1243. $("#gender").attr("disabled", "disabled");
  1244. $("#phoneNum").attr("readonly", "readonly");
  1245. $("#patientsNature").attr("disabled", "disabled");
  1246. $("#idCard").attr("readonly", "readonly");
  1247. $("#address").attr("readonly", "readonly");
  1248. $("#birthDayReadonly").removeClass("hide").addClass("in");
  1249. $("#birthDayGroup").removeClass("in").addClass("hide");
  1250. $("#userName").removeClass("in").addClass("hide");
  1251. $("#userNameReadOnly").removeClass("hide").addClass("in");
  1252. $("#webuiPopover0").css("display", "none");
  1253. } else {
  1254. $("#cardNo").removeAttr("readonly");
  1255. $("#userName").removeAttr("readonly");
  1256. $("#age").removeAttr("readonly");
  1257. $("#gender").removeAttr("disabled");
  1258. $("#gender").next().removeClass("disabled");
  1259. $("#phoneNum").removeAttr("readonly");
  1260. $("#patientsNature").removeAttr("disabled");
  1261. $("#patientsNature").next().removeClass("disabled");
  1262. $("#idCard").removeAttr("readonly");
  1263. $("#address").removeAttr("readonly");
  1264. $("#birthDayReadonly").removeClass("in").addClass("hide");
  1265. $("#birthDayGroup").removeClass("hide").addClass("in");
  1266. $("#userName").removeClass("hide").addClass("in");
  1267. $("#userNameReadOnly").removeClass("in").addClass("hide");
  1268. //$("#webuiPopover0").css("display", "block");
  1269. }
  1270. }
  1271. /**
  1272. * 查询默认打印机
  1273. */
  1274. function setPrint() {
  1275. if (printIndex >= 0) {
  1276. return;
  1277. }
  1278. $.ajax({
  1279. type: "GET",
  1280. url: '/thmz/getLastWindowsByCurrentUser',
  1281. contentType: "application/json;charset=UTF-8",
  1282. dataType: "json",
  1283. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1284. async: false,
  1285. success: function (res) {
  1286. if (res == '401' || res == 401) {
  1287. window.location.href = '/thmz/login/view'
  1288. return;
  1289. }
  1290. if (res.code == 0) {
  1291. printIndex = res.data.printIndex;
  1292. } else {
  1293. printIndex = -1;
  1294. }
  1295. }
  1296. });
  1297. }
  1298. //
  1299. // /**
  1300. // * 保存窗口号
  1301. // */
  1302. // function saveWindows() {
  1303. // $.ajax({
  1304. // type: "POST",
  1305. // url: '/thmz/saveWindows',
  1306. // contentType: "application/json;charset=UTF-8",
  1307. // dataType: "json",
  1308. // data: JSON.stringify({"windowsNo": $("#windowsNum").val()}),
  1309. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1310. // success: function (res) {
  1311. // if (res == '401' || res == 401) {
  1312. // window.location.href = '/thmz/login/view'
  1313. // return;
  1314. // }
  1315. // $('#editWindowsModal').modal('hide');
  1316. // if (res.code == 0) {
  1317. // new PNotify({
  1318. // title: '操作提示',
  1319. // text: res.message,
  1320. // type: 'success',
  1321. // hide: true,
  1322. // styling: 'bootstrap3'
  1323. // });
  1324. // } else {
  1325. // new PNotify({
  1326. // title: '错误提示',
  1327. // text: res.message,
  1328. // type: 'error',
  1329. // hide: true,
  1330. // styling: 'bootstrap3'
  1331. // });
  1332. // }
  1333. // }
  1334. // });
  1335. // }
  1336. //
  1337. // /**
  1338. // * 保存打印机
  1339. // */
  1340. // function savePrint() {
  1341. // $.ajax({
  1342. // type: "POST",
  1343. // url: '/thmz/savePrintIndex',
  1344. // contentType: "application/json;charset=UTF-8",
  1345. // dataType: "json",
  1346. // data: JSON.stringify({"printIndex": $("#printSelect").val()}),
  1347. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1348. // success: function (res) {
  1349. // if (res == '401' || res == 401) {
  1350. // window.location.href = '/thmz/login/view'
  1351. // return;
  1352. // }
  1353. // LODOP = getLodop();
  1354. // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
  1355. // LODOP.SET_PRINTER_INDEX($("#printSelect").val());
  1356. // printIndex=$("#printSelect").val();
  1357. // $('#editPrintModal').modal('hide');
  1358. // if (res.code == 0) {
  1359. // new PNotify({
  1360. // title: '操作提示',
  1361. // text: res.message,
  1362. // type: 'success',
  1363. // hide: true,
  1364. // styling: 'bootstrap3'
  1365. // });
  1366. // } else {
  1367. // new PNotify({
  1368. // title: '错误提示',
  1369. // text: res.message,
  1370. // type: 'error',
  1371. // hide: true,
  1372. // styling: 'bootstrap3'
  1373. // });
  1374. // }
  1375. // }
  1376. // });
  1377. // }
  1378. /**
  1379. * 保存病人信息
  1380. * @param type 1 继续调用挂号接口,2,只建档不挂号 3 不清空
  1381. */
  1382. function savePatient(type) {
  1383. $.ajax({
  1384. type: "POST",
  1385. url: '/thmz/savePatient',
  1386. contentType: "application/json;charset=UTF-8",
  1387. dataType: "json",
  1388. async: false,
  1389. data: JSON.stringify({
  1390. "name": $("#userName").val(),
  1391. "age": $("#age").val(),
  1392. "sex": $("#gender").val(),
  1393. "birthDay": $("#birthDay").val(),
  1394. "certificateType": $("#certificateType").val(),
  1395. "icCardNo": $("#cardNo").val(),
  1396. "phoneNo": $("#phoneNum").val(),
  1397. "responseType": $("#patientsNature").val(),
  1398. "socialNo": $("#idCard").val(),
  1399. "provinceCode": $("#provinceCode").val(),
  1400. "cityCode": $("#cityCode").val(),
  1401. "districtCode": $("#districtCode").val(),
  1402. "detail": $("#detail").val()
  1403. }),
  1404. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1405. success: function (res) {
  1406. if (res == '401' || res == 401) {
  1407. window.location.href = '/thmz/login/view'
  1408. return;
  1409. }
  1410. if (res.code == 0) {
  1411. if (type == 1) {
  1412. $("#patientId").val(res.data.patientId);
  1413. saveMzyReqrec();
  1414. } else if (type == 2) {
  1415. clearRegistration();
  1416. successMesage(res);
  1417. } else if (type == 3) {
  1418. $("#patientId").val(res.data.patientId);
  1419. $("#saveUser").hide();
  1420. }
  1421. } else {
  1422. $("#saveConfirmFee").attr("disabled", false);
  1423. errorMesage(res);
  1424. }
  1425. }
  1426. });
  1427. }
  1428. /**
  1429. * 修改病人信息
  1430. */
  1431. function modifyPatient() {
  1432. $.ajax({
  1433. type: "POST",
  1434. url: '/thmz/modifyPatient',
  1435. contentType: "application/json;charset=UTF-8",
  1436. dataType: "json",
  1437. data: JSON.stringify({
  1438. "name": $("#editUserName").val(),
  1439. "age": $("#editUserAge").val(),
  1440. "sex": $("#editUserGender").val(),
  1441. "birthDay": $("#editUserBirthDay").val(),
  1442. "certificateType": $("#editUserCertificateType").val(),
  1443. "icCardNo": $("#editUserCardNo").val(),
  1444. "phoneNo": $("#editUserPhoneNum").val(),
  1445. "responseType": $("#editUserPatientsNature").val(),
  1446. "socialNo": $("#editUserIdCard").val(),
  1447. "provinceCode": $("#editUserProvinceCode").val(),
  1448. "cityCode": $("#editCityCode").val(),
  1449. "districtCode": $("#editUserDistrictCode").val(),
  1450. "detail": $("#editUserDetail").val(),
  1451. "patientId": $("#editUserCode").val(),
  1452. "relName": $("#editUserContact").val(),
  1453. "contractName": $("#editUserContactPhone").val()
  1454. }),
  1455. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1456. success: function (res) {
  1457. if (res == '401' || res == 401) {
  1458. window.location.href = '/thmz/login/view'
  1459. return;
  1460. }
  1461. if (res.code == 0) {
  1462. $('#editUserModal').modal('hide');
  1463. fillPatinet($("#patientId").val());
  1464. clearPlusPatinet();
  1465. successMesage(res);
  1466. } else {
  1467. errorMesage(res);
  1468. }
  1469. }
  1470. });
  1471. }
  1472. /**
  1473. * 保存挂号信息
  1474. */
  1475. function saveMzyReqrec() {
  1476. var mzyRequestId = $('#doctor').find("option:selected").attr('data-mzyRequestId');
  1477. var patientId = $("#patientId").val();
  1478. var totalFee = $("#realMoney").val();
  1479. //诊疗卡是否选择
  1480. var zlkCheckbox = $("#zlkCheckbox").prop("checked");
  1481. //病历本是否选择
  1482. var blbCheckbox = $("#blbCheckbox").prop("checked");
  1483. //诊疗卡费用
  1484. var zlkFee = 0;
  1485. //病历本费用
  1486. var blbFee = 0;
  1487. if (zlkCheckbox) {
  1488. zlkFee = 1;
  1489. }
  1490. if (blbCheckbox) {
  1491. blbFee = 1;
  1492. }
  1493. $.ajax({
  1494. type: "POST",
  1495. url: '/thmz/saveMzyReqrec',
  1496. contentType: "application/json;charset=UTF-8",
  1497. dataType: "json",
  1498. data: JSON.stringify({
  1499. "mzyReqrec": {
  1500. "patientId": patientId,
  1501. "ampm": $("#ampm").val(),
  1502. "apTime": $("#apTimes").val(),
  1503. "unitCode": $("#deptNo").val(),
  1504. "chargeType": $("#chargeType").val(),
  1505. "paymode": $("#payType").val(),
  1506. "zlkFee": zlkFee,
  1507. "blbFee": blbFee,
  1508. "psordnum": $("#refNo").val(),
  1509. "agtordnum": $("#qrCodeParam").val(),
  1510. "transDate": $("#transDate").val(),
  1511. "parChannel": $("#payChannel").val(),
  1512. "traceNo": $("#traceNo").val()
  1513. },
  1514. "responceType": $("#patientsNature").val(),
  1515. "mzyRequestId": mzyRequestId,
  1516. "totalFee": totalFee,
  1517. "payMark": "0"
  1518. }),
  1519. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1520. success: function (res) {
  1521. if (res == '401' || res == 401) {
  1522. window.location.href = '/thmz/login/view'
  1523. return;
  1524. }
  1525. if (res.code == 0) {
  1526. successMesage(res);
  1527. $('#confirmFeeModal').modal('hide');
  1528. prn1Print(patientId, -1);
  1529. // loadTableCount();
  1530. // loadRegistrationList(true);
  1531. clearRegistration();
  1532. toEvaluation(patientId);
  1533. } else {
  1534. errorMesage(res);
  1535. }
  1536. $("#saveConfirmFee").attr("disabled", false);
  1537. }
  1538. });
  1539. }
  1540. /**
  1541. * 挂号列表中的科室和医生列表初始化
  1542. */
  1543. function initListSelect() {
  1544. initListDeptSelect();
  1545. initListDoctorSelect();
  1546. }
  1547. /**
  1548. * 挂号列表中的科室列表
  1549. */
  1550. function initListDeptSelect() {
  1551. //科室列表
  1552. $.ajax({
  1553. type: "GET",
  1554. url: '/thmz/allMzUnitCode',
  1555. dataType: "json",
  1556. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1557. success: function (data) {
  1558. if (data == '401' || data == 401) {
  1559. window.location.href = '/thmz/login/view'
  1560. return;
  1561. }
  1562. var html = '';
  1563. $.each(data.data, function (commentIndex, comment) {
  1564. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  1565. });
  1566. $('#deptNoParam').empty();
  1567. $('#deptNoParam').html(html);
  1568. $('#deptNoParam').selectpicker('refresh');
  1569. }
  1570. });
  1571. }
  1572. /**
  1573. * 挂号列表中的医生列表初始化
  1574. */
  1575. function initListDoctorSelect() {
  1576. //医生列表
  1577. $.ajax({
  1578. type: "GET",
  1579. url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNoParam').val(),
  1580. dataType: "json",
  1581. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1582. success: function (res) {
  1583. if (res == '401' || res == 401) {
  1584. window.location.href = '/thmz/login/view'
  1585. return;
  1586. }
  1587. var html = '';
  1588. $.each(res.data, function (commentIndex, comment) {
  1589. html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + '</option>';
  1590. });
  1591. $('#doctorParam').empty();
  1592. $('#doctorParam').html(html);
  1593. // $("#doctorParam").selectpicker({
  1594. // size: 10
  1595. // });
  1596. $('#doctorParam').selectpicker('destroy').selectpicker('refresh');
  1597. }
  1598. });
  1599. }
  1600. /**
  1601. * 清空搜索参数
  1602. */
  1603. function clearParams() {
  1604. $("#deptNoParam").selectpicker('val', null);
  1605. $("#deptNoParam").selectpicker('refresh');
  1606. $("#doctorParam").selectpicker('val', null);
  1607. $("#deptNoParam").selectpicker('refresh');
  1608. $("#userNameParam").val(null);
  1609. $("#phoneParam").val(null);
  1610. $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
  1611. }
  1612. /**
  1613. * 医保电子凭证读卡
  1614. * @param params
  1615. */
  1616. function siReadCard(params) {
  1617. $.ajax({
  1618. type: "GET",
  1619. url: 'http://localhost:8321/readcard/entry?param='+params,
  1620. contentType: "application/json;charset=UTF-8",
  1621. dataType: "json",
  1622. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1623. success: function (res) {
  1624. if (res == '401' || res == 401) {
  1625. window.location.href = '/thmz/login/view'
  1626. return;
  1627. }
  1628. //console.log(res);
  1629. if (res.code == 200) {
  1630. var data = JSON.parse(res.data);
  1631. $('#certificateType').selectpicker('val', data.data.idType);
  1632. $('#certificateType').selectpicker('refresh');
  1633. $("#idCard").val(data.data.idNo);
  1634. $("#userName").val(data.data.userName);
  1635. queryUserInfoBySocialNo();
  1636. //successMesage(res);
  1637. } else {
  1638. errorMesage(res);
  1639. }
  1640. }
  1641. });
  1642. // window.open('ReadCard://'+prm, '_self')
  1643. }
  1644. /**
  1645. * 清空挂号信息
  1646. */
  1647. function clearRegistration() {
  1648. $("#cardNo").val(null);
  1649. $("#cardNo").attr("title", null);
  1650. $("#userName").val(null);
  1651. $("#age").val(null);
  1652. $("#gender").selectpicker('val', 1);
  1653. $("#gender").selectpicker('refresh');
  1654. $("#birthDay").val(null);
  1655. $("#birthDay").attr("title", null);
  1656. $("#phoneNum").val(null);
  1657. $("#phoneNum").attr("title", null);
  1658. $("#patientsNature").selectpicker('val', '01');//默认选中
  1659. $('#patientsNature').selectpicker('refresh');
  1660. $("#idCard").val(null);
  1661. $("#idCard").attr("title", null);
  1662. $('#provinceCode').selectpicker('val', null);
  1663. $('#provinceCode').selectpicker('refresh');
  1664. $('#cityCode').selectpicker('val', null);
  1665. $('#cityCode').selectpicker('refresh');
  1666. $('#districtCode').selectpicker('val', null);
  1667. $('#districtCode').selectpicker('refresh');
  1668. $("#detail").val(null);
  1669. //$("#idAddress").val(null);
  1670. $("#copyAddress").removeAttr("data-clipboard-text");
  1671. $("#copyAddress").hide();
  1672. $("#patientId").val(null);
  1673. $("#editUser").hide();
  1674. $("#clearIcCardNo").hide();
  1675. $("#nucleicAcid").hide();
  1676. $("#hybridTest").hide();
  1677. //默认光标在卡号输入框
  1678. $("#cardNo").focus();
  1679. initMzWorkTime();
  1680. readonlyOrNot(false);
  1681. $('#certificateType').selectpicker('val', '01');
  1682. $('#certificateType').selectpicker('refresh');
  1683. $("#saveUser").hide();
  1684. var zlkCheckbox = $("#zlkCheckbox").prop("checked");
  1685. if (zlkCheckbox) {
  1686. $("#zlkCheckbox").parent().parent().click();//当前选中改为不选中
  1687. }
  1688. var blbCheckbox = $("#blbCheckbox").prop("checked");
  1689. if (blbCheckbox) {
  1690. $("#blbCheckbox").parent().parent().click();//当前选中改为不选中
  1691. }
  1692. $("#refNo").val(null);
  1693. $("#transDate").val(null);
  1694. $("#payChannel").val(null);
  1695. $("#qrCodeParam").val(null);
  1696. $("#traceNo").val(null);
  1697. }
  1698. /**
  1699. * 直接打印发票
  1700. * @param patientId
  1701. */
  1702. function prn1Print(patientId, times) {
  1703. setPrint();
  1704. var height = "93.15mm";
  1705. // if(countReceiot%2==0){
  1706. // height ="93.2mm";
  1707. // }
  1708. $.ajax({
  1709. type: "GET",
  1710. url: '/thmz/printMzyReqrecRecept?patientId=' + patientId + "&times=" + times,
  1711. contentType: "application/json;charset=UTF-8",
  1712. dataType: "json",
  1713. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1714. success: function (res) {
  1715. if (res == '401' || res == 401) {
  1716. window.location.href = '/thmz/login/view'
  1717. return;
  1718. }
  1719. if (res.code == 0) {
  1720. if (res.data == null || res.data.length == 0) {
  1721. return;
  1722. }
  1723. // countReceiot++;
  1724. LODOP = getLodop();
  1725. var temp = res.data;
  1726. LODOP.PRINT_INITA(6, 0, "120mm", height, "泰和门诊发票打印");
  1727. //设置默认打印机
  1728. LODOP.SET_PRINTER_INDEX(printIndex);
  1729. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");
  1730. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
  1731. LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
  1732. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
  1733. LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
  1734. LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", "湖南泰和医院管理有限公司");
  1735. LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "流水号:");
  1736. LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
  1737. LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);
  1738. LODOP.ADD_PRINT_TEXT("25mm", "7mm", "50mm", "3mm", temp.name);
  1739. LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
  1740. LODOP.ADD_PRINT_TEXT("32mm", "6mm", "50mm", "3mm", "就诊科室:" + temp.unitCode);
  1741. LODOP.ADD_PRINT_TEXT("32mm", "56mm", "50mm", "3mm", "地点:" + res.officePos == null ? "" : res.officePos);
  1742. LODOP.ADD_PRINT_TEXT("37mm", "6mm", "50mm", "3mm", "看诊医生:" + temp.doctorCode);
  1743. LODOP.ADD_PRINT_TEXT("37mm", "56mm", "50mm", "3mm", "号段:" + temp.ampm);
  1744. LODOP.ADD_PRINT_TEXT("42mm", "6mm", "50mm", "3mm", "号别:" + temp.chargeType);
  1745. LODOP.ADD_PRINT_TEXT("42mm", "56mm", "50mm", "3mm", "挂号费:" + temp.reqFee);
  1746. LODOP.ADD_PRINT_TEXT("47mm", "6mm", "50mm", "3mm", "诊查费:" + temp.clinicFee);
  1747. LODOP.ADD_PRINT_TEXT("47mm", "56mm", "50mm", "3mm", "其他:" + temp.othFee);
  1748. var blbFee = temp.blbFee;
  1749. if (blbFee == null) {
  1750. blbFee = 0;
  1751. }
  1752. if (temp.zlkFee != null) {
  1753. blbFee = blbFee + temp.zlkFee;
  1754. }
  1755. LODOP.ADD_PRINT_TEXT("52mm", "6mm", "50mm", "3mm", "工本费:" + blbFee);
  1756. LODOP.ADD_PRINT_TEXT("65mm", "21mm", "60mm", "3mm", res.totalFee + " 元");
  1757. LODOP.ADD_PRINT_TEXT("72mm", "19mm", "60mm", "3mm", res.totalFeeStr);
  1758. LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.year);//年
  1759. LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.month);//月
  1760. LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.day);//日
  1761. LODOP.ADD_PRINT_TEXT("79mm", "53mm", "23mm", "3mm", res.user.userName);//收费员
  1762. //LODOP.PREVIEW();
  1763. LODOP.PRINT();
  1764. if (times > 0) {
  1765. loadRegistrationList(true);
  1766. }
  1767. } else if (res.code == -2) {
  1768. warningMesageSimaple(res.message);
  1769. } else if (res.code == -1) {
  1770. errorMesage(res);
  1771. }
  1772. }
  1773. });
  1774. };
  1775. /**
  1776. * 销卡
  1777. * @param data
  1778. */
  1779. function clearIcCardNo() {
  1780. $.ajax({
  1781. type: "GET",
  1782. url: '/thmz/clearIcCardNo?patientId=' + $("#patientId").val(),
  1783. contentType: "application/json;charset=UTF-8",
  1784. dataType: "json",
  1785. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1786. success: function (res) {
  1787. if (res == '401' || res == 401) {
  1788. window.location.href = '/thmz/login/view'
  1789. return;
  1790. }
  1791. if (res.code == 0) {
  1792. clearRegistration();
  1793. successMesage(res);
  1794. } else {
  1795. errorMesage(res);
  1796. }
  1797. }
  1798. });
  1799. }
  1800. /**
  1801. * 根据手机号码查询病人信息
  1802. */
  1803. function queryUserInfoByphoneNo() {
  1804. var phoneNo = $("#phoneNum").val();
  1805. if (phoneNo.length == 11) {
  1806. $.ajax({
  1807. type: "GET",
  1808. url: '/thmz/getByPhoneNo?phoneNo=' + phoneNo,
  1809. contentType: "application/json;charset=UTF-8",
  1810. dataType: "json",
  1811. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1812. success: function (res) {
  1813. if (res == '401' || res == 401) {
  1814. window.location.href = '/thmz/login/view'
  1815. return;
  1816. }
  1817. if (res.code == 0) {
  1818. fitPatient(res);
  1819. }
  1820. }
  1821. });
  1822. }
  1823. }
  1824. /**
  1825. * 根据病人姓名查询病人信息
  1826. */
  1827. function queryUserInfoByName() {
  1828. var userName = $('#userName').val();
  1829. // var cardNo=$("#cardNo").val();
  1830. if (userName == null || userName == "") {
  1831. return;
  1832. }
  1833. if (userName.length > 0) {
  1834. $.ajax({
  1835. type: "GET",
  1836. url: '/thmz/getPatientMiByName?name=' + userName,
  1837. contentType: "application/json;charset=UTF-8",
  1838. dataType: "json",
  1839. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1840. success: function (res) {
  1841. if (res == '401' || res == 401) {
  1842. window.location.href = '/thmz/login/view'
  1843. return;
  1844. }
  1845. if (res.code == 0) {
  1846. fitPatient(res);
  1847. }
  1848. }
  1849. });
  1850. }
  1851. }
  1852. /**
  1853. * 设置年龄
  1854. */
  1855. function setAge() {
  1856. var birthDay = $("#birthDay").val();
  1857. var socialNo = $("#idCard").val();
  1858. if ((birthDay == null || birthDay == "") && idCard != null && idCard != "") {
  1859. birthDay = socialNo.substring(6, 14);
  1860. birthDay = birthDay.substring(0, 4) + "-" + birthDay.substring(4, 6) + "-" + birthDay.substring(6);
  1861. } else if (birthDay.length == 8 && birthDay.indexOf("-") <= 0) {
  1862. birthDay = birthDay.substring(0, 4) + "-" + birthDay.substring(4, 6) + "-" + birthDay.substring(6);
  1863. $("#birthDay").val(birthDay);
  1864. }
  1865. var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
  1866. if (!dateFormat.test(birthDay)) {
  1867. new PNotify({
  1868. title: '错误提示',
  1869. text: '生日日期错误',
  1870. type: 'error',
  1871. hide: true,
  1872. styling: 'bootstrap3'
  1873. });
  1874. }
  1875. var arr = birthDay.split("-");
  1876. if (!checkDate(arr[0], arr[1], arr[2])) {
  1877. new PNotify({
  1878. title: '错误提示',
  1879. text: '生日日期错误',
  1880. type: 'error',
  1881. hide: true,
  1882. styling: 'bootstrap3'
  1883. });
  1884. }
  1885. var returnAge = jsGetAge(birthDay);
  1886. $("#age").val(returnAge);
  1887. }
  1888. /**
  1889. * 打开创建核酸检测(单人)处方弹窗
  1890. */
  1891. function nucleicAcid() {
  1892. $("#nucleicAcidTip").html("是否要给患者【" + $("#userName").val() + "】创建核酸检查(单人单管)申请?");
  1893. $("#saveNucleicAcid").removeClass("hide");
  1894. $("#chargeFeeNucleicAcid").addClass("hide");
  1895. $("#nucleicAcidModal").modal();
  1896. }
  1897. /**
  1898. * 打开创建核酸检测(混检)处方弹窗
  1899. */
  1900. function hybridTest() {
  1901. $("#hybridTestTip").html("是否要给患者【" + $("#userName").val() + "】创建核酸检查(混检)申请?");
  1902. $("#saveHybridTest").removeClass("hide");
  1903. $("#chargeFeeHybridTest").addClass("hide");
  1904. $("#hybridTestModal").modal();
  1905. }
  1906. /**
  1907. * 创建核酸检查处方并保存
  1908. */
  1909. function saveNucleicAcid() {
  1910. $.ajax({
  1911. type: "GET",
  1912. url: '/thmz/identityCardVerification?patientId=' + $("#patientId").val(),
  1913. contentType: "application/json;charset=UTF-8",
  1914. dataType: "json",
  1915. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1916. success: function (res) {
  1917. if (res == '401' || res == 401) {
  1918. window.location.href = '/thmz/login/view'
  1919. return;
  1920. }
  1921. if (res.code == 0) {
  1922. $.ajax({
  1923. type: "GET",
  1924. url: '/thmz/nucleicAcidApplication?patientId=' + $("#patientId").val(),
  1925. contentType: "application/json;charset=UTF-8",
  1926. dataType: "json",
  1927. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1928. success: function (res) {
  1929. if (res == '401' || res == 401) {
  1930. window.location.href = '/thmz/login/view'
  1931. return;
  1932. }
  1933. if (res.code == 0) {
  1934. successMesage(res);
  1935. $("#nucleicAcidTip").html("患者【" + $("#userName").val() + "】的核酸检查(单人单管)申请已经创建成功,是否立即缴费?");
  1936. $("#chargeFeeNucleicAcid").removeClass("hide");
  1937. $("#saveNucleicAcid").addClass("hide");
  1938. //$("#nucleicAcidModal").modal("hide");
  1939. } else {
  1940. errorMesage(res);
  1941. }
  1942. }
  1943. });
  1944. } else {
  1945. errorMesage(res);
  1946. }
  1947. }
  1948. });
  1949. }
  1950. /**
  1951. * 跳转到缴费界面
  1952. */
  1953. function chargeFeeNucleicAcid() {
  1954. $("#nucleicAcidModal").modal("hide");
  1955. //延时刷新页面,因为页面弹窗有遮掩,需要时间清除
  1956. setTimeout(function () {
  1957. //不按传统的路径传值设置值,这个参数会在页面跳转的时候截断
  1958. changeContent('/thmz/toll-administration?' + $("#patientId").val());
  1959. }, 400);
  1960. }
  1961. /**
  1962. * 创建核酸检查(混检)处方并保存
  1963. */
  1964. function saveHybridTest() {
  1965. $.ajax({
  1966. type: "GET",
  1967. url: '/thmz/identityCardVerification?patientId=' + $("#patientId").val(),
  1968. contentType: "application/json;charset=UTF-8",
  1969. dataType: "json",
  1970. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1971. success: function (res) {
  1972. if (res == '401' || res == 401) {
  1973. window.location.href = '/thmz/login/view'
  1974. return;
  1975. }
  1976. if (res.code == 0) {
  1977. $.ajax({
  1978. type: "GET",
  1979. url: '/thmz/hybridTestApplication?patientId=' + $("#patientId").val(),
  1980. contentType: "application/json;charset=UTF-8",
  1981. dataType: "json",
  1982. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1983. success: function (res) {
  1984. if (res == '401' || res == 401) {
  1985. window.location.href = '/thmz/login/view'
  1986. return;
  1987. }
  1988. if (res.code == 0) {
  1989. successMesage(res);
  1990. $("#hybridTestTip").html("患者【" + $("#userName").val() + "】的核酸检查(混检)申请已经创建成功,是否立即缴费?");
  1991. $("#chargeFeeHybridTest").removeClass("hide");
  1992. $("#saveHybridTest").addClass("hide");
  1993. } else {
  1994. errorMesage(res);
  1995. }
  1996. }
  1997. });
  1998. } else {
  1999. errorMesage(res);
  2000. }
  2001. }
  2002. });
  2003. }
  2004. /**
  2005. * 跳转到(混检)缴费界面
  2006. */
  2007. function chargeFeeHybridTest() {
  2008. $("#hybridTestModal").modal("hide");
  2009. //延时刷新页面,因为页面弹窗有遮掩,需要时间清除
  2010. setTimeout(function () {
  2011. //不按传统的路径传值设置值,这个参数会在页面跳转的时候截断
  2012. changeContent('/thmz/toll-administration?' + $("#patientId").val());
  2013. }, 400);
  2014. }
  2015. /**
  2016. * 复制地址
  2017. */
  2018. function copyAddress() {
  2019. if (clipboard != null) {
  2020. clipboard.destroy();
  2021. }
  2022. clipboard = new ClipboardJS('#copyAddress', {
  2023. text: function (trigger) {
  2024. alert("复制成功!");
  2025. return trigger.getAttribute('data-clipboard-text');
  2026. }
  2027. });
  2028. }
  2029. /**
  2030. * 因为父元素加了点击事件,如果鼠标点击的是checkbox 本身,会触发一次,所以这里增加一个反事件
  2031. * @param obj
  2032. */
  2033. function checkProChangeCancel(obj) {
  2034. var check = $(obj).prop("checked");
  2035. $(obj).prop("checked", !check) //如果鼠标点击选中了,执行后可以取消选中
  2036. }
  2037. /**
  2038. * 附加收费点击事件
  2039. * @param obj
  2040. */
  2041. function checkProChange(obj) {
  2042. var check = !$(obj).find('label').find('input').prop("checked");
  2043. //以下两个方法,单独调用一个可能不行
  2044. $(obj).find('label').find('input').prop("checked", check) //如果鼠标点击选中了,执行后可以取消选中
  2045. fitFee();
  2046. }
  2047. /**
  2048. * 刷卡/扫码
  2049. */
  2050. function consume() {
  2051. $("#consume").attr("disabled", true);
  2052. $("#saveConfirmFee").attr("disabled", true);
  2053. var patientId = $("#patientId").val();
  2054. if (patientId == null || patientId == "") {
  2055. savePatient(3);
  2056. patientId = $("#patientId").val();
  2057. }
  2058. var chequeType = $("#payType").val();
  2059. var amt = $("#realMoney").val();
  2060. $.ajax({
  2061. type: "POST",
  2062. url: '/thmz/consume',
  2063. contentType: "application/json;charset=UTF-8",
  2064. dataType: "json",
  2065. data: JSON.stringify({
  2066. "patientId": patientId,
  2067. "chequeType": chequeType,
  2068. "amt": amt,
  2069. "type": 0
  2070. }),
  2071. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2072. success: function (res) {
  2073. if (res == '401' || res == 401) {
  2074. window.location.href = '/thmz/login/view'
  2075. return;
  2076. }
  2077. if (res.code == 0) {
  2078. successMesage(res);
  2079. $("#refNo").val(res.data.refNo);
  2080. $("#transDate").val(res.data.transDate);
  2081. $("#payChannel").val(res.data.payChannel);
  2082. $("#qrCodeParam").val(res.data.wxAliPayOrderNo);
  2083. $("#traceNo").val(res.data.traceNo);
  2084. } else {
  2085. errorMesage(res);
  2086. }
  2087. $("#saveConfirmFee").attr("disabled", false);
  2088. $("#consume").attr("disabled", false);
  2089. }
  2090. });
  2091. }