hospitalized.js 52 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526
  1. //@ sourceURL=hospitalized.js
  2. var LODOP; //声明为全局变量
  3. //默认打印机下标
  4. var printIndex = -1;
  5. $(function () {
  6. initMaritalStatusSelect();
  7. initGenderSelect();
  8. initResponceTypeSelect();
  9. //设置挂号窗口的高度
  10. var width = $('#confirmFee').css("width");
  11. var widthNum = parseInt(width);
  12. widthNum -= 24;
  13. $("#confirmFee").css("width", widthNum + "px");
  14. init_daterangepicker();
  15. formatCheck();
  16. //默认光标在卡号输入框
  17. $("#cardNo").focus();
  18. //根据病人姓名输入框内容动态加载病人列表
  19. //initUserList();
  20. //卡号输入改变事件
  21. cardNoChange();
  22. //病人姓名输入改变事件
  23. // userNameChange();
  24. //数据校验
  25. init_validator();
  26. //初始门诊收银方式下拉选
  27. initChequeType("payType");
  28. /**
  29. * 清空
  30. */
  31. $("#clearRegistration").on("click", function (t) {
  32. clearRegistration();
  33. });
  34. /**
  35. * 增加收款方式按钮事件
  36. */
  37. $("#addPayType").on("click", function (t) {
  38. var payTypeIndex = $("#payTypeIndex").val();
  39. var payTypeId = "payType_" + payTypeIndex;
  40. 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>';
  41. $("#changeAmountParent").before(html);
  42. initChequeType(payTypeId)
  43. payTypeIndex = payTypeIndex + 1;
  44. $("#payTypeIndex").val(payTypeIndex);
  45. });
  46. /**
  47. * 保存挂号信息
  48. */
  49. $("#saveConfirmFee").on("click", function (t) {
  50. $("#saveConfirmFee").attr("disabled",true);
  51. var cash=$("#cash").val();
  52. if(cash==null || cash ==""){
  53. new PNotify({
  54. title: '错误提示',
  55. text: "金额不能为空!",
  56. type: 'error',
  57. hide: false,
  58. styling: 'bootstrap3'
  59. });
  60. $("#saveConfirmFee").attr("disabled",false);
  61. return;
  62. }
  63. var realMoney = parseFloat($("#realMoney").val());
  64. realMoney = realMoney.toFixed(2);
  65. if (parseFloat(cash) < realMoney) {
  66. $("#saveConfirmFee").attr("disabled",false);
  67. return;
  68. }
  69. var patientId = $("#patientId").val();
  70. if (patientId == null || patientId == "") {
  71. savePatient(true);
  72. } else {
  73. saveMzyReqrec();
  74. }
  75. });
  76. /**
  77. * 患者信息修改
  78. */
  79. $("#saveEditUser").on("click", function (t) {
  80. modifyPatient();
  81. });
  82. /**
  83. * 初始化病区与小科室
  84. */
  85. initListSelect();
  86. //每隔三秒读一次身份证
  87. setInterval(function () {
  88. new Device().startFun();
  89. }, 3000);
  90. $("#birthDay").change(function (e) {
  91. var birthDay = $("#birthDay").val();
  92. if (birthDay.length == 8 && birthDay.indexOf("-") <= 0) {
  93. birthDay = birthDay.substring(0, 4) + "-" + birthDay.substring(4, 6) + "-" + birthDay.substring(6);
  94. $("#birthDay").val(birthDay);
  95. }
  96. var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
  97. if (!dateFormat.test(birthDay)) {
  98. new PNotify({
  99. title: '错误提示',
  100. text: '生日日期错误',
  101. type: 'error',
  102. hide: true,
  103. styling: 'bootstrap3'
  104. });
  105. }
  106. var arr = birthDay.split("-");
  107. if (!checkDate(arr[0], arr[1], arr[2])) {
  108. new PNotify({
  109. title: '错误提示',
  110. text: '生日日期错误',
  111. type: 'error',
  112. hide: true,
  113. styling: 'bootstrap3'
  114. });
  115. }
  116. var returnAge = jsGetAge(birthDay);
  117. $("#age").val(returnAge);
  118. $("#age").blur();
  119. });
  120. //默认入院日期是当天
  121. var now=nowString();
  122. $("#admissionDayReadonly").val(now);
  123. $("#admissionDayReadonly").attr("title", now);
  124. $("#admissionDay").val(now);
  125. $("#admissionDay").change(function (e) {
  126. var admissionDay = $("#admissionDay").val();
  127. if (admissionDay.length == 8 && admissionDay.indexOf("-") <= 0) {
  128. admissionDay = admissionDay.substring(0, 4) + "-" + admissionDay.substring(4, 6) + "-" + admissionDay.substring(6);
  129. $("#admissionDay").val(admissionDay);
  130. }
  131. var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
  132. if (!dateFormat.test(admissionDay)) {
  133. new PNotify({
  134. title: '错误提示',
  135. text: '入院日期错误',
  136. type: 'error',
  137. hide: true,
  138. styling: 'bootstrap3'
  139. });
  140. }
  141. var arr = admissionDay.split("-");
  142. if (!checkDate(arr[0], arr[1], arr[2])) {
  143. new PNotify({
  144. title: '错误提示',
  145. text: '入院日期错误',
  146. type: 'error',
  147. hide: true,
  148. styling: 'bootstrap3'
  149. });
  150. }
  151. });
  152. $("#editUserBirthDay").change(function (e) {
  153. var editUserBirthDay = $("#editUserBirthDay").val();
  154. if (editUserBirthDay.length == 8 && editUserBirthDay.indexOf("-") <= 0) {
  155. editUserBirthDay = editUserBirthDay.substring(0, 4) + "-" + editUserBirthDay.substring(4, 6) + "-" + editUserBirthDay.substring(6);
  156. $("#editUserBirthDay").val(editUserBirthDay);
  157. }
  158. var dateFormat = /^(\d{4})-(\d{2})-(\d{2})$/;
  159. if (!dateFormat.test(editUserBirthDay)) {
  160. new PNotify({
  161. title: '错误提示',
  162. text: '生日日期错误',
  163. type: 'error',
  164. hide: true,
  165. styling: 'bootstrap3'
  166. });
  167. }
  168. var arr = editUserBirthDay.split("-");
  169. if (!checkDate(arr[0], arr[1], arr[2])) {
  170. new PNotify({
  171. title: '错误提示',
  172. text: '生日日期错误',
  173. type: 'error',
  174. hide: true,
  175. styling: 'bootstrap3'
  176. });
  177. }
  178. var returnAge = jsGetAge(editUserBirthDay);
  179. $("#editUserAge").val(returnAge);
  180. });
  181. $("#idCard").change(function (e) {
  182. queryUserInfoBySocialNo();
  183. });
  184. $("#editUserIdCard").change(function (e) {
  185. var editUserIdCard = $("#editUserIdCard").val();
  186. if(editUserIdCard==null || editUserIdCard==""){
  187. return;
  188. }
  189. var birthday = editUserIdCard.substring(6, 14);
  190. birthday = birthday.substring(0, 4) + "-" + birthday.substring(4, 6) + "-" + birthday.substring(6);
  191. $("#editUserBirthDay").val(birthday);
  192. var returnAge = jsGetAge(birthday);
  193. $("#editUserAge").val(returnAge);
  194. var gender = editUserIdCard.substring(16, 17);
  195. if (gender % 2 == 0) {
  196. $("#editUserGender").val(2);
  197. } else {
  198. $("#editUserGender").val(1);
  199. }
  200. $('#editUserGender').selectpicker('refresh');
  201. });
  202. $("#phoneNum").change(function (e) {
  203. queryUserInfoByphoneNo();
  204. });
  205. $("#userName").change(function (e) {
  206. queryUserInfoByName();
  207. });
  208. // postCMD("connect",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
  209. // setTimeout(function () {
  210. // postCMD("login",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
  211. // }, 600);
  212. postCMD("login",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
  213. setTimeout(function () {
  214. getLodop();
  215. }, 800);
  216. });
  217. /**
  218. * 初始化婚姻状态下拉选
  219. */
  220. function initMaritalStatusSelect() {
  221. $(".selectpicker").selectpicker({
  222. dropuAuto: false
  223. });
  224. $.ajax({
  225. type: "GET",
  226. url: '/thmz/queryAllMaritalStatus',
  227. contentType: "application/json;charset=UTF-8",
  228. dataType: "json",
  229. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  230. success: function (res) {
  231. if (res == '401' || res == 401) {
  232. window.location.href = '/thmz/login/view'
  233. return;
  234. }
  235. if (res.code == 0) {
  236. res.data.forEach(function (item, index) {
  237. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  238. $('#maritalStatus').append(html);
  239. //$('#editUserPatientsNature').append(html);
  240. });
  241. $('#maritalStatus').selectpicker('refresh');
  242. // $('#editUserPatientsNature').selectpicker('refresh');
  243. } else {
  244. new PNotify({
  245. title: '错误提示',
  246. text: res.message,
  247. type: 'error',
  248. hide: true,
  249. styling: 'bootstrap3'
  250. });
  251. }
  252. }
  253. });
  254. }
  255. /**
  256. * 初始化性别下拉选
  257. */
  258. function initGenderSelect() {
  259. $(".selectpicker").selectpicker({
  260. //设置菜单的上浮或者下浮
  261. dropuAuto: false
  262. });
  263. var gender = '<option value="1">男</option><option value="2">女</option><option value="0">未知</option>';
  264. $('#gender').html(gender);
  265. $('#gender').selectpicker('refresh');
  266. $('#editUserGender').html(gender);
  267. $('#editUserGender').selectpicker('refresh');
  268. }
  269. /**
  270. * 初始化病人身份类别下拉选
  271. */
  272. function initResponceTypeSelect() {
  273. $(".selectpicker").selectpicker({
  274. dropuAuto: false
  275. });
  276. $.ajax({
  277. type: "GET",
  278. url: '/thmz/getMzResponceType',
  279. contentType: "application/json;charset=UTF-8",
  280. dataType: "json",
  281. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  282. success: function (res) {
  283. if (res == '401' || res == 401) {
  284. window.location.href = '/thmz/login/view'
  285. return;
  286. }
  287. if (res.code == 0) {
  288. res.data.forEach(function (item, index) {
  289. var html = '<option value="' + item.code + '">' + item.name + '</option>';
  290. $('#patientsNature').append(html);
  291. $('#editUserPatientsNature').append(html);
  292. });
  293. $('#patientsNature').selectpicker('refresh');
  294. $('#editUserPatientsNature').selectpicker('refresh');
  295. } else {
  296. new PNotify({
  297. title: '错误提示',
  298. text: res.message,
  299. type: 'error',
  300. hide: true,
  301. styling: 'bootstrap3'
  302. });
  303. }
  304. }
  305. });
  306. }
  307. /**
  308. * 初始门诊收银方式下拉选
  309. */
  310. function initChequeType(payType) {
  311. $.ajax({
  312. type: "GET",
  313. url: '/thmz/getAllZdChequeTypeForMz',
  314. dataType: "json",
  315. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  316. success: function (res) {
  317. if (res == '401' || res == 401) {
  318. window.location.href = '/thmz/login/view'
  319. return;
  320. }
  321. var html = '';
  322. $.each(res.data, function (commentIndex, comment) {
  323. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  324. });
  325. $('#' + payType).empty();
  326. $('#' + payType).html(html);
  327. $('#' + payType).selectpicker('refresh');
  328. $('#' + payType).selectpicker('val', 1);
  329. $('#' + payType).selectpicker('refresh');
  330. }
  331. });
  332. }
  333. /**
  334. * 列表类型按钮切换事件
  335. * @param object
  336. */
  337. function titleButtonChange(object) {
  338. $("#regi_List_btn_group").find("button").each(function (index, element) {
  339. if ($(element).hasClass("btn-primary")) {
  340. $(element).removeClass("btn-primary").addClass("btn-default");
  341. }
  342. });
  343. $(object).removeClass("btn-default").addClass("btn-primary");
  344. loadRegistrationList(true);
  345. }
  346. /**
  347. * 打开编辑用户信息窗口
  348. * @param data
  349. */
  350. function editUserModal(data) {
  351. $("#editUserModal").modal();
  352. if (data == null) {
  353. data = $("#patientId").val();
  354. }
  355. $.ajax({
  356. type: "GET",
  357. url: '/thmz/getByPatientId?patientId=' + data,
  358. contentType: "application/json;charset=UTF-8",
  359. dataType: "json",
  360. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  361. success: function (res) {
  362. if (res == '401' || res == 401) {
  363. window.location.href = '/thmz/login/view'
  364. return;
  365. }
  366. if (res.code == 0) {
  367. if (res.data != null) {
  368. //延时调用,因为当前弹框还没有加载出来,校验规则无法获取光标与模拟光标丢失事件,延时可以等弹框加载出来后模拟事件
  369. setTimeout(function () {
  370. fillPlusPatinet(res.data);
  371. }, 400);
  372. }
  373. } else {
  374. new PNotify({
  375. title: '错误提示',
  376. text: res.message,
  377. type: 'error',
  378. hide: true,
  379. styling: 'bootstrap3'
  380. });
  381. }
  382. }
  383. });
  384. }
  385. /**
  386. * 打开打印内容窗口
  387. * @param data
  388. */
  389. function printModal(data) {
  390. $("#printOrPreviewModal").modal("hide");
  391. $("#printModal").modal();
  392. }
  393. /**
  394. * checkBox样式
  395. */
  396. function formatCheck() {
  397. if ($("input.flat")[0]) {
  398. $(document).ready(function () {
  399. $('input.flat').iCheck({
  400. checkboxClass: 'icheckbox_flat-blue',
  401. radioClass: 'iradio_flat-blue'
  402. });
  403. });
  404. }
  405. }
  406. /**
  407. * 卡号有变化后查询病人信息
  408. */
  409. function queryUserInfoByCardNo() {
  410. var cardNo = $("#cardNo").val();
  411. var index =cardNo.indexOf("-");
  412. if ((index > 0 && index==cardNo.length-2) || cardNo.length == 8) {
  413. $("#cardNo").attr("title", cardNo);
  414. $.ajax({
  415. type: "GET",
  416. url: '/thmz/getByIcCardNo?icCardNo=' + cardNo,
  417. contentType: "application/json;charset=UTF-8",
  418. dataType: "json",
  419. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  420. success: function (res) {
  421. if (res == '401' || res == 401) {
  422. window.location.href = '/thmz/login/view'
  423. return;
  424. }
  425. if (res.code == 0) {
  426. if (res.data != null) {
  427. $("#cardNo").blur();
  428. $("#userName").val(res.data.name);
  429. $("#userName").blur();
  430. $("#userNameReadOnly").val(res.data.name);
  431. var age =jsGetAge(res.data.birthDayStr);
  432. if(age==null){
  433. age=res.data.age;
  434. }
  435. $("#age").val(age);
  436. $("#age").blur();
  437. $("#gender").selectpicker('val', res.data.sex);
  438. $("#gender").selectpicker('refresh');
  439. $("#gender").blur();
  440. $("#birthDayReadonly").val(res.data.birthDayStr);
  441. $("#birthDayReadonly").attr("title", res.data.birthDayStr);
  442. $("#birthDay").val(res.data.birthDayStr);
  443. $("#birthDay").blur();
  444. $("#phoneNum").val(res.data.phoneNo);
  445. $("#phoneNum").attr("title", res.data.phoneNo);
  446. $("#phoneNum").blur();
  447. $("#patientsNature").selectpicker('val', res.data.responseType);//默认选中
  448. $('#patientsNature').selectpicker('refresh');
  449. $("#patientsNature").blur();
  450. $("#idCard").val(res.data.socialNo);
  451. $("#idCard").attr("title", res.data.socialNo);
  452. $("#idCard").blur();
  453. $("#address").val(res.data.address);
  454. $("#address").blur();
  455. $("#patientId").val(res.data.patientId);
  456. if (res.data.name != null && res.data.name != "") {
  457. $("#editUser").show();
  458. $("#clearIcCardNo").show();
  459. }
  460. $("#saveUser").hide();
  461. //根据病人门诊id查询病人的入院申请
  462. $.ajax({
  463. type: "GET",
  464. url: '/thmz/getMzZyReqByPatientId?patientId='+res.data.patientId,
  465. contentType: "application/json;charset=UTF-8",
  466. dataType: "json",
  467. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  468. success: function (resZyz) {
  469. if (resZyz == '401' || resZyz == 401) {
  470. window.location.href = '/thmz/login/view'
  471. return;
  472. }
  473. if (resZyz.code == 0) {
  474. $("#reqDoctor").selectpicker('val', resZyz.data.doctorCode);
  475. $("#reqDoctor").selectpicker('refresh');
  476. $("#clinicDiagnosisCode").val(resZyz.data.icdCode);
  477. $("#clinicDiagnosis").val(resZyz.data.icdText);
  478. $("#hospitalDiagnosisCode").val(resZyz.data.icdCode);
  479. $("#hospitalDiagnosis").val(resZyz.data.icdText);
  480. $("#inpatientWard").selectpicker('val', resZyz.data.reqDept);
  481. $("#inpatientWard").selectpicker('refresh');
  482. initSmallDeptByDept();
  483. $("#smallWard").selectpicker('val', resZyz.data.smallDept);
  484. $("#smallWard").selectpicker('refresh');
  485. }
  486. }
  487. });
  488. //根据病人门诊id查询住院病人id
  489. $.ajax({
  490. type: "GET",
  491. url: '/thmz/getAPatientByMzNo?mzNo='+res.data.patientId,
  492. contentType: "application/json;charset=UTF-8",
  493. dataType: "json",
  494. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  495. success: function (resAp) {
  496. if (resAp == '401' || resAp == 401) {
  497. window.location.href = '/thmz/login/view'
  498. return;
  499. }
  500. if (resAp.code == 0) {
  501. $("#bornAddress").selectpicker('val', resAp.data.birthPlace);
  502. $("#bornAddress").selectpicker('refresh');
  503. $("#permanentAddress").val(resAp.data.accountStreet);
  504. $("#address").val(resAp.data.homeStreet);
  505. $("#unitAddress").val(resAp.data.employerStreet);
  506. $("#contractName").val(resAp.data.relationName);
  507. $("#relationship").selectpicker('val', resAp.data.relationCode);
  508. $("#relationship").selectpicker('refresh');
  509. $("#contractPhone").val(resAp.data.relationTel);
  510. $("#contractAddress").val(resAp.data.relationStreet);
  511. $("#profession").selectpicker('val', resAp.data.occupationCode);
  512. $("#profession").selectpicker('refresh');
  513. $("#maritalStatus").selectpicker('val', resAp.data.marryCode);
  514. $("#maritalStatus").selectpicker('refresh');
  515. $('#nationality').selectpicker('val',resAp.data.country);
  516. $('#nationality').selectpicker('refresh');
  517. $('#nation').selectpicker('val',resAp.data.nationCode);
  518. $('#nation').selectpicker('refresh');
  519. $("#idCard").val(resAp.data.socialNo);
  520. $("#idCard").attr("title", resAp.data.socialNo);
  521. $("#idCard").blur();
  522. $("#admissionNumber").val(resAp.data.inpatientNo);
  523. }
  524. }
  525. });
  526. } else {
  527. $("#saveUser").show();
  528. $("#newCardModal").modal();
  529. $(document).keydown(function (event) { //监听键盘按下时的事件
  530. if (event.keyCode == 13) {
  531. //回车键
  532. $('#newCardModal').modal('hide');
  533. }
  534. });
  535. }
  536. } else {
  537. new PNotify({
  538. title: '错误提示',
  539. text: res.message,
  540. type: 'error',
  541. hide: true,
  542. styling: 'bootstrap3'
  543. });
  544. }
  545. }
  546. });
  547. }
  548. }
  549. /**
  550. * 卡号输入改变事件
  551. */
  552. function cardNoChange() {
  553. if (window.ActiveXObject || "ActiveXObject" in window) {
  554. $("#cardNo").on('input propertychange', function () {
  555. queryUserInfoByCardNo();
  556. });
  557. } else {
  558. $("#cardNo").on('input οninput', function () {
  559. queryUserInfoByCardNo();
  560. });
  561. }
  562. }
  563. /**
  564. * 校验收款金额
  565. */
  566. function checkFee() {
  567. var cash = parseFloat($("#cash").val());
  568. var realMoney = parseFloat($("#realMoney").val());
  569. realMoney = realMoney.toFixed(2);
  570. $("#realMoney").val(realMoney)
  571. if (cash < realMoney) {
  572. new PNotify({
  573. title: '错误提示',
  574. text: "收款金额不能少于实收金额!",
  575. type: 'error',
  576. hide: true,
  577. styling: 'bootstrap3'
  578. });
  579. return;
  580. } else if (cash > realMoney) {
  581. if ($("#payType").val() == 1) {
  582. var changeAmount = cash - realMoney;
  583. $("#changeAmount").val(changeAmount.toFixed(2));
  584. sendPeiceMessage(realMoney,cash,changeAmount.toFixed(2),'实际支付金额为'+cash+'元,应找零'+changeAmount+'元',$("#patientId").val(),$("#userNameReadOnly").val());
  585. } else {
  586. new PNotify({
  587. title: '错误提示',
  588. text: "非现金收款金额不能大于实收金额!",
  589. type: 'error',
  590. hide: true,
  591. styling: 'bootstrap3'
  592. });
  593. return;
  594. }
  595. }else {
  596. $("#changeAmount").val(0.00);
  597. sendPeiceMessage(realMoney,cash,0.00,'实际支付金额为'+cash+'元',$("#patientId").val(),$("#userNameReadOnly").val());
  598. }
  599. //计算和设置折扣比例
  600. var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());
  601. var discount = 100;
  602. if (realMoney < amountMoneyConfirm) {
  603. discount = realMoney / amountMoneyConfirm * 100;
  604. }
  605. $("#discount").text(discount.toFixed(2))
  606. }
  607. /**
  608. * 按照病人id查询病人信息
  609. * @param patientId
  610. */
  611. function fillPatinet(patientId) {
  612. if (patientId == null || patientId == "") {
  613. return;
  614. }
  615. $.ajax({
  616. type: "GET",
  617. url: '/thmz/getByPatientId?patientId=' + patientId,
  618. contentType: "application/json;charset=UTF-8",
  619. dataType: "json",
  620. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  621. success: function (res) {
  622. if (res == '401' || res == 401) {
  623. window.location.href = '/thmz/login/view'
  624. return;
  625. }
  626. if (res.code == 0) {
  627. if (res.data != null) {
  628. $("#cardNo").val(res.data.icCardNo);
  629. $("#cardNo").attr("title", res.data.icCardNo);
  630. $("#cardNo").blur();
  631. $("#userName").val(res.data.name);
  632. $("#userName").blur();
  633. $("#userNameReadOnly").val(res.data.name);
  634. $("#age").val(res.data.age);
  635. $("#age").blur();
  636. $("#gender").selectpicker('val', res.data.sex);
  637. $("#gender").selectpicker('refresh');
  638. $("#gender").blur();
  639. $("#birthDayReadonly").val(res.data.birthDayStr);
  640. $("#birthDayReadonly").attr("title", res.data.birthDayStr);
  641. $("#birthDayReadonly").blur();
  642. $("#birthDay").val(res.data.birthDayStr);
  643. $("#birthDay").blur();
  644. $("#phoneNum").val(res.data.phoneNo);
  645. $("#phoneNum").attr("title", res.data.phoneNo);
  646. $("#phoneNum").blur();
  647. $("#patientsNature").selectpicker('val', res.data.responseType);//默认选中
  648. $('#patientsNature').selectpicker('refresh');
  649. $("#patientsNature").blur();
  650. $("#idCard").val(res.data.socialNo);
  651. $("#idCard").attr("title", res.data.socialNo);
  652. $("#idCard").blur();
  653. $("#address").val(res.data.address);
  654. $("#address").blur();
  655. $("#patientId").val(res.data.patientId);
  656. if (res.data.name != null && res.data.name != "") {
  657. $("#editUser").show();
  658. }
  659. }
  660. } else {
  661. new PNotify({
  662. title: '错误提示',
  663. text: res.message,
  664. type: 'error',
  665. hide: true,
  666. styling: 'bootstrap3'
  667. });
  668. }
  669. }
  670. });
  671. }
  672. /**
  673. * 将病人信息填入患者信息修改form
  674. * @param patinet
  675. */
  676. function fillPlusPatinet(patinet) {
  677. if (patinet != null) {
  678. $("#editUserCode").val(patinet.patientId);
  679. $("#editUserName").val(patinet.name);
  680. $("#editUserName").blur();
  681. $("#editUserAge").val(patinet.age);
  682. $("#editUserAge").blur();
  683. $("#editUserGender").selectpicker('val', patinet.sex);
  684. $("#editUserGender").selectpicker('refresh');
  685. $("#editUserGender").blur();
  686. $("#editUserBirthDay").val(patinet.birthDayStr);
  687. $("#editUserBirthDay").blur();
  688. $("#editUserCardNo").val(patinet.icCardNo);
  689. $("#editUserCardNo").attr("title", patinet.icCardNo);
  690. $("#editUserCardNo").blur();
  691. $("#editUserPhoneNum").val(patinet.phoneNo);
  692. $("#editUserPhoneNum").attr("title", patinet.phoneNo);
  693. $("#editUserPhoneNum").blur();
  694. $("#editUserPatientsNature").selectpicker('val', patinet.responseType);//默认选中
  695. $('#editUserPatientsNature').selectpicker('refresh');
  696. $("#editUserPatientsNature").blur();
  697. $("#editUserIdCard").val(patinet.socialNo);
  698. $("#editUserIdCard").attr("title", patinet.socialNo);
  699. $("#editUserIdCard").blur();
  700. $("#editUserAddress").val(patinet.address);
  701. $("#editUserAddress").blur();
  702. $("#editUserContact").val(patinet.relName);
  703. $("#editUserContactPhone").val(patinet.contractName);
  704. }
  705. }
  706. /**
  707. * 关闭当前这个付款方式
  708. */
  709. function closeThisParent(obj) {
  710. $(obj).parent().parent().remove();
  711. }
  712. /**
  713. * 科室与时间区间下拉选改变时清空输入框内容
  714. */
  715. function emptyInput() {
  716. $('#doctor').empty();
  717. $('#doctor').selectpicker('refresh');
  718. $("#registrationFee").val(0.00);
  719. $("#hospitalFee").val(0.00);
  720. $("#checkFee").val(0.00);
  721. $("#amountMoney").text(0.00);
  722. $("#amountMoneyConfirm").text(0.00);
  723. $("#realMoney").val(0.00);
  724. }
  725. /**
  726. * 给某些域增加title或者清除title
  727. * @param obj
  728. */
  729. function clearTextOrTitle(obj) {
  730. if ($(obj).val() == null || $(obj).val().length == 0) {
  731. $(obj).attr("title", null);
  732. } else {
  733. $(obj).attr("title", $(obj).val());
  734. if ($(obj).attr("id") == "birthDay") {
  735. $(obj).blur()
  736. }
  737. }
  738. }
  739. /**
  740. * 查询默认打印机
  741. */
  742. function setPrint() {
  743. if (printIndex >= 0) {
  744. return;
  745. }
  746. $.ajax({
  747. type: "GET",
  748. url: '/thmz/getLastWindowsByCurrentUser',
  749. contentType: "application/json;charset=UTF-8",
  750. dataType: "json",
  751. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  752. async: false,
  753. success: function (res) {
  754. if (res == '401' || res == 401) {
  755. window.location.href = '/thmz/login/view'
  756. return;
  757. }
  758. if (res.code == 0) {
  759. printIndex = res.data.printIndex;
  760. } else {
  761. printIndex = -1;
  762. }
  763. }
  764. });
  765. }
  766. /**
  767. * 保存病人信息
  768. * @param flag true 继续调用挂号接口,false,只建档不挂号
  769. */
  770. function savePatient(flag) {
  771. $.ajax({
  772. type: "POST",
  773. url: '/thmz/savePatient',
  774. contentType: "application/json;charset=UTF-8",
  775. dataType: "json",
  776. data: JSON.stringify({
  777. "name": $("#userName").val(),
  778. "age": $("#age").val(),
  779. "sex": $("#gender").val(),
  780. "birthDay": $("#birthDay").val(),
  781. "icCardNo": $("#cardNo").val(),
  782. "phoneNo": $("#phoneNum").val(),
  783. "responseType": $("#patientsNature").val(),
  784. "socialNo": $("#idCard").val(),
  785. "address": $("#address").val()
  786. }),
  787. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  788. success: function (res) {
  789. if (res == '401' || res == 401) {
  790. window.location.href = '/thmz/login/view'
  791. return;
  792. }
  793. if (res.code == 0) {
  794. if (flag) {
  795. $("#patientId").val(res.data.patientId);
  796. saveMzyReqrec();
  797. } else {
  798. clearRegistration();
  799. successMesage(res);
  800. }
  801. } else {
  802. $("#saveConfirmFee").attr("disabled",false);
  803. errorMesage(res);
  804. }
  805. }
  806. });
  807. }
  808. /**
  809. * 修改病人信息
  810. */
  811. function modifyPatient() {
  812. $.ajax({
  813. type: "POST",
  814. url: '/thmz/modifyPatient',
  815. contentType: "application/json;charset=UTF-8",
  816. dataType: "json",
  817. data: JSON.stringify({
  818. "name": $("#editUserName").val(),
  819. "age": $("#editUserAge").val(),
  820. "sex": $("#editUserGender").val(),
  821. "birthDay": $("#editUserBirthDay").val(),
  822. "icCardNo": $("#editUserCardNo").val(),
  823. "phoneNo": $("#editUserPhoneNum").val(),
  824. "responseType": $("#editUserPatientsNature").val(),
  825. "socialNo": $("#editUserIdCard").val(),
  826. "address": $("#editUserAddress").val(),
  827. "patientId": $("#editUserCode").val(),
  828. "relName": $("#editUserContact").val(),
  829. "contractName": $("#editUserContactPhone").val()
  830. }),
  831. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  832. success: function (res) {
  833. if (res == '401' || res == 401) {
  834. window.location.href = '/thmz/login/view'
  835. return;
  836. }
  837. if (res.code == 0) {
  838. $('#editUserModal').modal('hide');
  839. fillPatinet($("#patientId").val());
  840. successMesage(res);
  841. } else {
  842. new PNotify({
  843. title: '错误提示',
  844. text: res.message,
  845. type: 'error',
  846. hide: true,
  847. styling: 'bootstrap3'
  848. });
  849. }
  850. }
  851. });
  852. }
  853. /**
  854. * 保存挂号信息
  855. */
  856. function saveMzyReqrec() {
  857. var mzyRequestId = $('#doctor').find("option:selected").attr('data-mzyRequestId');
  858. var patientId = $("#patientId").val();
  859. $.ajax({
  860. type: "POST",
  861. url: '/thmz/saveMzyReqrec',
  862. contentType: "application/json;charset=UTF-8",
  863. dataType: "json",
  864. data: JSON.stringify({
  865. "mzyReqrec": {
  866. "patientId": patientId,
  867. "ampm": $("#ampm").val(),
  868. "unitCode": $("#deptNo").val(),
  869. "chargeType": $("#chargeType").val(),
  870. "paymode": $("#payType").val()
  871. }, "responceType": $("#patientsNature").val(), "mzyRequestId": mzyRequestId
  872. }),
  873. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  874. success: function (res) {
  875. if (res == '401' || res == 401) {
  876. window.location.href = '/thmz/login/view'
  877. return;
  878. }
  879. if (res.code == 0) {
  880. new PNotify({
  881. title: '操作提示',
  882. text: res.message,
  883. type: 'success',
  884. hide: true,
  885. styling: 'bootstrap3'
  886. });
  887. $('#confirmFeeModal').modal('hide');
  888. prn1Print(patientId, -1);
  889. // loadTableCount();
  890. // loadRegistrationList(true);
  891. clearRegistration();
  892. postCMD("appraise",localStorage.getItem("userID"),'000000','收费项目',0,0,0, '','祝您早日康复',0,0,0);
  893. } else {
  894. new PNotify({
  895. title: '错误提示',
  896. text: res.message,
  897. type: 'error',
  898. hide: true,
  899. styling: 'bootstrap3'
  900. });
  901. }
  902. $("#saveConfirmFee").attr("disabled",false);
  903. }
  904. });
  905. }
  906. /**
  907. * 科室和医生列表初始化
  908. */
  909. function initListSelect() {
  910. initListDeptSelect();
  911. initReqDoctorSelect()
  912. initCountrySelect();
  913. initNationSelect();
  914. initDistrictSelect();
  915. initRelationSelect();
  916. initOccupationSelect();
  917. }
  918. /**
  919. * 入院登记的病区列表
  920. */
  921. function initListDeptSelect() {
  922. //科室列表
  923. $.ajax({
  924. type: "GET",
  925. url: '/thmz/allInpatientWard',
  926. dataType: "json",
  927. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  928. success: function (data) {
  929. if (data == '401' || data == 401) {
  930. window.location.href = '/thmz/login/view'
  931. return;
  932. }
  933. var html = '';
  934. $.each(data.data, function (commentIndex, comment) {
  935. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  936. });
  937. $('#inpatientWard').empty();
  938. $('#inpatientWard').html(html);
  939. $('#inpatientWard').selectpicker('refresh');
  940. initSmallDeptByDept();
  941. }
  942. });
  943. }
  944. /**
  945. * 小科室列表
  946. */
  947. function initSmallDeptByDept() {
  948. //小科室列表
  949. $.ajax({
  950. type: "GET",
  951. url: '/thmz/getSmallDeptByDept?code=' + $('#inpatientWard').val(),
  952. dataType: "json",
  953. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  954. async: false,
  955. success: function (res) {
  956. if (res == '401' || res == 401) {
  957. window.location.href = '/thmz/login/view'
  958. return;
  959. }
  960. var html = '';
  961. $.each(res.data, function (commentIndex, comment) {
  962. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  963. });
  964. $('#smallWard').empty();
  965. $('#smallWard').html(html);
  966. $('#smallWard').selectpicker('destroy').selectpicker('refresh');
  967. }
  968. });
  969. //病床列表
  970. $.ajax({
  971. type: "GET",
  972. url: '/thmz/getBedNumByDept?code=' + $('#inpatientWard').val(),
  973. dataType: "json",
  974. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  975. success: function (res) {
  976. if (res == '401' || res == 401) {
  977. window.location.href = '/thmz/login/view'
  978. return;
  979. }
  980. var html = '';
  981. $.each(res.data, function (commentIndex, comment) {
  982. html += '<option value="' + comment + '">' + comment + '</option>';
  983. });
  984. $('#bedNum').empty();
  985. $('#bedNum').html(html);
  986. $('#bedNum').selectpicker('destroy').selectpicker('refresh');
  987. }
  988. });
  989. }
  990. /**
  991. * 入院医生列表初始化
  992. */
  993. function initReqDoctorSelect() {
  994. //医生列表
  995. $.ajax({
  996. type: "GET",
  997. url: '/thmz/listEmployeeByDepts?depts=',
  998. dataType: "json",
  999. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1000. success: function (res) {
  1001. if (res == '401' || res == 401) {
  1002. window.location.href = '/thmz/login/view'
  1003. return;
  1004. }
  1005. var html = '';
  1006. $.each(res.data, function (commentIndex, comment) {
  1007. html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + '</option>';
  1008. });
  1009. $('#reqDoctor').empty();
  1010. $('#reqDoctor').html(html);
  1011. $('#reqDoctor').selectpicker('destroy').selectpicker('refresh');
  1012. }
  1013. });
  1014. }
  1015. /**
  1016. * 国籍列表初始化
  1017. */
  1018. function initCountrySelect() {
  1019. //医生列表
  1020. $.ajax({
  1021. type: "GET",
  1022. url: '/thmz/getCountry',
  1023. dataType: "json",
  1024. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1025. success: function (res) {
  1026. if (res == '401' || res == 401) {
  1027. window.location.href = '/thmz/login/view'
  1028. return;
  1029. }
  1030. var html = '';
  1031. $.each(res.data, function (commentIndex, comment) {
  1032. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1033. });
  1034. $('#nationality').empty();
  1035. $('#nationality').html(html);
  1036. $('#nationality').selectpicker('destroy').selectpicker('refresh');
  1037. $('#nationality').selectpicker('val','cn');
  1038. $('#nationality').selectpicker('refresh');
  1039. }
  1040. });
  1041. }
  1042. /**
  1043. * 民族列表初始化
  1044. */
  1045. function initNationSelect() {
  1046. //医生列表
  1047. $.ajax({
  1048. type: "GET",
  1049. url: '/thmz/getNation',
  1050. dataType: "json",
  1051. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1052. success: function (res) {
  1053. if (res == '401' || res == 401) {
  1054. window.location.href = '/thmz/login/view'
  1055. return;
  1056. }
  1057. var html = '';
  1058. $.each(res.data, function (commentIndex, comment) {
  1059. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1060. });
  1061. $('#nation').empty();
  1062. $('#nation').html(html);
  1063. $('#nation').selectpicker('destroy').selectpicker('refresh');
  1064. $('#nation').selectpicker('val','HA');
  1065. $('#nation').selectpicker('refresh');
  1066. }
  1067. });
  1068. }
  1069. /**
  1070. * 省份列表初始化
  1071. */
  1072. function initDistrictSelect() {
  1073. //医生列表
  1074. $.ajax({
  1075. type: "GET",
  1076. url: '/thmz/getDistrict',
  1077. dataType: "json",
  1078. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1079. success: function (res) {
  1080. if (res == '401' || res == 401) {
  1081. window.location.href = '/thmz/login/view'
  1082. return;
  1083. }
  1084. var html = '';
  1085. $.each(res.data, function (commentIndex, comment) {
  1086. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1087. });
  1088. $('#bornAddress').empty();
  1089. $('#bornAddress').html(html);
  1090. $('#bornAddress').selectpicker('destroy').selectpicker('refresh');
  1091. $('#bornAddress').selectpicker('val','430000');
  1092. $('#bornAddress').selectpicker('refresh');
  1093. }
  1094. });
  1095. }
  1096. /**
  1097. * 关系列表初始化
  1098. */
  1099. function initRelationSelect() {
  1100. //医生列表
  1101. $.ajax({
  1102. type: "GET",
  1103. url: '/thmz/getRelation',
  1104. dataType: "json",
  1105. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1106. success: function (res) {
  1107. if (res == '401' || res == 401) {
  1108. window.location.href = '/thmz/login/view'
  1109. return;
  1110. }
  1111. var html = '';
  1112. $.each(res.data, function (commentIndex, comment) {
  1113. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1114. });
  1115. $('#relationship').empty();
  1116. $('#relationship').html(html);
  1117. $('#relationship').selectpicker('destroy').selectpicker('refresh');
  1118. }
  1119. });
  1120. }
  1121. /**
  1122. * 职业列表初始化
  1123. */
  1124. function initOccupationSelect() {
  1125. //医生列表
  1126. $.ajax({
  1127. type: "GET",
  1128. url: '/thmz/getOccupation',
  1129. dataType: "json",
  1130. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1131. success: function (res) {
  1132. if (res == '401' || res == 401) {
  1133. window.location.href = '/thmz/login/view'
  1134. return;
  1135. }
  1136. var html = '';
  1137. $.each(res.data, function (commentIndex, comment) {
  1138. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1139. });
  1140. $('#profession').empty();
  1141. $('#profession').html(html);
  1142. $('#profession').selectpicker('destroy').selectpicker('refresh');
  1143. }
  1144. });
  1145. }
  1146. /**
  1147. * 清空搜索参数
  1148. */
  1149. function clearParams() {
  1150. $("#deptNoParam").selectpicker('val', null);
  1151. $("#deptNoParam").selectpicker('refresh');
  1152. $("#doctorParam").selectpicker('val', null);
  1153. $("#deptNoParam").selectpicker('refresh');
  1154. $("#userNameParam").val(null);
  1155. $("#phoneParam").val(null);
  1156. $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
  1157. }
  1158. /**
  1159. * 保存退号信息
  1160. */
  1161. function saveBackNo() {
  1162. $.ajax({
  1163. type: "POST",
  1164. url: '/thmz/updateReqrec',
  1165. contentType: "application/json;charset=UTF-8",
  1166. dataType: "json",
  1167. data: JSON.stringify({
  1168. "patientId": $("#backNoPatientId").val(),
  1169. "times": $("#backNoTimes").val(),
  1170. "cancelMark": 1
  1171. }),
  1172. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1173. success: function (res) {
  1174. if (res == '401' || res == 401) {
  1175. window.location.href = '/thmz/login/view'
  1176. return;
  1177. }
  1178. if (res.code == 0) {
  1179. new PNotify({
  1180. title: '操作提示',
  1181. text: res.message,
  1182. type: 'success',
  1183. hide: true,
  1184. styling: 'bootstrap3'
  1185. });
  1186. loadTableCount();
  1187. loadRegistrationList(true);
  1188. $("#backNoModal").modal("hide");
  1189. } else {
  1190. new PNotify({
  1191. title: '错误提示',
  1192. text: res.message,
  1193. type: 'error',
  1194. hide: true,
  1195. styling: 'bootstrap3'
  1196. });
  1197. }
  1198. }
  1199. });
  1200. }
  1201. /**
  1202. * 清空挂号信息
  1203. */
  1204. function clearRegistration() {
  1205. $("#cardNo").val(null);
  1206. $("#cardNo").attr("title", null);
  1207. $("#userName").val(null);
  1208. $("#age").val(null);
  1209. $("#gender").selectpicker('val', 1);
  1210. $("#gender").selectpicker('refresh');
  1211. $("#birthDay").val(null);
  1212. $("#birthDay").attr("title", null);
  1213. $("#phoneNum").val(null);
  1214. $("#phoneNum").attr("title", null);
  1215. $("#patientsNature").selectpicker('val', '01');//默认选中
  1216. $('#patientsNature').selectpicker('refresh');
  1217. $("#idCard").val(null);
  1218. $("#idCard").attr("title", null);
  1219. $("#address").val(null);
  1220. $("#patientId").val(null);
  1221. $("#editUser").hide();
  1222. $("#clearIcCardNo").hide();
  1223. //默认光标在卡号输入框
  1224. $("#cardNo").focus();
  1225. initMzWorkTime();
  1226. readonlyOrNot(false);
  1227. $("#saveUser").hide();
  1228. }
  1229. /**
  1230. * 直接打印发票
  1231. * @param patientId
  1232. */
  1233. function prn1Print(patientId, times) {
  1234. setPrint();
  1235. var height ="93.15mm";
  1236. // if(countReceiot%2==0){
  1237. // height ="93.2mm";
  1238. // }
  1239. $.ajax({
  1240. type: "GET",
  1241. url: '/thmz/printMzyReqrecRecept?patientId=' + patientId + "&times=" + times,
  1242. contentType: "application/json;charset=UTF-8",
  1243. dataType: "json",
  1244. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1245. success: function (res) {
  1246. if (res == '401' || res == 401) {
  1247. window.location.href = '/thmz/login/view'
  1248. return;
  1249. }
  1250. if (res.code == 0) {
  1251. if (res.data == null || res.data.length == 0) {
  1252. return;
  1253. }
  1254. // countReceiot++;
  1255. LODOP = getLodop();
  1256. var temp = res.data;
  1257. LODOP.PRINT_INITA(6, 0, "120mm", height, "泰和门诊发票打印");
  1258. //设置默认打印机
  1259. LODOP.SET_PRINTER_INDEX(printIndex);
  1260. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");
  1261. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
  1262. LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
  1263. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
  1264. LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
  1265. LODOP.ADD_PRINT_TEXT("6mm", "0mm", "45mm", "3mm", "湖南泰和医院管理有限公司");
  1266. LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "流水号:");
  1267. LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
  1268. LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);
  1269. LODOP.ADD_PRINT_TEXT("25mm", "7mm", "50mm", "3mm", temp.name);
  1270. LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
  1271. LODOP.ADD_PRINT_TEXT("32mm", "6mm", "50mm", "3mm", "就诊科室:" + temp.unitCode);
  1272. LODOP.ADD_PRINT_TEXT("32mm", "56mm", "50mm", "3mm", "地点:" + res.officePos==null?"":res.officePos);
  1273. LODOP.ADD_PRINT_TEXT("37mm", "6mm", "50mm", "3mm", "看诊医生:" + temp.doctorCode);
  1274. LODOP.ADD_PRINT_TEXT("37mm", "56mm", "50mm", "3mm", "号段:" + temp.ampm);
  1275. LODOP.ADD_PRINT_TEXT("42mm", "6mm", "50mm", "3mm", "号别:" + temp.chargeType);
  1276. LODOP.ADD_PRINT_TEXT("42mm", "56mm", "50mm", "3mm", "挂号费:" + temp.reqFee);
  1277. LODOP.ADD_PRINT_TEXT("47mm", "6mm", "50mm", "3mm", "诊查费:" + temp.clinicFee);
  1278. LODOP.ADD_PRINT_TEXT("47mm", "56mm", "50mm", "3mm", "其他:" + temp.othFee);
  1279. LODOP.ADD_PRINT_TEXT("52mm", "6mm", "50mm", "3mm", "工本费:" + temp.brochureFee);
  1280. LODOP.ADD_PRINT_TEXT("65mm", "21mm", "60mm", "3mm", res.totalFee + " 元");
  1281. LODOP.ADD_PRINT_TEXT("72mm", "19mm", "60mm", "3mm", res.totalFeeStr);
  1282. LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.year);//年
  1283. LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.month);//月
  1284. LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.day);//日
  1285. LODOP.ADD_PRINT_TEXT("79mm", "53mm", "23mm", "3mm", res.user.userName);//收费员
  1286. //LODOP.PREVIEW();
  1287. LODOP.PRINT();
  1288. if (times > 0) {
  1289. loadRegistrationList(true);
  1290. }
  1291. }else if(res.code == -2){
  1292. new PNotify({
  1293. title: '操作提示',
  1294. text: res.message,
  1295. type: 'success',
  1296. hide: true,
  1297. styling: 'bootstrap3'
  1298. });
  1299. }else if (res.code == -1) {
  1300. new PNotify({
  1301. title: '错误提示',
  1302. text: res.message,
  1303. type: 'error',
  1304. hide: true,
  1305. styling: 'bootstrap3'
  1306. });
  1307. }
  1308. }
  1309. });
  1310. };
  1311. /**
  1312. * 销卡
  1313. * @param data
  1314. */
  1315. function clearIcCardNo() {
  1316. $.ajax({
  1317. type: "GET",
  1318. url: '/thmz/clearIcCardNo?patientId=' + $("#patientId").val(),
  1319. contentType: "application/json;charset=UTF-8",
  1320. dataType: "json",
  1321. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1322. success: function (res) {
  1323. if (res == '401' || res == 401) {
  1324. window.location.href = '/thmz/login/view'
  1325. return;
  1326. }
  1327. if (res.code == 0) {
  1328. clearRegistration();
  1329. successMesage(res);
  1330. } else {
  1331. errorMesage(res);
  1332. }
  1333. }
  1334. });
  1335. }
  1336. /**
  1337. * 根据手机号码查询病人信息
  1338. */
  1339. function queryUserInfoByphoneNo() {
  1340. var phoneNo = $("#phoneNum").val();
  1341. if (phoneNo.length == 11) {
  1342. $.ajax({
  1343. type: "GET",
  1344. url: '/thmz/getByPhoneNo?phoneNo=' + phoneNo,
  1345. contentType: "application/json;charset=UTF-8",
  1346. dataType: "json",
  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. if (res.code == 0) {
  1354. fitPatient(res);
  1355. }
  1356. }
  1357. });
  1358. }
  1359. }
  1360. /**
  1361. * 根据手机号码查询病人信息
  1362. */
  1363. function queryUserInfoByName() {
  1364. var userName = $('#userName').val();
  1365. // var cardNo=$("#cardNo").val();
  1366. if (userName == null || userName == "") {
  1367. return;
  1368. }
  1369. if (userName.length > 0) {
  1370. $.ajax({
  1371. type: "GET",
  1372. url: '/thmz/getPatientMiByName?name=' + userName,
  1373. contentType: "application/json;charset=UTF-8",
  1374. dataType: "json",
  1375. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1376. success: function (res) {
  1377. if (res == '401' || res == 401) {
  1378. window.location.href = '/thmz/login/view'
  1379. return;
  1380. }
  1381. if (res.code == 0) {
  1382. fitPatient(res);
  1383. }
  1384. }
  1385. });
  1386. }
  1387. }