toll_administration.js 105 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813
  1. //@ sourceURL=toll_administration.js
  2. var LODOP; //声明为全局变量
  3. //默认打印机下标
  4. var printIndex = -1;
  5. //选中的要退的费用收费编码
  6. var chargeItemCodes = null;
  7. //门诊结算单地址
  8. var mzjsdHost = null;
  9. $(function () {
  10. //默认光标在卡号输入框
  11. $("#cardNo").focus();
  12. init_daterangepicker();
  13. initSelect();
  14. initFeeTable();
  15. //卡号输入改变事件
  16. cardNoChange();
  17. //重置查询参数
  18. $('#btn_clean').click(function () {
  19. cleanParams();
  20. });
  21. //初始化页面上面的按钮事件
  22. //查询
  23. $('#btn_query').click(function () {
  24. initFeeTable();
  25. });
  26. /**
  27. * 增加收款方式按钮事件
  28. */
  29. $("#addPayType").on("click", function () {
  30. addPayType(null);
  31. });
  32. //初始门诊收银方式下拉选
  33. initChequeType("payType");
  34. //初始门诊收银方式下拉选
  35. initChequeType("payTypeEditPayMode");
  36. setTimeout(function () {
  37. getLodop();
  38. }, 800);
  39. /**
  40. * 核酸检测跳转过来的直接刷新待收费列表
  41. */
  42. if (patientIdFullForNucleicAcid != null && patientIdFullForNucleicAcid != "") {
  43. $("#cardNo").val(patientIdFullForNucleicAcid);
  44. $("#patientId").val(patientIdFullForNucleicAcid);
  45. initFeeTable();
  46. }
  47. /**
  48. * 医保电子凭证读卡
  49. */
  50. $("#siReadCard").on("click", function (t) {
  51. siReadCard();
  52. });
  53. //获取门诊医保结算单打印服务地址
  54. $.ajax({
  55. type: "GET",
  56. url: '/thmz/getMzjsdHost',
  57. dataType: "json",
  58. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  59. success: function (res) {
  60. if (res == '401' || res == 401) {
  61. window.location.href = '/thmz/login/view'
  62. return;
  63. }
  64. mzjsdHost = res.data;
  65. }
  66. });
  67. });
  68. /**
  69. * 列表类型按钮切换事件
  70. * @param object
  71. */
  72. function payMarkButtonChange(object) {
  73. $("#pay_mark_group").find("button").each(function (index, element) {
  74. if ($(element).hasClass("btn-primary")) {
  75. $(element).removeClass("btn-primary").addClass("btn-default");
  76. }
  77. });
  78. $(object).removeClass("btn-default").addClass("btn-primary");
  79. initFeeTable();
  80. }
  81. /**
  82. * 收费明细类型按钮切换事件
  83. * @param object
  84. */
  85. function billItemButtonChange(object) {
  86. $("#bill_item_group").find("button").each(function (index, element) {
  87. if ($(element).hasClass("btn-primary")) {
  88. $(element).removeClass("btn-primary").addClass("btn-default");
  89. }
  90. });
  91. $(object).removeClass("btn-default").addClass("btn-primary");
  92. initChargeDetailTable();
  93. //默认光标在卡号输入框
  94. $("#cardNo").focus();
  95. }
  96. /**
  97. * 收费明细类型按钮切换事件
  98. * @param object
  99. */
  100. function refundBillItemButtonChange(object) {
  101. $("#refund_bill_item_group").find("button").each(function (index, element) {
  102. if ($(element).hasClass("btn-primary")) {
  103. $(element).removeClass("btn-primary").addClass("btn-default");
  104. }
  105. });
  106. $(object).removeClass("btn-default").addClass("btn-primary");
  107. initMzChargeDetailByBillItem(false);
  108. }
  109. /**
  110. * 初始化下拉选
  111. */
  112. function initSelect() {
  113. $(".selectpicker").selectpicker({
  114. dropuAuto: false
  115. });
  116. initDeptSelect();
  117. initDoctorSelect();
  118. initCooperativeEnterprisesSelect();
  119. initMztczfSiReadCardTypeSelect();
  120. }
  121. /**
  122. * 初始化读卡类型
  123. */
  124. function initMztczfSiReadCardTypeSelect() {
  125. $('#mztczfSiReadCardType').html("<option value='03'>社保卡</option><option value='01'>电子凭证</option><option value='02'>身份证</option>");
  126. $('#mztczfSiReadCardType').selectpicker('refresh');
  127. var selectHtml = '<option value="0">否</option><option value="1">是</option>';
  128. $('#grzhzf').html(selectHtml);
  129. $('#grzhzf').selectpicker('refresh');
  130. }
  131. /**
  132. * 挂号列表中的科室列表
  133. */
  134. function initDeptSelect() {
  135. //科室列表
  136. $.ajax({
  137. type: "GET",
  138. url: '/thmz/allMzUnitCode',
  139. dataType: "json",
  140. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  141. success: function (data) {
  142. if (data == '401' || data == 401) {
  143. window.location.href = '/thmz/login/view'
  144. return;
  145. }
  146. var html = '';
  147. $.each(data.data, function (commentIndex, comment) {
  148. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  149. });
  150. $('#deptNoParam').empty();
  151. $('#deptNoParam').html(html);
  152. $('#deptNoParam').selectpicker('refresh');
  153. }
  154. });
  155. }
  156. /**
  157. * 挂号列表中的医生列表初始化
  158. */
  159. function initDoctorSelect() {
  160. //医生列表
  161. $.ajax({
  162. type: "GET",
  163. url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNoParam').val(),
  164. dataType: "json",
  165. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  166. success: function (res) {
  167. if (res == '401' || res == 401) {
  168. window.location.href = '/thmz/login/view'
  169. return;
  170. }
  171. var html = '';
  172. $.each(res.data, function (commentIndex, comment) {
  173. html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + '</option>';
  174. });
  175. $('#doctorParam').empty();
  176. $('#doctorParam').html(html);
  177. $('#doctorParam').selectpicker('destroy').selectpicker('refresh');
  178. }
  179. });
  180. }
  181. /**
  182. * 合作企业列表
  183. */
  184. function initCooperativeEnterprisesSelect() {
  185. $.ajax({
  186. type: "GET",
  187. url: '/thmz/getAllCooperativeEnterprises',
  188. dataType: "json",
  189. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  190. success: function (res) {
  191. if (res == '401' || res == 401) {
  192. window.location.href = '/thmz/login/view'
  193. return;
  194. }
  195. var html = '';
  196. $.each(res.data, function (commentIndex, comment) {
  197. html += '<option value="' + comment.id + '">' + comment.projectName + " " + comment.contractNo + '</option>';
  198. });
  199. $('#project').empty();
  200. $('#project').html(html);
  201. $('#project').selectpicker('destroy').selectpicker('refresh');
  202. $('#projectCharged').empty();
  203. $('#projectCharged').html(html);
  204. $('#projectCharged').selectpicker('destroy').selectpicker('refresh');
  205. }
  206. });
  207. }
  208. var $table_1;
  209. /**
  210. * 初始化收费表格
  211. */
  212. function initFeeTable() {
  213. var payMarkGroup = getIndex("pay_mark_group");
  214. var timeColumusName = "处方时间";
  215. var timeColumus = "priceTime";
  216. $("#refundFeeTip").removeClass("in").addClass("hide");
  217. $("#chargeFeeTip").removeClass("hide").addClass("in");
  218. if (payMarkGroup == 1) {
  219. timeColumusName = "缴费时间";
  220. timeColumus = "chargeDate";
  221. $("#refundFeeTip").removeClass("hide").addClass("in");
  222. $("#chargeFeeTip").removeClass("in").addClass("hide");
  223. } else if (payMarkGroup == 2) {
  224. timeColumusName = "退费时间";
  225. timeColumus = "inputDate";
  226. }
  227. var patientId = $("#patientId").val();
  228. //查询记账信息
  229. if (payMarkGroup == 0 && patientId != null && patientId != '') {
  230. $("#patientIdHaveTally").val(patientId);
  231. $.ajax({
  232. type: "GET",
  233. url: '/thmz/getTallyTotalCharge?patientId=' + patientId,
  234. contentType: "application/json;charset=UTF-8",
  235. dataType: "json",
  236. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  237. success: function (res) {
  238. if (res == '401' || res == 401) {
  239. window.location.href = '/thmz/login/view'
  240. return;
  241. }
  242. if (res.code == 0) {
  243. if (res.data != null && res.data > 0) {
  244. $("#haveTallyModal").modal();
  245. $("#totalTallyAmount").text(res.data.toFixed(2));
  246. } else {
  247. $("#haveTallyModal").modal('hide');
  248. }
  249. } else {
  250. new PNotify({
  251. title: '错误提示',
  252. text: res.message,
  253. type: 'error',
  254. hide: true,
  255. styling: 'bootstrap3'
  256. });
  257. }
  258. }
  259. });
  260. }
  261. $('#tb_table').bootstrapTable("destroy");
  262. $table_1 = $('#tb_table').bootstrapTable({
  263. url: '/thmz/listMzChargeDetail', //请求后台的URL(*)
  264. method: 'post', //请求方式(*)
  265. toolbar: '#toolbar', //工具按钮用哪个容器
  266. striped: true, //是否显示行间隔色
  267. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  268. pagination: true, //是否显示分页(*)
  269. sortable: true, //是否启用排序
  270. sortOrder: "asc", //排序方式
  271. queryParams: queryParams, //传递参数(*)
  272. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  273. pageNumber: 1, //初始化加载第一页,默认第一页
  274. pageSize: 5, //每页的记录行数(*)
  275. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  276. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  277. strictSearch: true,
  278. showColumns: false, //是否显示所有的列
  279. showRefresh: false, //是否显示刷新按钮
  280. minimumCountColumns: 2, //最少允许的列数
  281. clickToSelect: true, //是否启用点击选中行
  282. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  283. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  284. cardView: false, //是否显示详细视图
  285. detailView: false,
  286. //rowStyle:rowStyle,//通过自定义函数设置行样式
  287. ajaxOptions: {
  288. headers: {
  289. 'Accept': 'application/json',
  290. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  291. }
  292. },
  293. columns: [
  294. // {
  295. // checkbox: true
  296. // },
  297. {
  298. field: 'realNo',
  299. title: '缴费流水号',
  300. align: "center",
  301. valign: 'middle',
  302. formatter: function (value, row, index) {
  303. return Math.abs(value);
  304. }
  305. }, {
  306. field: 'patientId',
  307. title: '患者编号',
  308. align: "center",
  309. valign: 'middle',
  310. }, {
  311. field: 'name',
  312. title: '患者姓名',
  313. align: "center",
  314. valign: 'middle',
  315. }, {
  316. field: 'times',
  317. title: '就诊次数',
  318. align: "center",
  319. valign: 'middle',
  320. }, {
  321. field: 'receiptNo',
  322. title: '结算次数',
  323. align: "center",
  324. valign: 'middle',
  325. formatter: function (value, row, index) {
  326. return Math.abs(value);
  327. }
  328. }, {
  329. field: 'notDiscountAmount',
  330. title: '订单金额(元)',
  331. align: "center",
  332. valign: 'middle',
  333. formatter: function (value, row, index) {
  334. return Math.abs(value).toFixed(2);
  335. }
  336. }, {
  337. field: 'discountAmount',
  338. title: '优惠总额(元)',
  339. align: "center",
  340. valign: 'middle',
  341. formatter: function (value, row, index) {
  342. return Math.abs(value).toFixed(2);
  343. }
  344. }, {
  345. field: 'amount',
  346. title: '应付金额(元)',
  347. align: "center",
  348. valign: 'middle',
  349. formatter: function (value, row, index) {
  350. return Math.abs(value).toFixed(2);
  351. }
  352. }, {
  353. field: 'warnDept',
  354. title: '科室',
  355. align: "center",
  356. valign: 'middle',
  357. }, {
  358. field: 'doctorCode',
  359. title: '医生',
  360. align: "center",
  361. valign: 'middle',
  362. }, {
  363. field: timeColumus,
  364. title: timeColumusName,
  365. align: "center",
  366. valign: 'middle',
  367. formatter: function (value, row, index) {
  368. if (value == null || value == "") {
  369. return "";
  370. }
  371. return format(value, "yyyy-MM-dd HH:mm:ss");
  372. }
  373. }, {
  374. title: '操作',
  375. align: "center",
  376. valign: 'middle',
  377. // sortable: true,
  378. formatter: function (value, row, index) {
  379. var str = '<button type="button" class="registration-no-color-foot-button" title="费用明细" onclick="chargeDetailModal(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-plus"></i></button>';
  380. str += '<button type="button" class="registration-no-color-foot-button" title="诊断查询" onclick="diagnoseQuery(\'' + row.patientId + '\',' + row.times + ')"><i class="fa fa-search-minus"></i></button>';
  381. var payMarkGroup = getIndex("pay_mark_group");
  382. if (payMarkGroup == 0) {
  383. if (row.countYbZf!=null && row.countYbZf==1) {
  384. str += '<button type="button" class="registration-no-color-foot-button"title="医保读卡" onclick="mztczfSiReadCardTypeModel()"><i class="fa fa-newspaper-o"></i></button>';
  385. str += '<button type="button" class="registration-no-color-foot-button"title="医保结算" onclick="directRegistration(\'' + row.patientId + '\',' + row.times + ')"><i class="fa fa-credit-card"></i></button>';
  386. }
  387. str += '<button type="button" class="registration-no-color-foot-button"title="确认收费" onclick="tipHaveTally(' + row.amount + ',\'' + row.patientId + '\',' + row.times + ',\'' + row.name + '\',' + row.receiptNo + ')"><i class="fa fa-rmb"></i></button>';
  388. return str;
  389. }
  390. if (payMarkGroup == 1) {
  391. // str += '<button type="button" class="registration-no-color-foot-button" title="修改收款方式" onclick="showChequType(\'' + row.patientId + '\','+row.times+','+row.receiptNo+')"><i class="fa fa-credit-card"></i></button>' ;
  392. str += '<button type="button" class="registration-no-color-foot-button" title="退费" onclick="refundFee(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ',' + row.printFlag + ');"><i class="fa fa-reply"></i></button>';
  393. if (row.printFlag == 0) {
  394. str += '<button type="button" id="button_' + row.realNo + '" class="registration-no-color-foot-button" title="发票打印" onclick="prn1PrintHand(\'' + row.patientId + '\',' + row.times + ',true,' + row.receiptNo + ',' + row.realNo + ');" style="color: #35D082;"><i class="fa fa-print"></i></button>';
  395. } else if (row.printFlag == 1) {
  396. str += '<button type="button" class="registration-no-color-foot-button" title="发票重打" onclick="repPrint(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ');" style="color: #F4BD00;"><i class="fa fa-print"></i></button>';
  397. str += '<button type="button" class="registration-no-color-foot-button" title="发票作废重打" onclick="obsoleteAndRepPrint(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ');" style="color: #E73E48;"><i class="fa fa-print"></i></button>';
  398. }
  399. //是否有权限设置合同编号
  400. var buttonCodes = localStorage.getItem("buttonCodes");
  401. if (buttonCodes != null) {
  402. if (isInArrayStr("contract_match", buttonCodes)) {
  403. str += '<button type="button" class="registration-no-color-foot-button" title="合作项目维护" onclick="matchProject(\'' + row.realNo + '\');"><i class="fa fa-plug"></i></button>';
  404. }
  405. }
  406. if (row.countYbZf > 0) {
  407. str += '<button type="button" class="registration-no-color-foot-button" title="打印医保结算单" onclick="printYbjsd(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ');"><i class="fa fa-file-word-o"></i></button>';
  408. }
  409. return str;
  410. }
  411. if (payMarkGroup == 2) {
  412. // str += '<button type="button" class="registration-no-color-foot-button" title="修改收款方式" onclick="showChequType(\'' + row.patientId + '\','+row.times+','+row.receiptNo+')"><i class="fa fa-credit-card"></i></button>' ;
  413. return str;
  414. }
  415. }
  416. }
  417. ],
  418. responseHandler: function (res) {
  419. if (res == '401' || res == 401) {
  420. window.location.href = '/thmz/login/view'
  421. return;
  422. }
  423. var ress = eval(res);
  424. if (ress.code == -1) {
  425. if (ress.message != null && ress.message != '') {
  426. new PNotify({
  427. title: '错误提示',
  428. text: ress.message,
  429. type: 'error',
  430. hide: true,
  431. styling: 'bootstrap3'
  432. });
  433. }
  434. return {
  435. "total": 0,//总页数
  436. "rows": {} //数据
  437. };
  438. }
  439. // if(ress.pageViewVo.total==0){
  440. // $("#cardNo").val(null);
  441. // $("#name").val(null);
  442. // }
  443. return {
  444. "total": ress.pageViewVo.total,//总页数
  445. "rows": ress.pageViewVo.data //数据
  446. };
  447. },
  448. /**
  449. * @param {点击列的 field 名称} field
  450. * @param {点击列的 value 值} value
  451. * @param {点击列的整行数据} row
  452. * @param {td 元素} $element
  453. */
  454. onClickCell: function (field, value, row, $element) {
  455. var cardNo = $("#cardNo").val();
  456. if (cardNo == '120' && field == 'name' && (payMarkGroup == 0 || payMarkGroup == 1)) {
  457. $element.attr('contenteditable', true);
  458. $element.html(null);
  459. $element.focus();
  460. $element.blur(function () {
  461. var index = $element.parent().data('index');
  462. var tdValue = $element.html();
  463. saveData(index, field, tdValue, row, $table_1);
  464. })
  465. }
  466. },
  467. });
  468. }
  469. /**
  470. * 更新病人缴费记录病人姓名
  471. * @param index
  472. * @param field
  473. * @param value
  474. * @param row
  475. */
  476. function saveData(index, field, value, row, table) {
  477. $.ajax({
  478. type: "POST",
  479. url: '/thmz/changePatientIdName',
  480. contentType: "application/json;charset=UTF-8",
  481. dataType: "json",
  482. data: JSON.stringify({"patientId": row.patientId, "times": row.times, "name": value}),
  483. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  484. async: false,
  485. success: function (res) {
  486. if (res == '401' || res == 401) {
  487. window.location.href = '/thmz/login/view'
  488. return;
  489. }
  490. if (res.code == 0) {
  491. table.bootstrapTable('updateCell', {
  492. index: index, //行索引
  493. field: field, //列名
  494. value: value //cell值
  495. })
  496. } else {
  497. table.bootstrapTable('updateCell', {
  498. index: index, //行索引
  499. field: field, //列名
  500. value: row.name //cell值
  501. })
  502. errorMesage(res);
  503. }
  504. }
  505. });
  506. }
  507. /**
  508. * 构建列表查询参数
  509. * @param params
  510. * @returns {{mzChargeDetail: {patientId: string | number | string[] | undefined | jQuery, warnDept: string | number | string[] | undefined | jQuery, doctorCode: string | number | string[] | undefined | jQuery, name: string | number | string[] | undefined | jQuery, payMark: number}, beginTime: Date, endTime: Date, pageSize: *, pageIndex: number}}
  511. */
  512. function queryParams(params) {
  513. var rePortRangeArr = getRePortRangeArr();
  514. var payMarkGroup = getIndex("pay_mark_group");
  515. var temp = {
  516. mzChargeDetail: {
  517. patientId: $("#patientId").val(),
  518. warnDept: $("#deptNoParam").val(),
  519. doctorCode: $("#doctorParam").val(),
  520. name: $("#name").val(),
  521. payMark: 5
  522. },
  523. beginTime: new Date(rePortRangeArr[0]),
  524. endTime: new Date(rePortRangeArr[1]),
  525. pageSize: params.limit, //页面大小
  526. pageIndex: params.offset / params.limit, //页码
  527. serialNo: $("#serialNo").val(),
  528. ownData: $('#ownData').is(':checked') ? 0 : 1,
  529. };
  530. if (payMarkGroup == 1) {
  531. temp.mzChargeDetail.payMark = 0;
  532. } else if (payMarkGroup == 2) {
  533. temp.mzChargeDetail.payMark = 1;
  534. }
  535. return temp;
  536. };
  537. function initChargeDetailTable() {
  538. initChargeDetailTablePublic('/thmz/getMzChargeDetailByBillItem', $('#charge_detail_table'), queryParamsForDetail);
  539. }
  540. function initMzChargeDetailByBillItem(flag) {
  541. if (flag) {
  542. $("#refund_bill_item_group").removeClass("hide").addClass("in");
  543. if ($("#plusOrMinus").hasClass("fa-plus")) {
  544. $("#plusOrMinus").removeClass("fa-plus").addClass("fa-minus");
  545. initChargeDetailTablePublic('/thmz/getNewListForRefundFeeByBillItem', $('#refund_fee_bill_table'), queryParamsForRefundByBillItem);
  546. } else if ($("#plusOrMinus").hasClass("fa-minus")) {
  547. $("#plusOrMinus").removeClass("fa-minus").addClass("fa-plus");
  548. $("#refund_bill_item_group").removeClass("in").addClass("hide");
  549. $('#refund_fee_bill_table').bootstrapTable("destroy");
  550. }
  551. } else {
  552. initChargeDetailTablePublic('/thmz/getNewListForRefundFeeByBillItem', $('#refund_fee_bill_table'), queryParamsForRefundByBillItem);
  553. }
  554. }
  555. /**
  556. * 初始化收费明细表格
  557. */
  558. function initChargeDetailTablePublic(url, obj, params) {
  559. $(obj).bootstrapTable("destroy");
  560. $(obj).bootstrapTable({
  561. url: url, //请求后台的URL(*)
  562. method: 'post', //请求方式(*)
  563. toolbar: '#toolbar', //工具按钮用哪个容器
  564. striped: true, //是否显示行间隔色
  565. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  566. pagination: true, //是否显示分页(*)
  567. sortable: true, //是否启用排序
  568. sortOrder: "asc", //排序方式
  569. // sortName: 'orderNo', //排序字段
  570. queryParams: params, //传递参数(*)
  571. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  572. pageNumber: 1, //初始化加载第一页,默认第一页
  573. pageSize: 5, //每页的记录行数(*)
  574. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  575. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  576. strictSearch: true,
  577. showColumns: false, //是否显示所有的列
  578. showRefresh: false, //是否显示刷新按钮
  579. minimumCountColumns: 2, //最少允许的列数
  580. clickToSelect: true, //是否启用点击选中行
  581. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  582. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  583. cardView: false, //是否显示详细视图
  584. detailView: false,
  585. //rowStyle:rowStyle,//通过自定义函数设置行样式
  586. ajaxOptions: {
  587. headers: {
  588. 'Accept': 'application/json',
  589. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  590. }
  591. },
  592. columns: [
  593. // {
  594. // checkbox: true
  595. // },
  596. {
  597. field: 'orderNo',
  598. title: '处方号',
  599. align: "center",
  600. valign: 'middle',
  601. formatter: function (value, row, index) {
  602. return Math.abs(value);
  603. }
  604. }, {
  605. field: 'chargeItemCode',
  606. title: '编码',
  607. align: "center",
  608. valign: 'middle',
  609. }, {
  610. field: 'tcName',
  611. title: '项目',
  612. align: "center",
  613. valign: 'middle',
  614. },
  615. // {
  616. // field: 'times',
  617. // title: '规格',
  618. // align: "center",
  619. // valign: 'middle',
  620. // },
  621. {
  622. field: 'quantity',
  623. title: '数量',
  624. align: "center",
  625. valign: 'middle'
  626. }, {
  627. field: 'drugWin',
  628. title: '副数',
  629. align: "center",
  630. valign: 'middle',
  631. }, {
  632. field: 'origPrice',
  633. title: '原单价(元)',
  634. align: "center",
  635. valign: 'middle',
  636. formatter: function (value, row, index) {
  637. if (value != undefined && value != null) {
  638. return value.toFixed(2);
  639. }
  640. }
  641. }, {
  642. field: 'unitPrice',
  643. title: '折后单价(元)',
  644. align: "center",
  645. valign: 'middle',
  646. formatter: function (value, row, index) {
  647. return value.toFixed(2);
  648. }
  649. }, {
  650. field: 'amount',
  651. title: '总金额(元)',
  652. align: "center",
  653. valign: 'middle',
  654. formatter: function (value, row, index) {
  655. return value.toFixed(2);
  656. }
  657. }
  658. ],
  659. responseHandler: function (res) {
  660. if (res == '401' || res == 401) {
  661. window.location.href = '/thmz/login/view'
  662. return;
  663. }
  664. var ress = eval(res);
  665. if (ress.code == -1) {
  666. new PNotify({
  667. title: '错误提示',
  668. text: ress.message,
  669. type: 'error',
  670. hide: true,
  671. styling: 'bootstrap3'
  672. });
  673. return {
  674. "total": 0,//总页数
  675. "rows": {} //数据
  676. };
  677. }
  678. return {
  679. //"total": ress.pageViewVo.total,//总页数
  680. "rows": ress.data //数据
  681. };
  682. },
  683. });
  684. }
  685. /**
  686. * 构建列表查询参数
  687. * @param params
  688. * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}}
  689. */
  690. function queryParamsForDetail(params) {
  691. var billItemGroup = getIndex("bill_item_group");
  692. var payMarkGroup = getIndex("pay_mark_group");
  693. var temp = {
  694. patientId: $("#patientIdChargeItem").val(),
  695. times: $("#timesChargeItem").val(),
  696. receiptNo: $("#receiptNoChargeItem").val(),
  697. billItemCode: billItemGroup,
  698. payMark: 5
  699. };
  700. if (payMarkGroup == 1) {
  701. temp.payMark = 0;
  702. } else if (payMarkGroup == 2) {
  703. temp.payMark = 1;
  704. }
  705. return temp;
  706. };
  707. /**
  708. * 构建列表查询参数
  709. * @param params
  710. * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}}
  711. */
  712. function queryParamsForRefundByBillItem(params) {
  713. var billItemGroup = getIndex("refund_bill_item_group");
  714. return {
  715. patientId: $("#patientIdRefund").val(),
  716. times: $("#timesRefund").val(),
  717. receiptNo: $("#receiptNoRefund").val(),
  718. chargeItemCodes: chargeItemCodes,
  719. billItemCode: billItemGroup
  720. };
  721. };
  722. /**
  723. * 卡号输入改变事件
  724. */
  725. function cardNoChange() {
  726. if (window.ActiveXObject || "ActiveXObject" in window) {
  727. $("#cardNo").on('input propertychange', function () {
  728. queryUserInfoByCardNo();
  729. });
  730. } else {
  731. $("#cardNo").on('input οninput', function () {
  732. queryUserInfoByCardNo();
  733. });
  734. }
  735. }
  736. /**
  737. * 卡号有变化后查询病人信息
  738. */
  739. function queryUserInfoByCardNo() {
  740. var cardNo = $("#cardNo").val();
  741. var index = cardNo.indexOf("-");
  742. if (index > 0 && index == cardNo.length - 2) {
  743. $("#patientId").val(cardNo);
  744. initFeeTable();
  745. } else if (cardNo == '120' || cardNo.length == 8) {
  746. $("#cardNo").attr("title", cardNo);
  747. $.ajax({
  748. type: "GET",
  749. url: '/thmz/getByIcCardNo?icCardNo=' + cardNo,
  750. contentType: "application/json;charset=UTF-8",
  751. dataType: "json",
  752. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  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. if (res.data != null) {
  760. $("#patientId").val(res.data.patientId);
  761. initFeeTable();
  762. }
  763. } else {
  764. new PNotify({
  765. title: '错误提示',
  766. text: res.message,
  767. type: 'error',
  768. hide: true,
  769. styling: 'bootstrap3'
  770. });
  771. }
  772. }
  773. });
  774. } else if (cardNo == null || cardNo == "") {
  775. cleanParams();
  776. }
  777. }
  778. /**
  779. * 获取按钮组选择的下标
  780. * @param id
  781. * @returns {number}
  782. */
  783. function getIndex(id) {
  784. var index = 0;
  785. var item = $("#" + id).find("button");
  786. for (var i = 0; i <= item.length; i++) {
  787. if ($(item[i]).hasClass("btn-primary")) {
  788. index = i;
  789. break;
  790. }
  791. }
  792. return index;
  793. }
  794. /**
  795. * 获取时间选择器的时间数组
  796. * @returns {string[]}
  797. */
  798. function getRePortRangeArr() {
  799. var rePortRange = $('#reportrange span').html();
  800. var rePortRangeArr = rePortRange.split(" - ");
  801. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  802. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  803. return rePortRangeArr;
  804. }
  805. /**
  806. * 打开收费窗口
  807. */
  808. function confirmFeeModal(times, totalCharge, receiptNo) {
  809. var buttonCodes = localStorage.getItem("buttonCodes");
  810. if (buttonCodes != null) {
  811. if (isInArrayStr("contract_match", buttonCodes)) {
  812. $("#projectDiv").removeClass("hide").addClass("in");
  813. } else {
  814. $("#projectDiv").removeClass("in").addClass("hide");
  815. }
  816. } else {
  817. $("#projectDiv").removeClass("in").addClass("hide");
  818. }
  819. var payTypeList = $("#payType").children();
  820. if (payTypeList.length == 1) {
  821. $('#payType').selectpicker('val', 'Y');
  822. } else {
  823. $('#payType').selectpicker('val', 1);
  824. }
  825. $('#payType').selectpicker('refresh');
  826. var data = parseFloat($("#dataIdHaveTally").val());
  827. if (totalCharge != null && totalCharge > 0) {
  828. data = totalCharge;
  829. $("#timesHaveTally").val(times);
  830. $("#receiptNoHaveTally").val(receiptNo);
  831. }
  832. var prevAll = $("#changeAmountParent").prevAll();
  833. while (prevAll.length > 2) {
  834. $("#changeAmountParent").prev().remove();
  835. prevAll = $("#changeAmountParent").prevAll();
  836. }
  837. // $("#realMoney").val($("#amountMoneyConfirm").text());
  838. // $("#cash").val($("#amountMoneyConfirm").text());
  839. $("#tallyDetailModal").modal('hide');
  840. $("#haveTallyModal").modal('hide');
  841. $("#confirmFeeModal").modal();
  842. $("#amountMoneyConfirm").text(data);
  843. //医保报销金额
  844. var fundPay = $("#fundPay").val();
  845. //个人账户支付金额
  846. var acctPay = $("#acctPay").val();
  847. //医保卡类型
  848. var cardType = $("#cardType").val();
  849. var payTypeIndex = 0;
  850. if (fundPay > 0) {
  851. var payTypeId = "payType_" + payTypeIndex++;
  852. addPayType(payTypeId);
  853. $('#' + payTypeId).selectpicker('val', 2);
  854. $('#' + payTypeId).selectpicker('refresh');
  855. $('#' + payTypeId).parent().parent().next().children(':first').val(fundPay);
  856. $('#' + payTypeId).parent().parent().next().next().children(':first').remove();
  857. $('#' + payTypeId).attr("disabled", true);
  858. $('#' + payTypeId).parent().parent().next().children(':first').attr("readonly", "readonly");
  859. //payTypeIndex++;
  860. }
  861. if (acctPay > 0) {
  862. var payTypeId = "payType_" + payTypeIndex++;
  863. addPayType(payTypeId);
  864. // var ybkType = 'T';
  865. // if (cardType != null && (cardType == 2 || cardType == "2")) {
  866. // ybkType = 'P';
  867. // }
  868. $('#' + payTypeId).selectpicker('val', cardType);
  869. $('#' + payTypeId).selectpicker('refresh');
  870. $('#' + payTypeId).parent().parent().next().children(':first').val(acctPay);
  871. $('#' + payTypeId).parent().parent().next().next().children(':first').remove();
  872. $('#' + payTypeId).attr("disabled", true);
  873. $('#' + payTypeId).parent().parent().next().children(':first').attr("readonly", "readonly");
  874. }
  875. $("#payTypeIndex").val(payTypeIndex);
  876. //总金额减医保报销
  877. var realMoney = Minus(data, fundPay);
  878. //减完医保报销后减个人医保卡支付金额
  879. realMoney = Minus(realMoney, acctPay);
  880. $("#realMoney").val(data);
  881. $("#cash").val(realMoney);
  882. // $("#cash").val(null);
  883. setTimeout(function () {
  884. //默认光标在现金输入框
  885. $("#cash").focus();
  886. }, 800);
  887. if (payTypeList.length == 1) {
  888. $('#payType').selectpicker('val', 'Y');
  889. } else {
  890. $('#payType').selectpicker('val', 1);
  891. }
  892. $("#changeAmount").val(0.0);
  893. $("#surplusAmount").val(0.0);
  894. sendPriceMessage(realMoney, 0, 0, $("#patientIdHaveTally").val());
  895. }
  896. /**
  897. * 打开收费明细窗口
  898. * @param data
  899. */
  900. function chargeDetailModal(patientId, times, receiptNo) {
  901. $("#patientIdChargeItem").val(patientId);
  902. $("#timesChargeItem").val(times);
  903. $("#receiptNoChargeItem").val(receiptNo);
  904. $("#chargeDetailModal").modal();
  905. initChargeDetailTable();
  906. }
  907. /**
  908. * 病人当前就诊次数的诊断查询
  909. * @param data
  910. */
  911. function diagnoseQuery(patientId, times) {
  912. $.ajax({
  913. type: "POST",
  914. url: '/thmz/getVisitTableByPatientIdAndTimes',
  915. contentType: "application/json;charset=UTF-8",
  916. dataType: "json",
  917. data: JSON.stringify({"patientId": patientId, "times": times}),
  918. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  919. async: false,
  920. success: function (res) {
  921. if (res == '401' || res == 401) {
  922. window.location.href = '/thmz/login/view'
  923. return;
  924. }
  925. if (res.code == 0) {
  926. if (res.data.icdText != null || res.data.icdText != '') {
  927. $("#diagnoseModal").modal();
  928. $("#diagnose").html(res.data.icdText);
  929. } else {
  930. new PNotify({
  931. title: '操作提示',
  932. text: '当前病人诊断未知',
  933. type: 'warn',
  934. styling: 'bootstrap3'
  935. });
  936. }
  937. } else {
  938. errorMesage(res);
  939. }
  940. }
  941. });
  942. }
  943. // /**
  944. // * 打开退费重收明细窗口
  945. // * @param data
  946. // */
  947. // function chargeRefundDetailModal(patientId, times) {
  948. // // $("#patientIdChargeItem").val(patientId);
  949. // // $("#timesChargeItem").val(times);
  950. // initMzChargeDetailByBillItem();
  951. // }
  952. /**
  953. * 初始门诊收银方式下拉选
  954. */
  955. function initChequeType(payType) {
  956. $.ajax({
  957. type: "GET",
  958. url: '/thmz/getAllZdChequeTypeForMz',
  959. dataType: "json",
  960. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  961. async: false,
  962. success: function (res) {
  963. if (res == '401' || res == 401) {
  964. window.location.href = '/thmz/login/view'
  965. return;
  966. }
  967. var html = '';
  968. $.each(res.data, function (commentIndex, comment) {
  969. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  970. });
  971. $('#' + payType).empty();
  972. $('#' + payType).html(html);
  973. $('#' + payType).selectpicker('refresh');
  974. if (res.data.length == 1) {
  975. $('#' + payType).selectpicker('val', 'Y');
  976. } else {
  977. $('#' + payType).selectpicker('val', 1);
  978. }
  979. $('#' + payType).selectpicker('refresh');
  980. }
  981. });
  982. }
  983. /**
  984. * 关闭当前这个付款方式
  985. */
  986. function closeThisParent(obj) {
  987. $(obj).parent().parent().parent().remove();
  988. checkFee(false);
  989. }
  990. /**
  991. * 校验收款金额
  992. * @param flag 是否是提交时候的校验,是的话,如果缴费金额不够,需要返回 false
  993. */
  994. function checkFee(flag) {
  995. var realMoney = parseFloat($("#realMoney").val());
  996. realMoney = realMoney.toFixed(2);
  997. $("#realMoney").val(realMoney);
  998. var arr = $("#payForm").find("div.pay-item");
  999. if (arr.length > 0) {
  1000. //非现金收款总金额
  1001. var notCashAmount = 0;
  1002. //现金收款总额
  1003. var cashAmount = 0;
  1004. for (var i = 0; i < arr.length; i++) {
  1005. var temp = parseFloat($(arr[i]).find("input").val());
  1006. if (isNaN(temp)) {
  1007. temp = 0;
  1008. }
  1009. if ($(arr[i]).find("select").val() != 1) {
  1010. notCashAmount = Add(notCashAmount, temp);
  1011. } else {
  1012. cashAmount = Add(cashAmount, temp);
  1013. }
  1014. for (var j = 0; j < arr.length; j++) {
  1015. if ($(arr[i]).find("select").val() == $(arr[j]).find("select").val() && i != j) {
  1016. new PNotify({
  1017. title: '错误提示',
  1018. text: "已经存在相同的收款方式,请不要重复添加!",
  1019. type: 'error',
  1020. hide: true,
  1021. styling: 'bootstrap3'
  1022. });
  1023. return;
  1024. }
  1025. }
  1026. }
  1027. // if (notCashAmount > realMoney) {
  1028. // new PNotify({
  1029. // title: '错误提示',
  1030. // text: "非现金收款金额不能大于实收金额!",
  1031. // type: 'error',
  1032. // hide: true,
  1033. // styling: 'bootstrap3'
  1034. // });
  1035. // $("#addPayType").parent().removeClass("in").addClass("hide");
  1036. // return;
  1037. // }
  1038. var totalAmount = Add(cashAmount, notCashAmount);
  1039. $("#surplusAmount").val(0.0);
  1040. if (totalAmount < realMoney) {
  1041. if (flag) {
  1042. new PNotify({
  1043. title: '错误提示',
  1044. text: "收款金额不能少于实收金额,请调整收款金额或者增加收款方式!",
  1045. type: 'error',
  1046. hide: true,
  1047. styling: 'bootstrap3'
  1048. });
  1049. return false;
  1050. }
  1051. if (totalAmount == 0) {
  1052. $("#addPayType").parent().removeClass("in").addClass("hide");
  1053. } else {
  1054. $("#addPayType").parent().removeClass("hide").addClass("in");
  1055. }
  1056. $("#changeAmount").val(0.00);
  1057. var surplusAmount = Minus(realMoney, totalAmount);
  1058. $("#surplusAmount").val(surplusAmount);
  1059. return;
  1060. }
  1061. var changeAmount = 0.00;
  1062. if (totalAmount >= realMoney) {
  1063. changeAmount = Minus(totalAmount, realMoney);
  1064. //changeAmount = changeAmount.toFixed(2);
  1065. $("#changeAmount").val(changeAmount);
  1066. $("#addPayType").parent().removeClass("in").addClass("hide");
  1067. if (!flag) {
  1068. sendPriceMessage(realMoney, totalAmount, changeAmount, $("#patientIdHaveTally").val());
  1069. }
  1070. }
  1071. //设置收费首页找零与应收和实收金额
  1072. $("#payableAmount").text(realMoney);
  1073. $("#paidAmount").text(totalAmount);
  1074. $("#changedAmount").text(changeAmount);
  1075. }
  1076. //计算和设置折扣比例
  1077. var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());
  1078. var discount = 100;
  1079. if (realMoney < amountMoneyConfirm) {
  1080. discount = Division(realMoney, Multiply(amountMoneyConfirm, 100));
  1081. }
  1082. $("#discount").text(discount.toFixed(2))
  1083. return true;
  1084. }
  1085. /**
  1086. * 提示有记账记录
  1087. */
  1088. function tipHaveTally(data, patientId, times, name, receiptNo) {
  1089. closeConfirmFeeModal();
  1090. if (patientId == null || patientId == "") {
  1091. return;
  1092. }
  1093. $("#patientIdHaveTally").val(patientId);
  1094. $("#nameHaveTally").val(name);
  1095. $("#dataIdHaveTally").val(data);
  1096. $("#timesHaveTally").val(times);
  1097. $("#receiptNoHaveTally").val(receiptNo);
  1098. $.ajax({
  1099. type: "POST",
  1100. url: '/thmz/getTmFee',
  1101. contentType: "application/json;charset=UTF-8",
  1102. dataType: "json",
  1103. data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
  1104. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1105. async: false,
  1106. success: function (res) {
  1107. if (res == '401' || res == 401) {
  1108. window.location.href = '/thmz/login/view'
  1109. return;
  1110. }
  1111. if (res.code == 0) {
  1112. if (res.data != undefined && res.data != null) {
  1113. $("#fundPay").val(res.data.fundPay);
  1114. $("#acctPay").val(res.data.acctPay);
  1115. $("#cardType").val(res.data.ybkType);
  1116. //$("#realMoney").val(res.data.selfPay);
  1117. } else {
  1118. $("#fundPay").val(0.0);
  1119. $("#acctPay").val(0.0);
  1120. $("#cardType").val(null);
  1121. }
  1122. } else {
  1123. errorMesage(res);
  1124. }
  1125. $("#saveConfirmFee").attr("disabled", false);
  1126. }
  1127. });
  1128. confirmFeeModal(null, null, null);
  1129. }
  1130. var $tally_detail_table;
  1131. /**
  1132. * 初始化本院记账明细表格
  1133. */
  1134. function initTallyDetailTable() {
  1135. $("#haveTallyModal").modal('hide');
  1136. var patientId = $("#patientIdHaveTally").val();
  1137. // var name = $("#nameHaveTally").val();
  1138. if (patientId == null || patientId == '') {
  1139. return;
  1140. }
  1141. $("#tallyDetailModal").modal();
  1142. $('#tally_detail_table').bootstrapTable("destroy");
  1143. $tally_detail_table = $('#tally_detail_table').bootstrapTable({
  1144. url: '/thmz/getTallyReceiptSerial?patientId=' + patientId, //请求后台的URL(*)
  1145. method: 'get', //请求方式(*)
  1146. toolbar: '#toolbar', //工具按钮用哪个容器
  1147. striped: true, //是否显示行间隔色
  1148. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1149. pagination: false, //是否显示分页(*)
  1150. sortable: true, //是否启用排序
  1151. sortOrder: "asc", //排序方式
  1152. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  1153. pageNumber: 1, //初始化加载第一页,默认第一页
  1154. pageSize: 10, //每页的记录行数(*)
  1155. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  1156. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1157. strictSearch: true,
  1158. showColumns: false, //是否显示所有的列
  1159. showRefresh: false, //是否显示刷新按钮
  1160. minimumCountColumns: 2, //最少允许的列数
  1161. clickToSelect: true, //是否启用点击选中行
  1162. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1163. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1164. cardView: false, //是否显示详细视图
  1165. detailView: false,
  1166. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1167. ajaxOptions: {
  1168. headers: {
  1169. 'Accept': 'application/json',
  1170. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1171. }
  1172. },
  1173. columns: [
  1174. // {
  1175. // checkbox: true,
  1176. // },
  1177. {
  1178. field: 'patientId',
  1179. title: '病人编号',
  1180. align: "center",
  1181. valign: 'middle'
  1182. }, {
  1183. field: 'name',
  1184. title: '病人姓名',
  1185. align: "center",
  1186. valign: 'middle',
  1187. // formatter: function (value, row, index) {
  1188. // return name;
  1189. // }
  1190. }, {
  1191. field: 'times',
  1192. title: '就诊次数',
  1193. align: "center",
  1194. valign: 'middle',
  1195. },
  1196. {
  1197. field: 'totalCharge',
  1198. title: '总费用(元)',
  1199. align: "center",
  1200. valign: 'middle',
  1201. formatter: function (value, row, index) {
  1202. return value.toFixed(2);
  1203. }
  1204. },
  1205. {
  1206. field: 'chargeDate',
  1207. title: '记账时间',
  1208. align: "center",
  1209. valign: 'middle',
  1210. formatter: function (value, row, index) {
  1211. return format(value, "yyyy-MM-dd HH:mm:ss");
  1212. }
  1213. }
  1214. // , {
  1215. // title: '操作',
  1216. // align: "center",
  1217. // valign: 'middle',
  1218. // // sortable: true,
  1219. // formatter: function (value, row, index) {
  1220. // var str = '<button type="button" class="registration-no-color-foot-button" title="同步费用明细" onclick="reInsertDetailModal(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-exchange"></i></button>';
  1221. // return str;
  1222. // }
  1223. // }
  1224. ],
  1225. /**
  1226. * @param {点击列的 field 名称} field
  1227. * @param {点击列的 value 值} value
  1228. * @param {点击列的整行数据} row
  1229. * @param {td 元素} $element
  1230. */
  1231. onClickCell: function (field, value, row, $element) {
  1232. var cardNo = $("#cardNo").val();
  1233. if (cardNo == '120' && field == 'name') {
  1234. $element.attr('contenteditable', true);
  1235. $element.html(null);
  1236. $element.focus();
  1237. $element.blur(function () {
  1238. var index = $element.parent().data('index');
  1239. var tdValue = $element.html();
  1240. saveData(index, field, tdValue, row, $tally_detail_table);
  1241. })
  1242. }
  1243. },
  1244. onDblClickRow: function (row) {
  1245. confirmFeeModal(row.times, row.totalCharge, row.receiptNo);
  1246. },
  1247. responseHandler: function (res) {
  1248. if (res == '401' || res == 401) {
  1249. window.location.href = '/thmz/login/view'
  1250. return;
  1251. }
  1252. var ress = eval(res);
  1253. if (ress.code == -1) {
  1254. errorMesage(ress);
  1255. return {
  1256. "total": 0,//总页数
  1257. "rows": {} //数据
  1258. };
  1259. }
  1260. if (ress.data == null || ress.data.length == 0) {
  1261. $("#tallyDetailModal").modal("hide");
  1262. }
  1263. return {
  1264. "rows": ress.data //数据
  1265. };
  1266. },
  1267. });
  1268. }
  1269. /**
  1270. * 提交缴费申请
  1271. */
  1272. function saveConfirmFee() {
  1273. $("#saveConfirmFee").attr("disabled", true);
  1274. if (!checkFee(true)) {
  1275. $("#saveConfirmFee").attr("disabled", false);
  1276. return;
  1277. }
  1278. var project = $("#project").val();
  1279. var jsonData = JSON.parse('{"patientId":"","times":"","receiptNo":"","mzDepositFiles":[]}');
  1280. var patientId = $("#patientIdHaveTally").val();
  1281. var times = $("#timesHaveTally").val();
  1282. var receiptNo = $("#receiptNoHaveTally").val();
  1283. jsonData.patientId = patientId;
  1284. jsonData.times = times;
  1285. jsonData.receiptNo = receiptNo;
  1286. var arr = $("#payForm").find("div.pay-item");
  1287. if (arr.length > 0) {
  1288. for (var i = 0; i < arr.length; i++) {
  1289. var temp = parseFloat($(arr[i]).find("input").val());
  1290. if (temp == null || temp == 0) {
  1291. continue;
  1292. }
  1293. var tempJson = JSON.parse('{"chequeType":"","amount":"","contractId":""}');
  1294. tempJson.chequeType = $(arr[i]).find("select").val();
  1295. //现金有可能会多收,比入实收37,对方给了100,需要找零63. 所以必须减去找零金额,才是实收金额
  1296. if (tempJson.chequeType == "1") {
  1297. temp = temp - $("#changeAmount").val();
  1298. temp = temp.toFixed(2);
  1299. }
  1300. if (project != null && project != "null" && project != "") {
  1301. tempJson.contractId = project;
  1302. }
  1303. tempJson.amount = temp;
  1304. jsonData.mzDepositFiles[jsonData.mzDepositFiles.length] = tempJson;
  1305. }
  1306. }
  1307. $.ajax({
  1308. type: "POST",
  1309. url: '/thmz/chargeFee',
  1310. contentType: "application/json;charset=UTF-8",
  1311. dataType: "json",
  1312. data: JSON.stringify(jsonData),
  1313. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1314. success: function (res) {
  1315. if (res == '401' || res == 401) {
  1316. window.location.href = '/thmz/login/view'
  1317. return;
  1318. }
  1319. if (res.code == 0) {
  1320. prn1Print(patientId, times, true, res.receiptNo);
  1321. successMesage(res);
  1322. closeConfirmFeeModal();
  1323. //缴费成功后清空全局参数
  1324. patientIdFullForNucleicAcid = null;
  1325. initFeeTable();
  1326. //默认光标在卡号输入框
  1327. $("#cardNo").focus();
  1328. toEvaluation(patientId);
  1329. } else {
  1330. errorMesage(res);
  1331. }
  1332. $("#saveConfirmFee").attr("disabled", false);
  1333. }
  1334. });
  1335. }
  1336. /**
  1337. * 关闭收费确认模态弹框
  1338. */
  1339. function closeConfirmFeeModal() {
  1340. $("#confirmFeeModal").modal("hide");
  1341. $("#patientId").val(null);
  1342. $("#cardNo").val(null);
  1343. $("#name").val(null);
  1344. $("#fundPay").val(0);
  1345. $("#acctPay").val(0);
  1346. $("#cardType").val(null);
  1347. }
  1348. /**
  1349. * 保存合作项目
  1350. */
  1351. function saveProject() {
  1352. var projectRealNo = $("#projectRealNo").val();
  1353. var projectCharged = $("#projectCharged").val();
  1354. $.ajax({
  1355. type: "GET",
  1356. url: '/thmz/setMzDepositFileSetContractId?contractId=' + projectCharged + '&serialNo=' + projectRealNo,
  1357. contentType: "application/json;charset=UTF-8",
  1358. dataType: "json",
  1359. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1360. success: function (res) {
  1361. if (res == '401' || res == 401) {
  1362. window.location.href = '/thmz/login/view'
  1363. return;
  1364. }
  1365. if (res.code == 0) {
  1366. successMesage(res);
  1367. $("#projectRealNo").val(null);
  1368. $('#projectCharged').selectpicker('val', null);
  1369. $('#projectCharged').selectpicker('refresh');
  1370. $("#projectModal").modal("hide");
  1371. } else {
  1372. errorMesage(res);
  1373. }
  1374. $("#saveConfirmFee").attr("disabled", false);
  1375. }
  1376. });
  1377. }
  1378. /**
  1379. * 直接打印发票
  1380. * @param patientId
  1381. * @param times
  1382. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  1383. */
  1384. function prn1PrintHand(patientId, times, chargeFeeFlag, receiptNo, realNo) {
  1385. $("#button_" + realNo).css("display", "none");
  1386. prn1Print(patientId, times, chargeFeeFlag, receiptNo);
  1387. }
  1388. /**
  1389. * 直接打印发票
  1390. * @param patientId
  1391. * @param times
  1392. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  1393. */
  1394. function prn1Print(patientId, times, chargeFeeFlag, receiptNo) {
  1395. var url = '/thmz/getAllSerialForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo;
  1396. printCommon(url, patientId, times, chargeFeeFlag);
  1397. }
  1398. /**
  1399. * 重打发票
  1400. * @param patientId
  1401. * @param times
  1402. */
  1403. function repPrint(patientId, times, receiptNo) {
  1404. $.ajax({
  1405. type: "GET",
  1406. url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
  1407. contentType: "application/json;charset=UTF-8",
  1408. dataType: "json",
  1409. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1410. success: function (res) {
  1411. if (res == '401' || res == 401) {
  1412. window.location.href = '/thmz/login/view'
  1413. return;
  1414. }
  1415. if (res.code == 0) {
  1416. if (res.data.length == 1) {
  1417. var message = "确定要重新打印发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认发票打印机即将要打印的发票编号";
  1418. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0&receiptBill=" + res.data[0].receiptBill;
  1419. confirmMessage(patientId, times, message, url);
  1420. } else {
  1421. $("#tip_message").text("请选择需要重新打印的发票号");
  1422. $("#repPrintModal").modal();
  1423. $("#repPrintTable").html(null);
  1424. for (var i = 0; i < res.data.length; i++) {
  1425. $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
  1426. $("#repPrintModal").modal("hide");
  1427. var message = "确定要重新打印发票号码为【" + $(this).text() + "】的发票吗?请确认发票打印机即将要打印的发票编号";
  1428. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0&receiptBill=" + $(this).text();
  1429. confirmMessage(patientId, times, message, url);
  1430. });
  1431. }
  1432. }
  1433. }
  1434. }
  1435. });
  1436. }
  1437. /**
  1438. * 发票重打提示
  1439. * @param patientId
  1440. * @param times
  1441. * @param name
  1442. */
  1443. function confirmMessage(patientId, times, message, url) {
  1444. if (!confirm(message)) {
  1445. return;
  1446. }
  1447. //var url='/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0" + "&receiptBill="+receiptBill;
  1448. printCommon(url, patientId, times, true);
  1449. }
  1450. /**
  1451. * 作废重打发票
  1452. * @param patientId
  1453. * @param times
  1454. */
  1455. function obsoleteAndRepPrint(patientId, times, receiptNo) {
  1456. $.ajax({
  1457. type: "GET",
  1458. url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
  1459. contentType: "application/json;charset=UTF-8",
  1460. dataType: "json",
  1461. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1462. success: function (res) {
  1463. if (res == '401' || res == 401) {
  1464. window.location.href = '/thmz/login/view'
  1465. return;
  1466. }
  1467. if (res.code == 0) {
  1468. if (res.data.length == 1) {
  1469. var message = "确定要作废发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认需要作废发票编号";
  1470. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1&receiptBill=" + res.data[0].receiptBill;
  1471. confirmMessage(patientId, times, message, url);
  1472. } else {
  1473. $("#tip_message").text("请选择需要作废的发票号");
  1474. $("#repPrintModal").modal();
  1475. $("#repPrintTable").html(null);
  1476. for (var i = 0; i < res.data.length; i++) {
  1477. $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
  1478. $("#repPrintModal").modal("hide");
  1479. var message = "确定要作废发票号码为【" + $(this).text() + "】的发票吗?请确认需要作废发票编号";
  1480. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1&receiptBill=" + $(this).text();
  1481. confirmMessage(patientId, times, message, url);
  1482. });
  1483. }
  1484. }
  1485. }
  1486. }
  1487. });
  1488. }
  1489. /**
  1490. * 打印医保结算单
  1491. * @param patientId
  1492. * @param times
  1493. * @param receiptNo
  1494. */
  1495. function printYbjsd(patientId, times, receiptNo) {
  1496. if (mzjsdHost == null) {
  1497. errorMesageSimaple("医保结算单域名为空,操作失败!");
  1498. return;
  1499. }
  1500. const iframeEle = document.getElementById('ybjsdDiv');
  1501. const loadingEle = document.getElementById('loading');
  1502. //设置ififrame透明
  1503. iframeEle.style.opacity = 0;
  1504. loadingEle.style.display = 'block';
  1505. var url = mzjsdHost + "/siSettleDetailList/" + patientId + "/" + times;
  1506. $("#ybjsdDiv").attr("src", url);
  1507. iframeEle.addEventListener('load', function () {
  1508. // Hide the loading indicator
  1509. loadingEle.style.display = 'none';
  1510. // Bring the iframe back
  1511. iframeEle.style.opacity = 1;
  1512. });
  1513. $("#ybjsdModal").modal();
  1514. }
  1515. /**
  1516. * 匹配合作项目
  1517. * @param realNo
  1518. */
  1519. function matchProject(realNo) {
  1520. $("#projectRealNo").val(realNo);
  1521. $("#projectModal").modal();
  1522. $.ajax({
  1523. type: "GET",
  1524. url: '/thmz/getMzDepositFileContractId?serialNo=' + realNo,
  1525. contentType: "application/json;charset=UTF-8",
  1526. dataType: "json",
  1527. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1528. success: function (res) {
  1529. if (res == '401' || res == 401) {
  1530. window.location.href = '/thmz/login/view'
  1531. return;
  1532. }
  1533. if (res.code == 0) {
  1534. $('#projectCharged').selectpicker('val', res.data);
  1535. $('#projectCharged').selectpicker('refresh');
  1536. }
  1537. }
  1538. });
  1539. }
  1540. /**
  1541. * 打印发票通用方法
  1542. * @param patientId
  1543. * @param times
  1544. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  1545. */
  1546. function printCommon(url, patientId, times, chargeFeeFlag) {
  1547. setPrint();
  1548. var height = "93.15mm";
  1549. // if (countReceiot % 2 == 0) {
  1550. // height = "93.2mm";
  1551. // }
  1552. $.ajax({
  1553. type: "GET",
  1554. url: url,
  1555. contentType: "application/json;charset=UTF-8",
  1556. dataType: "json",
  1557. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1558. async: false,
  1559. success: function (res) {
  1560. if (res == '401' || res == 401) {
  1561. window.location.href = '/thmz/login/view'
  1562. return;
  1563. }
  1564. if (res.code == 0) {
  1565. if (res.data == null || res.data.length == 0) {
  1566. return;
  1567. }
  1568. // countReceiot++;
  1569. for (var i = 0; i < res.data.length; i++) {
  1570. LODOP = getLodop();
  1571. var temp = res.data[i].mzReceiptSerial;
  1572. LODOP.PRINT_INITA(6, 0, "120mm", height, "泰和门诊发票打印");
  1573. //设置默认打印机
  1574. LODOP.SET_PRINTER_INDEX(printIndex);
  1575. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");
  1576. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
  1577. LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
  1578. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
  1579. LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
  1580. LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", "湖南泰和医院管理有限公司");
  1581. LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "机制号:");
  1582. LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
  1583. LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);
  1584. LODOP.ADD_PRINT_TEXT("25mm", "7mm", "40mm", "3mm", res.mzPatientMi.name);
  1585. LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
  1586. var feeList = res.data[i].feeList;
  1587. if (feeList != null && feeList.length > 0) {
  1588. var top = 32;
  1589. var left = 6;
  1590. for (var j = 0; j < feeList.length; j++) {
  1591. var row = parseInt(j / 3);
  1592. var tempTop = top + row * 5;
  1593. var tempLeft = left;
  1594. if (j % 3 == 1) {
  1595. tempLeft = left + 30;
  1596. } else if (j % 3 == 2) {
  1597. tempLeft = left + 60;
  1598. }
  1599. LODOP.ADD_PRINT_TEXT(tempTop + "mm", tempLeft + "mm", "30mm", "3mm", feeList[j]);
  1600. }
  1601. }
  1602. // LODOP.ADD_PRINT_TEXT("32mm","25mm","25mm","3mm","诊查费 10.00");
  1603. // LODOP.ADD_PRINT_TEXT("32mm","50mm","25mm","3mm","中成药费30.10");
  1604. // LODOP.ADD_PRINT_TEXT("37mm","25mm","25mm","3mm","治疗费 22.00");
  1605. // LODOP.ADD_PRINT_TEXT("37mm","50mm","25mm","3mm","材料费 14.20");
  1606. // LODOP.ADD_PRINT_TEXT("42mm","25mm","25mm","3mm","西药费 161.20");
  1607. var qyxxs = res.data[i].qyxxs;
  1608. if (qyxxs != null && qyxxs.length > 0) {
  1609. var top = 54;
  1610. for (var j = 0; j < qyxxs.length; j++) {
  1611. var row = j / 3;
  1612. var tempTop = top + row * 10;
  1613. var qyxx = qyxxs[j];
  1614. var arr = qyxx.split(",");
  1615. LODOP.ADD_PRINT_TEXT(tempTop + "mm", "6mm", "50mm", "3mm", "取药窗口:" + arr[0]);
  1616. LODOP.ADD_PRINT_TEXT(tempTop + "mm", "61mm", "50mm", "3mm", "取药号码:" + arr[1]);
  1617. }
  1618. }
  1619. // LODOP.ADD_PRINT_TEXT("54mm","25mm","50mm","3mm","取药窗口:西药房4号窗口");
  1620. // LODOP.ADD_PRINT_TEXT("54mm","80mm","35mm","3mm","取药号码:408392");
  1621. var totalCharge=temp.totalCharge + " 元";
  1622. if(res.data[i].countYbZf>0){
  1623. totalCharge=totalCharge+"(不含门诊统筹)"
  1624. }
  1625. LODOP.ADD_PRINT_TEXT("65mm", "21mm", "65mm", "3mm", totalCharge);
  1626. LODOP.ADD_PRINT_TEXT("72mm", "19mm", "65mm", "3mm", res.data[i].totalChargeStr);
  1627. LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.data[i].year);//年
  1628. LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.data[i].month);//月
  1629. LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.data[i].day);//日
  1630. LODOP.ADD_PRINT_TEXT("79mm", "53mm", "50mm", "3mm", temp.operatorId);//收费员
  1631. LODOP.PRINT();
  1632. //LODOP.PREVIEW();
  1633. initFeeTable();
  1634. }
  1635. } else if (res.code == -1) {
  1636. //退费就退出,不提示异常
  1637. if (!chargeFeeFlag) {
  1638. return;
  1639. }
  1640. new PNotify({
  1641. title: '错误提示',
  1642. text: res.message,
  1643. type: 'error',
  1644. hide: true,
  1645. styling: 'bootstrap3'
  1646. });
  1647. }
  1648. }
  1649. });
  1650. }
  1651. //
  1652. // /**
  1653. // * 加载打印机列表
  1654. // * @constructor
  1655. // */
  1656. // function CreatePrinterList() {
  1657. // LODOP = getLodop();
  1658. // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
  1659. // //获取打印机设备数,用于进行遍历
  1660. // var count = LODOP.GET_PRINTER_COUNT();
  1661. // var html = "";
  1662. // for (var i = 0; i < count; i++) {
  1663. // //根据设备序号获取设备名
  1664. // var msg = LODOP.GET_PRINTER_NAME(i);
  1665. // html += "<option value='" + i + "'>" + msg + "</option>";
  1666. // }
  1667. // $('#printSelect').html(html);
  1668. // $('#printSelect').selectpicker('refresh');
  1669. // $.ajax({
  1670. // type: "GET",
  1671. // url: '/thmz/getLastWindowsByCurrentUser',
  1672. // contentType: "application/json;charset=UTF-8",
  1673. // dataType: "json",
  1674. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1675. // success: function (res) {
  1676. // if (res == '401' || res == 401) {
  1677. // window.location.href = '/thmz/login/view'
  1678. // return;
  1679. // }
  1680. // if (res.code == 0) {
  1681. // $('#printSelect').selectpicker('val', res.data.printIndex);
  1682. // $('#printSelect').selectpicker('refresh');
  1683. // printIndex=res.data.printIndex;
  1684. // }
  1685. // }
  1686. // });
  1687. // }
  1688. //
  1689. //
  1690. // /**
  1691. // * 保存窗口号
  1692. // */
  1693. // function saveWindows() {
  1694. // $.ajax({
  1695. // type: "POST",
  1696. // url: '/thmz/saveWindows',
  1697. // contentType: "application/json;charset=UTF-8",
  1698. // dataType: "json",
  1699. // data: JSON.stringify({"windowsNo": $("#windowsNum").val()}),
  1700. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1701. // success: function (res) {
  1702. // if (res == '401' || res == 401) {
  1703. // window.location.href = '/thmz/login/view'
  1704. // return;
  1705. // }
  1706. // $('#editWindowsModal').modal('hide');
  1707. // if (res.code == 0) {
  1708. // new PNotify({
  1709. // title: '操作提示',
  1710. // text: res.message,
  1711. // type: 'success',
  1712. // hide: true,
  1713. // styling: 'bootstrap3'
  1714. // });
  1715. // } else {
  1716. // new PNotify({
  1717. // title: '错误提示',
  1718. // text: res.message,
  1719. // type: 'error',
  1720. // hide: true,
  1721. // styling: 'bootstrap3'
  1722. // });
  1723. // }
  1724. // }
  1725. // });
  1726. // }
  1727. //
  1728. //
  1729. //
  1730. // /**
  1731. // * 保存打印机
  1732. // */
  1733. // function savePrint() {
  1734. // $.ajax({
  1735. // type: "POST",
  1736. // url: '/thmz/savePrintIndex',
  1737. // contentType: "application/json;charset=UTF-8",
  1738. // dataType: "json",
  1739. // data: JSON.stringify({"printIndex": $("#printSelect").val()}),
  1740. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1741. // success: function (res) {
  1742. // if (res == '401' || res == 401) {
  1743. // window.location.href = '/thmz/login/view'
  1744. // return;
  1745. // }
  1746. // LODOP = getLodop();
  1747. // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
  1748. // LODOP.SET_PRINTER_INDEX($("#printSelect").val());
  1749. // printIndex=$("#printSelect").val();
  1750. // $('#editPrintModal').modal('hide');
  1751. // if (res.code == 0) {
  1752. // new PNotify({
  1753. // title: '操作提示',
  1754. // text: res.message,
  1755. // type: 'success',
  1756. // hide: true,
  1757. // styling: 'bootstrap3'
  1758. // });
  1759. // } else {
  1760. // new PNotify({
  1761. // title: '错误提示',
  1762. // text: res.message,
  1763. // type: 'error',
  1764. // hide: true,
  1765. // styling: 'bootstrap3'
  1766. // });
  1767. // }
  1768. // }
  1769. // });
  1770. // }
  1771. /**
  1772. * 查询默认打印机
  1773. */
  1774. function setPrint() {
  1775. if (printIndex >= 0) {
  1776. return;
  1777. }
  1778. $.ajax({
  1779. type: "GET",
  1780. url: '/thmz/getLastWindowsByCurrentUser',
  1781. contentType: "application/json;charset=UTF-8",
  1782. dataType: "json",
  1783. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1784. async: false,
  1785. success: function (res) {
  1786. if (res == '401' || res == 401) {
  1787. window.location.href = '/thmz/login/view'
  1788. return;
  1789. }
  1790. if (res.code == 0) {
  1791. printIndex = res.data.printIndex;
  1792. } else {
  1793. printIndex = -1;
  1794. }
  1795. }
  1796. });
  1797. }
  1798. /**
  1799. * 退费操作
  1800. */
  1801. function refundFee(patientId, times, receiptNo, printFlag) {
  1802. if (printFlag == 0) {
  1803. new PNotify({
  1804. title: '错误提示',
  1805. text: '当前病人缴费记录发票还未打印,无法进行退费,请先打印该发票!',
  1806. type: 'error',
  1807. hide: true,
  1808. styling: 'bootstrap3'
  1809. });
  1810. return;
  1811. }
  1812. $("#refundFeePrepare").text(0.00);
  1813. $("#refundFeeDetailModal").modal();
  1814. $("#refund_bill_item_group").removeClass("in").addClass("hide");
  1815. $('#refund_fee_bill_table').bootstrapTable("destroy");
  1816. initRefundFeeDetailTable(patientId, times, receiptNo);
  1817. }
  1818. /**
  1819. * 初始化退费明细表格
  1820. * @param patientId
  1821. * @param times
  1822. * @param receiptNo
  1823. */
  1824. function initRefundFeeDetailTable(patientId, times, receiptNo) {
  1825. $("#patientIdRefund").val(patientId);
  1826. $("#timesRefund").val(times);
  1827. $("#receiptNoRefund").val(receiptNo);
  1828. $('#refund_fee_detail_table').bootstrapTable("destroy");
  1829. $('#refund_fee_detail_table').bootstrapTable({
  1830. url: '/thmz/getRefundFeeDetail', //请求后台的URL(*)
  1831. method: 'post', //请求方式(*)
  1832. toolbar: '#toolbar', //工具按钮用哪个容器
  1833. striped: true, //是否显示行间隔色
  1834. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1835. pagination: false, //是否显示分页(*)
  1836. sortable: true, //是否启用排序
  1837. sortOrder: "asc", //排序方式
  1838. // sortName: 'orderNo', //排序字段
  1839. queryParams: queryParamsForRefundFee(patientId, times, receiptNo), //传递参数(*)
  1840. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1841. pageNumber: 1, //初始化加载第一页,默认第一页
  1842. pageSize: 10, //每页的记录行数(*)
  1843. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  1844. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1845. strictSearch: true,
  1846. showColumns: false, //是否显示所有的列
  1847. showRefresh: false, //是否显示刷新按钮
  1848. minimumCountColumns: 2, //最少允许的列数
  1849. clickToSelect: true, //是否启用点击选中行
  1850. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1851. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1852. cardView: false, //是否显示详细视图
  1853. detailView: false,
  1854. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1855. ajaxOptions: {
  1856. headers: {
  1857. 'Accept': 'application/json',
  1858. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1859. }
  1860. },
  1861. columns: [
  1862. {
  1863. checkbox: true,
  1864. formatter: function (value, row, index) {
  1865. if (row.confirmFlag == 1) {
  1866. return {
  1867. disabled: true, //设置是否可用
  1868. checked: false//设置选中
  1869. }
  1870. }
  1871. if (row.confirmFlag == 3) {
  1872. //getRefundFee();
  1873. return {
  1874. disabled: true, //设置是否可用
  1875. checked: true//设置选中
  1876. }
  1877. }
  1878. }
  1879. },
  1880. {
  1881. field: 'orderNo',
  1882. title: '处方号',
  1883. align: "center",
  1884. valign: 'middle',
  1885. formatter: function (value, row, index) {
  1886. return Math.abs(value);
  1887. }
  1888. }, {
  1889. field: '',
  1890. title: '项目号',
  1891. align: "center",
  1892. valign: 'middle',
  1893. formatter: function (value, row, index) {
  1894. return index + 1;
  1895. }
  1896. }, {
  1897. field: 'billItemCode',
  1898. title: '分类名称',
  1899. align: "center",
  1900. valign: 'middle',
  1901. }, {
  1902. field: 'chargeItemCode',
  1903. title: '收费编码',
  1904. align: "center",
  1905. valign: 'middle',
  1906. }, {
  1907. field: 'tcName',
  1908. title: '项目',
  1909. align: "center",
  1910. valign: 'middle',
  1911. },
  1912. {
  1913. field: 'quantity',
  1914. title: '数量',
  1915. align: "center",
  1916. valign: 'middle'
  1917. ,
  1918. formatter: function (value, row, index) {
  1919. return value * row.drugWin;
  1920. }
  1921. }, {
  1922. field: 'unitPrice',
  1923. title: '单价(元)',
  1924. align: "center",
  1925. valign: 'middle',
  1926. formatter: function (value, row, index) {
  1927. return value.toFixed(2);
  1928. }
  1929. }, {
  1930. field: 'amount',
  1931. title: '总金额(元)',
  1932. align: "center",
  1933. valign: 'middle',
  1934. formatter: function (value, row, index) {
  1935. return value.toFixed(2);
  1936. }
  1937. }, {
  1938. field: 'confirmFlag',
  1939. title: '确认标志',
  1940. align: "center",
  1941. valign: 'middle',
  1942. formatter: function (value, row, index) {
  1943. if (value == 0) {
  1944. return "待确认";
  1945. }
  1946. if (value == 1) {
  1947. return "已确认";
  1948. }
  1949. if (value == 3) {
  1950. return "已取消";
  1951. }
  1952. if (value == 4) {
  1953. return "已退费";
  1954. }
  1955. }
  1956. }, {
  1957. field: 'decAmount',
  1958. title: '退药量',
  1959. align: "center",
  1960. valign: 'middle',
  1961. // formatter: function (value, row, index) {
  1962. // return value.toFixed(2);
  1963. // }
  1964. }, {
  1965. field: 'execDept',
  1966. title: '确认科室',
  1967. align: "center",
  1968. valign: 'middle'
  1969. }, {
  1970. field: 'confirmTime',
  1971. title: '确认时间',
  1972. align: "center",
  1973. valign: 'middle',
  1974. formatter: function (value, row, index) {
  1975. if (value != null && value != "") {
  1976. return format(value, "yyyy-MM-dd HH:mm:ss");
  1977. }
  1978. return "";
  1979. }
  1980. }
  1981. ],
  1982. //点击全选框时触发的操作
  1983. onCheckAll: function (rows) {
  1984. getRefundFee();
  1985. },
  1986. //取消所有
  1987. onUncheckAll: function (row) {
  1988. getRefundFee();
  1989. },
  1990. //点击每一个单选框时触发的操作
  1991. onCheck: function (row) {
  1992. getRefundFee();
  1993. },
  1994. //取消每一个单选框时对应的操作;
  1995. onUncheck: function (row) {
  1996. getRefundFee();
  1997. },
  1998. responseHandler: function (res) {
  1999. if (res == '401' || res == 401) {
  2000. window.location.href = '/thmz/login/view'
  2001. return;
  2002. }
  2003. var ress = eval(res);
  2004. if (ress.code == -1) {
  2005. new PNotify({
  2006. title: '错误提示',
  2007. text: ress.message,
  2008. type: 'error',
  2009. hide: true,
  2010. styling: 'bootstrap3'
  2011. });
  2012. return {
  2013. "total": 0,//总页数
  2014. "rows": {} //数据
  2015. };
  2016. }
  2017. return {
  2018. //"total": ress.pageViewVo.total,//总页数
  2019. "rows": ress.data //数据
  2020. };
  2021. },
  2022. //加载完成事件
  2023. onLoadSuccess: function (data) {
  2024. getRefundFee();
  2025. }
  2026. });
  2027. }
  2028. /**
  2029. * 退费列表参数
  2030. * @param patientId
  2031. * @param times
  2032. * @returns {{patientId: *, times: *}}
  2033. */
  2034. function queryParamsForRefundFee(patientId, times, receiptNo) {
  2035. var temp = {
  2036. patientId: patientId,
  2037. times: times,
  2038. receiptNo: receiptNo
  2039. };
  2040. return temp;
  2041. };
  2042. /**
  2043. * 每次选择费用清单明细时计算实际应退金额
  2044. */
  2045. function getRefundFee() {
  2046. extracted();
  2047. if (chargeItemCodes == null) {
  2048. $("#refundFeePrepare").text(0.00);
  2049. return;
  2050. }
  2051. $.ajax({
  2052. type: "POST",
  2053. url: '/thmz/getNewListForRefundFee',
  2054. contentType: "application/json;charset=UTF-8",
  2055. dataType: "json",
  2056. data: JSON.stringify({
  2057. patientId: $("#patientIdRefund").val(),
  2058. times: $("#timesRefund").val(),
  2059. receiptNo: $("#receiptNoRefund").val(),
  2060. chargeItemCodes: chargeItemCodes
  2061. }),
  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. $("#refundFeePrepare").text(res.pageViewVo.data[0].refundFee.toFixed(2));
  2070. } else {
  2071. new PNotify({
  2072. title: '错误提示',
  2073. text: res.message,
  2074. type: 'error',
  2075. hide: true,
  2076. styling: 'bootstrap3'
  2077. });
  2078. }
  2079. }
  2080. });
  2081. }
  2082. /**
  2083. * 发起预退费
  2084. */
  2085. function readyRefundFee() {
  2086. extracted();
  2087. $("#refundFeeModal").modal();
  2088. initRefundChargeDetailTable(chargeItemCodes);
  2089. $("#refundFeeDetailModal").modal("hide");
  2090. }
  2091. /**
  2092. * 获取预退费金额
  2093. * @returns {*}
  2094. */
  2095. function extracted() {
  2096. var allSelecteds = $('#refund_fee_detail_table').bootstrapTable('getAllSelections');
  2097. chargeItemCodes = null;
  2098. if (allSelecteds != null && allSelecteds.length > 0) {
  2099. for (var i = 0; i < allSelecteds.length; i++) {
  2100. var temp = allSelecteds[i].orderNo + "_" + allSelecteds[i].itemNo + "_" + allSelecteds[i].chargeItemCode;
  2101. if (chargeItemCodes == null) {
  2102. chargeItemCodes = temp;
  2103. } else {
  2104. chargeItemCodes += "," + temp;
  2105. }
  2106. }
  2107. }
  2108. }
  2109. /**
  2110. * 初始化退费重收费明细表格
  2111. */
  2112. function initRefundChargeDetailTable(chargeItemCodes) {
  2113. $('#refund_fee_table').bootstrapTable("destroy");
  2114. $('#refund_fee_table').bootstrapTable({
  2115. url: '/thmz/getNewListForRefundFee', //请求后台的URL(*)
  2116. method: 'post', //请求方式(*)
  2117. toolbar: '#toolbar', //工具按钮用哪个容器
  2118. striped: true, //是否显示行间隔色
  2119. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  2120. pagination: false, //是否显示分页(*)
  2121. sortable: true, //是否启用排序
  2122. sortOrder: "asc", //排序方式
  2123. // sortName: 'orderNo', //排序字段
  2124. queryParams: queryParamsForRefundDetail(chargeItemCodes), //传递参数(*)
  2125. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  2126. pageNumber: 1, //初始化加载第一页,默认第一页
  2127. pageSize: 10, //每页的记录行数(*)
  2128. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  2129. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  2130. strictSearch: true,
  2131. showColumns: false, //是否显示所有的列
  2132. showRefresh: false, //是否显示刷新按钮
  2133. minimumCountColumns: 2, //最少允许的列数
  2134. clickToSelect: true, //是否启用点击选中行
  2135. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  2136. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  2137. cardView: false, //是否显示详细视图
  2138. detailView: false,
  2139. //rowStyle:rowStyle,//通过自定义函数设置行样式
  2140. ajaxOptions: {
  2141. headers: {
  2142. 'Accept': 'application/json',
  2143. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2144. }
  2145. },
  2146. columns: [
  2147. // {
  2148. // checkbox: true
  2149. // },
  2150. {
  2151. field: 'patientId',
  2152. title: '患者编号',
  2153. align: "center",
  2154. valign: 'middle',
  2155. }, {
  2156. field: 'name',
  2157. title: '患者姓名',
  2158. align: "center",
  2159. valign: 'middle',
  2160. }, {
  2161. field: 'oriAmount',
  2162. title: '已收金额(元)',
  2163. align: "center",
  2164. valign: 'middle',
  2165. }, {
  2166. field: 'refundFee',
  2167. title: '应退金额(元)',
  2168. align: "center",
  2169. valign: 'middle'
  2170. }, {
  2171. field: 'amount',
  2172. title: '应收金额(元)',
  2173. align: "center",
  2174. valign: 'middle',
  2175. formatter: function (value, row, index) {
  2176. return Math.abs(value);
  2177. }
  2178. }, {
  2179. title: '操作',
  2180. align: "center",
  2181. valign: 'middle',
  2182. // sortable: true,
  2183. formatter: function (value, row, index) {
  2184. var str = "";
  2185. if (row.amount == 0 || row.amount == null || row.amount == undefined) {
  2186. str = '<button type="button" class="can-not-used" title="费用明细" ><i id="plusOrMinus" class="fa fa-plus"></i></button>';
  2187. } else {
  2188. str = '<button type="button" class="registration-no-color-foot-button" title="费用明细" onclick="initMzChargeDetailByBillItem(true)"><i id="plusOrMinus" class="fa fa-plus"></i></button>';
  2189. }
  2190. str += '<button type="button" class="registration-no-color-foot-button"title="确认退费" onclick="saveRefundFee()"><i class="fa fa-check"></i></button>';
  2191. return str;
  2192. }
  2193. }
  2194. ],
  2195. responseHandler: function (res) {
  2196. if (res == '401' || res == 401) {
  2197. window.location.href = '/thmz/login/view'
  2198. return;
  2199. }
  2200. var ress = eval(res);
  2201. if (ress.code == -1) {
  2202. new PNotify({
  2203. title: '错误提示',
  2204. text: ress.message,
  2205. type: 'error',
  2206. hide: true,
  2207. styling: 'bootstrap3'
  2208. });
  2209. return {
  2210. "total": 0,//总页数
  2211. "rows": {} //数据
  2212. };
  2213. }
  2214. $("#oriAmount").text(ress.pageViewVo.data[0].oriAmount);
  2215. $("#newAmount").text(ress.pageViewVo.data[0].amount);
  2216. $("#refundAmount").text(ress.pageViewVo.data[0].refundFee);
  2217. return {
  2218. "total": ress.pageViewVo.total,//总页数
  2219. "rows": ress.pageViewVo.data //数据
  2220. };
  2221. },
  2222. });
  2223. }
  2224. /**
  2225. * 构建列表查询参数
  2226. * @param chargeItemCodes
  2227. * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}}
  2228. */
  2229. function queryParamsForRefundDetail(chargeItemCodes) {
  2230. return {
  2231. patientId: $("#patientIdRefund").val(),
  2232. times: $("#timesRefund").val(),
  2233. receiptNo: $("#receiptNoRefund").val(),
  2234. chargeItemCodes: chargeItemCodes
  2235. };
  2236. };
  2237. /**
  2238. * 关闭预退费窗口
  2239. */
  2240. function closeRefundFeeDetailModal() {
  2241. $("#refundFeeDetailModal").modal("hide");
  2242. }
  2243. /**
  2244. * 提交退费操作
  2245. */
  2246. function saveRefundFee() {
  2247. var params = queryParamsForRefundByBillItem(null);
  2248. $.ajax({
  2249. type: "POST",
  2250. url: '/thmz/saveRefundFee',
  2251. contentType: "application/json;charset=UTF-8",
  2252. dataType: "json",
  2253. data: JSON.stringify(params),
  2254. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2255. success: function (res) {
  2256. if (res == '401' || res == 401) {
  2257. window.location.href = '/thmz/login/view'
  2258. return;
  2259. }
  2260. if (res.code == 0) {
  2261. new PNotify({
  2262. title: '操作提示',
  2263. text: res.message,
  2264. type: 'success',
  2265. hide: true,
  2266. styling: 'bootstrap3'
  2267. });
  2268. $("#refundFeeModal").modal("hide");
  2269. if (res.times > 0) {
  2270. prn1Print(res.patientId, res.times, false, 1);
  2271. } else {
  2272. initFeeTable();
  2273. }
  2274. } else {
  2275. new PNotify({
  2276. title: '错误提示',
  2277. text: res.message,
  2278. type: 'error',
  2279. hide: true,
  2280. styling: 'bootstrap3'
  2281. });
  2282. }
  2283. }
  2284. });
  2285. }
  2286. /**
  2287. * 清空查询条件
  2288. */
  2289. function cleanParams() {
  2290. $("#deptNoParam").selectpicker('val', null);//默认选中
  2291. $("#deptNoParam").selectpicker('refresh');
  2292. $("#doctorParam").selectpicker('val', null);//默认选中
  2293. $("#doctorParam").selectpicker('refresh');
  2294. $("#cardNo").val(null);
  2295. $("#name").val(null);
  2296. $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
  2297. $("#patientId").val(null);
  2298. //默认光标在卡号输入框
  2299. $("#cardNo").focus();
  2300. $("#serialNo").val(null);
  2301. $("#ownData").removeAttr("checked");
  2302. }
  2303. /**
  2304. * 增加收费方式
  2305. */
  2306. function addPayType(id) {
  2307. // var arr = $("#payForm").find("div.pay-item");
  2308. // if (arr.length > 0) {
  2309. // for (var i = 0; i < arr.length; i++) {
  2310. // var temp = parseFloat($(arr[i]).find("input").val());
  2311. // if (temp == 0) {
  2312. // new PNotify({
  2313. // title: '错误提示',
  2314. // text: "存在未使用的收款方式,请不要重复添加!",
  2315. // type: 'error',
  2316. // hide: true,
  2317. // styling: 'bootstrap3'
  2318. // });
  2319. // return;
  2320. // }
  2321. // }
  2322. // }
  2323. var payTypeId = null;
  2324. if (id != undefined && id != null) {
  2325. payTypeId = id;
  2326. } else {
  2327. var payTypeIndex = $("#payTypeIndex").val();
  2328. payTypeId = "payType_" + payTypeIndex;
  2329. }
  2330. var html = '<div class="item form-group pay-item"><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 + '" onchange="checkFee(false)"></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" onchange="checkFee()"></div><div class="col-md-1 col-sm-1 col-xs-12" style="line-height: 34px;">元&nbsp;&nbsp;<a style="line-height: 34px;cursor: pointer;" onclick="closeThisParent(this)"><i class="fa fa-close"></i></a></div></div></div>';
  2331. $("#changeAmountParent").before(html);
  2332. initChequeType(payTypeId)
  2333. if (payTypeIndex != undefined && payTypeIndex != null) {
  2334. payTypeIndex = Add(payTypeIndex, 1);
  2335. $("#payTypeIndex").val(payTypeIndex);
  2336. }
  2337. $("#addPayType").parent().removeClass("in").addClass("hide");
  2338. }
  2339. // /**
  2340. // * 取消费用上传
  2341. // */
  2342. // function cancelFee() {
  2343. // var patientId = $("#patientIdHaveTally").val();
  2344. // var times = $("#timesHaveTally").val();
  2345. // var receiptNo = $("#receiptNoHaveTally").val();
  2346. // $.ajax({
  2347. // type: "POST",
  2348. // url: '/thmz/cancelTmFee',
  2349. // contentType: "application/json;charset=UTF-8",
  2350. // dataType: "json",
  2351. // data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
  2352. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2353. // async: false,
  2354. // success: function (res) {
  2355. // if (res == '401' || res == 401) {
  2356. // window.location.href = '/thmz/login/view'
  2357. // return;
  2358. // }
  2359. // if (res.code == 0) {
  2360. // $("#fundPay").val(0);
  2361. // } else {
  2362. // new PNotify({
  2363. // title: '错误提示',
  2364. // text: res.message,
  2365. // type: 'error',
  2366. // hide: true,
  2367. // styling: 'bootstrap3'
  2368. // });
  2369. // }
  2370. // }
  2371. // });
  2372. // }
  2373. /**
  2374. * 查询当前门诊缴费订单的所有缴费方式列表
  2375. * @param patientId
  2376. * @param times
  2377. * @param receiptNo
  2378. */
  2379. function showChequType(patientId, times, receiptNo) {
  2380. $("#depositFileModal").modal();
  2381. $('#deposit_file_detail_table').bootstrapTable("destroy");
  2382. $('#deposit_file_detail_table').bootstrapTable({
  2383. url: '/thmz/getAllDepositFileForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + Math.abs(receiptNo), //请求后台的URL(*)
  2384. method: 'get', //请求方式(*)
  2385. toolbar: '#toolbar', //工具按钮用哪个容器
  2386. striped: true, //是否显示行间隔色
  2387. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  2388. pagination: false, //是否显示分页(*)
  2389. sortable: true, //是否启用排序
  2390. sortOrder: "asc", //排序方式
  2391. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  2392. pageNumber: 1, //初始化加载第一页,默认第一页
  2393. pageSize: 5, //每页的记录行数(*)
  2394. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  2395. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  2396. strictSearch: true,
  2397. showColumns: false, //是否显示所有的列
  2398. showRefresh: false, //是否显示刷新按钮
  2399. minimumCountColumns: 2, //最少允许的列数
  2400. clickToSelect: true, //是否启用点击选中行
  2401. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  2402. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  2403. cardView: false, //是否显示详细视图
  2404. detailView: false,
  2405. //rowStyle:rowStyle,//通过自定义函数设置行样式
  2406. ajaxOptions: {
  2407. headers: {
  2408. 'Accept': 'application/json',
  2409. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2410. }
  2411. },
  2412. columns: [
  2413. // {
  2414. // checkbox: true,
  2415. // },
  2416. {
  2417. field: 'patientId',
  2418. title: '病人编号',
  2419. align: "center",
  2420. valign: 'middle'
  2421. }, {
  2422. field: 'times',
  2423. title: '就诊次数',
  2424. align: "center",
  2425. valign: 'middle',
  2426. }, {
  2427. field: 'amount',
  2428. title: '支付金额(元)',
  2429. align: "center",
  2430. valign: 'middle',
  2431. formatter: function (value, row, index) {
  2432. return value.toFixed(2);
  2433. }
  2434. },
  2435. {
  2436. field: 'chequeTypeName',
  2437. title: '支付方式',
  2438. align: "center",
  2439. valign: 'middle'
  2440. }
  2441. ],
  2442. onDblClickRow: function (row) {
  2443. editChequType(row.receiptSn, row.chequeType, row.dcountNo, row.chequeTypeName);
  2444. },
  2445. responseHandler: function (res) {
  2446. if (res == '401' || res == 401) {
  2447. window.location.href = '/thmz/login/view'
  2448. return;
  2449. }
  2450. var ress = eval(res);
  2451. if (ress.code == -1) {
  2452. new PNotify({
  2453. title: '错误提示',
  2454. text: ress.message,
  2455. type: 'error',
  2456. hide: true,
  2457. styling: 'bootstrap3'
  2458. });
  2459. return {
  2460. "total": 0,//总页数
  2461. "rows": {} //数据
  2462. };
  2463. }
  2464. if (ress.data == null || ress.data.length == 0) {
  2465. $("#tallyDetailModal").modal("hide");
  2466. }
  2467. return {
  2468. "rows": ress.data //数据
  2469. };
  2470. },
  2471. });
  2472. }
  2473. /**
  2474. * 修改收款方式
  2475. * @param patientId
  2476. * @param times
  2477. * @param paymode
  2478. */
  2479. function editChequType(receiptSn, chequType, dcountNo, chequeTypeName) {
  2480. var message = "当前病人本次门诊缴费的支付方式为【" + chequeTypeName + "】,确定需要修改吗?";
  2481. if (dcountNo == 1) {
  2482. message = "当前病人本次门诊缴费的支付方式为【" + chequeTypeName + "】,且本次缴费已经结算,确定需要修改吗?如仍需继续修改,会影响已经结算的报表,请重新打印本次缴费所在日期的【日结报表】!";
  2483. }
  2484. $("#editPayModeTip").html(message);
  2485. $("#receiptSn").val(receiptSn);
  2486. $("#chequType").val(chequType);
  2487. $('#payTypeEditPayMode').selectpicker('val', 1);
  2488. $('#payTypeEditPayMode').selectpicker('refresh');
  2489. $("#editPayModeModal").modal();
  2490. $("#depositFileModal").modal("hide");
  2491. }
  2492. /**
  2493. * 提交修改收款方式
  2494. */
  2495. function saveEditPayMode() {
  2496. $.ajax({
  2497. type: "GET",
  2498. url: '/thmz/updateChequType?oldChequeType=' + $("#chequType").val() + "&receiptSn=" + $("#receiptSn").val() + "&chequeType=" + $("#payTypeEditPayMode").val(),
  2499. contentType: "application/json;charset=UTF-8",
  2500. dataType: "json",
  2501. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2502. success: function (res) {
  2503. if (res == '401' || res == 401) {
  2504. window.location.href = '/thmz/login/view'
  2505. return;
  2506. }
  2507. if (res.code == 0) {
  2508. successMesage(res);
  2509. clearEditPayMode();
  2510. $("#editPayModeModal").modal("hide");
  2511. } else if (res.code == -1) {
  2512. new PNotify({
  2513. title: '错误提示',
  2514. text: res.message,
  2515. type: 'error',
  2516. hide: true,
  2517. styling: 'bootstrap3'
  2518. });
  2519. }
  2520. }
  2521. });
  2522. }
  2523. /**
  2524. * 清空
  2525. */
  2526. function clearEditPayMode() {
  2527. $("#receiptSn").val(null);
  2528. $("#chequType").val(null);
  2529. }
  2530. //
  2531. // /**
  2532. // * 反写备份表的数据到正式表中,记账的数据在备分表
  2533. // * @param patientId
  2534. // * @param times
  2535. // * @param receiptNo
  2536. // */
  2537. // function reInsertDetailModal(patientId,times ,receiptNo) {
  2538. // $.ajax({
  2539. // type: "POST",
  2540. // url: '/thmz/reSaveDetailForByjz',
  2541. // contentType: "application/json;charset=UTF-8",
  2542. // dataType: "json",
  2543. // data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
  2544. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2545. // async: false,
  2546. // success: function (res) {
  2547. // if (res == '401' || res == 401) {
  2548. // window.location.href = '/thmz/login/view'
  2549. // return;
  2550. // }
  2551. // if (res.code == 0) {
  2552. // successMesage(res);
  2553. // initFeeTable();
  2554. // } else {
  2555. // new PNotify({
  2556. // title: '错误提示',
  2557. // text: res.message,
  2558. // type: 'error',
  2559. // hide: true,
  2560. // styling: 'bootstrap3'
  2561. // });
  2562. // }
  2563. // }
  2564. // });
  2565. // }
  2566. /**
  2567. * 医保电子凭证读卡
  2568. */
  2569. function siReadCard() {
  2570. $.ajax({
  2571. type: "GET",
  2572. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  2573. contentType: "application/json;charset=UTF-8",
  2574. dataType: "json",
  2575. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2576. success: function (res) {
  2577. if (res == '401' || res == 401) {
  2578. window.location.href = '/thmz/login/view'
  2579. return;
  2580. }
  2581. //console.log(res);
  2582. if (res.code == 200) {
  2583. var data = JSON.parse(res.data);
  2584. queryUserInfoBySocialNoNotFillPatient('cardNo', "" + data.data.idNo + "", initFeeTable, null);
  2585. } else {
  2586. errorMesage(res);
  2587. }
  2588. }
  2589. });
  2590. // window.open('ReadCard://'+prm, '_self')
  2591. }
  2592. /**
  2593. * 读卡类型改变事件
  2594. */
  2595. function mztczfSiReadCardTypeChange() {
  2596. var grzhzf = $("#grzhzf").val();
  2597. if (grzhzf == null || grzhzf == "") {
  2598. errorMesageSimaple("请先选择是否使用个人账户余额支付剩余门诊费用!")
  2599. $('#mztczfSiReadCardType').selectpicker('val', null);
  2600. $('#mztczfSiReadCardType').selectpicker('refresh');
  2601. return;
  2602. }
  2603. var mztczfSiReadCardType = $("#mztczfSiReadCardType").val();
  2604. if (mztczfSiReadCardType == null || mztczfSiReadCardType == "") {
  2605. return;
  2606. }
  2607. var url = "http://localhost:8321/readcard/entry?param=";
  2608. if (mztczfSiReadCardType == "03") {
  2609. url += 'sicard_01101';
  2610. } else if (mztczfSiReadCardType == "01") {
  2611. url += 'qrcode_01101';
  2612. } else if (mztczfSiReadCardType == "02") {
  2613. url += 'idcard_01101';
  2614. }
  2615. $.ajax({
  2616. type: "GET",
  2617. url: url,
  2618. contentType: "application/json;charset=UTF-8",
  2619. dataType: "json",
  2620. headers: {
  2621. 'Accept': 'application/json',
  2622. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2623. },
  2624. success: function (res) {
  2625. if (res == '401' || res == 401) {
  2626. window.location.href = '/thmz/login/view'
  2627. return;
  2628. }
  2629. //console.log(res);
  2630. if (res.code == 200) {
  2631. if (mztczfSiReadCardType == "01") {
  2632. var data = JSON.parse(res.data);
  2633. $("#readCardResult").val(JSON.stringify(data.data));
  2634. } else {
  2635. $("#readCardResult").val(res.data);
  2636. }
  2637. successMesageSimaple("读卡成功,可以进行医保结算操作。");
  2638. $("#mztczfSiReadCardModal").modal("hide");
  2639. } else {
  2640. warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!")
  2641. console.log(res);
  2642. //errorMesage(res);
  2643. }
  2644. },
  2645. error: function (XMLHttpRequest, textStatus, errorThrown) {
  2646. warningMesageSimaple("读卡异常,可以稍后重试或者自费结算(不享受门诊统筹)!")
  2647. }
  2648. });
  2649. }
  2650. /**
  2651. * 打开读卡类型弹窗
  2652. */
  2653. function mztczfSiReadCardTypeModel() {
  2654. $("#readCardResult").val(null);
  2655. $('#mztczfSiReadCardType').selectpicker('val', null);
  2656. $('#mztczfSiReadCardType').selectpicker('refresh');
  2657. $('#grzhzf').selectpicker('val', null);
  2658. $('#grzhzf').selectpicker('refresh');
  2659. $("#mztczfSiReadCardModal").modal();
  2660. }
  2661. /**
  2662. * 医保结算
  2663. * @param patientId
  2664. * @param times
  2665. */
  2666. function directRegistration(patientId, times) {
  2667. //显示弹层
  2668. $("#loadingModal").modal('show');
  2669. $.ajax({
  2670. type: "POST",
  2671. url: '/thmz/directRegistration',
  2672. contentType: "application/json;charset=UTF-8",
  2673. dataType: "json",
  2674. data: JSON.stringify({
  2675. patientId: patientId,
  2676. times: times,
  2677. readCardResult: $("#readCardResult").val(),
  2678. grzhzf: $("#grzhzf").val(),
  2679. readCardType: $("#mztczfSiReadCardType").val()
  2680. }),
  2681. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2682. success: function (res) {
  2683. //隐藏
  2684. $("#loadingModal").modal('hide');
  2685. if (res == '401' || res == 401) {
  2686. window.location.href = '/thmz/login/view'
  2687. return;
  2688. }
  2689. if (res.code == 0) {
  2690. successMesage(res);
  2691. } else {
  2692. errorMesage(res);
  2693. }
  2694. }
  2695. });
  2696. }