registration.js 82 KB

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