toll_administration.js 104 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798
  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 > 0) {
  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 = 6;
  865. if (cardType != null && (cardType == 2 || cardType == "2")) {
  866. ybkType = 7;
  867. }
  868. $('#' + payTypeId).selectpicker('val', ybkType);
  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. //总金额减医保报销
  876. var realMoney = Minus(data, fundPay);
  877. //减完医保报销后减个人医保卡支付金额
  878. realMoney = Minus(realMoney, acctPay);
  879. $("#realMoney").val(data);
  880. $("#cash").val(realMoney);
  881. // $("#cash").val(null);
  882. setTimeout(function () {
  883. //默认光标在现金输入框
  884. $("#cash").focus();
  885. }, 800);
  886. if (payTypeList.length == 1) {
  887. $('#payType').selectpicker('val', 'Y');
  888. } else {
  889. $('#payType').selectpicker('val', 1);
  890. }
  891. $("#changeAmount").val(0.0);
  892. $("#surplusAmount").val(0.0);
  893. sendPriceMessage(realMoney, 0, 0, $("#patientIdHaveTally").val());
  894. }
  895. /**
  896. * 打开收费明细窗口
  897. * @param data
  898. */
  899. function chargeDetailModal(patientId, times, receiptNo) {
  900. $("#patientIdChargeItem").val(patientId);
  901. $("#timesChargeItem").val(times);
  902. $("#receiptNoChargeItem").val(receiptNo);
  903. $("#chargeDetailModal").modal();
  904. initChargeDetailTable();
  905. }
  906. /**
  907. * 病人当前就诊次数的诊断查询
  908. * @param data
  909. */
  910. function diagnoseQuery(patientId, times) {
  911. $.ajax({
  912. type: "POST",
  913. url: '/thmz/getVisitTableByPatientIdAndTimes',
  914. contentType: "application/json;charset=UTF-8",
  915. dataType: "json",
  916. data: JSON.stringify({"patientId": patientId, "times": times}),
  917. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  918. async: false,
  919. success: function (res) {
  920. if (res == '401' || res == 401) {
  921. window.location.href = '/thmz/login/view'
  922. return;
  923. }
  924. if (res.code == 0) {
  925. if (res.data.icdText != null || res.data.icdText != '') {
  926. $("#diagnoseModal").modal();
  927. $("#diagnose").html(res.data.icdText);
  928. } else {
  929. new PNotify({
  930. title: '操作提示',
  931. text: '当前病人诊断未知',
  932. type: 'warn',
  933. styling: 'bootstrap3'
  934. });
  935. }
  936. } else {
  937. errorMesage(res);
  938. }
  939. }
  940. });
  941. }
  942. // /**
  943. // * 打开退费重收明细窗口
  944. // * @param data
  945. // */
  946. // function chargeRefundDetailModal(patientId, times) {
  947. // // $("#patientIdChargeItem").val(patientId);
  948. // // $("#timesChargeItem").val(times);
  949. // initMzChargeDetailByBillItem();
  950. // }
  951. /**
  952. * 初始门诊收银方式下拉选
  953. */
  954. function initChequeType(payType) {
  955. $.ajax({
  956. type: "GET",
  957. url: '/thmz/getAllZdChequeTypeForMz',
  958. dataType: "json",
  959. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  960. async: false,
  961. success: function (res) {
  962. if (res == '401' || res == 401) {
  963. window.location.href = '/thmz/login/view'
  964. return;
  965. }
  966. var html = '';
  967. $.each(res.data, function (commentIndex, comment) {
  968. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  969. });
  970. $('#' + payType).empty();
  971. $('#' + payType).html(html);
  972. $('#' + payType).selectpicker('refresh');
  973. if (res.data.length == 1) {
  974. $('#' + payType).selectpicker('val', 'Y');
  975. } else {
  976. $('#' + payType).selectpicker('val', 1);
  977. }
  978. $('#' + payType).selectpicker('refresh');
  979. }
  980. });
  981. }
  982. /**
  983. * 关闭当前这个付款方式
  984. */
  985. function closeThisParent(obj) {
  986. $(obj).parent().parent().parent().remove();
  987. checkFee(false);
  988. }
  989. /**
  990. * 校验收款金额
  991. * @param flag 是否是提交时候的校验,是的话,如果缴费金额不够,需要返回 false
  992. */
  993. function checkFee(flag) {
  994. var realMoney = parseFloat($("#realMoney").val());
  995. realMoney = realMoney.toFixed(2);
  996. $("#realMoney").val(realMoney);
  997. var arr = $("#payForm").find("div.pay-item");
  998. if (arr.length > 0) {
  999. //非现金收款总金额
  1000. var notCashAmount = 0;
  1001. //现金收款总额
  1002. var cashAmount = 0;
  1003. for (var i = 0; i < arr.length; i++) {
  1004. var temp = parseFloat($(arr[i]).find("input").val());
  1005. if (isNaN(temp)) {
  1006. temp = 0;
  1007. }
  1008. if ($(arr[i]).find("select").val() != 1) {
  1009. notCashAmount = Add(notCashAmount, temp);
  1010. } else {
  1011. cashAmount = Add(cashAmount, temp);
  1012. }
  1013. for (var j = 0; j < arr.length; j++) {
  1014. if ($(arr[i]).find("select").val() == $(arr[j]).find("select").val() && i != j) {
  1015. new PNotify({
  1016. title: '错误提示',
  1017. text: "已经存在相同的收款方式,请不要重复添加!",
  1018. type: 'error',
  1019. hide: true,
  1020. styling: 'bootstrap3'
  1021. });
  1022. return;
  1023. }
  1024. }
  1025. }
  1026. if (notCashAmount > realMoney) {
  1027. new PNotify({
  1028. title: '错误提示',
  1029. text: "非现金收款金额不能大于实收金额!",
  1030. type: 'error',
  1031. hide: true,
  1032. styling: 'bootstrap3'
  1033. });
  1034. $("#addPayType").parent().removeClass("in").addClass("hide");
  1035. return;
  1036. }
  1037. var totalAmount = Add(cashAmount, notCashAmount);
  1038. $("#surplusAmount").val(0.0);
  1039. if (totalAmount < realMoney) {
  1040. if (flag) {
  1041. new PNotify({
  1042. title: '错误提示',
  1043. text: "收款金额不能少于实收金额,请调整收款金额或者增加收款方式!",
  1044. type: 'error',
  1045. hide: true,
  1046. styling: 'bootstrap3'
  1047. });
  1048. return false;
  1049. }
  1050. if (totalAmount == 0) {
  1051. $("#addPayType").parent().removeClass("in").addClass("hide");
  1052. } else {
  1053. $("#addPayType").parent().removeClass("hide").addClass("in");
  1054. }
  1055. $("#changeAmount").val(0.00);
  1056. var surplusAmount = Minus(realMoney, totalAmount);
  1057. $("#surplusAmount").val(surplusAmount);
  1058. return;
  1059. }
  1060. var changeAmount = 0.00;
  1061. if (totalAmount >= realMoney) {
  1062. changeAmount = Minus(totalAmount, realMoney);
  1063. //changeAmount = changeAmount.toFixed(2);
  1064. $("#changeAmount").val(changeAmount);
  1065. $("#addPayType").parent().removeClass("in").addClass("hide");
  1066. if (!flag) {
  1067. sendPriceMessage(realMoney, totalAmount, changeAmount, $("#patientIdHaveTally").val());
  1068. }
  1069. }
  1070. //设置收费首页找零与应收和实收金额
  1071. $("#payableAmount").text(realMoney);
  1072. $("#paidAmount").text(totalAmount);
  1073. $("#changedAmount").text(changeAmount);
  1074. }
  1075. //计算和设置折扣比例
  1076. var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());
  1077. var discount = 100;
  1078. if (realMoney < amountMoneyConfirm) {
  1079. discount = Division(realMoney, Multiply(amountMoneyConfirm, 100));
  1080. }
  1081. $("#discount").text(discount.toFixed(2))
  1082. return true;
  1083. }
  1084. /**
  1085. * 提示有记账记录
  1086. */
  1087. function tipHaveTally(data, patientId, times, name, receiptNo) {
  1088. if (patientId == null || patientId == "") {
  1089. return;
  1090. }
  1091. $("#patientIdHaveTally").val(patientId);
  1092. $("#nameHaveTally").val(name);
  1093. $("#dataIdHaveTally").val(data);
  1094. $("#timesHaveTally").val(times);
  1095. $("#receiptNoHaveTally").val(receiptNo);
  1096. $.ajax({
  1097. type: "POST",
  1098. url: '/thmz/getTmFee',
  1099. contentType: "application/json;charset=UTF-8",
  1100. dataType: "json",
  1101. data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
  1102. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1103. async: false,
  1104. success: function (res) {
  1105. if (res == '401' || res == 401) {
  1106. window.location.href = '/thmz/login/view'
  1107. return;
  1108. }
  1109. if (res.code == 0) {
  1110. if (res.data != undefined && res.data != null) {
  1111. $("#fundPay").val(res.data.fundPay);
  1112. $("#acctPay").val(res.data.acctPay);
  1113. $("#cardType").val(res.data.cardType);
  1114. //$("#realMoney").val(res.data.selfPay);
  1115. } else {
  1116. $("#fundPay").val(0.0);
  1117. $("#acctPay").val(0.0);
  1118. $("#cardType").val(null);
  1119. }
  1120. } else {
  1121. errorMesage(res);
  1122. }
  1123. $("#saveConfirmFee").attr("disabled", false);
  1124. }
  1125. });
  1126. confirmFeeModal(null, null, null);
  1127. }
  1128. var $tally_detail_table;
  1129. /**
  1130. * 初始化本院记账明细表格
  1131. */
  1132. function initTallyDetailTable() {
  1133. $("#haveTallyModal").modal('hide');
  1134. var patientId = $("#patientIdHaveTally").val();
  1135. // var name = $("#nameHaveTally").val();
  1136. if (patientId == null || patientId == '') {
  1137. return;
  1138. }
  1139. $("#tallyDetailModal").modal();
  1140. $('#tally_detail_table').bootstrapTable("destroy");
  1141. $tally_detail_table = $('#tally_detail_table').bootstrapTable({
  1142. url: '/thmz/getTallyReceiptSerial?patientId=' + patientId, //请求后台的URL(*)
  1143. method: 'get', //请求方式(*)
  1144. toolbar: '#toolbar', //工具按钮用哪个容器
  1145. striped: true, //是否显示行间隔色
  1146. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1147. pagination: false, //是否显示分页(*)
  1148. sortable: true, //是否启用排序
  1149. sortOrder: "asc", //排序方式
  1150. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  1151. pageNumber: 1, //初始化加载第一页,默认第一页
  1152. pageSize: 10, //每页的记录行数(*)
  1153. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  1154. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1155. strictSearch: true,
  1156. showColumns: false, //是否显示所有的列
  1157. showRefresh: false, //是否显示刷新按钮
  1158. minimumCountColumns: 2, //最少允许的列数
  1159. clickToSelect: true, //是否启用点击选中行
  1160. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1161. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1162. cardView: false, //是否显示详细视图
  1163. detailView: false,
  1164. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1165. ajaxOptions: {
  1166. headers: {
  1167. 'Accept': 'application/json',
  1168. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1169. }
  1170. },
  1171. columns: [
  1172. // {
  1173. // checkbox: true,
  1174. // },
  1175. {
  1176. field: 'patientId',
  1177. title: '病人编号',
  1178. align: "center",
  1179. valign: 'middle'
  1180. }, {
  1181. field: 'name',
  1182. title: '病人姓名',
  1183. align: "center",
  1184. valign: 'middle',
  1185. // formatter: function (value, row, index) {
  1186. // return name;
  1187. // }
  1188. }, {
  1189. field: 'times',
  1190. title: '就诊次数',
  1191. align: "center",
  1192. valign: 'middle',
  1193. },
  1194. {
  1195. field: 'totalCharge',
  1196. title: '总费用(元)',
  1197. align: "center",
  1198. valign: 'middle',
  1199. formatter: function (value, row, index) {
  1200. return value.toFixed(2);
  1201. }
  1202. },
  1203. {
  1204. field: 'chargeDate',
  1205. title: '记账时间',
  1206. align: "center",
  1207. valign: 'middle',
  1208. formatter: function (value, row, index) {
  1209. return format(value, "yyyy-MM-dd HH:mm:ss");
  1210. }
  1211. }
  1212. // , {
  1213. // title: '操作',
  1214. // align: "center",
  1215. // valign: 'middle',
  1216. // // sortable: true,
  1217. // formatter: function (value, row, index) {
  1218. // 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>';
  1219. // return str;
  1220. // }
  1221. // }
  1222. ],
  1223. /**
  1224. * @param {点击列的 field 名称} field
  1225. * @param {点击列的 value 值} value
  1226. * @param {点击列的整行数据} row
  1227. * @param {td 元素} $element
  1228. */
  1229. onClickCell: function (field, value, row, $element) {
  1230. var cardNo = $("#cardNo").val();
  1231. if (cardNo == '120' && field == 'name') {
  1232. $element.attr('contenteditable', true);
  1233. $element.html(null);
  1234. $element.focus();
  1235. $element.blur(function () {
  1236. var index = $element.parent().data('index');
  1237. var tdValue = $element.html();
  1238. saveData(index, field, tdValue, row, $tally_detail_table);
  1239. })
  1240. }
  1241. },
  1242. onDblClickRow: function (row) {
  1243. confirmFeeModal(row.times, row.totalCharge, row.receiptNo);
  1244. },
  1245. responseHandler: function (res) {
  1246. if (res == '401' || res == 401) {
  1247. window.location.href = '/thmz/login/view'
  1248. return;
  1249. }
  1250. var ress = eval(res);
  1251. if (ress.code == -1) {
  1252. errorMesage(ress);
  1253. return {
  1254. "total": 0,//总页数
  1255. "rows": {} //数据
  1256. };
  1257. }
  1258. if (ress.data == null || ress.data.length == 0) {
  1259. $("#tallyDetailModal").modal("hide");
  1260. }
  1261. return {
  1262. "rows": ress.data //数据
  1263. };
  1264. },
  1265. });
  1266. }
  1267. /**
  1268. * 提交缴费申请
  1269. */
  1270. function saveConfirmFee() {
  1271. $("#saveConfirmFee").attr("disabled", true);
  1272. if (!checkFee(true)) {
  1273. $("#saveConfirmFee").attr("disabled", false);
  1274. return;
  1275. }
  1276. var project = $("#project").val();
  1277. var jsonData = JSON.parse('{"patientId":"","times":"","receiptNo":"","mzDepositFiles":[]}');
  1278. var patientId = $("#patientIdHaveTally").val();
  1279. var times = $("#timesHaveTally").val();
  1280. var receiptNo = $("#receiptNoHaveTally").val();
  1281. jsonData.patientId = patientId;
  1282. jsonData.times = times;
  1283. jsonData.receiptNo = receiptNo;
  1284. var arr = $("#payForm").find("div.pay-item");
  1285. if (arr.length > 0) {
  1286. for (var i = 0; i < arr.length; i++) {
  1287. var temp = parseFloat($(arr[i]).find("input").val());
  1288. if (temp == null || temp == 0) {
  1289. continue;
  1290. }
  1291. var tempJson = JSON.parse('{"chequeType":"","amount":"","contractId":""}');
  1292. tempJson.chequeType = $(arr[i]).find("select").val();
  1293. //现金有可能会多收,比入实收37,对方给了100,需要找零63. 所以必须减去找零金额,才是实收金额
  1294. if (tempJson.chequeType == "1") {
  1295. temp = temp - $("#changeAmount").val();
  1296. temp = temp.toFixed(2);
  1297. }
  1298. if (project != null && project != "null" && project != "") {
  1299. tempJson.contractId = project;
  1300. }
  1301. tempJson.amount = temp;
  1302. jsonData.mzDepositFiles[jsonData.mzDepositFiles.length] = tempJson;
  1303. }
  1304. }
  1305. $.ajax({
  1306. type: "POST",
  1307. url: '/thmz/chargeFee',
  1308. contentType: "application/json;charset=UTF-8",
  1309. dataType: "json",
  1310. data: JSON.stringify(jsonData),
  1311. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1312. success: function (res) {
  1313. if (res == '401' || res == 401) {
  1314. window.location.href = '/thmz/login/view'
  1315. return;
  1316. }
  1317. if (res.code == 0) {
  1318. prn1Print(patientId, times, true, res.receiptNo);
  1319. successMesage(res);
  1320. $("#confirmFeeModal").modal("hide");
  1321. $("#patientId").val(null);
  1322. $("#cardNo").val(null);
  1323. $("#name").val(null);
  1324. $("#fundPay").val(0);
  1325. $("#acctPay").val(0);
  1326. $("#cardType").val(null);
  1327. //缴费成功后清空全局参数
  1328. patientIdFullForNucleicAcid = null;
  1329. initFeeTable();
  1330. //默认光标在卡号输入框
  1331. $("#cardNo").focus();
  1332. toEvaluation(patientId);
  1333. } else {
  1334. errorMesage(res);
  1335. }
  1336. $("#saveConfirmFee").attr("disabled", false);
  1337. }
  1338. });
  1339. }
  1340. /**
  1341. * 保存合作项目
  1342. */
  1343. function saveProject() {
  1344. var projectRealNo = $("#projectRealNo").val();
  1345. var projectCharged = $("#projectCharged").val();
  1346. $.ajax({
  1347. type: "GET",
  1348. url: '/thmz/setMzDepositFileSetContractId?contractId=' + projectCharged + '&serialNo=' + projectRealNo,
  1349. contentType: "application/json;charset=UTF-8",
  1350. dataType: "json",
  1351. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1352. success: function (res) {
  1353. if (res == '401' || res == 401) {
  1354. window.location.href = '/thmz/login/view'
  1355. return;
  1356. }
  1357. if (res.code == 0) {
  1358. successMesage(res);
  1359. $("#projectRealNo").val(null);
  1360. $('#projectCharged').selectpicker('val', null);
  1361. $('#projectCharged').selectpicker('refresh');
  1362. $("#projectModal").modal("hide");
  1363. } else {
  1364. errorMesage(res);
  1365. }
  1366. $("#saveConfirmFee").attr("disabled", false);
  1367. }
  1368. });
  1369. }
  1370. /**
  1371. * 直接打印发票
  1372. * @param patientId
  1373. * @param times
  1374. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  1375. */
  1376. function prn1PrintHand(patientId, times, chargeFeeFlag, receiptNo, realNo) {
  1377. $("#button_" + realNo).css("display", "none");
  1378. prn1Print(patientId, times, chargeFeeFlag, receiptNo);
  1379. }
  1380. /**
  1381. * 直接打印发票
  1382. * @param patientId
  1383. * @param times
  1384. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  1385. */
  1386. function prn1Print(patientId, times, chargeFeeFlag, receiptNo) {
  1387. var url = '/thmz/getAllSerialForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo;
  1388. printCommon(url, patientId, times, chargeFeeFlag);
  1389. }
  1390. /**
  1391. * 重打发票
  1392. * @param patientId
  1393. * @param times
  1394. */
  1395. function repPrint(patientId, times, receiptNo) {
  1396. $.ajax({
  1397. type: "GET",
  1398. url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
  1399. contentType: "application/json;charset=UTF-8",
  1400. dataType: "json",
  1401. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1402. success: function (res) {
  1403. if (res == '401' || res == 401) {
  1404. window.location.href = '/thmz/login/view'
  1405. return;
  1406. }
  1407. if (res.code == 0) {
  1408. if (res.data.length == 1) {
  1409. var message = "确定要重新打印发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认发票打印机即将要打印的发票编号";
  1410. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0&receiptBill=" + res.data[0].receiptBill;
  1411. confirmMessage(patientId, times, message, url);
  1412. } else {
  1413. $("#tip_message").text("请选择需要重新打印的发票号");
  1414. $("#repPrintModal").modal();
  1415. $("#repPrintTable").html(null);
  1416. for (var i = 0; i < res.data.length; i++) {
  1417. $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
  1418. $("#repPrintModal").modal("hide");
  1419. var message = "确定要重新打印发票号码为【" + $(this).text() + "】的发票吗?请确认发票打印机即将要打印的发票编号";
  1420. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0&receiptBill=" + $(this).text();
  1421. confirmMessage(patientId, times, message, url);
  1422. });
  1423. }
  1424. }
  1425. }
  1426. }
  1427. });
  1428. }
  1429. /**
  1430. * 发票重打提示
  1431. * @param patientId
  1432. * @param times
  1433. * @param name
  1434. */
  1435. function confirmMessage(patientId, times, message, url) {
  1436. if (!confirm(message)) {
  1437. return;
  1438. }
  1439. //var url='/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0" + "&receiptBill="+receiptBill;
  1440. printCommon(url, patientId, times, true);
  1441. }
  1442. /**
  1443. * 作废重打发票
  1444. * @param patientId
  1445. * @param times
  1446. */
  1447. function obsoleteAndRepPrint(patientId, times, receiptNo) {
  1448. $.ajax({
  1449. type: "GET",
  1450. url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
  1451. contentType: "application/json;charset=UTF-8",
  1452. dataType: "json",
  1453. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1454. success: function (res) {
  1455. if (res == '401' || res == 401) {
  1456. window.location.href = '/thmz/login/view'
  1457. return;
  1458. }
  1459. if (res.code == 0) {
  1460. if (res.data.length == 1) {
  1461. var message = "确定要作废发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认需要作废发票编号";
  1462. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1&receiptBill=" + res.data[0].receiptBill;
  1463. confirmMessage(patientId, times, message, url);
  1464. } else {
  1465. $("#tip_message").text("请选择需要作废的发票号");
  1466. $("#repPrintModal").modal();
  1467. $("#repPrintTable").html(null);
  1468. for (var i = 0; i < res.data.length; i++) {
  1469. $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
  1470. $("#repPrintModal").modal("hide");
  1471. var message = "确定要作废发票号码为【" + $(this).text() + "】的发票吗?请确认需要作废发票编号";
  1472. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1&receiptBill=" + $(this).text();
  1473. confirmMessage(patientId, times, message, url);
  1474. });
  1475. }
  1476. }
  1477. }
  1478. }
  1479. });
  1480. }
  1481. /**
  1482. * 打印医保结算单
  1483. * @param patientId
  1484. * @param times
  1485. * @param receiptNo
  1486. */
  1487. function printYbjsd(patientId, times, receiptNo) {
  1488. if (mzjsdHost == null) {
  1489. errorMesageSimaple("医保结算单域名为空,操作失败!");
  1490. return;
  1491. }
  1492. const iframeEle = document.getElementById('ybjsdDiv');
  1493. const loadingEle = document.getElementById('loading');
  1494. //设置ififrame透明
  1495. iframeEle.style.opacity = 0;
  1496. loadingEle.style.display = 'block';
  1497. var url = mzjsdHost + "/siSettleDetailList/" + patientId + "/" + times;
  1498. $("#ybjsdDiv").attr("src", url);
  1499. iframeEle.addEventListener('load', function () {
  1500. // Hide the loading indicator
  1501. loadingEle.style.display = 'none';
  1502. // Bring the iframe back
  1503. iframeEle.style.opacity = 1;
  1504. });
  1505. $("#ybjsdModal").modal();
  1506. }
  1507. /**
  1508. * 匹配合作项目
  1509. * @param realNo
  1510. */
  1511. function matchProject(realNo) {
  1512. $("#projectRealNo").val(realNo);
  1513. $("#projectModal").modal();
  1514. $.ajax({
  1515. type: "GET",
  1516. url: '/thmz/getMzDepositFileContractId?serialNo=' + realNo,
  1517. contentType: "application/json;charset=UTF-8",
  1518. dataType: "json",
  1519. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1520. success: function (res) {
  1521. if (res == '401' || res == 401) {
  1522. window.location.href = '/thmz/login/view'
  1523. return;
  1524. }
  1525. if (res.code == 0) {
  1526. $('#projectCharged').selectpicker('val', res.data);
  1527. $('#projectCharged').selectpicker('refresh');
  1528. }
  1529. }
  1530. });
  1531. }
  1532. /**
  1533. * 打印发票通用方法
  1534. * @param patientId
  1535. * @param times
  1536. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  1537. */
  1538. function printCommon(url, patientId, times, chargeFeeFlag) {
  1539. setPrint();
  1540. var height = "93.15mm";
  1541. // if (countReceiot % 2 == 0) {
  1542. // height = "93.2mm";
  1543. // }
  1544. $.ajax({
  1545. type: "GET",
  1546. url: url,
  1547. contentType: "application/json;charset=UTF-8",
  1548. dataType: "json",
  1549. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1550. async: false,
  1551. success: function (res) {
  1552. if (res == '401' || res == 401) {
  1553. window.location.href = '/thmz/login/view'
  1554. return;
  1555. }
  1556. if (res.code == 0) {
  1557. if (res.data == null || res.data.length == 0) {
  1558. return;
  1559. }
  1560. // countReceiot++;
  1561. for (var i = 0; i < res.data.length; i++) {
  1562. LODOP = getLodop();
  1563. var temp = res.data[i].mzReceiptSerial;
  1564. LODOP.PRINT_INITA(6, 0, "120mm", height, "泰和门诊发票打印");
  1565. //设置默认打印机
  1566. LODOP.SET_PRINTER_INDEX(printIndex);
  1567. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");
  1568. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
  1569. LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
  1570. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
  1571. LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
  1572. LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", "湖南泰和医院管理有限公司");
  1573. LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "机制号:");
  1574. LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
  1575. LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);
  1576. LODOP.ADD_PRINT_TEXT("25mm", "7mm", "40mm", "3mm", res.mzPatientMi.name);
  1577. LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
  1578. var feeList = res.data[i].feeList;
  1579. if (feeList != null && feeList.length > 0) {
  1580. var top = 32;
  1581. var left = 6;
  1582. for (var j = 0; j < feeList.length; j++) {
  1583. var row = parseInt(j / 3);
  1584. var tempTop = top + row * 5;
  1585. var tempLeft = left;
  1586. if (j % 3 == 1) {
  1587. tempLeft = left + 30;
  1588. } else if (j % 3 == 2) {
  1589. tempLeft = left + 60;
  1590. }
  1591. LODOP.ADD_PRINT_TEXT(tempTop + "mm", tempLeft + "mm", "30mm", "3mm", feeList[j]);
  1592. }
  1593. }
  1594. // LODOP.ADD_PRINT_TEXT("32mm","25mm","25mm","3mm","诊查费 10.00");
  1595. // LODOP.ADD_PRINT_TEXT("32mm","50mm","25mm","3mm","中成药费30.10");
  1596. // LODOP.ADD_PRINT_TEXT("37mm","25mm","25mm","3mm","治疗费 22.00");
  1597. // LODOP.ADD_PRINT_TEXT("37mm","50mm","25mm","3mm","材料费 14.20");
  1598. // LODOP.ADD_PRINT_TEXT("42mm","25mm","25mm","3mm","西药费 161.20");
  1599. var qyxxs = res.data[i].qyxxs;
  1600. if (qyxxs != null && qyxxs.length > 0) {
  1601. var top = 54;
  1602. for (var j = 0; j < qyxxs.length; j++) {
  1603. var row = j / 3;
  1604. var tempTop = top + row * 10;
  1605. var qyxx = qyxxs[j];
  1606. var arr = qyxx.split(",");
  1607. LODOP.ADD_PRINT_TEXT(tempTop + "mm", "6mm", "50mm", "3mm", "取药窗口:" + arr[0]);
  1608. LODOP.ADD_PRINT_TEXT(tempTop + "mm", "61mm", "50mm", "3mm", "取药号码:" + arr[1]);
  1609. }
  1610. }
  1611. // LODOP.ADD_PRINT_TEXT("54mm","25mm","50mm","3mm","取药窗口:西药房4号窗口");
  1612. // LODOP.ADD_PRINT_TEXT("54mm","80mm","35mm","3mm","取药号码:408392");
  1613. LODOP.ADD_PRINT_TEXT("65mm", "21mm", "60mm", "3mm", temp.totalCharge + " 元");
  1614. LODOP.ADD_PRINT_TEXT("72mm", "19mm", "60mm", "3mm", res.data[i].totalChargeStr);
  1615. LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.data[i].year);//年
  1616. LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.data[i].month);//月
  1617. LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.data[i].day);//日
  1618. LODOP.ADD_PRINT_TEXT("79mm", "53mm", "50mm", "3mm", temp.operatorId);//收费员
  1619. LODOP.PRINT();
  1620. //LODOP.PREVIEW();
  1621. initFeeTable();
  1622. }
  1623. } else if (res.code == -1) {
  1624. //退费就退出,不提示异常
  1625. if (!chargeFeeFlag) {
  1626. return;
  1627. }
  1628. new PNotify({
  1629. title: '错误提示',
  1630. text: res.message,
  1631. type: 'error',
  1632. hide: true,
  1633. styling: 'bootstrap3'
  1634. });
  1635. }
  1636. }
  1637. });
  1638. }
  1639. //
  1640. // /**
  1641. // * 加载打印机列表
  1642. // * @constructor
  1643. // */
  1644. // function CreatePrinterList() {
  1645. // LODOP = getLodop();
  1646. // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
  1647. // //获取打印机设备数,用于进行遍历
  1648. // var count = LODOP.GET_PRINTER_COUNT();
  1649. // var html = "";
  1650. // for (var i = 0; i < count; i++) {
  1651. // //根据设备序号获取设备名
  1652. // var msg = LODOP.GET_PRINTER_NAME(i);
  1653. // html += "<option value='" + i + "'>" + msg + "</option>";
  1654. // }
  1655. // $('#printSelect').html(html);
  1656. // $('#printSelect').selectpicker('refresh');
  1657. // $.ajax({
  1658. // type: "GET",
  1659. // url: '/thmz/getLastWindowsByCurrentUser',
  1660. // contentType: "application/json;charset=UTF-8",
  1661. // dataType: "json",
  1662. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1663. // success: function (res) {
  1664. // if (res == '401' || res == 401) {
  1665. // window.location.href = '/thmz/login/view'
  1666. // return;
  1667. // }
  1668. // if (res.code == 0) {
  1669. // $('#printSelect').selectpicker('val', res.data.printIndex);
  1670. // $('#printSelect').selectpicker('refresh');
  1671. // printIndex=res.data.printIndex;
  1672. // }
  1673. // }
  1674. // });
  1675. // }
  1676. //
  1677. //
  1678. // /**
  1679. // * 保存窗口号
  1680. // */
  1681. // function saveWindows() {
  1682. // $.ajax({
  1683. // type: "POST",
  1684. // url: '/thmz/saveWindows',
  1685. // contentType: "application/json;charset=UTF-8",
  1686. // dataType: "json",
  1687. // data: JSON.stringify({"windowsNo": $("#windowsNum").val()}),
  1688. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1689. // success: function (res) {
  1690. // if (res == '401' || res == 401) {
  1691. // window.location.href = '/thmz/login/view'
  1692. // return;
  1693. // }
  1694. // $('#editWindowsModal').modal('hide');
  1695. // if (res.code == 0) {
  1696. // new PNotify({
  1697. // title: '操作提示',
  1698. // text: res.message,
  1699. // type: 'success',
  1700. // hide: true,
  1701. // styling: 'bootstrap3'
  1702. // });
  1703. // } else {
  1704. // new PNotify({
  1705. // title: '错误提示',
  1706. // text: res.message,
  1707. // type: 'error',
  1708. // hide: true,
  1709. // styling: 'bootstrap3'
  1710. // });
  1711. // }
  1712. // }
  1713. // });
  1714. // }
  1715. //
  1716. //
  1717. //
  1718. // /**
  1719. // * 保存打印机
  1720. // */
  1721. // function savePrint() {
  1722. // $.ajax({
  1723. // type: "POST",
  1724. // url: '/thmz/savePrintIndex',
  1725. // contentType: "application/json;charset=UTF-8",
  1726. // dataType: "json",
  1727. // data: JSON.stringify({"printIndex": $("#printSelect").val()}),
  1728. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1729. // success: function (res) {
  1730. // if (res == '401' || res == 401) {
  1731. // window.location.href = '/thmz/login/view'
  1732. // return;
  1733. // }
  1734. // LODOP = getLodop();
  1735. // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "泰和门诊发票打印");
  1736. // LODOP.SET_PRINTER_INDEX($("#printSelect").val());
  1737. // printIndex=$("#printSelect").val();
  1738. // $('#editPrintModal').modal('hide');
  1739. // if (res.code == 0) {
  1740. // new PNotify({
  1741. // title: '操作提示',
  1742. // text: res.message,
  1743. // type: 'success',
  1744. // hide: true,
  1745. // styling: 'bootstrap3'
  1746. // });
  1747. // } else {
  1748. // new PNotify({
  1749. // title: '错误提示',
  1750. // text: res.message,
  1751. // type: 'error',
  1752. // hide: true,
  1753. // styling: 'bootstrap3'
  1754. // });
  1755. // }
  1756. // }
  1757. // });
  1758. // }
  1759. /**
  1760. * 查询默认打印机
  1761. */
  1762. function setPrint() {
  1763. if (printIndex >= 0) {
  1764. return;
  1765. }
  1766. $.ajax({
  1767. type: "GET",
  1768. url: '/thmz/getLastWindowsByCurrentUser',
  1769. contentType: "application/json;charset=UTF-8",
  1770. dataType: "json",
  1771. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1772. async: false,
  1773. success: function (res) {
  1774. if (res == '401' || res == 401) {
  1775. window.location.href = '/thmz/login/view'
  1776. return;
  1777. }
  1778. if (res.code == 0) {
  1779. printIndex = res.data.printIndex;
  1780. } else {
  1781. printIndex = -1;
  1782. }
  1783. }
  1784. });
  1785. }
  1786. /**
  1787. * 退费操作
  1788. */
  1789. function refundFee(patientId, times, receiptNo, printFlag) {
  1790. if (printFlag == 0) {
  1791. new PNotify({
  1792. title: '错误提示',
  1793. text: '当前病人缴费记录发票还未打印,无法进行退费,请先打印该发票!',
  1794. type: 'error',
  1795. hide: true,
  1796. styling: 'bootstrap3'
  1797. });
  1798. return;
  1799. }
  1800. $("#refundFeePrepare").text(0.00);
  1801. $("#refundFeeDetailModal").modal();
  1802. $("#refund_bill_item_group").removeClass("in").addClass("hide");
  1803. $('#refund_fee_bill_table').bootstrapTable("destroy");
  1804. initRefundFeeDetailTable(patientId, times, receiptNo);
  1805. }
  1806. /**
  1807. * 初始化退费明细表格
  1808. * @param patientId
  1809. * @param times
  1810. * @param receiptNo
  1811. */
  1812. function initRefundFeeDetailTable(patientId, times, receiptNo) {
  1813. $("#patientIdRefund").val(patientId);
  1814. $("#timesRefund").val(times);
  1815. $("#receiptNoRefund").val(receiptNo);
  1816. $('#refund_fee_detail_table').bootstrapTable("destroy");
  1817. $('#refund_fee_detail_table').bootstrapTable({
  1818. url: '/thmz/getRefundFeeDetail', //请求后台的URL(*)
  1819. method: 'post', //请求方式(*)
  1820. toolbar: '#toolbar', //工具按钮用哪个容器
  1821. striped: true, //是否显示行间隔色
  1822. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1823. pagination: false, //是否显示分页(*)
  1824. sortable: true, //是否启用排序
  1825. sortOrder: "asc", //排序方式
  1826. // sortName: 'orderNo', //排序字段
  1827. queryParams: queryParamsForRefundFee(patientId, times, receiptNo), //传递参数(*)
  1828. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  1829. pageNumber: 1, //初始化加载第一页,默认第一页
  1830. pageSize: 10, //每页的记录行数(*)
  1831. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  1832. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1833. strictSearch: true,
  1834. showColumns: false, //是否显示所有的列
  1835. showRefresh: false, //是否显示刷新按钮
  1836. minimumCountColumns: 2, //最少允许的列数
  1837. clickToSelect: true, //是否启用点击选中行
  1838. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1839. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1840. cardView: false, //是否显示详细视图
  1841. detailView: false,
  1842. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1843. ajaxOptions: {
  1844. headers: {
  1845. 'Accept': 'application/json',
  1846. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1847. }
  1848. },
  1849. columns: [
  1850. {
  1851. checkbox: true,
  1852. formatter: function (value, row, index) {
  1853. if (row.confirmFlag == 1) {
  1854. return {
  1855. disabled: true, //设置是否可用
  1856. checked: false//设置选中
  1857. }
  1858. }
  1859. if (row.confirmFlag == 3) {
  1860. //getRefundFee();
  1861. return {
  1862. disabled: true, //设置是否可用
  1863. checked: true//设置选中
  1864. }
  1865. }
  1866. }
  1867. },
  1868. {
  1869. field: 'orderNo',
  1870. title: '处方号',
  1871. align: "center",
  1872. valign: 'middle',
  1873. formatter: function (value, row, index) {
  1874. return Math.abs(value);
  1875. }
  1876. }, {
  1877. field: '',
  1878. title: '项目号',
  1879. align: "center",
  1880. valign: 'middle',
  1881. formatter: function (value, row, index) {
  1882. return index + 1;
  1883. }
  1884. }, {
  1885. field: 'billItemCode',
  1886. title: '分类名称',
  1887. align: "center",
  1888. valign: 'middle',
  1889. }, {
  1890. field: 'chargeItemCode',
  1891. title: '收费编码',
  1892. align: "center",
  1893. valign: 'middle',
  1894. }, {
  1895. field: 'tcName',
  1896. title: '项目',
  1897. align: "center",
  1898. valign: 'middle',
  1899. },
  1900. {
  1901. field: 'quantity',
  1902. title: '数量',
  1903. align: "center",
  1904. valign: 'middle'
  1905. ,
  1906. formatter: function (value, row, index) {
  1907. return value * row.drugWin;
  1908. }
  1909. }, {
  1910. field: 'unitPrice',
  1911. title: '单价(元)',
  1912. align: "center",
  1913. valign: 'middle',
  1914. formatter: function (value, row, index) {
  1915. return value.toFixed(2);
  1916. }
  1917. }, {
  1918. field: 'amount',
  1919. title: '总金额(元)',
  1920. align: "center",
  1921. valign: 'middle',
  1922. formatter: function (value, row, index) {
  1923. return value.toFixed(2);
  1924. }
  1925. }, {
  1926. field: 'confirmFlag',
  1927. title: '确认标志',
  1928. align: "center",
  1929. valign: 'middle',
  1930. formatter: function (value, row, index) {
  1931. if (value == 0) {
  1932. return "待确认";
  1933. }
  1934. if (value == 1) {
  1935. return "已确认";
  1936. }
  1937. if (value == 3) {
  1938. return "已取消";
  1939. }
  1940. if (value == 4) {
  1941. return "已退费";
  1942. }
  1943. }
  1944. }, {
  1945. field: 'decAmount',
  1946. title: '退药量',
  1947. align: "center",
  1948. valign: 'middle',
  1949. // formatter: function (value, row, index) {
  1950. // return value.toFixed(2);
  1951. // }
  1952. }, {
  1953. field: 'execDept',
  1954. title: '确认科室',
  1955. align: "center",
  1956. valign: 'middle'
  1957. }, {
  1958. field: 'confirmTime',
  1959. title: '确认时间',
  1960. align: "center",
  1961. valign: 'middle',
  1962. formatter: function (value, row, index) {
  1963. if (value != null && value != "") {
  1964. return format(value, "yyyy-MM-dd HH:mm:ss");
  1965. }
  1966. return "";
  1967. }
  1968. }
  1969. ],
  1970. //点击全选框时触发的操作
  1971. onCheckAll: function (rows) {
  1972. getRefundFee();
  1973. },
  1974. //取消所有
  1975. onUncheckAll: function (row) {
  1976. getRefundFee();
  1977. },
  1978. //点击每一个单选框时触发的操作
  1979. onCheck: function (row) {
  1980. getRefundFee();
  1981. },
  1982. //取消每一个单选框时对应的操作;
  1983. onUncheck: function (row) {
  1984. getRefundFee();
  1985. },
  1986. responseHandler: function (res) {
  1987. if (res == '401' || res == 401) {
  1988. window.location.href = '/thmz/login/view'
  1989. return;
  1990. }
  1991. var ress = eval(res);
  1992. if (ress.code == -1) {
  1993. new PNotify({
  1994. title: '错误提示',
  1995. text: ress.message,
  1996. type: 'error',
  1997. hide: true,
  1998. styling: 'bootstrap3'
  1999. });
  2000. return {
  2001. "total": 0,//总页数
  2002. "rows": {} //数据
  2003. };
  2004. }
  2005. return {
  2006. //"total": ress.pageViewVo.total,//总页数
  2007. "rows": ress.data //数据
  2008. };
  2009. },
  2010. //加载完成事件
  2011. onLoadSuccess: function (data) {
  2012. getRefundFee();
  2013. }
  2014. });
  2015. }
  2016. /**
  2017. * 退费列表参数
  2018. * @param patientId
  2019. * @param times
  2020. * @returns {{patientId: *, times: *}}
  2021. */
  2022. function queryParamsForRefundFee(patientId, times, receiptNo) {
  2023. var temp = {
  2024. patientId: patientId,
  2025. times: times,
  2026. receiptNo: receiptNo
  2027. };
  2028. return temp;
  2029. };
  2030. /**
  2031. * 每次选择费用清单明细时计算实际应退金额
  2032. */
  2033. function getRefundFee() {
  2034. extracted();
  2035. if (chargeItemCodes == null) {
  2036. $("#refundFeePrepare").text(0.00);
  2037. return;
  2038. }
  2039. $.ajax({
  2040. type: "POST",
  2041. url: '/thmz/getNewListForRefundFee',
  2042. contentType: "application/json;charset=UTF-8",
  2043. dataType: "json",
  2044. data: JSON.stringify({
  2045. patientId: $("#patientIdRefund").val(),
  2046. times: $("#timesRefund").val(),
  2047. receiptNo: $("#receiptNoRefund").val(),
  2048. chargeItemCodes: chargeItemCodes
  2049. }),
  2050. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2051. success: function (res) {
  2052. if (res == '401' || res == 401) {
  2053. window.location.href = '/thmz/login/view'
  2054. return;
  2055. }
  2056. if (res.code == 0) {
  2057. $("#refundFeePrepare").text(res.pageViewVo.data[0].refundFee.toFixed(2));
  2058. } else {
  2059. new PNotify({
  2060. title: '错误提示',
  2061. text: res.message,
  2062. type: 'error',
  2063. hide: true,
  2064. styling: 'bootstrap3'
  2065. });
  2066. }
  2067. }
  2068. });
  2069. }
  2070. /**
  2071. * 发起预退费
  2072. */
  2073. function readyRefundFee() {
  2074. extracted();
  2075. $("#refundFeeModal").modal();
  2076. initRefundChargeDetailTable(chargeItemCodes);
  2077. $("#refundFeeDetailModal").modal("hide");
  2078. }
  2079. /**
  2080. * 获取预退费金额
  2081. * @returns {*}
  2082. */
  2083. function extracted() {
  2084. var allSelecteds = $('#refund_fee_detail_table').bootstrapTable('getAllSelections');
  2085. chargeItemCodes = null;
  2086. if (allSelecteds != null && allSelecteds.length > 0) {
  2087. for (var i = 0; i < allSelecteds.length; i++) {
  2088. var temp = allSelecteds[i].orderNo + "_" + allSelecteds[i].itemNo + "_" + allSelecteds[i].chargeItemCode;
  2089. if (chargeItemCodes == null) {
  2090. chargeItemCodes = temp;
  2091. } else {
  2092. chargeItemCodes += "," + temp;
  2093. }
  2094. }
  2095. }
  2096. }
  2097. /**
  2098. * 初始化退费重收费明细表格
  2099. */
  2100. function initRefundChargeDetailTable(chargeItemCodes) {
  2101. $('#refund_fee_table').bootstrapTable("destroy");
  2102. $('#refund_fee_table').bootstrapTable({
  2103. url: '/thmz/getNewListForRefundFee', //请求后台的URL(*)
  2104. method: 'post', //请求方式(*)
  2105. toolbar: '#toolbar', //工具按钮用哪个容器
  2106. striped: true, //是否显示行间隔色
  2107. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  2108. pagination: false, //是否显示分页(*)
  2109. sortable: true, //是否启用排序
  2110. sortOrder: "asc", //排序方式
  2111. // sortName: 'orderNo', //排序字段
  2112. queryParams: queryParamsForRefundDetail(chargeItemCodes), //传递参数(*)
  2113. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  2114. pageNumber: 1, //初始化加载第一页,默认第一页
  2115. pageSize: 10, //每页的记录行数(*)
  2116. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  2117. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  2118. strictSearch: true,
  2119. showColumns: false, //是否显示所有的列
  2120. showRefresh: false, //是否显示刷新按钮
  2121. minimumCountColumns: 2, //最少允许的列数
  2122. clickToSelect: true, //是否启用点击选中行
  2123. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  2124. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  2125. cardView: false, //是否显示详细视图
  2126. detailView: false,
  2127. //rowStyle:rowStyle,//通过自定义函数设置行样式
  2128. ajaxOptions: {
  2129. headers: {
  2130. 'Accept': 'application/json',
  2131. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2132. }
  2133. },
  2134. columns: [
  2135. // {
  2136. // checkbox: true
  2137. // },
  2138. {
  2139. field: 'patientId',
  2140. title: '患者编号',
  2141. align: "center",
  2142. valign: 'middle',
  2143. }, {
  2144. field: 'name',
  2145. title: '患者姓名',
  2146. align: "center",
  2147. valign: 'middle',
  2148. }, {
  2149. field: 'oriAmount',
  2150. title: '已收金额(元)',
  2151. align: "center",
  2152. valign: 'middle',
  2153. }, {
  2154. field: 'refundFee',
  2155. title: '应退金额(元)',
  2156. align: "center",
  2157. valign: 'middle'
  2158. }, {
  2159. field: 'amount',
  2160. title: '应收金额(元)',
  2161. align: "center",
  2162. valign: 'middle',
  2163. formatter: function (value, row, index) {
  2164. return Math.abs(value);
  2165. }
  2166. }, {
  2167. title: '操作',
  2168. align: "center",
  2169. valign: 'middle',
  2170. // sortable: true,
  2171. formatter: function (value, row, index) {
  2172. var str = "";
  2173. if (row.amount == 0 || row.amount == null || row.amount == undefined) {
  2174. str = '<button type="button" class="can-not-used" title="费用明细" ><i id="plusOrMinus" class="fa fa-plus"></i></button>';
  2175. } else {
  2176. str = '<button type="button" class="registration-no-color-foot-button" title="费用明细" onclick="initMzChargeDetailByBillItem(true)"><i id="plusOrMinus" class="fa fa-plus"></i></button>';
  2177. }
  2178. str += '<button type="button" class="registration-no-color-foot-button"title="确认退费" onclick="saveRefundFee()"><i class="fa fa-check"></i></button>';
  2179. return str;
  2180. }
  2181. }
  2182. ],
  2183. responseHandler: function (res) {
  2184. if (res == '401' || res == 401) {
  2185. window.location.href = '/thmz/login/view'
  2186. return;
  2187. }
  2188. var ress = eval(res);
  2189. if (ress.code == -1) {
  2190. new PNotify({
  2191. title: '错误提示',
  2192. text: ress.message,
  2193. type: 'error',
  2194. hide: true,
  2195. styling: 'bootstrap3'
  2196. });
  2197. return {
  2198. "total": 0,//总页数
  2199. "rows": {} //数据
  2200. };
  2201. }
  2202. $("#oriAmount").text(ress.pageViewVo.data[0].oriAmount);
  2203. $("#newAmount").text(ress.pageViewVo.data[0].amount);
  2204. $("#refundAmount").text(ress.pageViewVo.data[0].refundFee);
  2205. return {
  2206. "total": ress.pageViewVo.total,//总页数
  2207. "rows": ress.pageViewVo.data //数据
  2208. };
  2209. },
  2210. });
  2211. }
  2212. /**
  2213. * 构建列表查询参数
  2214. * @param chargeItemCodes
  2215. * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}}
  2216. */
  2217. function queryParamsForRefundDetail(chargeItemCodes) {
  2218. return {
  2219. patientId: $("#patientIdRefund").val(),
  2220. times: $("#timesRefund").val(),
  2221. receiptNo: $("#receiptNoRefund").val(),
  2222. chargeItemCodes: chargeItemCodes
  2223. };
  2224. };
  2225. /**
  2226. * 关闭预退费窗口
  2227. */
  2228. function closeRefundFeeDetailModal() {
  2229. $("#refundFeeDetailModal").modal("hide");
  2230. }
  2231. /**
  2232. * 提交退费操作
  2233. */
  2234. function saveRefundFee() {
  2235. var params = queryParamsForRefundByBillItem(null);
  2236. $.ajax({
  2237. type: "POST",
  2238. url: '/thmz/saveRefundFee',
  2239. contentType: "application/json;charset=UTF-8",
  2240. dataType: "json",
  2241. data: JSON.stringify(params),
  2242. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2243. success: function (res) {
  2244. if (res == '401' || res == 401) {
  2245. window.location.href = '/thmz/login/view'
  2246. return;
  2247. }
  2248. if (res.code == 0) {
  2249. new PNotify({
  2250. title: '操作提示',
  2251. text: res.message,
  2252. type: 'success',
  2253. hide: true,
  2254. styling: 'bootstrap3'
  2255. });
  2256. $("#refundFeeModal").modal("hide");
  2257. if (res.times > 0) {
  2258. prn1Print(res.patientId, res.times, false, 1);
  2259. } else {
  2260. initFeeTable();
  2261. }
  2262. } else {
  2263. new PNotify({
  2264. title: '错误提示',
  2265. text: res.message,
  2266. type: 'error',
  2267. hide: true,
  2268. styling: 'bootstrap3'
  2269. });
  2270. }
  2271. }
  2272. });
  2273. }
  2274. /**
  2275. * 清空查询条件
  2276. */
  2277. function cleanParams() {
  2278. $("#deptNoParam").selectpicker('val', null);//默认选中
  2279. $("#deptNoParam").selectpicker('refresh');
  2280. $("#doctorParam").selectpicker('val', null);//默认选中
  2281. $("#doctorParam").selectpicker('refresh');
  2282. $("#cardNo").val(null);
  2283. $("#name").val(null);
  2284. $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
  2285. $("#patientId").val(null);
  2286. //默认光标在卡号输入框
  2287. $("#cardNo").focus();
  2288. $("#serialNo").val(null);
  2289. $("#ownData").removeAttr("checked");
  2290. }
  2291. /**
  2292. * 增加收费方式
  2293. */
  2294. function addPayType(id) {
  2295. // var arr = $("#payForm").find("div.pay-item");
  2296. // if (arr.length > 0) {
  2297. // for (var i = 0; i < arr.length; i++) {
  2298. // var temp = parseFloat($(arr[i]).find("input").val());
  2299. // if (temp == 0) {
  2300. // new PNotify({
  2301. // title: '错误提示',
  2302. // text: "存在未使用的收款方式,请不要重复添加!",
  2303. // type: 'error',
  2304. // hide: true,
  2305. // styling: 'bootstrap3'
  2306. // });
  2307. // return;
  2308. // }
  2309. // }
  2310. // }
  2311. var payTypeId = null;
  2312. if (id != undefined && id != null) {
  2313. payTypeId = id;
  2314. } else {
  2315. var payTypeIndex = $("#payTypeIndex").val();
  2316. payTypeId = "payType_" + payTypeIndex;
  2317. }
  2318. 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>';
  2319. $("#changeAmountParent").before(html);
  2320. initChequeType(payTypeId)
  2321. if (payTypeIndex != undefined && payTypeIndex != null) {
  2322. payTypeIndex = Add(payTypeIndex, 1);
  2323. $("#payTypeIndex").val(payTypeIndex);
  2324. }
  2325. $("#addPayType").parent().removeClass("in").addClass("hide");
  2326. }
  2327. // /**
  2328. // * 取消费用上传
  2329. // */
  2330. // function cancelFee() {
  2331. // var patientId = $("#patientIdHaveTally").val();
  2332. // var times = $("#timesHaveTally").val();
  2333. // var receiptNo = $("#receiptNoHaveTally").val();
  2334. // $.ajax({
  2335. // type: "POST",
  2336. // url: '/thmz/cancelTmFee',
  2337. // contentType: "application/json;charset=UTF-8",
  2338. // dataType: "json",
  2339. // data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
  2340. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2341. // async: false,
  2342. // success: function (res) {
  2343. // if (res == '401' || res == 401) {
  2344. // window.location.href = '/thmz/login/view'
  2345. // return;
  2346. // }
  2347. // if (res.code == 0) {
  2348. // $("#fundPay").val(0);
  2349. // } else {
  2350. // new PNotify({
  2351. // title: '错误提示',
  2352. // text: res.message,
  2353. // type: 'error',
  2354. // hide: true,
  2355. // styling: 'bootstrap3'
  2356. // });
  2357. // }
  2358. // }
  2359. // });
  2360. // }
  2361. /**
  2362. * 查询当前门诊缴费订单的所有缴费方式列表
  2363. * @param patientId
  2364. * @param times
  2365. * @param receiptNo
  2366. */
  2367. function showChequType(patientId, times, receiptNo) {
  2368. $("#depositFileModal").modal();
  2369. $('#deposit_file_detail_table').bootstrapTable("destroy");
  2370. $('#deposit_file_detail_table').bootstrapTable({
  2371. url: '/thmz/getAllDepositFileForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + Math.abs(receiptNo), //请求后台的URL(*)
  2372. method: 'get', //请求方式(*)
  2373. toolbar: '#toolbar', //工具按钮用哪个容器
  2374. striped: true, //是否显示行间隔色
  2375. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  2376. pagination: false, //是否显示分页(*)
  2377. sortable: true, //是否启用排序
  2378. sortOrder: "asc", //排序方式
  2379. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  2380. pageNumber: 1, //初始化加载第一页,默认第一页
  2381. pageSize: 5, //每页的记录行数(*)
  2382. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  2383. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  2384. strictSearch: true,
  2385. showColumns: false, //是否显示所有的列
  2386. showRefresh: false, //是否显示刷新按钮
  2387. minimumCountColumns: 2, //最少允许的列数
  2388. clickToSelect: true, //是否启用点击选中行
  2389. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  2390. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  2391. cardView: false, //是否显示详细视图
  2392. detailView: false,
  2393. //rowStyle:rowStyle,//通过自定义函数设置行样式
  2394. ajaxOptions: {
  2395. headers: {
  2396. 'Accept': 'application/json',
  2397. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2398. }
  2399. },
  2400. columns: [
  2401. // {
  2402. // checkbox: true,
  2403. // },
  2404. {
  2405. field: 'patientId',
  2406. title: '病人编号',
  2407. align: "center",
  2408. valign: 'middle'
  2409. }, {
  2410. field: 'times',
  2411. title: '就诊次数',
  2412. align: "center",
  2413. valign: 'middle',
  2414. }, {
  2415. field: 'amount',
  2416. title: '支付金额(元)',
  2417. align: "center",
  2418. valign: 'middle',
  2419. formatter: function (value, row, index) {
  2420. return value.toFixed(2);
  2421. }
  2422. },
  2423. {
  2424. field: 'chequeTypeName',
  2425. title: '支付方式',
  2426. align: "center",
  2427. valign: 'middle'
  2428. }
  2429. ],
  2430. onDblClickRow: function (row) {
  2431. editChequType(row.receiptSn, row.chequeType, row.dcountNo, row.chequeTypeName);
  2432. },
  2433. responseHandler: function (res) {
  2434. if (res == '401' || res == 401) {
  2435. window.location.href = '/thmz/login/view'
  2436. return;
  2437. }
  2438. var ress = eval(res);
  2439. if (ress.code == -1) {
  2440. new PNotify({
  2441. title: '错误提示',
  2442. text: ress.message,
  2443. type: 'error',
  2444. hide: true,
  2445. styling: 'bootstrap3'
  2446. });
  2447. return {
  2448. "total": 0,//总页数
  2449. "rows": {} //数据
  2450. };
  2451. }
  2452. if (ress.data == null || ress.data.length == 0) {
  2453. $("#tallyDetailModal").modal("hide");
  2454. }
  2455. return {
  2456. "rows": ress.data //数据
  2457. };
  2458. },
  2459. });
  2460. }
  2461. /**
  2462. * 修改收款方式
  2463. * @param patientId
  2464. * @param times
  2465. * @param paymode
  2466. */
  2467. function editChequType(receiptSn, chequType, dcountNo, chequeTypeName) {
  2468. var message = "当前病人本次门诊缴费的支付方式为【" + chequeTypeName + "】,确定需要修改吗?";
  2469. if (dcountNo == 1) {
  2470. message = "当前病人本次门诊缴费的支付方式为【" + chequeTypeName + "】,且本次缴费已经结算,确定需要修改吗?如仍需继续修改,会影响已经结算的报表,请重新打印本次缴费所在日期的【日结报表】!";
  2471. }
  2472. $("#editPayModeTip").html(message);
  2473. $("#receiptSn").val(receiptSn);
  2474. $("#chequType").val(chequType);
  2475. $('#payTypeEditPayMode').selectpicker('val', 1);
  2476. $('#payTypeEditPayMode').selectpicker('refresh');
  2477. $("#editPayModeModal").modal();
  2478. $("#depositFileModal").modal("hide");
  2479. }
  2480. /**
  2481. * 提交修改收款方式
  2482. */
  2483. function saveEditPayMode() {
  2484. $.ajax({
  2485. type: "GET",
  2486. url: '/thmz/updateChequType?oldChequeType=' + $("#chequType").val() + "&receiptSn=" + $("#receiptSn").val() + "&chequeType=" + $("#payTypeEditPayMode").val(),
  2487. contentType: "application/json;charset=UTF-8",
  2488. dataType: "json",
  2489. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2490. success: function (res) {
  2491. if (res == '401' || res == 401) {
  2492. window.location.href = '/thmz/login/view'
  2493. return;
  2494. }
  2495. if (res.code == 0) {
  2496. successMesage(res);
  2497. clearEditPayMode();
  2498. $("#editPayModeModal").modal("hide");
  2499. } else if (res.code == -1) {
  2500. new PNotify({
  2501. title: '错误提示',
  2502. text: res.message,
  2503. type: 'error',
  2504. hide: true,
  2505. styling: 'bootstrap3'
  2506. });
  2507. }
  2508. }
  2509. });
  2510. }
  2511. /**
  2512. * 清空
  2513. */
  2514. function clearEditPayMode() {
  2515. $("#receiptSn").val(null);
  2516. $("#chequType").val(null);
  2517. }
  2518. //
  2519. // /**
  2520. // * 反写备份表的数据到正式表中,记账的数据在备分表
  2521. // * @param patientId
  2522. // * @param times
  2523. // * @param receiptNo
  2524. // */
  2525. // function reInsertDetailModal(patientId,times ,receiptNo) {
  2526. // $.ajax({
  2527. // type: "POST",
  2528. // url: '/thmz/reSaveDetailForByjz',
  2529. // contentType: "application/json;charset=UTF-8",
  2530. // dataType: "json",
  2531. // data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
  2532. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2533. // async: false,
  2534. // success: function (res) {
  2535. // if (res == '401' || res == 401) {
  2536. // window.location.href = '/thmz/login/view'
  2537. // return;
  2538. // }
  2539. // if (res.code == 0) {
  2540. // successMesage(res);
  2541. // initFeeTable();
  2542. // } else {
  2543. // new PNotify({
  2544. // title: '错误提示',
  2545. // text: res.message,
  2546. // type: 'error',
  2547. // hide: true,
  2548. // styling: 'bootstrap3'
  2549. // });
  2550. // }
  2551. // }
  2552. // });
  2553. // }
  2554. /**
  2555. * 医保电子凭证读卡
  2556. */
  2557. function siReadCard() {
  2558. $.ajax({
  2559. type: "GET",
  2560. url: 'http://localhost:8321/readcard/entry?param=qrcode_01101',
  2561. contentType: "application/json;charset=UTF-8",
  2562. dataType: "json",
  2563. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2564. success: function (res) {
  2565. if (res == '401' || res == 401) {
  2566. window.location.href = '/thmz/login/view'
  2567. return;
  2568. }
  2569. //console.log(res);
  2570. if (res.code == 200) {
  2571. var data = JSON.parse(res.data);
  2572. queryUserInfoBySocialNoNotFillPatient('cardNo', "" + data.data.idNo + "", initFeeTable, null);
  2573. } else {
  2574. errorMesage(res);
  2575. }
  2576. }
  2577. });
  2578. // window.open('ReadCard://'+prm, '_self')
  2579. }
  2580. /**
  2581. * 读卡类型改变事件
  2582. */
  2583. function mztczfSiReadCardTypeChange() {
  2584. var grzhzf = $("#grzhzf").val();
  2585. if (grzhzf == null || grzhzf == "") {
  2586. errorMesageSimaple("请先选择是否使用个人账户余额支付剩余门诊费用!")
  2587. $('#mztczfSiReadCardType').selectpicker('val', null);
  2588. $('#mztczfSiReadCardType').selectpicker('refresh');
  2589. return;
  2590. }
  2591. var mztczfSiReadCardType = $("#mztczfSiReadCardType").val();
  2592. if (mztczfSiReadCardType == null || mztczfSiReadCardType == "") {
  2593. return;
  2594. }
  2595. var url = "http://localhost:8321/readcard/entry?param=";
  2596. if (mztczfSiReadCardType == "03") {
  2597. url+='sicard_01101';
  2598. } else if (mztczfSiReadCardType == "01") {
  2599. url+= 'qrcode_01101';
  2600. } else if (mztczfSiReadCardType == "02") {
  2601. url+= 'idcard_01101';
  2602. }
  2603. $.ajax({
  2604. type: "GET",
  2605. url: url,
  2606. contentType: "application/json;charset=UTF-8",
  2607. dataType: "json",
  2608. headers: {
  2609. 'Accept': 'application/json',
  2610. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2611. },
  2612. success: function (res) {
  2613. if (res == '401' || res == 401) {
  2614. window.location.href = '/thmz/login/view'
  2615. return;
  2616. }
  2617. //console.log(res);
  2618. if (res.code == 200) {
  2619. if(mztczfSiReadCardType == "01"){
  2620. var data = JSON.parse(res.data);
  2621. $("#readCardResult").val(JSON.stringify(data.data));
  2622. }else {
  2623. $("#readCardResult").val(res.data);
  2624. }
  2625. successMesageSimaple("读卡成功,可以进行医保结算操作。");
  2626. $("#mztczfSiReadCardModal").modal("hide");
  2627. } else {
  2628. warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!")
  2629. console.log(res);
  2630. //errorMesage(res);
  2631. }
  2632. },
  2633. error: function (XMLHttpRequest, textStatus, errorThrown) {
  2634. warningMesageSimaple("读卡异常,可以稍后重试或者自费结算(不享受门诊统筹)!")
  2635. }
  2636. });
  2637. }
  2638. /**
  2639. * 打开读卡类型弹窗
  2640. */
  2641. function mztczfSiReadCardTypeModel() {
  2642. $("#readCardResult").val(null);
  2643. $('#mztczfSiReadCardType').selectpicker('val', null);
  2644. $('#mztczfSiReadCardType').selectpicker('refresh');
  2645. $('#grzhzf').selectpicker('val', null);
  2646. $('#grzhzf').selectpicker('refresh');
  2647. $("#mztczfSiReadCardModal").modal();
  2648. }
  2649. /**
  2650. * 医保结算
  2651. * @param patientId
  2652. * @param times
  2653. */
  2654. function directRegistration(patientId, times) {
  2655. $.ajax({
  2656. type: "POST",
  2657. url: '/thmz/directRegistration',
  2658. contentType: "application/json;charset=UTF-8",
  2659. dataType: "json",
  2660. data: JSON.stringify({
  2661. patientId: patientId,
  2662. times: times,
  2663. readCardResult: $("#readCardResult").val(),
  2664. grzhzf: $("#grzhzf").val(),
  2665. readCardType:$("#mztczfSiReadCardType").val()
  2666. }),
  2667. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2668. success: function (res) {
  2669. if (res == '401' || res == 401) {
  2670. window.location.href = '/thmz/login/view'
  2671. return;
  2672. }
  2673. if (res.code == 0) {
  2674. successMesage(res);
  2675. } else {
  2676. errorMesage(res);
  2677. }
  2678. }
  2679. });
  2680. }