toll_administration.js 163 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311
  1. //@ sourceURL=toll_administration.js
  2. var LODOP; //声明为全局变量
  3. //默认打印机下标
  4. var printIndex = -1;
  5. //选中的要退的费用收费编码
  6. var chargeItemCodes = null;
  7. //门诊结算单地址
  8. var mzjsdHost = null;
  9. var readPatientId ='';
  10. var readTimes = null
  11. var fpVsesionNo = 0;
  12. var hospitalName ='沭阳铭和医院'
  13. $(function () {
  14. getAjaxRequst("/thmz/queryHospitalName",{},true,function (res) {
  15. hospitalName = res.data
  16. })
  17. //默认光标在卡号输入框
  18. $("#cardNo").focus();
  19. init_daterangepicker();
  20. initFpVersion();
  21. initSelect();
  22. // initConsumeChequeType();
  23. initFeeTable();
  24. //卡号输入改变事件
  25. cardNoChange();
  26. //重置查询参数
  27. $('#btn_clean').click(function () {
  28. cleanParams();
  29. });
  30. //初始化页面上面的按钮事件
  31. //查询
  32. $('#btn_query').click(function () {
  33. initFeeTable();
  34. });
  35. // //财务工具包
  36. // $('#btn_tools').click(function () {
  37. // $("#toolsModal").modal();
  38. // });
  39. /**
  40. * 增加收款方式按钮事件
  41. */
  42. $("#addPayType").on("click", function () {
  43. addPayType(null);
  44. });
  45. //初始门诊收银方式下拉选
  46. initChequeType("payType");
  47. //初始门诊收银方式下拉选
  48. initChequeType("payTypeEditPayMode");
  49. setTimeout(function () {
  50. getLodop();
  51. }, 800);
  52. /**
  53. * 核酸检测跳转过来的直接刷新待收费列表
  54. */
  55. if (patientIdFullForNucleicAcid != null && patientIdFullForNucleicAcid != "") {
  56. $("#cardNo").val(patientIdFullForNucleicAcid);
  57. $("#patientId").val(patientIdFullForNucleicAcid);
  58. initFeeTable();
  59. }
  60. /**
  61. * 医保电子凭证读卡
  62. */
  63. $("#siReadCard").on("click", function (t) {
  64. // siReadCard("qrcode_01101");
  65. siReadCard("jiangsu_qrcode_01101");
  66. });
  67. /**
  68. * 医保刷脸
  69. */
  70. $("#siReadCardFace").on("click", function (t) {
  71. // siReadCard("face_01101");
  72. siReadCard("jiangsu_face_01101");
  73. });
  74. //获取门诊医保结算单打印服务地址
  75. $.ajax({
  76. type: "GET",
  77. url: '/thmz/getMzjsdHost',
  78. dataType: "json",
  79. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  80. success: function (res) {
  81. if (res == '401' || res == 401) {
  82. window.location.href = '/thmz/login/view'
  83. return;
  84. }
  85. mzjsdHost = res.data;
  86. }
  87. });
  88. /**
  89. * 刷卡/扫码
  90. */
  91. $("#consume").on("click", function (t) {
  92. consume();
  93. });
  94. });
  95. function getCurrentTime() {
  96. const now = new Date();
  97. const year = now.getFullYear().toString();
  98. const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始
  99. const day = String(now.getDate()).padStart(2, '0');
  100. const hours = String(now.getHours()).padStart(2, '0');
  101. const minutes = String(now.getMinutes()).padStart(2, '0');
  102. const seconds = String(now.getSeconds()).padStart(2, '0');
  103. return `${year}${month}${day}${hours}${minutes}${seconds}`;
  104. };
  105. function getEBill(serialNo) {
  106. $.ajax({
  107. type: "POST",
  108. url: 'http://130.150.161.72:9206/thyy/api/public/ebill/invoicequery',
  109. contentType: "application/json;charset=UTF-8",
  110. dataType: "json",
  111. data: JSON.stringify({
  112. "timestamp":this.getCurrentTime(),
  113. "busseqno":serialNo,
  114. }),
  115. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  116. success: function (res) {
  117. // console.log('getEBill',res);
  118. if(res.code == 1 && res.data.invoice_url){
  119. successMesageSimaple("电子发票查询成功!")
  120. }
  121. }
  122. })
  123. };
  124. function downloadEBill(serialNo) {
  125. $.ajax({
  126. type: "POST",
  127. url: 'http://130.150.161.72:9206/thyy/api/public/ebill/invoicedownload',
  128. contentType: "application/json;charset=UTF-8",
  129. dataType: "json",
  130. data: JSON.stringify({
  131. "timestamp":this.getCurrentTime(),
  132. "busseqno": serialNo,
  133. }),
  134. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  135. success: function (res) {
  136. if(res.code == 1 && res.data.invoicefiledata){
  137. base64toPDF(res.data.invoicefiledata)
  138. }
  139. }
  140. })
  141. };
  142. //function issueEBill(realNo,amount,name,doctorCode) {
  143. // $.ajax({
  144. // type: "POST",
  145. // url: 'http://localhost:9206/thyy/api/public/ebill/invoicehisissue',
  146. // contentType: "application/json;charset=UTF-8",
  147. // dataType: "json",
  148. // data: JSON.stringify({
  149. // "timestamp":this.getCurrentTime(),
  150. // "busseqno":realNo,
  151. // "bustype": "02",
  152. // "totalAmount":amount,
  153. // "payerPartyType":"1",
  154. // "payerPartyName":name,
  155. // "bizcode":realNo,
  156. // "handlingPerson":doctorCode,
  157. //
  158. //
  159. // }),
  160. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  161. // success: function (res) {
  162. // console.log('issueEBill',res);
  163. // if(res.code == 1 && res.data.invoice_url){
  164. //
  165. // // successMesageSimaple("电子发票查询成功!")
  166. // }
  167. // }
  168. // })
  169. //};
  170. /**
  171. * 列表类型按钮切换事件
  172. * @param object
  173. */
  174. function payMarkButtonChange(object) {
  175. $("#pay_mark_group").find("button").each(function (index, element) {
  176. if ($(element).hasClass("btn-primary")) {
  177. $(element).removeClass("btn-primary").addClass("btn-default");
  178. }
  179. });
  180. $(object).removeClass("btn-default").addClass("btn-primary");
  181. initFeeTable();
  182. }
  183. /**
  184. * 收费明细类型按钮切换事件
  185. * @param object
  186. */
  187. function billItemButtonChange(object) {
  188. $("#bill_item_group").find("button").each(function (index, element) {
  189. if ($(element).hasClass("btn-primary")) {
  190. $(element).removeClass("btn-primary").addClass("btn-default");
  191. }
  192. });
  193. $(object).removeClass("btn-default").addClass("btn-primary");
  194. initChargeDetailTable();
  195. //默认光标在卡号输入框
  196. $("#cardNo").focus();
  197. }
  198. /**
  199. * 收费明细类型按钮切换事件
  200. * @param object
  201. */
  202. function refundBillItemButtonChange(object) {
  203. $("#refund_bill_item_group").find("button").each(function (index, element) {
  204. if ($(element).hasClass("btn-primary")) {
  205. $(element).removeClass("btn-primary").addClass("btn-default");
  206. }
  207. });
  208. $(object).removeClass("btn-default").addClass("btn-primary");
  209. initMzChargeDetailByBillItem(false);
  210. }
  211. //初始化版本电子发票版本
  212. function initFpVersion() {
  213. getAjaxRequst("/thmz/queryFpVersion",{},true,function (res) {
  214. console.log('发票版本=',res.data)
  215. fpVsesionNo = res.data;
  216. })
  217. }
  218. /**
  219. * 初始化下拉选
  220. */
  221. function initSelect() {
  222. $(".selectpicker").selectpicker({
  223. dropuAuto: false
  224. });
  225. initDeptSelect();
  226. initDoctorSelect();
  227. initCooperativeEnterprisesSelect();
  228. initMztczfSiReadCardTypeSelect();
  229. initTfGrzhzfSelect()
  230. }
  231. /**
  232. * 初始化读卡类型
  233. */
  234. function initMztczfSiReadCardTypeSelect() {
  235. // // $('#mztczfSiReadCardType').html("<option value='03'>社保卡</option><option value='01'>电子凭证</option><option value='02'>身份证</option><option value='04'>刷脸</option>");
  236. // $('#mztczfSiReadCardType').html("<option value='03'>社保卡</option><option value='01'>电子凭证</option><option value='04'>刷脸</option>");
  237. // $('#mztczfSiReadCardType').selectpicker('refresh');
  238. // var selectHtml = '<option value="0">否</option><option value="1">使用个账</option><option value="2">使用共济账户</option>';
  239. // $('#grzhzf').html(selectHtml);
  240. // $('#grzhzf').selectpicker('refresh');
  241. // 读卡类型和个账支付已改为单选框,不需要初始化下拉框
  242. initAdvmPro('mztczfAdvmPro')
  243. }
  244. function initTfGrzhzfSelect() {
  245. var selectHtml = '<option value="0">否</option><option value="1">使用个账</option><option value="2">使用共济账户</option>';
  246. $('#tfGrzhzf').html(selectHtml);
  247. $('#tfGrzhzf').selectpicker('refresh');
  248. initAdvmPro('tfAdvmPro')
  249. }
  250. //初始化参保地省
  251. function initAdvmPro(proId) {
  252. getAjaxRequst("/thmz/queryProvinceCodes",{},true,function (res) {
  253. if(res.code == 0 && res.data !=null && res.data.length > 0){
  254. let selectHtml = '';
  255. for (let i=0 ; i <res.data.length; i++ ){
  256. // 如果是医保读卡弹窗的省份选择,默认选中江苏省
  257. let selected = (proId === 'mztczfAdvmPro' && res.data[i].code === '320000') ? ' selected' : '';
  258. selectHtml+= `<option value="${res.data[i].code}"${selected}>${res.data[i].code} ${res.data[i].name}</option>`
  259. }
  260. $('#'+proId).html(selectHtml);
  261. $('#'+proId).selectpicker('refresh');
  262. // 如果是医保读卡弹窗且选中了江苏省,自动加载城市列表
  263. if(proId === 'mztczfAdvmPro' && $('#'+proId).val() === '320000') {
  264. cityChange('mztczfAdvmPro', 'mztczfAdvmCity');
  265. }
  266. }
  267. })
  268. }
  269. //初始化参保地市
  270. function cityChange(proId,cityId) {
  271. let code = $('#'+proId).val()
  272. postAjaxJsonHttpRequst("/thmz/queryCityCodes",{code:code},true,function (res) {
  273. if(res.code == 0 && res.data !=null && res.data.length > 0){
  274. let selectHtml = '';
  275. let suqianCityCode = null; // 用于存储宿迁市的code
  276. for (let i=0 ; i <res.data.length; i++ ){
  277. selectHtml+= `<option value="${res.data[i].code}">${res.data[i].code} ${res.data[i].name}</option>`
  278. // 查找宿迁市的code,优先使用code匹配,其次使用name匹配
  279. if(cityId === 'mztczfAdvmCity') {
  280. if(res.data[i].code === '321300' || res.data[i].name.includes('宿迁市')) {
  281. suqianCityCode = res.data[i].code;
  282. }
  283. }
  284. }
  285. $('#'+cityId).html(selectHtml);
  286. $('#'+cityId).selectpicker('refresh');
  287. // 如果是医保读卡弹窗且找到了宿迁市,设置为默认选中
  288. if(cityId === 'mztczfAdvmCity' && suqianCityCode) {
  289. $('#'+cityId).selectpicker('val', suqianCityCode);
  290. $('#'+cityId).selectpicker('refresh');
  291. }
  292. }
  293. })
  294. }
  295. /**
  296. * 挂号列表中的科室列表
  297. */
  298. function initDeptSelect() {
  299. //科室列表
  300. $.ajax({
  301. type: "GET",
  302. url: '/thmz/allMzUnitCode',
  303. dataType: "json",
  304. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  305. success: function (data) {
  306. if (data == '401' || data == 401) {
  307. window.location.href = '/thmz/login/view'
  308. return;
  309. }
  310. var html = '';
  311. $.each(data.data, function (commentIndex, comment) {
  312. html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';
  313. });
  314. $('#deptNoParam').empty();
  315. $('#deptNoParam').html(html);
  316. $('#deptNoParam').selectpicker('refresh');
  317. }
  318. });
  319. }
  320. /**
  321. * 挂号列表中的医生列表初始化
  322. */
  323. function initDoctorSelect() {
  324. //医生列表
  325. $.ajax({
  326. type: "GET",
  327. url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNoParam').val(),
  328. dataType: "json",
  329. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  330. success: function (res) {
  331. if (res == '401' || res == 401) {
  332. window.location.href = '/thmz/login/view'
  333. return;
  334. }
  335. var html = '';
  336. $.each(res.data, function (commentIndex, comment) {
  337. html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + '</option>';
  338. });
  339. $('#doctorParam').empty();
  340. $('#doctorParam').html(html);
  341. $('#doctorParam').selectpicker('destroy').selectpicker('refresh');
  342. }
  343. });
  344. }
  345. /**
  346. * 合作企业列表
  347. */
  348. function initCooperativeEnterprisesSelect() {
  349. $.ajax({
  350. type: "GET",
  351. url: '/thmz/getAllCooperativeEnterprises',
  352. dataType: "json",
  353. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  354. success: function (res) {
  355. if (res == '401' || res == 401) {
  356. window.location.href = '/thmz/login/view'
  357. return;
  358. }
  359. var html = '';
  360. $.each(res.data, function (commentIndex, comment) {
  361. html += '<option value="' + comment.id + '">' + comment.projectName + " " + comment.contractNo + '</option>';
  362. });
  363. $('#project').empty();
  364. $('#project').html(html);
  365. $('#project').selectpicker('destroy').selectpicker('refresh');
  366. $('#projectCharged').empty();
  367. $('#projectCharged').html(html);
  368. $('#projectCharged').selectpicker('destroy').selectpicker('refresh');
  369. }
  370. });
  371. }
  372. var $table_1;
  373. /**
  374. * 初始化收费表格
  375. */
  376. function initFeeTable() {
  377. var payMarkGroup = getIndex("pay_mark_group");
  378. var timeColumusName = "处方时间";
  379. var timeColumus = "priceTime";
  380. $("#refundFeeTip").removeClass("in").addClass("hide");
  381. $("#chargeFeeTip").removeClass("hide").addClass("in");
  382. if (payMarkGroup == 1) {
  383. timeColumusName = "缴费时间";
  384. timeColumus = "chargeDate";
  385. $("#refundFeeTip").removeClass("hide").addClass("in");
  386. $("#chargeFeeTip").removeClass("in").addClass("hide");
  387. } else if (payMarkGroup == 2) {
  388. timeColumusName = "退费时间";
  389. timeColumus = "inputDate";
  390. }
  391. var patientId = $("#patientId").val();
  392. //查询记账信息
  393. if (payMarkGroup == 0 && patientId != null && patientId != '') {
  394. $("#patientIdHaveTally").val(patientId);
  395. $.ajax({
  396. type: "GET",
  397. url: '/thmz/getTallyTotalCharge?patientId=' + patientId,
  398. contentType: "application/json;charset=UTF-8",
  399. dataType: "json",
  400. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  401. success: function (res) {
  402. if (res == '401' || res == 401) {
  403. window.location.href = '/thmz/login/view'
  404. return;
  405. }
  406. if (res.code == 0) {
  407. if (res.data != null && res.data > 0) {
  408. $("#haveTallyModal").modal();
  409. $("#totalTallyAmount").text(res.data.toFixed(2));
  410. } else {
  411. $("#haveTallyModal").modal('hide');
  412. }
  413. } else {
  414. new PNotify({
  415. title: '错误提示',
  416. text: res.message,
  417. type: 'error',
  418. hide: true,
  419. styling: 'bootstrap3'
  420. });
  421. }
  422. }
  423. });
  424. }
  425. $('#tb_table').bootstrapTable("destroy");
  426. $table_1 = $('#tb_table').bootstrapTable({
  427. url: '/thmz/listMzChargeDetail', //请求后台的URL(*)
  428. method: 'post', //请求方式(*)
  429. toolbar: '#toolbar', //工具按钮用哪个容器
  430. striped: true, //是否显示行间隔色
  431. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  432. pagination: true, //是否显示分页(*)
  433. sortable: true, //是否启用排序
  434. sortOrder: "asc", //排序方式
  435. queryParams: queryParams, //传递参数(*)
  436. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  437. pageNumber: 1, //初始化加载第一页,默认第一页
  438. pageSize: 5, //每页的记录行数(*)
  439. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  440. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  441. strictSearch: true,
  442. showColumns: false, //是否显示所有的列
  443. showRefresh: false, //是否显示刷新按钮
  444. minimumCountColumns: 2, //最少允许的列数
  445. clickToSelect: true, //是否启用点击选中行
  446. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  447. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  448. cardView: false, //是否显示详细视图
  449. detailView: false,
  450. //rowStyle:rowStyle,//通过自定义函数设置行样式
  451. ajaxOptions: {
  452. headers: {
  453. 'Accept': 'application/json',
  454. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  455. }
  456. },
  457. columns: [
  458. // {
  459. // checkbox: true
  460. // },
  461. {
  462. field: 'realNo',
  463. title: '缴费流水号',
  464. align: "center",
  465. valign: 'middle',
  466. formatter: function (value, row, index) {
  467. return Math.abs(value);
  468. }
  469. }, {
  470. field: 'patientId',
  471. title: '患者编号',
  472. align: "center",
  473. valign: 'middle',
  474. }, {
  475. field: 'name',
  476. title: '患者姓名',
  477. align: "center",
  478. valign: 'middle',
  479. },
  480. {
  481. field: 'times',
  482. title: '就诊次数',
  483. align: "center",
  484. valign: 'middle',
  485. }, {
  486. field: 'visitTypeName',
  487. title: '患者身份',
  488. align: "center",
  489. valign: 'middle',
  490. },
  491. {
  492. field: 'orderTypeName',
  493. title: '处方类型',
  494. align: "center",
  495. valign: 'middle',
  496. },
  497. {
  498. field: 'receiptNo',
  499. title: '结算次数',
  500. align: "center",
  501. valign: 'middle',
  502. formatter: function (value, row, index) {
  503. return Math.abs(value);
  504. }
  505. }, {
  506. field: 'notDiscountAmount',
  507. title: '订单金额(元)',
  508. align: "center",
  509. valign: 'middle',
  510. formatter: function (value, row, index) {
  511. return Math.abs(value).toFixed(2);
  512. }
  513. }, {
  514. field: 'discountAmount',
  515. title: '优惠总额(元)',
  516. align: "center",
  517. valign: 'middle',
  518. formatter: function (value, row, index) {
  519. return Math.abs(value).toFixed(2);
  520. }
  521. }, {
  522. field: 'amount',
  523. title: '应付金额(元)',
  524. align: "center",
  525. valign: 'middle',
  526. formatter: function (value, row, index) {
  527. return Math.abs(value).toFixed(2);
  528. }
  529. }, {
  530. field: 'warnDept',
  531. title: '科室',
  532. align: "center",
  533. valign: 'middle',
  534. }, {
  535. field: 'doctorCode',
  536. title: '医生',
  537. align: "center",
  538. valign: 'middle',
  539. }, {
  540. field: timeColumus,
  541. title: timeColumusName,
  542. align: "center",
  543. valign: 'middle',
  544. formatter: function (value, row, index) {
  545. if (value == null || value == "") {
  546. return "";
  547. }
  548. return format(value, "yyyy-MM-dd HH:mm:ss");
  549. }
  550. }, {
  551. title: '操作',
  552. align: "center",
  553. valign: 'middle',
  554. // sortable: true,
  555. formatter: function (value, row, index) {
  556. var buttonCodes = localStorage.getItem("buttonCodes");
  557. 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>';
  558. 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>';
  559. var payMarkGroup = getIndex("pay_mark_group");
  560. if (payMarkGroup == 0) {
  561. if(row.countYbZf !=null && row.countYbZf > 0 ){
  562. str += '<button type="button" class="registration-no-color-foot-button"title="医保读卡" onclick="mztczfSiReadCardTypeModel(\'' + row.patientId + '\',' + row.times + ')"><i class="fa fa-newspaper-o"></i></button>';
  563. 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>';
  564. }
  565. 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>';
  566. if (buttonCodes != null) {
  567. if (isInArrayStr("init_clinic_for_exception", buttonCodes)) {
  568. str += '<button type="button" class="registration-no-color-foot-button" title="就诊记录修复" onclick="initClinicForException(\'' + row.patientId + '\',' + row.times + ',\'5\',' + row.receiptNo + ');"><i class="fa fa-wrench"></i></button>';
  569. }
  570. }
  571. if(row.orderLockFlag != null && row.orderLockFlag == 1){
  572. str += '<button type="button" class="registration-no-color-foot-button" title="解锁处方" onclick="deleteOrderLock(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-remove"></i></button>';
  573. }
  574. return str;
  575. }
  576. if (payMarkGroup == 1) {
  577. // 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>' ;
  578. if(isInArrayStr("mz_refund", buttonCodes)){
  579. str += '<button type="button" class="registration-no-color-foot-button" title="退费" onclick="refundFee(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ',' + row.printFlag+',\'' + row.orderTypeName +'\''+ ');"><i class="fa fa-reply"></i></button>';
  580. }
  581. if (row.printFlag == 0 && fpVsesionNo == 0) {
  582. 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>';
  583. } else if (row.printFlag == 1 && fpVsesionNo == 0) {
  584. 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>';
  585. 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>';
  586. }
  587. if(fpVsesionNo == 1){
  588. str += '<button type="button" class="registration-no-color-foot-button" title="上传电子发票" onclick="printDzfp(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo +',1'+ ');" style="color: #35D082;"><i class="fa fa-upload"></i></button>';
  589. // str += '<button type="button" class="registration-no-color-foot-button" title="开具电子发票" onclick="issueEBill(\'' + row.realNo + '\',' + row.amount + ',\'' + row.name + '\',\'' + row.doctorCode +'\'' + ');" style="color: #35D082;"><i class="fa fa-sign-in"></i></button>';
  590. str += '<button type="button" class="registration-no-color-foot-button"title="下载电子发票" onclick="openDzfpDownModal(\'' + row.patientId + '\',' + row.times +',\'' + row.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';
  591. str += '<button type="button" class="registration-no-color-foot-button"title="查询电子发票" onclick="getEBill(\'' + row.serialNo+ '\',)"><i class="fa fa-search"></i></button>';
  592. // str += '<button type="button" class="registration-no-color-foot-button"title="下载电子发票" onclick="downloadEBill(\'' + row.serialNo+ '\',)"><i class="fa fa-download"></i></button>';
  593. }
  594. str += '<button type="button" class="registration-no-color-foot-button"title="支付明细" onclick="depositFileList(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-th-list"></i></button>';
  595. //是否有权限设置合同编号
  596. if (buttonCodes != null) {
  597. if (isInArrayStr("contract_match", buttonCodes)) {
  598. str += '<button type="button" class="registration-no-color-foot-button" title="合作项目维护" onclick="matchProject(\'' + row.realNo + '\');"><i class="fa fa-plug"></i></button>';
  599. }
  600. }
  601. if (row.countYbZf > 0) {
  602. 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>';
  603. }
  604. if (row.mztcbl > 0) {
  605. str += '<button type="button" class="registration-no-color-foot-button" title="门诊统筹补录" onclick="mztcbl(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ');"><i class="fa fa-paypal"></i></button>';
  606. }
  607. if (buttonCodes != null) {
  608. if (isInArrayStr("init_clinic_for_exception", buttonCodes)) {
  609. str += '<button type="button" class="registration-no-color-foot-button" title="就诊记录修复" onclick="initClinicForException(\'' + row.patientId + '\',' + row.times + ',\'0\',' + row.receiptNo + ');"><i class="fa fa-wrench"></i></button>';
  610. }
  611. }
  612. return str;
  613. }
  614. if (payMarkGroup == 2) {
  615. str += '<button type="button" class="registration-no-color-foot-button"title="支付明细" onclick="depositFileList(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo + ')"><i class="fa fa-th-list"></i></button>';
  616. if(fpVsesionNo == 1){
  617. str += '<button type="button" class="registration-no-color-foot-button"title="电子发票作废" onclick="uploadMzInvoice(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo +',2'+ ')"><i class="fa fa-mail-reply-all"></i></button>';
  618. str += '<button type="button" class="registration-no-color-foot-button"title="下载已作废的电子发票" onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';
  619. }
  620. // 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>' ;
  621. return str;
  622. }
  623. }
  624. }
  625. ],
  626. responseHandler: function (res) {
  627. if (res == '401' || res == 401) {
  628. window.location.href = '/thmz/login/view'
  629. return;
  630. }
  631. var ress = eval(res);
  632. if (ress.code == -1) {
  633. if (ress.message != null && ress.message != '') {
  634. new PNotify({
  635. title: '错误提示',
  636. text: ress.message,
  637. type: 'error',
  638. hide: true,
  639. styling: 'bootstrap3'
  640. });
  641. }
  642. return {
  643. "total": 0,//总页数
  644. "rows": {} //数据
  645. };
  646. }
  647. // if(ress.pageViewVo.total==0){
  648. // $("#cardNo").val(null);
  649. // $("#name").val(null);
  650. // }
  651. return {
  652. "total": ress.pageViewVo.total,//总页数
  653. "rows": ress.pageViewVo.data //数据
  654. };
  655. },
  656. /**
  657. * @param {点击列的 field 名称} field
  658. * @param {点击列的 value 值} value
  659. * @param {点击列的整行数据} row
  660. * @param {td 元素} $element
  661. */
  662. onClickCell: function (field, value, row, $element) {
  663. var cardNo = $("#cardNo").val();
  664. if (cardNo == '120' && field == 'name' && (payMarkGroup == 0 || payMarkGroup == 1)) {
  665. $element.attr('contenteditable', true);
  666. $element.html(null);
  667. $element.focus();
  668. $element.blur(function () {
  669. var index = $element.parent().data('index');
  670. var tdValue = $element.html();
  671. saveData(index, field, tdValue, row, $table_1);
  672. })
  673. }
  674. },
  675. });
  676. }
  677. /**
  678. * 更新病人缴费记录病人姓名
  679. * @param index
  680. * @param field
  681. * @param value
  682. * @param row
  683. */
  684. function saveData(index, field, value, row, table) {
  685. $.ajax({
  686. type: "POST",
  687. url: '/thmz/changePatientIdName',
  688. contentType: "application/json;charset=UTF-8",
  689. dataType: "json",
  690. data: JSON.stringify({"patientId": row.patientId, "times": row.times, "name": value}),
  691. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  692. async: false,
  693. success: function (res) {
  694. if (res == '401' || res == 401) {
  695. window.location.href = '/thmz/login/view'
  696. return;
  697. }
  698. if (res.code == 0) {
  699. table.bootstrapTable('updateCell', {
  700. index: index, //行索引
  701. field: field, //列名
  702. value: value //cell值
  703. })
  704. } else {
  705. table.bootstrapTable('updateCell', {
  706. index: index, //行索引
  707. field: field, //列名
  708. value: row.name //cell值
  709. })
  710. errorMesage(res);
  711. }
  712. }
  713. });
  714. }
  715. /**
  716. * 构建列表查询参数
  717. * @param params
  718. * @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}}
  719. */
  720. function queryParams(params) {
  721. var rePortRangeArr = getRePortRangeArr();
  722. var payMarkGroup = getIndex("pay_mark_group");
  723. var temp = {
  724. mzChargeDetail: {
  725. patientId: $("#patientId").val(),
  726. warnDept: $("#deptNoParam").val(),
  727. doctorCode: $("#doctorParam").val(),
  728. name: $("#name").val(),
  729. payMark: 5
  730. },
  731. beginTime: new Date(rePortRangeArr[0]),
  732. endTime: new Date(rePortRangeArr[1]),
  733. pageSize: params.limit, //页面大小
  734. pageIndex: params.offset / params.limit, //页码
  735. serialNo: $("#serialNo").val(),
  736. ownData: $('#ownData').is(':checked') ? 0 : 1,
  737. };
  738. if (payMarkGroup == 1) {
  739. temp.mzChargeDetail.payMark = 0;
  740. } else if (payMarkGroup == 2) {
  741. temp.mzChargeDetail.payMark = 1;
  742. }
  743. console.log('param=', temp)
  744. return temp;
  745. };
  746. function initChargeDetailTable() {
  747. initChargeDetailTablePublic('/thmz/getMzChargeDetailByBillItem', $('#charge_detail_table'), queryParamsForDetail);
  748. }
  749. function initMzChargeDetailByBillItem(flag) {
  750. if (flag) {
  751. $("#refund_bill_item_group").removeClass("hide").addClass("in");
  752. if ($("#plusOrMinus").hasClass("fa-plus")) {
  753. $("#plusOrMinus").removeClass("fa-plus").addClass("fa-minus");
  754. initChargeDetailTablePublic('/thmz/getNewListForRefundFeeByBillItem', $('#refund_fee_bill_table'), queryParamsForRefundByBillItem);
  755. } else if ($("#plusOrMinus").hasClass("fa-minus")) {
  756. $("#plusOrMinus").removeClass("fa-minus").addClass("fa-plus");
  757. $("#refund_bill_item_group").removeClass("in").addClass("hide");
  758. $('#refund_fee_bill_table').bootstrapTable("destroy");
  759. }
  760. } else {
  761. initChargeDetailTablePublic('/thmz/getNewListForRefundFeeByBillItem', $('#refund_fee_bill_table'), queryParamsForRefundByBillItem);
  762. }
  763. }
  764. //撤销医保重新 申请医保电子凭证
  765. function reqYb() {
  766. let tfReadType = $("#tfReadType").val();
  767. if(!stringNotBlank($("#tfGrzhzf").val())){
  768. errorMesageSimaple('请选择是否使用个账或共济账户支付')
  769. return
  770. }
  771. if(!stringNotBlank(tfReadType)){
  772. errorMesageSimaple('请选择读卡类型')
  773. return
  774. }
  775. if(tfReadType == '02'){
  776. sfzReadCard()
  777. }else {
  778. let param = {
  779. patientId :$("#patientIdRefund").val(),
  780. times :$("#timesRefund").val()
  781. }
  782. postAjaxJsonHttpRequst("/thmz/retractYbFees",param,true,function (res) {
  783. if (res == '401' || res == 401) {
  784. window.location.href = '/thmz/login/view'
  785. return;
  786. }
  787. if(res.code == 0){
  788. successMesageSimaple('医保费用撤销成功!')
  789. reSiReadCard(false,tfReadType);
  790. }else {
  791. errorMesage(res)
  792. }
  793. })
  794. }
  795. }
  796. function sfzReadCard() {
  797. let tfAdvmCity = $("#tfAdvmCity").val()
  798. if(!stringNotBlank(tfAdvmCity)){
  799. errorMesageSimaple("请选择参保地")
  800. return
  801. }
  802. $.ajax({
  803. type: "GET",
  804. // url: 'http://localhost:8321/readcard/entry?param=idcard_01101',
  805. url: 'http://localhost:8321/readcard/entry?param=huashi_readcard',
  806. contentType: "application/json;charset=UTF-8",
  807. dataType: "json",
  808. async: true,
  809. headers: {
  810. 'Accept': 'application/json',
  811. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  812. },
  813. success: function (res) {
  814. if (res == '401' || res == 401) {
  815. window.location.href = '/thmz/login/view'
  816. return;
  817. }
  818. if (res.code == 200) {
  819. $("#cdReadCardResult").val(res.data);
  820. var str = res.data.split("^");
  821. var str1= str.filter(item=>item !='');
  822. let IDNumber = str1[0];
  823. postAjaxJsonHttpRequst("/thmz/queryNewInsuinfo",{
  824. patientId :$("#patientIdRefund").val(),
  825. times :$("#timesRefund").val(),
  826. admdvs:tfAdvmCity,
  827. socialNo:IDNumber
  828. },true,function (res) {
  829. if (res == '401' || res == 401) {
  830. window.location.href = '/thmz/login/view'
  831. return;
  832. }
  833. if(res.code == 0){
  834. let param = {
  835. patientId :$("#patientIdRefund").val(),
  836. times :$("#timesRefund").val()
  837. }
  838. postAjaxJsonHttpRequst("/thmz/retractYbFees",param,true,function (res) {
  839. if (res == '401' || res == 401) {
  840. window.location.href = '/thmz/login/view'
  841. return;
  842. }
  843. if(res.code == 0){
  844. successMesageSimaple("撤销医保费用成功")
  845. }else {
  846. errorMesage(res)
  847. }
  848. })
  849. }else {
  850. errorMesage(res)
  851. }
  852. })
  853. } else {
  854. errorMesage(res);
  855. }
  856. },
  857. error: function (XMLHttpRequest, textStatus, errorThrown) {
  858. errorMesageSimaple("读卡错误")
  859. }
  860. });
  861. }
  862. function reSiReadCard(asyncFlag,tfReadType) {
  863. let params ='';
  864. let url = '';
  865. if(tfReadType == '03'){
  866. // 江苏医保读取社保卡使用专用地址
  867. url = 'http://localhost:8321/readcard/jiangsu/readcard_auto';
  868. }else if(tfReadType == '01'){
  869. // params ='qrcode_01101';
  870. params ='jiangsu_qrcode_01101';
  871. // url = 'http://localhost:8321/readcard/entry?param=' + params;
  872. url = 'http://localhost:8321/api/entry?param=' + params;
  873. }else if(tfReadType =='02'){
  874. // params ='idcard_01101'
  875. params ='huashi_readcard';
  876. url = 'http://localhost:8321/readcard/entry?param=' + params;
  877. }
  878. $.ajax({
  879. type: "GET",
  880. url: url,
  881. contentType: "application/json;charset=UTF-8",
  882. dataType: "json",
  883. async: asyncFlag,
  884. headers: {
  885. 'Accept': 'application/json',
  886. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  887. },
  888. success: function (res) {
  889. if (res == '401' || res == 401) {
  890. window.location.href = '/thmz/login/view'
  891. return;
  892. }
  893. if (res.code == 200) {
  894. successMesageSimaple('读卡成功')
  895. if(tfReadType == '01'){
  896. var data = JSON.parse(res.data);
  897. $("#cdReadCardResult").val(JSON.stringify(data.data));
  898. }else {
  899. $("#cdReadCardResult").val(res.data);
  900. }
  901. } else {
  902. errorMesage(res);
  903. }
  904. },
  905. error: function (XMLHttpRequest, textStatus, errorThrown) {
  906. errorMesageSimaple("读卡错误")
  907. }
  908. });
  909. }
  910. /**
  911. * 初始化收费明细表格
  912. */
  913. function initChargeDetailTablePublic(url, obj, params) {
  914. $(obj).bootstrapTable("destroy");
  915. $(obj).bootstrapTable({
  916. url: url, //请求后台的URL(*)
  917. method: 'post', //请求方式(*)
  918. toolbar: '#toolbar', //工具按钮用哪个容器
  919. striped: true, //是否显示行间隔色
  920. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  921. pagination: true, //是否显示分页(*)
  922. sortable: true, //是否启用排序
  923. sortOrder: "asc", //排序方式
  924. // sortName: 'orderNo', //排序字段
  925. queryParams: params, //传递参数(*)
  926. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  927. pageNumber: 1, //初始化加载第一页,默认第一页
  928. pageSize: 5, //每页的记录行数(*)
  929. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  930. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  931. strictSearch: true,
  932. showColumns: false, //是否显示所有的列
  933. showRefresh: false, //是否显示刷新按钮
  934. minimumCountColumns: 2, //最少允许的列数
  935. clickToSelect: true, //是否启用点击选中行
  936. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  937. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  938. cardView: false, //是否显示详细视图
  939. detailView: false,
  940. //rowStyle:rowStyle,//通过自定义函数设置行样式
  941. ajaxOptions: {
  942. headers: {
  943. 'Accept': 'application/json',
  944. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  945. }
  946. },
  947. columns: [
  948. // {
  949. // checkbox: true
  950. // },
  951. {
  952. field: 'orderNo',
  953. title: '处方号',
  954. align: "center",
  955. valign: 'middle',
  956. formatter: function (value, row, index) {
  957. return Math.abs(value);
  958. }
  959. }, {
  960. field: 'chargeItemCode',
  961. title: '编码',
  962. align: "center",
  963. valign: 'middle',
  964. }, {
  965. field: 'tcName',
  966. title: '项目',
  967. align: "center",
  968. valign: 'middle',
  969. },
  970. // {
  971. // field: 'times',
  972. // title: '规格',
  973. // align: "center",
  974. // valign: 'middle',
  975. // },
  976. {
  977. field: 'quantity',
  978. title: '数量',
  979. align: "center",
  980. valign: 'middle'
  981. }, {
  982. field: 'drugWin',
  983. title: '副数',
  984. align: "center",
  985. valign: 'middle',
  986. }, {
  987. field: 'origPrice',
  988. title: '原单价(元)',
  989. align: "center",
  990. valign: 'middle',
  991. formatter: function (value, row, index) {
  992. if (value != undefined && value != null) {
  993. return value.toFixed(2);
  994. }
  995. }
  996. }, {
  997. field: 'unitPrice',
  998. title: '折后单价(元)',
  999. align: "center",
  1000. valign: 'middle',
  1001. formatter: function (value, row, index) {
  1002. return value.toFixed(2);
  1003. }
  1004. }, {
  1005. field: 'amount',
  1006. title: '总金额(元)',
  1007. align: "center",
  1008. valign: 'middle',
  1009. formatter: function (value, row, index) {
  1010. return value.toFixed(2);
  1011. }
  1012. }
  1013. ],
  1014. responseHandler: function (res) {
  1015. if (res == '401' || res == 401) {
  1016. window.location.href = '/thmz/login/view'
  1017. return;
  1018. }
  1019. var ress = eval(res);
  1020. if (ress.code == -1) {
  1021. new PNotify({
  1022. title: '错误提示',
  1023. text: ress.message,
  1024. type: 'error',
  1025. hide: true,
  1026. styling: 'bootstrap3'
  1027. });
  1028. return {
  1029. "total": 0,//总页数
  1030. "rows": {} //数据
  1031. };
  1032. }
  1033. return {
  1034. //"total": ress.pageViewVo.total,//总页数
  1035. "rows": ress.data //数据
  1036. };
  1037. },
  1038. });
  1039. }
  1040. /**
  1041. * 构建列表查询参数
  1042. * @param params
  1043. * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}}
  1044. */
  1045. function queryParamsForDetail(params) {
  1046. var billItemGroup = getIndex("bill_item_group");
  1047. var payMarkGroup = getIndex("pay_mark_group");
  1048. var temp = {
  1049. patientId: $("#patientIdChargeItem").val(),
  1050. times: $("#timesChargeItem").val(),
  1051. receiptNo: $("#receiptNoChargeItem").val(),
  1052. billItemCode: billItemGroup,
  1053. payMark: 5
  1054. };
  1055. if (payMarkGroup == 1) {
  1056. temp.payMark = 0;
  1057. } else if (payMarkGroup == 2) {
  1058. temp.payMark = 1;
  1059. }
  1060. return temp;
  1061. };
  1062. /**
  1063. * 构建列表查询参数
  1064. * @param params
  1065. * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}}
  1066. */
  1067. function queryParamsForRefundByBillItem(params) {
  1068. var billItemGroup = getIndex("refund_bill_item_group");
  1069. return {
  1070. patientId: $("#patientIdRefund").val(),
  1071. times: $("#timesRefund").val(),
  1072. receiptNo: $("#receiptNoRefund").val(),
  1073. chargeItemCodes: chargeItemCodes,
  1074. billItemCode: billItemGroup
  1075. };
  1076. };
  1077. /**
  1078. * 卡号输入改变事件
  1079. */
  1080. function cardNoChange() {
  1081. if (window.ActiveXObject || "ActiveXObject" in window) {
  1082. $("#cardNo").on('input propertychange', function () {
  1083. queryUserInfoByCardNo();
  1084. });
  1085. } else {
  1086. $("#cardNo").on('input οninput', function () {
  1087. queryUserInfoByCardNo();
  1088. });
  1089. }
  1090. }
  1091. /**
  1092. * 卡号有变化后查询病人信息
  1093. */
  1094. function queryUserInfoByCardNo() {
  1095. var cardNo = $("#cardNo").val();
  1096. var index = cardNo.indexOf("-");
  1097. if ((index > 0 && index === cardNo.length - 2) || true) {
  1098. $("#patientId").val(cardNo);
  1099. initFeeTable();
  1100. } else if (cardNo == '120' || cardNo.length == 8) {
  1101. $("#cardNo").attr("title", cardNo);
  1102. $.ajax({
  1103. type: "GET",
  1104. url: '/thmz/getByIcCardNo?icCardNo=' + cardNo,
  1105. contentType: "application/json;charset=UTF-8",
  1106. dataType: "json",
  1107. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1108. success: function (res) {
  1109. if (res == '401' || res == 401) {
  1110. window.location.href = '/thmz/login/view'
  1111. return;
  1112. }
  1113. if (res.code == 0) {
  1114. if (res.data != null) {
  1115. $("#patientId").val(res.data.patientId);
  1116. initFeeTable();
  1117. }
  1118. } else {
  1119. new PNotify({
  1120. title: '错误提示',
  1121. text: res.message,
  1122. type: 'error',
  1123. hide: true,
  1124. styling: 'bootstrap3'
  1125. });
  1126. }
  1127. }
  1128. });
  1129. } else if (cardNo == null || cardNo == "") {
  1130. cleanParams();
  1131. }
  1132. }
  1133. /**
  1134. * 获取按钮组选择的下标
  1135. * @param id
  1136. * @returns {number}
  1137. */
  1138. function getIndex(id) {
  1139. var index = 0;
  1140. var item = $("#" + id).find("button");
  1141. for (var i = 0; i <= item.length; i++) {
  1142. if ($(item[i]).hasClass("btn-primary")) {
  1143. index = i;
  1144. break;
  1145. }
  1146. }
  1147. return index;
  1148. }
  1149. /**
  1150. * 获取时间选择器的时间数组
  1151. * @returns {string[]}
  1152. */
  1153. function getRePortRangeArr() {
  1154. var rePortRange = $('#reportrange span').html();
  1155. var rePortRangeArr = rePortRange.split(" - ");
  1156. rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"
  1157. rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"
  1158. return rePortRangeArr;
  1159. }
  1160. /**
  1161. * 打开收费窗口
  1162. */
  1163. function confirmFeeModal(times, totalCharge, receiptNo) {
  1164. var buttonCodes = localStorage.getItem("buttonCodes");
  1165. if (buttonCodes != null) {
  1166. if (isInArrayStr("contract_match", buttonCodes)) {
  1167. $("#projectDiv").removeClass("hide").addClass("in");
  1168. } else {
  1169. $("#projectDiv").removeClass("in").addClass("hide");
  1170. }
  1171. } else {
  1172. $("#projectDiv").removeClass("in").addClass("hide");
  1173. }
  1174. var payTypeList = $("#payType").children();
  1175. if (payTypeList.length == 1) {
  1176. $('#payType').selectpicker('val', 'Y');
  1177. } else {
  1178. $('#payType').selectpicker('val', 1);
  1179. }
  1180. $('#payType').selectpicker('refresh');
  1181. var data = parseFloat($("#dataIdHaveTally").val());
  1182. if (totalCharge != null && totalCharge > 0) {
  1183. data = totalCharge;
  1184. $("#timesHaveTally").val(times);
  1185. $("#receiptNoHaveTally").val(receiptNo);
  1186. }
  1187. var prevAll = $("#changeAmountParent").prevAll();
  1188. while (prevAll.length > 1) {
  1189. $("#changeAmountParent").prev().remove();
  1190. prevAll = $("#changeAmountParent").prevAll();
  1191. }
  1192. // $("#realMoney").val($("#amountMoneyConfirm").text());
  1193. // $("#cash").val($("#amountMoneyConfirm").text());
  1194. $("#tallyDetailModal").modal('hide');
  1195. $("#haveTallyModal").modal('hide');
  1196. $("#confirmFeeModal").modal();
  1197. $("#amountMoneyConfirm").text(data);
  1198. //医保报销金额
  1199. var fundPay = $("#fundPay").val();
  1200. //个人账户支付金额
  1201. var acctPay = $("#acctPay").val();
  1202. //医保卡类型
  1203. var cardType = $("#cardType").val();
  1204. var payTypeIndex = 0;
  1205. if (fundPay > 0) {
  1206. var payTypeId = "payType_" + payTypeIndex++;
  1207. addPayType(payTypeId);
  1208. $('#' + payTypeId).selectpicker('val', 2);
  1209. $('#' + payTypeId).selectpicker('refresh');
  1210. $('#' + payTypeId).parent().parent().next().children(':first').val(fundPay);
  1211. $('#' + payTypeId).parent().parent().next().next().children(':first').remove();
  1212. $('#' + payTypeId).attr("disabled", true);
  1213. $('#' + payTypeId).parent().parent().next().children(':first').attr("readonly", "readonly");
  1214. //payTypeIndex++;
  1215. }
  1216. if (acctPay > 0) {
  1217. var payTypeId = "payType_" + payTypeIndex++;
  1218. addPayType(payTypeId);
  1219. // var ybkType = 'T';
  1220. // if (cardType != null && (cardType == 2 || cardType == "2")) {
  1221. // ybkType = 'P';
  1222. // }
  1223. $('#' + payTypeId).selectpicker('val', cardType);
  1224. $('#' + payTypeId).selectpicker('refresh');
  1225. $('#' + payTypeId).parent().parent().next().children(':first').val(acctPay);
  1226. $('#' + payTypeId).parent().parent().next().next().children(':first').remove();
  1227. $('#' + payTypeId).attr("disabled", true);
  1228. $('#' + payTypeId).parent().parent().next().children(':first').attr("readonly", "readonly");
  1229. }
  1230. $("#payTypeIndex").val(payTypeIndex);
  1231. //总金额减医保报销
  1232. var realMoney = Minus(data, fundPay);
  1233. //减完医保报销后减个人医保卡支付金额
  1234. realMoney = Minus(realMoney, acctPay);
  1235. $("#realMoney").val(data);
  1236. if (realMoney > 0) {
  1237. addPayType("payType");
  1238. $("#cash").val(realMoney);
  1239. }
  1240. // $("#cash").val(null);
  1241. setTimeout(function () {
  1242. //默认光标在现金输入框
  1243. $("#cash").focus();
  1244. }, 800);
  1245. if (payTypeList.length == 1) {
  1246. $('#payType').selectpicker('val', 'Y');
  1247. } else {
  1248. $('#payType').selectpicker('val', 'O');
  1249. }
  1250. $("#changeAmount").val(0.0);
  1251. $("#surplusAmount").val(0.0);
  1252. $("input.refNo").val(null);
  1253. $("input.transDate").val(null);
  1254. $("input.payChannel").val(null);
  1255. $("input.qrCodeParam").val(null);
  1256. $("input.traceNo").val(null);
  1257. sendPriceMessage(realMoney, 0.0, 0.0, $("#patientIdHaveTally").val());
  1258. }
  1259. /**
  1260. * 打开收费明细窗口
  1261. * @param data
  1262. */
  1263. function chargeDetailModal(patientId, times, receiptNo) {
  1264. $("#patientIdChargeItem").val(patientId);
  1265. $("#timesChargeItem").val(times);
  1266. $("#receiptNoChargeItem").val(receiptNo);
  1267. $("#chargeDetailModal").modal();
  1268. initChargeDetailTable();
  1269. }
  1270. /**
  1271. * 病人当前就诊次数的诊断查询
  1272. * @param data
  1273. */
  1274. function diagnoseQuery(patientId, times) {
  1275. $.ajax({
  1276. type: "POST",
  1277. url: '/thmz/getVisitTableByPatientIdAndTimes',
  1278. contentType: "application/json;charset=UTF-8",
  1279. dataType: "json",
  1280. data: JSON.stringify({"patientId": patientId, "times": times}),
  1281. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1282. async: false,
  1283. success: function (res) {
  1284. if (res == '401' || res == 401) {
  1285. window.location.href = '/thmz/login/view'
  1286. return;
  1287. }
  1288. if (res.code == 0) {
  1289. if (res.data.icdText != null || res.data.icdText != '') {
  1290. $("#diagnoseModal").modal();
  1291. $("#diagnose").html(res.data.icdText);
  1292. } else {
  1293. new PNotify({
  1294. title: '操作提示',
  1295. text: '当前病人诊断未知',
  1296. type: 'warn',
  1297. styling: 'bootstrap3'
  1298. });
  1299. }
  1300. } else {
  1301. errorMesage(res);
  1302. }
  1303. }
  1304. });
  1305. }
  1306. // /**
  1307. // * 打开退费重收明细窗口
  1308. // * @param data
  1309. // */
  1310. // function chargeRefundDetailModal(patientId, times) {
  1311. // // $("#patientIdChargeItem").val(patientId);
  1312. // // $("#timesChargeItem").val(times);
  1313. // initMzChargeDetailByBillItem();
  1314. // }
  1315. /**
  1316. * 初始门诊收银方式下拉选
  1317. */
  1318. function initChequeType(payType) {
  1319. $.ajax({
  1320. type: "GET",
  1321. url: '/thmz/getAllZdChequeTypeForMz',
  1322. dataType: "json",
  1323. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1324. async: false,
  1325. success: function (res) {
  1326. if (res == '401' || res == 401) {
  1327. window.location.href = '/thmz/login/view'
  1328. return;
  1329. }
  1330. var html = '';
  1331. $.each(res.data, function (commentIndex, comment) {
  1332. html += '<option value="' + comment.code + '">' + comment.name + '</option>';
  1333. });
  1334. $('#' + payType).empty();
  1335. $('#' + payType).html(html);
  1336. $('#' + payType).selectpicker('refresh');
  1337. if (res.data.length == 1) {
  1338. $('#' + payType).selectpicker('val', 'Y');
  1339. } else {
  1340. $('#' + payType).selectpicker('val', 'O');
  1341. }
  1342. $('#' + payType).selectpicker('refresh');
  1343. }
  1344. });
  1345. }
  1346. /**
  1347. * 关闭当前这个付款方式
  1348. */
  1349. function closeThisParent(obj) {
  1350. $(obj).parent().parent().parent().remove();
  1351. checkFee(false);
  1352. }
  1353. /**
  1354. * 校验收款金额
  1355. * @param flag 是否是提交时候的校验,是的话,如果缴费金额不够,需要返回 false
  1356. */
  1357. function checkFee(flag) {
  1358. var realMoney = parseFloat($("#realMoney").val());
  1359. realMoney = toDecimal(realMoney);
  1360. $("#realMoney").val(realMoney);
  1361. var arr = $("#payForm").find("div.pay-item");
  1362. if (arr.length > 0) {
  1363. // //是否存在未使用的收款方式
  1364. // var hadNotFill=false;
  1365. //非现金收款总金额
  1366. var notCashAmount = 0;
  1367. //现金收款总额
  1368. var cashAmount = 0;
  1369. for (var i = 0; i < arr.length; i++) {
  1370. var temp = parseFloat($(arr[i]).find("input.money").val());
  1371. if (isNaN(temp)) {
  1372. temp = 0;
  1373. // hadNotFill=true;
  1374. }
  1375. if ($(arr[i]).find("select").val() != 1) {
  1376. notCashAmount = Add(notCashAmount, temp);
  1377. } else {
  1378. cashAmount = Add(cashAmount, temp);
  1379. }
  1380. for (var j = 0; j < arr.length; j++) {
  1381. if ($(arr[i]).find("select").val() == $(arr[j]).find("select").val() && i != j) {
  1382. new PNotify({
  1383. title: '错误提示',
  1384. text: "已经存在相同的收款方式,请不要重复添加!",
  1385. type: 'error',
  1386. hide: true,
  1387. styling: 'bootstrap3'
  1388. });
  1389. return;
  1390. }
  1391. }
  1392. }
  1393. var totalAmount = Add(cashAmount, notCashAmount);
  1394. $("#surplusAmount").val(0.0);
  1395. if (totalAmount < realMoney) {
  1396. if (flag) {
  1397. new PNotify({
  1398. title: '错误提示',
  1399. text: "收款金额不能少于实收金额,请调整收款金额或者增加收款方式!",
  1400. type: 'error',
  1401. hide: true,
  1402. styling: 'bootstrap3'
  1403. });
  1404. return false;
  1405. }
  1406. if (totalAmount == 0) {
  1407. $("#addPayType").parent().removeClass("in").addClass("hide");
  1408. } else {
  1409. $("#addPayType").parent().removeClass("hide").addClass("in");
  1410. }
  1411. // if(!hadNotFill){
  1412. // addPayType(null);
  1413. // }
  1414. $("#changeAmount").val(0.00);
  1415. var surplusAmount = Minus(realMoney, totalAmount);
  1416. $("#surplusAmount").val(surplusAmount);
  1417. return;
  1418. }
  1419. var changeAmount = 0.00;
  1420. if (totalAmount >= realMoney) {
  1421. changeAmount = Minus(totalAmount, realMoney);
  1422. //changeAmount = changeAmount.toFixed(2);
  1423. $("#changeAmount").val(changeAmount);
  1424. $("#addPayType").parent().removeClass("in").addClass("hide");
  1425. if (!flag) {
  1426. sendPriceMessage(realMoney, totalAmount, changeAmount, $("#patientIdHaveTally").val());
  1427. }
  1428. }
  1429. //设置收费首页找零与应收和实收金额
  1430. $("#payableAmount").text(realMoney);
  1431. $("#paidAmount").text(totalAmount);
  1432. $("#changedAmount").text(changeAmount);
  1433. }
  1434. //计算和设置折扣比例
  1435. var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());
  1436. var discount = 100;
  1437. if (realMoney < amountMoneyConfirm) {
  1438. discount = Division(realMoney, Multiply(amountMoneyConfirm, 100));
  1439. }
  1440. $("#discount").text(toDecimal(discount));
  1441. return true;
  1442. }
  1443. /**
  1444. * 异常接诊数据修复
  1445. * @param patientId
  1446. * @param times
  1447. * @param payMark
  1448. * @param receiptNo
  1449. */
  1450. function initClinicForException(patientId, times, payMark, receiptNo) {
  1451. $.ajax({
  1452. type: "GET",
  1453. url: '/thmz/initClinicForException?patientId=' + patientId + '&times=' + times+ '&receiptNo=' + receiptNo + "&payMark=" + payMark,
  1454. contentType: "application/json;charset=UTF-8",
  1455. dataType: "json",
  1456. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1457. success: function (res) {
  1458. if (res == '401' || res == 401) {
  1459. window.location.href = '/thmz/login/view'
  1460. return;
  1461. }
  1462. if (res.code == 0) {
  1463. successMesage(res);
  1464. } else {
  1465. errorMesage(res);
  1466. }
  1467. }
  1468. });
  1469. }
  1470. /**
  1471. * 提示有记账记录
  1472. */
  1473. function tipHaveTally(data, patientId, times, name, receiptNo) {
  1474. addOrderLock(patientId,times,null)
  1475. closeConfirmFeeModal();
  1476. if (patientId == null || patientId == "") {
  1477. return;
  1478. }
  1479. $("#patientIdHaveTally").val(patientId);
  1480. $("#nameHaveTally").val(name);
  1481. $("#dataIdHaveTally").val(data);
  1482. $("#timesHaveTally").val(times);
  1483. $("#receiptNoHaveTally").val(receiptNo);
  1484. saveFeeGzzf()
  1485. // postAjaxJsonHttpRequst("/thmz/queryCountYbZf",{"patientId": patientId, "times": times},true,function (rs) {
  1486. // if (rs == '401' || rs == 401) {
  1487. // window.location.href = '/thmz/login/view'
  1488. // return;
  1489. // }
  1490. // if(rs.code == 0){
  1491. // if(rs.data > 0){
  1492. //
  1493. // }
  1494. // }else {
  1495. // errorMesage(rs);
  1496. // }
  1497. //
  1498. // })
  1499. }
  1500. //收费时保存个账支付选择
  1501. function saveFeeGzzf() {
  1502. $.ajax({
  1503. type: "POST",
  1504. url: '/thmz/getTmFee',
  1505. contentType: "application/json;charset=UTF-8",
  1506. dataType: "json",
  1507. data: JSON.stringify({"patientId": $("#patientIdHaveTally").val(), "times": $("#timesHaveTally").val(), "receiptNo": $("#receiptNoHaveTally").val()}),
  1508. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1509. async: false,
  1510. success: function (res) {
  1511. if (res == '401' || res == 401) {
  1512. window.location.href = '/thmz/login/view'
  1513. return;
  1514. }
  1515. if (res.code == 0) {
  1516. if (res.data != undefined && res.data != null) {
  1517. $("#fundPay").val(res.data.fundPay);
  1518. $("#acctPay").val(res.data.acctPay);
  1519. $("#cardType").val(res.data.ybkType);
  1520. //$("#realMoney").val(res.data.selfPay);
  1521. } else {
  1522. $("#fundPay").val(0.0);
  1523. $("#acctPay").val(0.0);
  1524. $("#cardType").val(null);
  1525. }
  1526. } else {
  1527. errorMesage(res);
  1528. }
  1529. $("#saveConfirmFee").attr("disabled", false);
  1530. }
  1531. });
  1532. confirmFeeModal(null, null, null);
  1533. }
  1534. var $tally_detail_table;
  1535. /**
  1536. * 初始化本院记账明细表格
  1537. */
  1538. function initTallyDetailTable() {
  1539. $("#haveTallyModal").modal('hide');
  1540. var patientId = $("#patientIdHaveTally").val();
  1541. // var name = $("#nameHaveTally").val();
  1542. if (patientId == null || patientId == '') {
  1543. return;
  1544. }
  1545. $("#tallyDetailModal").modal();
  1546. $('#tally_detail_table').bootstrapTable("destroy");
  1547. $tally_detail_table = $('#tally_detail_table').bootstrapTable({
  1548. url: '/thmz/getTallyReceiptSerial?patientId=' + patientId, //请求后台的URL(*)
  1549. method: 'get', //请求方式(*)
  1550. toolbar: '#toolbar', //工具按钮用哪个容器
  1551. striped: true, //是否显示行间隔色
  1552. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  1553. pagination: false, //是否显示分页(*)
  1554. sortable: true, //是否启用排序
  1555. sortOrder: "asc", //排序方式
  1556. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  1557. pageNumber: 1, //初始化加载第一页,默认第一页
  1558. pageSize: 10, //每页的记录行数(*)
  1559. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  1560. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  1561. strictSearch: true,
  1562. showColumns: false, //是否显示所有的列
  1563. showRefresh: false, //是否显示刷新按钮
  1564. minimumCountColumns: 2, //最少允许的列数
  1565. clickToSelect: true, //是否启用点击选中行
  1566. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  1567. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  1568. cardView: false, //是否显示详细视图
  1569. detailView: false,
  1570. //rowStyle:rowStyle,//通过自定义函数设置行样式
  1571. ajaxOptions: {
  1572. headers: {
  1573. 'Accept': 'application/json',
  1574. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  1575. }
  1576. },
  1577. columns: [
  1578. // {
  1579. // checkbox: true,
  1580. // },
  1581. {
  1582. field: 'patientId',
  1583. title: '病人编号',
  1584. align: "center",
  1585. valign: 'middle'
  1586. }, {
  1587. field: 'name',
  1588. title: '病人姓名',
  1589. align: "center",
  1590. valign: 'middle',
  1591. // formatter: function (value, row, index) {
  1592. // return name;
  1593. // }
  1594. }, {
  1595. field: 'times',
  1596. title: '就诊次数',
  1597. align: "center",
  1598. valign: 'middle',
  1599. },
  1600. {
  1601. field: 'totalCharge',
  1602. title: '总费用(元)',
  1603. align: "center",
  1604. valign: 'middle',
  1605. formatter: function (value, row, index) {
  1606. return value.toFixed(2);
  1607. }
  1608. },
  1609. {
  1610. field: 'chargeDate',
  1611. title: '记账时间',
  1612. align: "center",
  1613. valign: 'middle',
  1614. formatter: function (value, row, index) {
  1615. return format(value, "yyyy-MM-dd HH:mm:ss");
  1616. }
  1617. }
  1618. // , {
  1619. // title: '操作',
  1620. // align: "center",
  1621. // valign: 'middle',
  1622. // // sortable: true,
  1623. // formatter: function (value, row, index) {
  1624. // 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>';
  1625. // return str;
  1626. // }
  1627. // }
  1628. ],
  1629. /**
  1630. * @param {点击列的 field 名称} field
  1631. * @param {点击列的 value 值} value
  1632. * @param {点击列的整行数据} row
  1633. * @param {td 元素} $element
  1634. */
  1635. onClickCell: function (field, value, row, $element) {
  1636. var cardNo = $("#cardNo").val();
  1637. if (cardNo == '120' && field == 'name') {
  1638. $element.attr('contenteditable', true);
  1639. $element.html(null);
  1640. $element.focus();
  1641. $element.blur(function () {
  1642. var index = $element.parent().data('index');
  1643. var tdValue = $element.html();
  1644. saveData(index, field, tdValue, row, $tally_detail_table);
  1645. })
  1646. }
  1647. },
  1648. onDblClickRow: function (row) {
  1649. confirmFeeModal(row.times, row.totalCharge, row.receiptNo);
  1650. },
  1651. responseHandler: function (res) {
  1652. if (res == '401' || res == 401) {
  1653. window.location.href = '/thmz/login/view'
  1654. return;
  1655. }
  1656. var ress = eval(res);
  1657. if (ress.code == -1) {
  1658. errorMesage(ress);
  1659. return {
  1660. "total": 0,//总页数
  1661. "rows": {} //数据
  1662. };
  1663. }
  1664. if (ress.data == null || ress.data.length == 0) {
  1665. $("#tallyDetailModal").modal("hide");
  1666. }
  1667. return {
  1668. "rows": ress.data //数据
  1669. };
  1670. },
  1671. });
  1672. }
  1673. /**
  1674. * 提交缴费申请
  1675. */
  1676. function saveConfirmFee() {
  1677. $("#saveConfirmFee").attr("disabled", true);
  1678. if (!checkFee(true)) {
  1679. $("#saveConfirmFee").attr("disabled", false);
  1680. return;
  1681. }
  1682. var project = $("#project").val();
  1683. let dyTgId = $("#dyTgId").val();
  1684. var jsonData = JSON.parse('{"patientId":"","times":"","receiptNo":"","mzDepositFiles":[]}');
  1685. var patientId = $("#patientIdHaveTally").val();
  1686. var times = $("#timesHaveTally").val();
  1687. var receiptNo = $("#receiptNoHaveTally").val();
  1688. jsonData.patientId = patientId;
  1689. jsonData.times = times;
  1690. jsonData.receiptNo = receiptNo;
  1691. var arr = $("#payForm").find("div.pay-item");
  1692. if (arr.length > 0) {
  1693. for (var i = 0; i < arr.length; i++) {
  1694. var temp = parseFloat($(arr[i]).find("input.money").val());
  1695. if (temp == null || temp == 0) {
  1696. continue;
  1697. }
  1698. var tempJson = JSON.parse('{"chequeType":"","amount":"","contractId":"","psordnum":"","agtordnum":"","parChannel":"","transDate":"","traceNo":"","dyTgNo":""}');
  1699. tempJson.chequeType = $(arr[i]).find("select").val();
  1700. tempJson.psordnum = $(arr[i]).find("input.refNo").val();
  1701. tempJson.agtordnum = $(arr[i]).find("input.qrCodeParam").val();
  1702. tempJson.parChannel = $(arr[i]).find("input.payChannel").val();
  1703. tempJson.transDate = $(arr[i]).find("input.transDate").val();
  1704. tempJson.traceNo = $(arr[i]).find("input.traceNo").val();
  1705. //现金有可能会多收,比入实收37,对方给了100,需要找零63. 所以必须减去找零金额,才是实收金额
  1706. if (tempJson.chequeType == "1") {
  1707. temp = temp - $("#changeAmount").val();
  1708. temp = temp.toFixed(2);
  1709. }
  1710. if (project != null && project != "null" && project != "") {
  1711. tempJson.contractId = project;
  1712. }
  1713. if(stringNotBlank(dyTgId)){
  1714. tempJson.dyTgNo = dyTgId;
  1715. }
  1716. tempJson.amount = temp;
  1717. jsonData.mzDepositFiles[jsonData.mzDepositFiles.length] = tempJson;
  1718. }
  1719. }
  1720. $.ajax({
  1721. type: "POST",
  1722. url: '/thmz/chargeFee',
  1723. contentType: "application/json;charset=UTF-8",
  1724. dataType: "json",
  1725. data: JSON.stringify(jsonData),
  1726. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1727. success: function (res) {
  1728. if (res == '401' || res == 401) {
  1729. window.location.href = '/thmz/login/view'
  1730. return;
  1731. }
  1732. if (res.code == 0) {
  1733. if(fpVsesionNo == 0){
  1734. prn1Print(patientId, times, true, res.receiptNo);
  1735. }else {
  1736. printDzfp(patientId, times,res.receiptNo,0)
  1737. }
  1738. successMesage(res);
  1739. closeConfirmFeeModal();
  1740. //缴费成功后清空全局参数
  1741. patientIdFullForNucleicAcid = null;
  1742. initFeeTable();
  1743. //默认光标在卡号输入框
  1744. $("#cardNo").focus();
  1745. // toEvaluation(patientId);
  1746. toNewEvaluation(patientId,times);
  1747. } else {
  1748. errorMesage(res);
  1749. }
  1750. $("#saveConfirmFee").attr("disabled", false);
  1751. }
  1752. });
  1753. }
  1754. /**
  1755. * 关闭收费确认模态弹框
  1756. */
  1757. function closeConfirmFeeModal() {
  1758. $("#confirmFeeModal").modal("hide");
  1759. $("#patientId").val(null);
  1760. $("#cardNo").val(null);
  1761. $("#name").val(null);
  1762. $("#fundPay").val(0);
  1763. $("#acctPay").val(0);
  1764. $("#cardType").val(null);
  1765. }
  1766. /**
  1767. * 保存合作项目
  1768. */
  1769. function saveProject() {
  1770. var projectRealNo = $("#projectRealNo").val();
  1771. var projectCharged = $("#projectCharged").val();
  1772. $.ajax({
  1773. type: "GET",
  1774. url: '/thmz/setMzDepositFileSetContractId?contractId=' + projectCharged + '&serialNo=' + projectRealNo,
  1775. contentType: "application/json;charset=UTF-8",
  1776. dataType: "json",
  1777. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1778. success: function (res) {
  1779. if (res == '401' || res == 401) {
  1780. window.location.href = '/thmz/login/view'
  1781. return;
  1782. }
  1783. if (res.code == 0) {
  1784. successMesage(res);
  1785. $("#projectRealNo").val(null);
  1786. $('#projectCharged').selectpicker('val', null);
  1787. $('#projectCharged').selectpicker('refresh');
  1788. $("#projectModal").modal("hide");
  1789. } else {
  1790. errorMesage(res);
  1791. }
  1792. $("#saveConfirmFee").attr("disabled", false);
  1793. }
  1794. });
  1795. }
  1796. //上传电子发票
  1797. function printDzfp(patientId,times,receiptNo,loadingFlag) {
  1798. if(loadingFlag == 1){
  1799. $("#dzfpLoadingModal").modal('show');
  1800. }
  1801. postAjaxJsonHttpRequst("/thmz/getNewAllSerialForThisTime",{patientId:patientId,times:times,receiptNo:receiptNo},true,function (res) {
  1802. if(res.code == 0){
  1803. uploadMzInvoice(patientId,times,receiptNo,1,localStorage.getItem("userName"))
  1804. }else {
  1805. $("#dzfpLoadingModal").modal('hide');
  1806. errorMesage(res)
  1807. }
  1808. })
  1809. }
  1810. /**
  1811. *
  1812. * @param patientId
  1813. * @param times
  1814. * @param receiptNo
  1815. * @param typeFlag 1 上传门诊蓝字发票 2上传红字发票 (作废)
  1816. */
  1817. function uploadMzInvoice(patientId,times,receiptNo,typeFlag) {
  1818. postAjaxJsonHttpRequst("/thmz/uploadMzInvoice",{patientId:patientId,times:times,receiptNo:receiptNo,ghFlag:false,typeFlag:typeFlag},true,function (rs) {
  1819. if(typeFlag == 1){
  1820. $("#dzfpLoadingModal").modal('hide');
  1821. }
  1822. if(rs.code ==0){
  1823. successMesageSimaple("电子发票上传成功!")
  1824. if(typeFlag == 1){
  1825. initFeeTable();
  1826. }
  1827. }else {
  1828. errorMesage(rs);
  1829. }
  1830. })
  1831. }
  1832. var dzfp_patientId ;
  1833. var dzfp_times ;
  1834. var dzfp_serialNo;
  1835. //var dzfp_typeFlag;
  1836. //打开电子发票弹窗
  1837. function openDzfpDownModal(patientId,times,serialNo) {
  1838. console.log("dfds",patientId,times,serialNo)
  1839. dzfp_patientId = patientId;
  1840. dzfp_times = times;
  1841. dzfp_serialNo = serialNo;
  1842. // dzfp_typeFlag = typeFlag;
  1843. $("#dzfpDownModal").modal();
  1844. }
  1845. /**
  1846. * @param type 1 打印二维码 2 下载pdf
  1847. */
  1848. function downOrPrintDzfp(type) {
  1849. //console.log("11111111111111111111111111111")
  1850. //console.log("dfds",dzfp_patientId,dzfp_times,dzfp_serialNo)
  1851. downloadDzfp(dzfp_patientId,dzfp_times,dzfp_serialNo,type)
  1852. }
  1853. //下载电子发票
  1854. function downloadDzfp(patientId,times,serialNo,type) {
  1855. setPrint();
  1856. postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (res) {
  1857. if(res.code == 0){
  1858. $("#dzfpDownModal").modal("hide");
  1859. if(res.data.resUrl){
  1860. if(type == 2 || !stringNotBlank(type)){
  1861. window.open(res.data.resUrl)
  1862. }else {
  1863. //打印二维码
  1864. let height = "70mm"
  1865. let bkimgWidth = "110mm"
  1866. LODOP = getLodop();
  1867. LODOP.PRINT_INITA(6, 0, bkimgWidth, height, hospitalName+"门诊电子发票二维码打印");
  1868. //设置默认打印机
  1869. LODOP.SET_PRINTER_INDEX(printIndex);
  1870. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", bkimgWidth);
  1871. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
  1872. LODOP.SET_PRINT_PAGESIZE(1,bkimgWidth, height, "CreateCustomPage");
  1873. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊电子发票二维码");//对新建的纸张重命名
  1874. LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
  1875. LODOP.ADD_PRINT_TEXT("6mm", "3mm", "60mm", "3mm", hospitalName+"发票二维码");
  1876. LODOP.ADD_PRINT_IMAGE("10mm", "3mm", "50mm", "50mm", "data:image/png;base64,"+res.data.qrcode);
  1877. LODOP.PRINT();
  1878. // LODOP.PREVIEW();
  1879. }
  1880. } else {
  1881. errorMesage("未获取到电子发票,请重新上传发票!");
  1882. }
  1883. }else {
  1884. errorMesage(res)
  1885. }
  1886. })
  1887. }
  1888. /**
  1889. * 直接打印发票
  1890. * @param patientId
  1891. * @param times
  1892. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  1893. */
  1894. function prn1PrintHand(patientId, times, chargeFeeFlag, receiptNo, realNo) {
  1895. $("#button_" + realNo).css("display", "none");
  1896. prn1Print(patientId, times, chargeFeeFlag, receiptNo);
  1897. }
  1898. /**
  1899. * 直接打印发票
  1900. * @param patientId
  1901. * @param times
  1902. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  1903. */
  1904. function prn1Print(patientId, times, chargeFeeFlag, receiptNo) {
  1905. var url = '/thmz/getAllSerialForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo;
  1906. printCommon(url, patientId, times, chargeFeeFlag);
  1907. }
  1908. /**
  1909. * 重打发票
  1910. * @param patientId
  1911. * @param times
  1912. */
  1913. function repPrint(patientId, times, receiptNo) {
  1914. $.ajax({
  1915. type: "GET",
  1916. url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
  1917. contentType: "application/json;charset=UTF-8",
  1918. dataType: "json",
  1919. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1920. success: function (res) {
  1921. if (res == '401' || res == 401) {
  1922. window.location.href = '/thmz/login/view'
  1923. return;
  1924. }
  1925. if (res.code == 0) {
  1926. if (res.data.length == 1) {
  1927. var message = "确定要重新打印发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认发票打印机即将要打印的发票编号";
  1928. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0&receiptBill=" + res.data[0].receiptBill;
  1929. confirmMessage(patientId, times, message, url);
  1930. } else {
  1931. $("#tip_message").text("请选择需要重新打印的发票号");
  1932. $("#repPrintModal").modal();
  1933. $("#repPrintTable").html(null);
  1934. for (var i = 0; i < res.data.length; i++) {
  1935. $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
  1936. $("#repPrintModal").modal("hide");
  1937. var message = "确定要重新打印发票号码为【" + $(this).text() + "】的发票吗?请确认发票打印机即将要打印的发票编号";
  1938. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0&receiptBill=" + $(this).text();
  1939. confirmMessage(patientId, times, message, url);
  1940. });
  1941. }
  1942. }
  1943. }
  1944. }
  1945. });
  1946. }
  1947. /**
  1948. * 发票重打提示
  1949. * @param patientId
  1950. * @param times
  1951. * @param name
  1952. */
  1953. function confirmMessage(patientId, times, message, url) {
  1954. if (!confirm(message)) {
  1955. return;
  1956. }
  1957. //var url='/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=0" + "&receiptBill="+receiptBill;
  1958. printCommon(url, patientId, times, true);
  1959. }
  1960. /**
  1961. * 作废重打发票
  1962. * @param patientId
  1963. * @param times
  1964. */
  1965. function obsoleteAndRepPrint(patientId, times, receiptNo) {
  1966. $.ajax({
  1967. type: "GET",
  1968. url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
  1969. contentType: "application/json;charset=UTF-8",
  1970. dataType: "json",
  1971. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  1972. success: function (res) {
  1973. if (res == '401' || res == 401) {
  1974. window.location.href = '/thmz/login/view'
  1975. return;
  1976. }
  1977. if (res.code == 0) {
  1978. if (res.data.length == 1) {
  1979. var message = "确定要作废发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认需要作废发票编号";
  1980. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1&receiptBill=" + res.data[0].receiptBill;
  1981. confirmMessage(patientId, times, message, url);
  1982. } else {
  1983. $("#tip_message").text("请选择需要作废的发票号");
  1984. $("#repPrintModal").modal();
  1985. $("#repPrintTable").html(null);
  1986. for (var i = 0; i < res.data.length; i++) {
  1987. $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {
  1988. $("#repPrintModal").modal("hide");
  1989. var message = "确定要作废发票号码为【" + $(this).text() + "】的发票吗?请确认需要作废发票编号";
  1990. var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "&times=" + times + "&obsolete=1&receiptBill=" + $(this).text();
  1991. confirmMessage(patientId, times, message, url);
  1992. });
  1993. }
  1994. }
  1995. }
  1996. }
  1997. });
  1998. }
  1999. /**
  2000. * 打印医保结算单
  2001. * @param patientId
  2002. * @param times
  2003. * @param receiptNo
  2004. */
  2005. function printYbjsd(patientId, times, receiptNo) {
  2006. if (mzjsdHost == null) {
  2007. errorMesageSimaple("医保结算单域名为空,操作失败!");
  2008. return;
  2009. }
  2010. const iframeEle = document.getElementById('ybjsdDiv');
  2011. const loadingEle = document.getElementById('loading');
  2012. //设置ififrame透明
  2013. iframeEle.style.opacity = 0;
  2014. loadingEle.style.display = 'block';
  2015. var url = mzjsdHost + "/siSettleDetailList/" + patientId + "/" + times;
  2016. $("#ybjsdDiv").attr("src", url);
  2017. iframeEle.addEventListener('load', function () {
  2018. // Hide the loading indicator
  2019. loadingEle.style.display = 'none';
  2020. // Bring the iframe back
  2021. iframeEle.style.opacity = 1;
  2022. });
  2023. $("#ybjsdModal").modal();
  2024. }
  2025. /**
  2026. * 匹配合作项目
  2027. * @param realNo
  2028. */
  2029. function matchProject(realNo) {
  2030. $("#projectRealNo").val(realNo);
  2031. $("#projectModal").modal();
  2032. $.ajax({
  2033. type: "GET",
  2034. url: '/thmz/getMzDepositFileContractId?serialNo=' + realNo,
  2035. contentType: "application/json;charset=UTF-8",
  2036. dataType: "json",
  2037. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2038. success: function (res) {
  2039. if (res == '401' || res == 401) {
  2040. window.location.href = '/thmz/login/view'
  2041. return;
  2042. }
  2043. if (res.code == 0) {
  2044. $('#projectCharged').selectpicker('val', res.data);
  2045. $('#projectCharged').selectpicker('refresh');
  2046. }
  2047. }
  2048. });
  2049. }
  2050. /**
  2051. * 打印发票通用方法
  2052. * @param patientId
  2053. * @param times
  2054. * @param chargeFeeFlag 收费 退费标记 true 收费和重打发票来源 false 退费来源
  2055. */
  2056. function printCommon(url, patientId, times, chargeFeeFlag) {
  2057. setPrint();
  2058. var height = "93.15mm";
  2059. // if (countReceiot % 2 == 0) {
  2060. // height = "93.2mm";
  2061. // }
  2062. $.ajax({
  2063. type: "GET",
  2064. url: url,
  2065. contentType: "application/json;charset=UTF-8",
  2066. dataType: "json",
  2067. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2068. async: false,
  2069. success: function (res) {
  2070. if (res == '401' || res == 401) {
  2071. window.location.href = '/thmz/login/view'
  2072. return;
  2073. }
  2074. if (res.code == 0) {
  2075. if (res.data == null || res.data.length == 0) {
  2076. return;
  2077. }
  2078. // countReceiot++;
  2079. for (var i = 0; i < res.data.length; i++) {
  2080. LODOP = getLodop();
  2081. var temp = res.data[i].mzReceiptSerial;
  2082. LODOP.PRINT_INITA(6, 0, "120mm", height, "铭和门诊发票打印");
  2083. //设置默认打印机
  2084. LODOP.SET_PRINTER_INDEX(printIndex);
  2085. LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");
  2086. LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);
  2087. LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");
  2088. LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名
  2089. LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小
  2090. LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", hospitalName);
  2091. LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "机制号:");
  2092. LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);
  2093. LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);
  2094. LODOP.ADD_PRINT_TEXT("25mm", "7mm", "40mm", "3mm", res.mzPatientMi.name);
  2095. LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);
  2096. var feeList = res.data[i].feeList;
  2097. if (feeList != null && feeList.length > 0) {
  2098. var top = 32;
  2099. var left = 6;
  2100. for (var j = 0; j < feeList.length; j++) {
  2101. var row = parseInt(j / 3);
  2102. var tempTop = top + row * 5;
  2103. var tempLeft = left;
  2104. if (j % 3 == 1) {
  2105. tempLeft = left + 30;
  2106. } else if (j % 3 == 2) {
  2107. tempLeft = left + 60;
  2108. }
  2109. LODOP.ADD_PRINT_TEXT(tempTop + "mm", tempLeft + "mm", "30mm", "3mm", feeList[j]);
  2110. }
  2111. }
  2112. // LODOP.ADD_PRINT_TEXT("32mm","25mm","25mm","3mm","诊查费 10.00");
  2113. // LODOP.ADD_PRINT_TEXT("32mm","50mm","25mm","3mm","中成药费30.10");
  2114. // LODOP.ADD_PRINT_TEXT("37mm","25mm","25mm","3mm","治疗费 22.00");
  2115. // LODOP.ADD_PRINT_TEXT("37mm","50mm","25mm","3mm","材料费 14.20");
  2116. // LODOP.ADD_PRINT_TEXT("42mm","25mm","25mm","3mm","西药费 161.20");
  2117. // var qyxxs = res.data[i].qyxxs;
  2118. // if (qyxxs != null && qyxxs.length > 0) {
  2119. // var top = 54;
  2120. // for (var j = 0; j < qyxxs.length; j++) {
  2121. // var row = j / 3;
  2122. // var tempTop = top + row * 10;
  2123. // var qyxx = qyxxs[j];
  2124. // var arr = qyxx.split(",");
  2125. // LODOP.ADD_PRINT_TEXT(tempTop + "mm", "6mm", "50mm", "3mm", "取药窗口:" + arr[0]);
  2126. // LODOP.ADD_PRINT_TEXT(tempTop + "mm", "61mm", "50mm", "3mm", "取药号码:" + arr[1]);
  2127. // }
  2128. // }
  2129. var payInfo = res.data[i].payInfo;
  2130. LODOP.ADD_PRINT_TEXT("54mm", "6mm", "100mm", "3mm", payInfo);
  2131. // LODOP.ADD_PRINT_TEXT("54mm","25mm","50mm","3mm","取药窗口:西药房4号窗口");
  2132. // LODOP.ADD_PRINT_TEXT("54mm","80mm","35mm","3mm","取药号码:408392");
  2133. var totalCharge = temp.totalCharge + " 元 ";
  2134. if (res.data[i].countYbZf > 0) {
  2135. totalCharge = totalCharge + "城职普门"
  2136. } else {
  2137. totalCharge = totalCharge + "自费"
  2138. }
  2139. LODOP.ADD_PRINT_TEXT("65mm", "21mm", "65mm", "3mm", totalCharge);
  2140. LODOP.ADD_PRINT_TEXT("72mm", "19mm", "65mm", "3mm", res.data[i].totalChargeStr);
  2141. LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.data[i].year);//年
  2142. LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.data[i].month);//月
  2143. LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.data[i].day);//日
  2144. LODOP.ADD_PRINT_TEXT("79mm", "53mm", "50mm", "3mm", temp.operatorId);//收费员
  2145. LODOP.PRINT();
  2146. //LODOP.PREVIEW();
  2147. initFeeTable();
  2148. }
  2149. } else if (res.code == -1) {
  2150. //退费就退出,不提示异常
  2151. if (!chargeFeeFlag) {
  2152. return;
  2153. }
  2154. new PNotify({
  2155. title: '错误提示',
  2156. text: res.message,
  2157. type: 'error',
  2158. hide: true,
  2159. styling: 'bootstrap3'
  2160. });
  2161. }
  2162. }
  2163. });
  2164. }
  2165. //
  2166. // /**
  2167. // * 加载打印机列表
  2168. // * @constructor
  2169. // */
  2170. // function CreatePrinterList() {
  2171. // LODOP = getLodop();
  2172. // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "铭和门诊发票打印");
  2173. // //获取打印机设备数,用于进行遍历
  2174. // var count = LODOP.GET_PRINTER_COUNT();
  2175. // var html = "";
  2176. // for (var i = 0; i < count; i++) {
  2177. // //根据设备序号获取设备名
  2178. // var msg = LODOP.GET_PRINTER_NAME(i);
  2179. // html += "<option value='" + i + "'>" + msg + "</option>";
  2180. // }
  2181. // $('#printSelect').html(html);
  2182. // $('#printSelect').selectpicker('refresh');
  2183. // $.ajax({
  2184. // type: "GET",
  2185. // url: '/thmz/getLastWindowsByCurrentUser',
  2186. // contentType: "application/json;charset=UTF-8",
  2187. // dataType: "json",
  2188. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2189. // success: function (res) {
  2190. // if (res == '401' || res == 401) {
  2191. // window.location.href = '/thmz/login/view'
  2192. // return;
  2193. // }
  2194. // if (res.code == 0) {
  2195. // $('#printSelect').selectpicker('val', res.data.printIndex);
  2196. // $('#printSelect').selectpicker('refresh');
  2197. // printIndex=res.data.printIndex;
  2198. // }
  2199. // }
  2200. // });
  2201. // }
  2202. //
  2203. //
  2204. // /**
  2205. // * 保存窗口号
  2206. // */
  2207. // function saveWindows() {
  2208. // $.ajax({
  2209. // type: "POST",
  2210. // url: '/thmz/saveWindows',
  2211. // contentType: "application/json;charset=UTF-8",
  2212. // dataType: "json",
  2213. // data: JSON.stringify({"windowsNo": $("#windowsNum").val()}),
  2214. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2215. // success: function (res) {
  2216. // if (res == '401' || res == 401) {
  2217. // window.location.href = '/thmz/login/view'
  2218. // return;
  2219. // }
  2220. // $('#editWindowsModal').modal('hide');
  2221. // if (res.code == 0) {
  2222. // new PNotify({
  2223. // title: '操作提示',
  2224. // text: res.message,
  2225. // type: 'success',
  2226. // hide: true,
  2227. // styling: 'bootstrap3'
  2228. // });
  2229. // } else {
  2230. // new PNotify({
  2231. // title: '错误提示',
  2232. // text: res.message,
  2233. // type: 'error',
  2234. // hide: true,
  2235. // styling: 'bootstrap3'
  2236. // });
  2237. // }
  2238. // }
  2239. // });
  2240. // }
  2241. //
  2242. //
  2243. //
  2244. // /**
  2245. // * 保存打印机
  2246. // */
  2247. // function savePrint() {
  2248. // $.ajax({
  2249. // type: "POST",
  2250. // url: '/thmz/savePrintIndex',
  2251. // contentType: "application/json;charset=UTF-8",
  2252. // dataType: "json",
  2253. // data: JSON.stringify({"printIndex": $("#printSelect").val()}),
  2254. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2255. // success: function (res) {
  2256. // if (res == '401' || res == 401) {
  2257. // window.location.href = '/thmz/login/view'
  2258. // return;
  2259. // }
  2260. // LODOP = getLodop();
  2261. // LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "铭和门诊发票打印");
  2262. // LODOP.SET_PRINTER_INDEX($("#printSelect").val());
  2263. // printIndex=$("#printSelect").val();
  2264. // $('#editPrintModal').modal('hide');
  2265. // if (res.code == 0) {
  2266. // new PNotify({
  2267. // title: '操作提示',
  2268. // text: res.message,
  2269. // type: 'success',
  2270. // hide: true,
  2271. // styling: 'bootstrap3'
  2272. // });
  2273. // } else {
  2274. // new PNotify({
  2275. // title: '错误提示',
  2276. // text: res.message,
  2277. // type: 'error',
  2278. // hide: true,
  2279. // styling: 'bootstrap3'
  2280. // });
  2281. // }
  2282. // }
  2283. // });
  2284. // }
  2285. /**
  2286. * 查询默认打印机
  2287. */
  2288. function setPrint() {
  2289. if (printIndex >= 0) {
  2290. return;
  2291. }
  2292. $.ajax({
  2293. type: "GET",
  2294. url: '/thmz/getLastWindowsByCurrentUser',
  2295. contentType: "application/json;charset=UTF-8",
  2296. dataType: "json",
  2297. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2298. async: false,
  2299. success: function (res) {
  2300. if (res == '401' || res == 401) {
  2301. window.location.href = '/thmz/login/view'
  2302. return;
  2303. }
  2304. if (res.code == 0) {
  2305. printIndex = res.data.printIndex;
  2306. } else {
  2307. printIndex = -1;
  2308. }
  2309. }
  2310. });
  2311. }
  2312. /**
  2313. * 退费操作
  2314. */
  2315. function refundFee(patientId, times, receiptNo, printFlag,orderTypeName) {
  2316. if(orderTypeName =='商城处方'){
  2317. errorMesageSimaple('商城处方不能退费')
  2318. return
  2319. }
  2320. $("#refundFeePrepare").text(0.00);
  2321. $("#refundFeeDetailModal").modal();
  2322. $("#refund_bill_item_group").removeClass("in").addClass("hide");
  2323. $('#refund_fee_bill_table').bootstrapTable("destroy");
  2324. initRefundFeeDetailTable(patientId, times, receiptNo);
  2325. }
  2326. /**
  2327. * 初始化退费明细表格
  2328. * @param patientId
  2329. * @param times
  2330. * @param receiptNo
  2331. */
  2332. function initRefundFeeDetailTable(patientId, times, receiptNo) {
  2333. $("#patientIdRefund").val(patientId);
  2334. $("#timesRefund").val(times);
  2335. $("#receiptNoRefund").val(receiptNo);
  2336. $('#refund_fee_detail_table').bootstrapTable("destroy");
  2337. $('#refund_fee_detail_table').bootstrapTable({
  2338. url: '/thmz/getRefundFeeDetail', //请求后台的URL(*)
  2339. method: 'post', //请求方式(*)
  2340. toolbar: '#toolbar', //工具按钮用哪个容器
  2341. striped: true, //是否显示行间隔色
  2342. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  2343. pagination: false, //是否显示分页(*)
  2344. sortable: true, //是否启用排序
  2345. sortOrder: "asc", //排序方式
  2346. // sortName: 'orderNo', //排序字段
  2347. queryParams: queryParamsForRefundFee(patientId, times, receiptNo), //传递参数(*)
  2348. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  2349. pageNumber: 1, //初始化加载第一页,默认第一页
  2350. pageSize: 10, //每页的记录行数(*)
  2351. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  2352. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  2353. strictSearch: true,
  2354. showColumns: false, //是否显示所有的列
  2355. showRefresh: false, //是否显示刷新按钮
  2356. minimumCountColumns: 2, //最少允许的列数
  2357. clickToSelect: true, //是否启用点击选中行
  2358. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  2359. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  2360. cardView: false, //是否显示详细视图
  2361. detailView: false,
  2362. //rowStyle:rowStyle,//通过自定义函数设置行样式
  2363. ajaxOptions: {
  2364. headers: {
  2365. 'Accept': 'application/json',
  2366. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2367. }
  2368. },
  2369. columns: [
  2370. {
  2371. checkbox: true,
  2372. formatter: function (value, row, index) {
  2373. if (row.confirmFlag == 1) {
  2374. return {
  2375. disabled: true, //设置是否可用
  2376. checked: false//设置选中
  2377. }
  2378. }
  2379. if (row.confirmFlag == 3) {
  2380. //getRefundFee();
  2381. return {
  2382. disabled: true, //设置是否可用
  2383. checked: true//设置选中
  2384. }
  2385. }
  2386. }
  2387. },
  2388. {
  2389. field: 'orderNo',
  2390. title: '处方号',
  2391. align: "center",
  2392. valign: 'middle',
  2393. formatter: function (value, row, index) {
  2394. return Math.abs(value);
  2395. }
  2396. }, {
  2397. field: '',
  2398. title: '项目号',
  2399. align: "center",
  2400. valign: 'middle',
  2401. formatter: function (value, row, index) {
  2402. return index + 1;
  2403. }
  2404. }, {
  2405. field: 'billItemCode',
  2406. title: '分类名称',
  2407. align: "center",
  2408. valign: 'middle',
  2409. },
  2410. {
  2411. field: 'yjName',
  2412. title: '医技项目名称',
  2413. align: "center",
  2414. valign: 'middle',
  2415. },{
  2416. field: 'chargeItemCode',
  2417. title: '收费编码',
  2418. align: "center",
  2419. valign: 'middle',
  2420. }, {
  2421. field: 'tcName',
  2422. title: '项目',
  2423. align: "center",
  2424. valign: 'middle',
  2425. },
  2426. {
  2427. field: 'quantity',
  2428. title: '数量',
  2429. align: "center",
  2430. valign: 'middle'
  2431. ,
  2432. formatter: function (value, row, index) {
  2433. return value * row.drugWin;
  2434. }
  2435. }, {
  2436. field: 'unitPrice',
  2437. title: '单价(元)',
  2438. align: "center",
  2439. valign: 'middle',
  2440. formatter: function (value, row, index) {
  2441. return value.toFixed(2);
  2442. }
  2443. }, {
  2444. field: 'amount',
  2445. title: '总金额(元)',
  2446. align: "center",
  2447. valign: 'middle',
  2448. formatter: function (value, row, index) {
  2449. return value.toFixed(2);
  2450. }
  2451. }, {
  2452. field: 'confirmFlag',
  2453. title: '确认标志',
  2454. align: "center",
  2455. valign: 'middle',
  2456. formatter: function (value, row, index) {
  2457. if (value == 0) {
  2458. return "待确认";
  2459. }
  2460. if (value == 1) {
  2461. return "已确认";
  2462. }
  2463. if (value == 3) {
  2464. return "已取消";
  2465. }
  2466. if (value == 4) {
  2467. return "已退费";
  2468. }
  2469. }
  2470. }, {
  2471. field: 'decAmount',
  2472. title: '退药量',
  2473. align: "center",
  2474. valign: 'middle',
  2475. // formatter: function (value, row, index) {
  2476. // return value.toFixed(2);
  2477. // }
  2478. }, {
  2479. field: 'execDept',
  2480. title: '确认科室',
  2481. align: "center",
  2482. valign: 'middle'
  2483. }, {
  2484. field: 'confirmTime',
  2485. title: '确认时间',
  2486. align: "center",
  2487. valign: 'middle',
  2488. formatter: function (value, row, index) {
  2489. if (value != null && value != "") {
  2490. return format(value, "yyyy-MM-dd HH:mm:ss");
  2491. }
  2492. return "";
  2493. }
  2494. }
  2495. ],
  2496. //点击全选框时触发的操作
  2497. onCheckAll: function (rows) {
  2498. getRefundFee();
  2499. },
  2500. //取消所有
  2501. onUncheckAll: function (row) {
  2502. getRefundFee();
  2503. },
  2504. //点击每一个单选框时触发的操作
  2505. onCheck: function (row) {
  2506. getRefundFee();
  2507. },
  2508. //取消每一个单选框时对应的操作;
  2509. onUncheck: function (row) {
  2510. getRefundFee();
  2511. },
  2512. responseHandler: function (res) {
  2513. if (res == '401' || res == 401) {
  2514. window.location.href = '/thmz/login/view'
  2515. return;
  2516. }
  2517. var ress = eval(res);
  2518. if (ress.code == -1) {
  2519. new PNotify({
  2520. title: '错误提示',
  2521. text: ress.message,
  2522. type: 'error',
  2523. hide: true,
  2524. styling: 'bootstrap3'
  2525. });
  2526. return {
  2527. "total": 0,//总页数
  2528. "rows": {} //数据
  2529. };
  2530. }
  2531. return {
  2532. //"total": ress.pageViewVo.total,//总页数
  2533. "rows": ress.data //数据
  2534. };
  2535. },
  2536. //加载完成事件
  2537. onLoadSuccess: function (data) {
  2538. getRefundFee();
  2539. }
  2540. });
  2541. }
  2542. /**
  2543. * 退费列表参数
  2544. * @param patientId
  2545. * @param times
  2546. * @returns {{patientId: *, times: *}}
  2547. */
  2548. function queryParamsForRefundFee(patientId, times, receiptNo) {
  2549. var temp = {
  2550. patientId: patientId,
  2551. times: times,
  2552. receiptNo: receiptNo
  2553. };
  2554. return temp;
  2555. };
  2556. /**
  2557. * 每次选择费用清单明细时计算实际应退金额
  2558. */
  2559. function getRefundFee() {
  2560. extracted();
  2561. if (chargeItemCodes == null) {
  2562. $("#refundFeePrepare").text(0.00);
  2563. return;
  2564. }
  2565. $.ajax({
  2566. type: "POST",
  2567. url: '/thmz/getNewListForRefundFee',
  2568. contentType: "application/json;charset=UTF-8",
  2569. dataType: "json",
  2570. data: JSON.stringify({
  2571. patientId: $("#patientIdRefund").val(),
  2572. times: $("#timesRefund").val(),
  2573. receiptNo: $("#receiptNoRefund").val(),
  2574. chargeItemCodes: chargeItemCodes
  2575. }),
  2576. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2577. success: function (res) {
  2578. if (res == '401' || res == 401) {
  2579. window.location.href = '/thmz/login/view'
  2580. return;
  2581. }
  2582. if (res.code == 0) {
  2583. $("#refundFeePrepare").text(res.pageViewVo.data[0].refundFee.toFixed(2));
  2584. } else {
  2585. new PNotify({
  2586. title: '错误提示',
  2587. text: res.message,
  2588. type: 'error',
  2589. hide: true,
  2590. styling: 'bootstrap3'
  2591. });
  2592. }
  2593. }
  2594. });
  2595. }
  2596. /**
  2597. * 发起预退费
  2598. */
  2599. function readyRefundFee() {
  2600. extracted();
  2601. $("#refundFeeModal").modal();
  2602. initRefundChargeDetailTable(chargeItemCodes);
  2603. $("#refundFeeDetailModal").modal("hide");
  2604. }
  2605. /**
  2606. * 获取预退费金额
  2607. * @returns {*}
  2608. */
  2609. function extracted() {
  2610. var allSelecteds = $('#refund_fee_detail_table').bootstrapTable('getAllSelections');
  2611. chargeItemCodes = null;
  2612. if (allSelecteds != null && allSelecteds.length > 0) {
  2613. for (var i = 0; i < allSelecteds.length; i++) {
  2614. var temp = allSelecteds[i].orderNo + "_" + allSelecteds[i].itemNo + "_" + allSelecteds[i].chargeItemCode;
  2615. if (chargeItemCodes == null) {
  2616. chargeItemCodes = temp;
  2617. } else {
  2618. chargeItemCodes += "," + temp;
  2619. }
  2620. }
  2621. }
  2622. }
  2623. /**
  2624. * 初始化退费重收费明细表格
  2625. */
  2626. function initRefundChargeDetailTable(chargeItemCodes) {
  2627. $('#refund_fee_table').bootstrapTable("destroy");
  2628. $('#refund_fee_table').bootstrapTable({
  2629. url: '/thmz/getNewListForRefundFee', //请求后台的URL(*)
  2630. method: 'post', //请求方式(*)
  2631. toolbar: '#toolbar', //工具按钮用哪个容器
  2632. striped: true, //是否显示行间隔色
  2633. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  2634. pagination: false, //是否显示分页(*)
  2635. sortable: true, //是否启用排序
  2636. sortOrder: "asc", //排序方式
  2637. // sortName: 'orderNo', //排序字段
  2638. queryParams: queryParamsForRefundDetail(chargeItemCodes), //传递参数(*)
  2639. sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
  2640. pageNumber: 1, //初始化加载第一页,默认第一页
  2641. pageSize: 10, //每页的记录行数(*)
  2642. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  2643. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  2644. strictSearch: true,
  2645. showColumns: false, //是否显示所有的列
  2646. showRefresh: false, //是否显示刷新按钮
  2647. minimumCountColumns: 2, //最少允许的列数
  2648. clickToSelect: true, //是否启用点击选中行
  2649. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  2650. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  2651. cardView: false, //是否显示详细视图
  2652. detailView: false,
  2653. //rowStyle:rowStyle,//通过自定义函数设置行样式
  2654. ajaxOptions: {
  2655. headers: {
  2656. 'Accept': 'application/json',
  2657. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2658. }
  2659. },
  2660. columns: [
  2661. // {
  2662. // checkbox: true
  2663. // },
  2664. {
  2665. field: 'patientId',
  2666. title: '患者编号',
  2667. align: "center",
  2668. valign: 'middle',
  2669. }, {
  2670. field: 'name',
  2671. title: '患者姓名',
  2672. align: "center",
  2673. valign: 'middle',
  2674. }, {
  2675. field: 'oriAmount',
  2676. title: '已收金额(元)',
  2677. align: "center",
  2678. valign: 'middle',
  2679. }, {
  2680. field: 'refundFee',
  2681. title: '应退金额(元)',
  2682. align: "center",
  2683. valign: 'middle'
  2684. }, {
  2685. field: 'amount',
  2686. title: '应收金额(元)',
  2687. align: "center",
  2688. valign: 'middle',
  2689. formatter: function (value, row, index) {
  2690. return Math.abs(value);
  2691. }
  2692. }, {
  2693. title: '操作',
  2694. align: "center",
  2695. valign: 'middle',
  2696. // sortable: true,
  2697. formatter: function (value, row, index) {
  2698. var str = "";
  2699. if (row.amount == 0 || row.amount == null || row.amount == undefined) {
  2700. str = '<button type="button" class="can-not-used" title="费用明细" ><i id="plusOrMinus" class="fa fa-plus"></i></button>';
  2701. } else {
  2702. str = '<button type="button" class="registration-no-color-foot-button" title="费用明细" onclick="initMzChargeDetailByBillItem(true)"><i id="plusOrMinus" class="fa fa-plus"></i></button>';
  2703. }
  2704. if((row.amount == 0 || row.amount == null || row.amount == undefined) || row.ybZfFlag == null || row.ybZfFlag =='0'){
  2705. str += '<button type="button" class="can-not-used" title="撤销医保重新登记医保" ><i class="fa fa-server"></i></button>';
  2706. }else {
  2707. str += '<button type="button" class="registration-no-color-foot-button" title="撤销医保重新登记医保" onclick="reqYb()"><i class="fa fa-server"></i></button>';
  2708. }
  2709. if(row.mipOrderFlag == 1){
  2710. str += `<button type="button" class="registration-no-color-foot-button"title="读取电子凭证" onclick="reSiReadCard(true,'01')"><i class="fa fa-newspaper-o"></i></button>`;
  2711. }
  2712. str += '<button type="button" class="registration-no-color-foot-button"title="普通退费" onclick="saveRefundFee(0)"><i class="fa fa-check"></i></button>';
  2713. str += '<button type="button" class="registration-no-color-foot-button"title="原路退费" onclick="saveRefundFee(1)"><i class="fa fa-exchange"></i></button>';
  2714. return str;
  2715. }
  2716. }
  2717. ],
  2718. responseHandler: function (res) {
  2719. if (res == '401' || res == 401) {
  2720. window.location.href = '/thmz/login/view'
  2721. return;
  2722. }
  2723. var ress = eval(res);
  2724. if (ress.code == -1) {
  2725. new PNotify({
  2726. title: '错误提示',
  2727. text: ress.message,
  2728. type: 'error',
  2729. hide: true,
  2730. styling: 'bootstrap3'
  2731. });
  2732. return {
  2733. "total": 0,//总页数
  2734. "rows": {} //数据
  2735. };
  2736. }
  2737. if((ress.pageViewVo.data[0].ybZfFlag =='1' ) && (ress.pageViewVo.data[0].amount !=null && ress.pageViewVo.data[0].amount != undefined && ress.pageViewVo.data[0].amount != 0)){
  2738. $("#tfGrzhzfDiv").removeClass("hide").addClass("in");
  2739. }else {
  2740. $("#tfGrzhzfDiv").removeClass("in").addClass("hide");
  2741. }
  2742. $("#oriAmount").text(ress.pageViewVo.data[0].oriAmount);
  2743. $("#newAmount").text(ress.pageViewVo.data[0].amount);
  2744. $("#refundAmount").text(ress.pageViewVo.data[0].refundFee);
  2745. return {
  2746. "total": ress.pageViewVo.total,//总页数
  2747. "rows": ress.pageViewVo.data //数据
  2748. };
  2749. },
  2750. });
  2751. }
  2752. /**
  2753. * 构建列表查询参数
  2754. * @param chargeItemCodes
  2755. * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}}
  2756. */
  2757. function queryParamsForRefundDetail(chargeItemCodes) {
  2758. return {
  2759. patientId: $("#patientIdRefund").val(),
  2760. times: $("#timesRefund").val(),
  2761. receiptNo: $("#receiptNoRefund").val(),
  2762. chargeItemCodes: chargeItemCodes
  2763. };
  2764. };
  2765. /**
  2766. * 关闭预退费窗口
  2767. */
  2768. function closeRefundFeeDetailModal() {
  2769. $("#refundFeeDetailModal").modal("hide");
  2770. }
  2771. /**
  2772. * 提交退费操作
  2773. * @param refundType 0 现金退费 1 原路退费
  2774. */
  2775. function saveRefundFee(refundType) {
  2776. var params = queryParamsForRefundByBillItem(null);
  2777. params.refundType = refundType;
  2778. params['readCardResult'] = $("#cdReadCardResult").val()
  2779. params['acctUsedFlag'] = $("#tfGrzhzf").val()
  2780. params['readCardType'] = $("#tfReadType").val()
  2781. $.ajax({
  2782. type: "POST",
  2783. url: '/thmz/saveRefundFee',
  2784. contentType: "application/json;charset=UTF-8",
  2785. dataType: "json",
  2786. data: JSON.stringify(params),
  2787. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2788. success: function (res) {
  2789. if (res == '401' || res == 401) {
  2790. window.location.href = '/thmz/login/view'
  2791. return;
  2792. }
  2793. $("#cdReadCardResult").val(null)
  2794. if (res.code == 0 || res.code == -2) {
  2795. successMesage(res);
  2796. $("#refundFeeModal").modal("hide");
  2797. var refundMzDepositFiles = res.refundMzDepositFiles;
  2798. if (refundMzDepositFiles != null && refundMzDepositFiles.length > 0) {
  2799. var html = '';
  2800. for (var i = 0; i < refundMzDepositFiles.length; i++) {
  2801. var mzDepositFile = refundMzDepositFiles[i];
  2802. html += '<div class="item form-group col-md-12 col-sm-12 col-xs-12">';
  2803. html += '<label style="padding-left: 0px;" class="control-label col-md-2 col-sm-2 col-xs-2">';
  2804. html += mzDepositFile.chequeType;
  2805. html += '</label>';
  2806. html += '<div class="col-md-6 col-sm-6 col-xs-6">';
  2807. html += '<input type="text" class="form-control" readonly value="' + Math.abs(mzDepositFile.amount) + '">';
  2808. html += '</div>';
  2809. html += '<label style="text-align: left;" class="control-label col-md-1 col-sm-1 col-xs-1">元</label>';
  2810. html += '<label style="text-align: left;color: red" class="control-label col-md-3 col-sm-3 col-xs-3">';
  2811. if(res.mipOrdeFlag !=null && res.mipOrdeFlag == 1){
  2812. html += "原路退回";
  2813. }
  2814. else if ((refundType == 1 && (mzDepositFile.chequeType == "银联卡" || mzDepositFile.chequeType == "聚合支付")) || mzDepositFile.chequeType == "医保记账" || mzDepositFile.chequeType == "省医保个账" || mzDepositFile.chequeType == "市医保个账") {
  2815. html += "原路退回";
  2816. }
  2817. html += '</label>';
  2818. html += '</div>';
  2819. }
  2820. $("#refundPayDetailForm").html(html);
  2821. $("#refundPayDetailModal").modal();
  2822. }
  2823. //作废电子发票
  2824. if(fpVsesionNo == 1){
  2825. uploadMzInvoice(params.patientId, params.times,params.receiptNo,2);
  2826. }
  2827. if (res.times > 0) {
  2828. let fpTitle = fpVsesionNo == 0 ? '打印' : '上传';
  2829. if(confirm(`是否${fpTitle}发票?`)){
  2830. if(fpVsesionNo == 0){
  2831. prn1Print(res.patientId, res.times, false, 1);
  2832. }else {
  2833. printDzfp(res.patientId, res.times,1,0)
  2834. }
  2835. }
  2836. } else {
  2837. initFeeTable();
  2838. }
  2839. } else {
  2840. errorMesage(res);
  2841. }
  2842. }
  2843. });
  2844. }
  2845. /**
  2846. * 清空查询条件
  2847. */
  2848. function cleanParams() {
  2849. $("#deptNoParam").selectpicker('val', null);//默认选中
  2850. $("#deptNoParam").selectpicker('refresh');
  2851. $("#doctorParam").selectpicker('val', null);//默认选中
  2852. $("#doctorParam").selectpicker('refresh');
  2853. $("#cardNo").val(null);
  2854. $("#name").val(null);
  2855. $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));
  2856. $("#patientId").val(null);
  2857. //默认光标在卡号输入框
  2858. $("#cardNo").focus();
  2859. $("#serialNo").val(null);
  2860. $("#ownData").removeAttr("checked");
  2861. }
  2862. /**
  2863. * 增加收费方式
  2864. */
  2865. function addPayType(id) {
  2866. // var arr = $("#payForm").find("div.pay-item");
  2867. // if (arr.length > 0) {
  2868. // for (var i = 0; i < arr.length; i++) {
  2869. // var temp = parseFloat($(arr[i]).find("input").val());
  2870. // if (temp == 0) {
  2871. // new PNotify({
  2872. // title: '错误提示',
  2873. // text: "存在未使用的收款方式,请不要重复添加!",
  2874. // type: 'error',
  2875. // hide: true,
  2876. // styling: 'bootstrap3'
  2877. // });
  2878. // return;
  2879. // }
  2880. // }
  2881. // }
  2882. var payTypeId = null;
  2883. if (id != undefined && id != null) {
  2884. payTypeId = id;
  2885. } else {
  2886. var payTypeIndex = $("#payTypeIndex").val();
  2887. payTypeId = "payType_" + payTypeIndex;
  2888. }
  2889. var html = '<div class="item form-group pay-item"><div class="col-md-12 col-sm-12 col-xs-12"> <input type="hidden" class="refNo"/><input type="hidden" class="qrCodeParam"/><input type="hidden" class="transDate"/><input type="hidden" class="payChannel"/><input type="hidden" class="traceNo"/><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 money" type="number" data-placement="bottom-right" min="0" onchange="checkFee(false)" ';
  2890. if ("payType" == id) {
  2891. html += " id='cash' ";
  2892. }
  2893. html += '></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>';
  2894. $("#changeAmountParent").before(html);
  2895. initChequeType(payTypeId)
  2896. if (payTypeIndex != undefined && payTypeIndex != null) {
  2897. payTypeIndex = Add(payTypeIndex, 1);
  2898. $("#payTypeIndex").val(payTypeIndex);
  2899. }
  2900. $("#addPayType").parent().removeClass("in").addClass("hide");
  2901. }
  2902. // /**
  2903. // * 取消费用上传
  2904. // */
  2905. // function cancelFee() {
  2906. // var patientId = $("#patientIdHaveTally").val();
  2907. // var times = $("#timesHaveTally").val();
  2908. // var receiptNo = $("#receiptNoHaveTally").val();
  2909. // $.ajax({
  2910. // type: "POST",
  2911. // url: '/thmz/cancelTmFee',
  2912. // contentType: "application/json;charset=UTF-8",
  2913. // dataType: "json",
  2914. // data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
  2915. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  2916. // async: false,
  2917. // success: function (res) {
  2918. // if (res == '401' || res == 401) {
  2919. // window.location.href = '/thmz/login/view'
  2920. // return;
  2921. // }
  2922. // if (res.code == 0) {
  2923. // $("#fundPay").val(0);
  2924. // } else {
  2925. // new PNotify({
  2926. // title: '错误提示',
  2927. // text: res.message,
  2928. // type: 'error',
  2929. // hide: true,
  2930. // styling: 'bootstrap3'
  2931. // });
  2932. // }
  2933. // }
  2934. // });
  2935. // }
  2936. /**
  2937. * 查询当前门诊缴费订单的所有缴费方式列表
  2938. * @param patientId
  2939. * @param times
  2940. * @param receiptNo
  2941. */
  2942. function showChequType(patientId, times, receiptNo) {
  2943. $("#depositFileModal").modal();
  2944. $('#deposit_file_detail_table').bootstrapTable("destroy");
  2945. $('#deposit_file_detail_table').bootstrapTable({
  2946. url: '/thmz/getAllDepositFileForThisTime?patientId=' + patientId + "&times=" + times + "&receiptNo=" + Math.abs(receiptNo), //请求后台的URL(*)
  2947. method: 'get', //请求方式(*)
  2948. toolbar: '#toolbar', //工具按钮用哪个容器
  2949. striped: true, //是否显示行间隔色
  2950. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  2951. pagination: false, //是否显示分页(*)
  2952. sortable: true, //是否启用排序
  2953. sortOrder: "asc", //排序方式
  2954. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  2955. pageNumber: 1, //初始化加载第一页,默认第一页
  2956. pageSize: 5, //每页的记录行数(*)
  2957. pageList: [10, 25, 50, 100], //可供选择的每页的行数(*)
  2958. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  2959. strictSearch: true,
  2960. showColumns: false, //是否显示所有的列
  2961. showRefresh: false, //是否显示刷新按钮
  2962. minimumCountColumns: 2, //最少允许的列数
  2963. clickToSelect: true, //是否启用点击选中行
  2964. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  2965. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  2966. cardView: false, //是否显示详细视图
  2967. detailView: false,
  2968. //rowStyle:rowStyle,//通过自定义函数设置行样式
  2969. ajaxOptions: {
  2970. headers: {
  2971. 'Accept': 'application/json',
  2972. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  2973. }
  2974. },
  2975. columns: [
  2976. // {
  2977. // checkbox: true,
  2978. // },
  2979. {
  2980. field: 'patientId',
  2981. title: '病人编号',
  2982. align: "center",
  2983. valign: 'middle'
  2984. }, {
  2985. field: 'times',
  2986. title: '就诊次数',
  2987. align: "center",
  2988. valign: 'middle',
  2989. }, {
  2990. field: 'amount',
  2991. title: '支付金额(元)',
  2992. align: "center",
  2993. valign: 'middle',
  2994. formatter: function (value, row, index) {
  2995. return value.toFixed(2);
  2996. }
  2997. },
  2998. {
  2999. field: 'chequeTypeName',
  3000. title: '支付方式',
  3001. align: "center",
  3002. valign: 'middle'
  3003. }
  3004. ],
  3005. onDblClickRow: function (row) {
  3006. editChequType(row.receiptSn, row.chequeType, row.dcountNo, row.chequeTypeName);
  3007. },
  3008. responseHandler: function (res) {
  3009. if (res == '401' || res == 401) {
  3010. window.location.href = '/thmz/login/view'
  3011. return;
  3012. }
  3013. var ress = eval(res);
  3014. if (ress.code == -1) {
  3015. new PNotify({
  3016. title: '错误提示',
  3017. text: ress.message,
  3018. type: 'error',
  3019. hide: true,
  3020. styling: 'bootstrap3'
  3021. });
  3022. return {
  3023. "total": 0,//总页数
  3024. "rows": {} //数据
  3025. };
  3026. }
  3027. if (ress.data == null || ress.data.length == 0) {
  3028. $("#tallyDetailModal").modal("hide");
  3029. }
  3030. return {
  3031. "rows": ress.data //数据
  3032. };
  3033. },
  3034. });
  3035. }
  3036. /**
  3037. * 修改收款方式
  3038. * @param patientId
  3039. * @param times
  3040. * @param paymode
  3041. */
  3042. function editChequType(receiptSn, chequType, dcountNo, chequeTypeName) {
  3043. var message = "当前病人本次门诊缴费的支付方式为【" + chequeTypeName + "】,确定需要修改吗?";
  3044. if (dcountNo == 1) {
  3045. message = "当前病人本次门诊缴费的支付方式为【" + chequeTypeName + "】,且本次缴费已经结算,确定需要修改吗?如仍需继续修改,会影响已经结算的报表,请重新打印本次缴费所在日期的【日结报表】!";
  3046. }
  3047. $("#editPayModeTip").html(message);
  3048. $("#receiptSn").val(receiptSn);
  3049. $("#chequType").val(chequType);
  3050. $('#payTypeEditPayMode').selectpicker('val', 1);
  3051. $('#payTypeEditPayMode').selectpicker('refresh');
  3052. $("#editPayModeModal").modal();
  3053. $("#depositFileModal").modal("hide");
  3054. }
  3055. /**
  3056. * 提交修改收款方式
  3057. */
  3058. function saveEditPayMode() {
  3059. $.ajax({
  3060. type: "GET",
  3061. url: '/thmz/updateChequType?oldChequeType=' + $("#chequType").val() + "&receiptSn=" + $("#receiptSn").val() + "&chequeType=" + $("#payTypeEditPayMode").val(),
  3062. contentType: "application/json;charset=UTF-8",
  3063. dataType: "json",
  3064. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3065. success: function (res) {
  3066. if (res == '401' || res == 401) {
  3067. window.location.href = '/thmz/login/view'
  3068. return;
  3069. }
  3070. if (res.code == 0) {
  3071. successMesage(res);
  3072. clearEditPayMode();
  3073. $("#editPayModeModal").modal("hide");
  3074. } else if (res.code == -1) {
  3075. new PNotify({
  3076. title: '错误提示',
  3077. text: res.message,
  3078. type: 'error',
  3079. hide: true,
  3080. styling: 'bootstrap3'
  3081. });
  3082. }
  3083. }
  3084. });
  3085. }
  3086. /**
  3087. * 清空
  3088. */
  3089. function clearEditPayMode() {
  3090. $("#receiptSn").val(null);
  3091. $("#chequType").val(null);
  3092. }
  3093. //
  3094. // /**
  3095. // * 反写备份表的数据到正式表中,记账的数据在备分表
  3096. // * @param patientId
  3097. // * @param times
  3098. // * @param receiptNo
  3099. // */
  3100. // function reInsertDetailModal(patientId,times ,receiptNo) {
  3101. // $.ajax({
  3102. // type: "POST",
  3103. // url: '/thmz/reSaveDetailForByjz',
  3104. // contentType: "application/json;charset=UTF-8",
  3105. // dataType: "json",
  3106. // data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),
  3107. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3108. // async: false,
  3109. // success: function (res) {
  3110. // if (res == '401' || res == 401) {
  3111. // window.location.href = '/thmz/login/view'
  3112. // return;
  3113. // }
  3114. // if (res.code == 0) {
  3115. // successMesage(res);
  3116. // initFeeTable();
  3117. // } else {
  3118. // new PNotify({
  3119. // title: '错误提示',
  3120. // text: res.message,
  3121. // type: 'error',
  3122. // hide: true,
  3123. // styling: 'bootstrap3'
  3124. // });
  3125. // }
  3126. // }
  3127. // });
  3128. // }
  3129. /**
  3130. * 医保电子凭证读卡
  3131. * @param params
  3132. */
  3133. function siReadCard(params) {
  3134. $.ajax({
  3135. type: "GET",
  3136. url: params && params.startsWith('jiangsu_qrcode') ? 'http://localhost:8321/api/entry?param=' + params : 'http://localhost:8321/readcard/entry?param=' + params,
  3137. contentType: "application/json;charset=UTF-8",
  3138. dataType: "json",
  3139. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3140. success: function (res) {
  3141. if (res == '401' || res == 401) {
  3142. window.location.href = '/thmz/login/view'
  3143. return;
  3144. }
  3145. //console.log(res);
  3146. if (res.code == 200) {
  3147. var data = JSON.parse(res.data);
  3148. queryUserInfoBySocialNoNotFillPatient('cardNo', "" + data.data.idNo + "", initFeeTable, null);
  3149. } else {
  3150. errorMesage(res);
  3151. }
  3152. }
  3153. });
  3154. // window.open('ReadCard://'+prm, '_self')
  3155. }
  3156. /**
  3157. * 读卡类型改变事件
  3158. */
  3159. // function mztczfSiReadCardTypeChange() {
  3160. // var grzhzf = $("#grzhzf").val();
  3161. // if (grzhzf == null || grzhzf == "") {
  3162. // errorMesageSimaple("请先选择是否使用个人账户余额支付剩余门诊费用!")
  3163. // $('#mztczfSiReadCardType').selectpicker('val', null);
  3164. // $('#mztczfSiReadCardType').selectpicker('refresh');
  3165. // return;
  3166. // }
  3167. // var mztczfSiReadCardType = $("#mztczfSiReadCardType").val();
  3168. // if (mztczfSiReadCardType == null || mztczfSiReadCardType == "") {
  3169. // return;
  3170. // }
  3171. // let admdvs = $('#mztczfAdvmCity').val()
  3172. // if(!stringNotBlank(admdvs)){
  3173. // errorMesageSimaple("请选择参保地!")
  3174. // $('#mztczfSiReadCardType').selectpicker('val', null);
  3175. // $('#mztczfSiReadCardType').selectpicker('refresh');
  3176. // return;
  3177. // }
  3178. // postAjaxJsonHttpRequst("/thmz/queryNewInsuinfo",{
  3179. // patientId :readPatientId,
  3180. // times :readTimes,
  3181. // admdvs:admdvs
  3182. // },true,function (sfzRes) {
  3183. // if (sfzRes == '401' || sfzRes == 401) {
  3184. // window.location.href = '/thmz/login/view'
  3185. // return;
  3186. // }
  3187. // if(sfzRes.code == 0){
  3188. // var url = "http://localhost:8321/readcard/entry?param=";
  3189. // if (mztczfSiReadCardType == "03") {
  3190. // // url += 'sicard_01101';
  3191. // url = "http://localhost:8321/readcard/jiangsu/readcard_auto";
  3192. // // url += 'readcard_auto';
  3193. // } else if (mztczfSiReadCardType == "01") {
  3194. // // url += 'qrcode_01101';
  3195. // url = "http://localhost:8321/api/entry?param=";
  3196. // url += 'jiangsu_qrcode_01101';
  3197. // } else if (mztczfSiReadCardType == "02") {
  3198. // // url += 'idcard_01101';
  3199. // url += 'huashi_readcard';
  3200. // }else if (mztczfSiReadCardType == "04") {
  3201. // url += 'face_01101';
  3202. // url += 'jiangsu_face_01101';
  3203. // }
  3204. // $.ajax({
  3205. // type: "GET",
  3206. // url: url,
  3207. // contentType: "application/json;charset=UTF-8",
  3208. // dataType: "json",
  3209. // headers: {
  3210. // 'Accept': 'application/json',
  3211. // 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3212. // },
  3213. // success: function (res) {
  3214. // if (res == '401' || res == 401) {
  3215. // window.location.href = '/thmz/login/view'
  3216. // return;
  3217. // }
  3218. // if (res.code == 200) {
  3219. // if (mztczfSiReadCardType == "03") {
  3220. // $("#readCardResult").val(res.rawCardData);
  3221. // $("#pBusiCardInfo").val(res.rawBusiData);
  3222. // } else if (mztczfSiReadCardType == "01") {
  3223. // var data = JSON.parse(res.data);
  3224. // $("#readCardResult").val(JSON.stringify(data.data));
  3225. // } else {
  3226. // $("#readCardResult").val(res.data);
  3227. // }
  3228. // successMesageSimaple("读卡成功,可以进行医保结算操作。");
  3229. // $("#mztczfSiReadCardModal").modal("hide");
  3230. // } else {
  3231. // warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!")
  3232. // console.log(res);
  3233. // }
  3234. // },
  3235. // error: function (XMLHttpRequest, textStatus, errorThrown) {
  3236. // warningMesageSimaple("读卡异常,可以稍后重试或者自费结算(不享受门诊统筹)!")
  3237. // }
  3238. // });
  3239. // }else {
  3240. // errorMesage(sfzRes)
  3241. // }
  3242. // })
  3243. // }
  3244. function mztczfSiReadCardTypeChange() {
  3245. // 显示loading效果
  3246. $("#readLoadingModal").modal('show');
  3247. // var grzhzf = $("#grzhzf").val();
  3248. // if (grzhzf == null || grzhzf == "") {
  3249. // errorMesageSimaple("请先选择是否使用个人账户余额支付剩余门诊费用!");
  3250. // $('#mztczfSiReadCardType').selectpicker('val', null);
  3251. // $('#mztczfSiReadCardType').selectpicker('refresh');
  3252. // $("#readLoadingModal").modal('hide'); // 隐藏loading
  3253. // return;
  3254. // }
  3255. // var mztczfSiReadCardType = $("#mztczfSiReadCardType").val();
  3256. // if (mztczfSiReadCardType == null || mztczfSiReadCardType == "") {
  3257. // $("#readLoadingModal").modal('hide'); // 隐藏loading
  3258. // return;
  3259. // }
  3260. // let admdvs = $('#mztczfAdvmCity').val();
  3261. // if (!stringNotBlank(admdvs)) {
  3262. // errorMesageSimaple("请选择参保地!");
  3263. // $('#mztczfSiReadCardType').selectpicker('val', null);
  3264. // $('#mztczfSiReadCardType').selectpicker('refresh');
  3265. // $("#readLoadingModal").modal('hide'); // 隐藏loading
  3266. // return;
  3267. // }
  3268. var grzhzf = $('input[name="grzhzf"]:checked').val();
  3269. if (grzhzf == null || grzhzf == "") {
  3270. errorMesageSimaple("请先选择是否使用个人账户余额支付剩余门诊费用!");
  3271. $('input[name="grzhzf"]').prop('checked', false);
  3272. $("#grzhzf_0").prop('checked', true);
  3273. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3274. return;
  3275. }
  3276. var mztczfSiReadCardType = $('input[name="mztczfSiReadCardType"]:checked').val();
  3277. if (mztczfSiReadCardType == null || mztczfSiReadCardType == "") {
  3278. errorMesageSimaple("请选择读卡类型!");
  3279. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3280. return;
  3281. }
  3282. let admdvs = $('#mztczfAdvmCity').val();
  3283. if (!stringNotBlank(admdvs)) {
  3284. errorMesageSimaple("请选择参保地!");
  3285. $('input[name="mztczfSiReadCardType"]').prop('checked', false);
  3286. $("#mztczfSiReadCardType_03").prop('checked', true);
  3287. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3288. return;
  3289. }
  3290. postAjaxJsonHttpRequst("/thmz/queryNewInsuinfo", {
  3291. patientId: readPatientId,
  3292. times: readTimes,
  3293. admdvs: admdvs
  3294. }, true, function (sfzRes) {
  3295. if (sfzRes == '401' || sfzRes == 401) {
  3296. window.location.href = '/thmz/login/view';
  3297. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3298. return;
  3299. }
  3300. if (sfzRes.code == 0) {
  3301. var url = "";
  3302. if (mztczfSiReadCardType == "03") {
  3303. url = "http://localhost:8321/readcard/jiangsu/readcard_auto";
  3304. } else if (mztczfSiReadCardType == "01") {
  3305. url = "http://localhost:8321/api/entry?param=jiangsu_qrcode_01101";
  3306. } else if (mztczfSiReadCardType == "02") {
  3307. url = "http://localhost:8321/readcard/entry?param=huashi_readcard";
  3308. } else if (mztczfSiReadCardType == "04") {
  3309. // url = "http://localhost:8321/readcard/entry?param=face_01101";
  3310. url = "http://localhost:8321/readcard/entry?param=jiangsu_face_01101";
  3311. }
  3312. // 社保卡使用自动重试机制,其他读卡类型不使用重试
  3313. if (mztczfSiReadCardType == "03") {
  3314. // 社保卡:使用自动重试机制
  3315. callReadCardWithRetry(url, 5, 500, function (res) {
  3316. // 成功回调
  3317. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3318. $("#readCardResult").val(res.rawCardData);
  3319. $("#pBusiCardInfo").val(res.rawBusiData);
  3320. successMesageSimaple("读卡成功,可以进行医保结算操作。");
  3321. $("#mztczfSiReadCardModal").modal("hide");
  3322. }, function (err) {
  3323. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3324. warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!");
  3325. console.log(err);
  3326. });
  3327. } else {
  3328. // 其他读卡类型:不使用重试,直接请求一次
  3329. $.ajax({
  3330. type: "GET",
  3331. url: url,
  3332. contentType: "application/json;charset=UTF-8",
  3333. dataType: "json",
  3334. headers: {
  3335. 'Accept': 'application/json',
  3336. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3337. },
  3338. success: function (res) {
  3339. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3340. if (res.code == 200) {
  3341. if (mztczfSiReadCardType == "01") {
  3342. var data = JSON.parse(res.data);
  3343. $("#readCardResult").val(JSON.stringify(data.data));
  3344. } else {
  3345. $("#readCardResult").val(res.data);
  3346. }
  3347. successMesageSimaple("读卡成功,可以进行医保结算操作。");
  3348. $("#mztczfSiReadCardModal").modal("hide");
  3349. } else {
  3350. warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!");
  3351. }
  3352. },
  3353. error: function (XMLHttpRequest, textStatus, errorThrown) {
  3354. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3355. warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!");
  3356. console.log("读卡异常:", textStatus, errorThrown);
  3357. }
  3358. });
  3359. }
  3360. } else {
  3361. $("#readLoadingModal").modal('hide'); // 隐藏loading
  3362. errorMesage(sfzRes);
  3363. }
  3364. });
  3365. }
  3366. // 自动重试的通用函数
  3367. function callReadCardWithRetry(url, retryCount, retryDelay, successCallback, errorCallback) {
  3368. $.ajax({
  3369. type: "GET",
  3370. url: url,
  3371. contentType: "application/json;charset=UTF-8",
  3372. dataType: "json",
  3373. headers: {
  3374. 'Accept': 'application/json',
  3375. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3376. },
  3377. success: function (res) {
  3378. if (res.code == 200) {
  3379. successCallback(res);
  3380. } else if (retryCount > 0) {
  3381. // 重试时保持loading状态,不隐藏
  3382. setTimeout(function () {
  3383. callReadCardWithRetry(url, retryCount - 1, retryDelay, successCallback, errorCallback);
  3384. }, retryDelay);
  3385. } else {
  3386. errorCallback(res);
  3387. }
  3388. },
  3389. error: function (XMLHttpRequest, textStatus, errorThrown) {
  3390. if (retryCount > 0) {
  3391. // 重试时保持loading状态,不隐藏
  3392. setTimeout(function () {
  3393. callReadCardWithRetry(url, retryCount - 1, retryDelay, successCallback, errorCallback);
  3394. }, retryDelay);
  3395. } else {
  3396. errorCallback({ message: "读卡异常" });
  3397. }
  3398. }
  3399. });
  3400. }
  3401. /**
  3402. * 打开读卡类型弹窗
  3403. */
  3404. function mztczfSiReadCardTypeModel(patientId,times) {
  3405. addOrderLock(patientId,times,null)
  3406. $("#readCardResult").val(null);
  3407. $("#pBusiCardInfo").val(null);
  3408. readPatientId = patientId
  3409. readTimes = times
  3410. // $('#mztczfSiReadCardType').selectpicker('val', null);
  3411. // $('#mztczfSiReadCardType').selectpicker('refresh');
  3412. // $('#grzhzf').selectpicker('val', null);
  3413. // $('#grzhzf').selectpicker('refresh');
  3414. // 重置单选框状态
  3415. $('input[name="mztczfSiReadCardType"]').prop('checked', false);
  3416. $("#mztczfSiReadCardType_03").prop('checked', true);
  3417. $('input[name="grzhzf"]').prop('checked', false);
  3418. $("#grzhzf_0").prop('checked', true);
  3419. // 确保参保地已正确设置为江苏省宿迁市(如果还未设置)
  3420. if($('#mztczfAdvmPro').val() !== '320000') {
  3421. $('#mztczfAdvmPro').selectpicker('val', '320000');
  3422. $('#mztczfAdvmPro').selectpicker('refresh');
  3423. cityChange('mztczfAdvmPro', 'mztczfAdvmCity');
  3424. }
  3425. $("#mztczfSiReadCardModal").modal();
  3426. }
  3427. /**
  3428. * 处方加锁
  3429. */
  3430. function addOrderLock(patientId,times,receiptNo) {
  3431. postAjaxJsonHttpRequst("/thmz/addOrderLock",{patientId:patientId,times:times,receiptNo:receiptNo},true,function (res) {
  3432. })
  3433. }
  3434. /**
  3435. * 处方解锁
  3436. */
  3437. function deleteOrderLock(patientId,times,receiptNo) {
  3438. postAjaxJsonHttpRequst("/thmz/deleteOrderLock",{patientId:patientId,times:times,receiptNo:receiptNo},true,function (res) {
  3439. if(res.code == 0){
  3440. successMesageSimaple('处方解锁成功')
  3441. }
  3442. })
  3443. }
  3444. /**
  3445. * 医保结算
  3446. * @param patientId
  3447. * @param times
  3448. */
  3449. function directRegistration(patientId, times) {
  3450. //显示弹层
  3451. $("#loadingModal").modal('show');
  3452. $.ajax({
  3453. type: "POST",
  3454. url: '/thmz/directRegistration',
  3455. contentType: "application/json;charset=UTF-8",
  3456. dataType: "json",
  3457. data: JSON.stringify({
  3458. patientId: patientId,
  3459. times: times,
  3460. readCardResult: $("#readCardResult").val(),
  3461. busCardInfo: $("#pBusiCardInfo").val(),
  3462. // grzhzf: $("#grzhzf").val(),
  3463. // readCardType: $("#mztczfSiReadCardType").val()
  3464. grzhzf: $('input[name="grzhzf"]:checked').val(),
  3465. readCardType: $('input[name="mztczfSiReadCardType"]:checked').val()
  3466. }),
  3467. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3468. success: function (res) {
  3469. //隐藏
  3470. $("#loadingModal").modal('hide');
  3471. if (res == '401' || res == 401) {
  3472. window.location.href = '/thmz/login/view'
  3473. return;
  3474. }
  3475. if (res.code == 0) {
  3476. successMesage(res);
  3477. } else {
  3478. errorMesage(res);
  3479. }
  3480. }
  3481. });
  3482. }
  3483. /**
  3484. * 门诊统筹补录
  3485. * @param patientId
  3486. * @param times
  3487. * @param receiptNo
  3488. */
  3489. function mztcbl(patientId, times, receiptNo) {
  3490. $.ajax({
  3491. type: "GET",
  3492. url: '/thmz/mztcblInfo?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
  3493. contentType: "application/json;charset=UTF-8",
  3494. dataType: "json",
  3495. headers: {
  3496. 'Accept': 'application/json',
  3497. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3498. },
  3499. success: function (res) {
  3500. if (res == '401' || res == 401) {
  3501. window.location.href = '/thmz/login/view'
  3502. return;
  3503. }
  3504. if (res.code == 0) {
  3505. $("#changedTotalAmount").val(res.data.totalAmount);
  3506. $("#ybjzAmount").val(res.data.fund_pay_sumamt);
  3507. $("#accAmount").val(res.data.acct_pay);
  3508. $("#needRefundAmount").val(res.data.refundFee);
  3509. $("#mzblPatientId").val(patientId);
  3510. $("#mzblTimes").val(times);
  3511. $("#mzblReceiptNo").val(receiptNo);
  3512. //successMesage(res);
  3513. } else {
  3514. errorMesage(res);
  3515. }
  3516. },
  3517. error: function (XMLHttpRequest, textStatus, errorThrown) {
  3518. }
  3519. });
  3520. $("#mzblModal").modal();
  3521. }
  3522. /**
  3523. * 提交门诊补录申请
  3524. */
  3525. function chargeFeeForMztcbl() {
  3526. if (!confirm("确定要对当前费用进行门诊统筹补录操作吗?")) {
  3527. return;
  3528. }
  3529. var patientId = $("#mzblPatientId").val();
  3530. var times = $("#mzblTimes").val();
  3531. var receiptNo = $("#mzblReceiptNo").val();
  3532. $.ajax({
  3533. type: "GET",
  3534. url: '/thmz/chargeFeeForMztcbl?patientId=' + patientId + "&times=" + times + "&receiptNo=" + receiptNo,
  3535. contentType: "application/json;charset=UTF-8",
  3536. dataType: "json",
  3537. headers: {
  3538. 'Accept': 'application/json',
  3539. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3540. },
  3541. success: function (res) {
  3542. if (res == '401' || res == 401) {
  3543. window.location.href = '/thmz/login/view'
  3544. return;
  3545. }
  3546. if (res.code == 0) {
  3547. $("#mzblModal").modal("hide");
  3548. clearMztcbl();
  3549. if(fpVsesionNo == 0){
  3550. prn1Print(patientId, times, false, res.receiptNo);
  3551. }else {
  3552. printDzfp(patientId, times,res.receiptNo,0)
  3553. }
  3554. } else {
  3555. errorMesage(res);
  3556. }
  3557. },
  3558. error: function (XMLHttpRequest, textStatus, errorThrown) {
  3559. }
  3560. });
  3561. }
  3562. /**
  3563. * 清空门诊统筹补录
  3564. */
  3565. function clearMztcbl() {
  3566. $("#changedTotalAmount").val(null);
  3567. $("#ybjzAmount").val(null);
  3568. $("#accAmount").val(null);
  3569. $("#needRefundAmount").val(null);
  3570. $("#mzblPatientId").val(null);
  3571. $("#mzblTimes").val(null);
  3572. $("#mzblReceiptNo").val(null);
  3573. }
  3574. function queryCodePay() {
  3575. $.ajax({
  3576. type: "GET",
  3577. url: '/thmz/NongPay/query?mchOrderNo=202507221753175802948&type=0',
  3578. dataType: "json",
  3579. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3580. success: function (res) {
  3581. if (res == '401' || res == 401) {
  3582. window.location.href = '/thmz/login/view'
  3583. return;
  3584. }
  3585. }
  3586. });
  3587. }
  3588. function codePay() {
  3589. const moneyValues = [];
  3590. $('.pay-item').each(function() {
  3591. const $this = $(this);
  3592. const $select = $this.find('select');
  3593. const isAggregatePay = $select.find('option:selected').text() === '聚合支付';
  3594. if (isAggregatePay) {
  3595. const $moneyInput = $this.find('input.money');
  3596. const moneyValue = parseFloat($moneyInput.val()) || 0;
  3597. moneyValues.push(moneyValue);
  3598. }
  3599. });
  3600. var authCode = $('#paymentCode').val();
  3601. $.ajax({
  3602. type: "POST",
  3603. url: '/thmz/NongPay/unifiedOrder',
  3604. contentType: "application/json;charset=UTF-8",
  3605. dataType: "json",
  3606. data: JSON.stringify({
  3607. "amount": moneyValues[0],
  3608. "authCode": authCode,
  3609. "subject": "门诊收费",
  3610. "body": "门诊收费"
  3611. }),
  3612. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3613. success: function (res) {
  3614. if (res.code === 9000) {
  3615. if(res.data && (res.data.state === 2 || res.data.orderState === 2)) {
  3616. alert("付款成功");
  3617. }
  3618. }
  3619. }
  3620. });
  3621. }
  3622. /*function debounce(func, delay = 500) {
  3623. let timer = null;
  3624. return function(...args) {
  3625. clearTimeout(timer);
  3626. timer = setTimeout(() => {
  3627. func.apply(this, args); // 执行目标方法
  3628. }, delay);
  3629. };
  3630. }
  3631. $('#paymentCode').on('input', debounce(codePay, 500));*/
  3632. /**
  3633. * 刷卡/扫码,正常收费的的接口
  3634. */
  3635. function consume() {
  3636. $("#consume").attr("disabled", true);
  3637. $("#saveConfirmFee").attr("disabled", true);
  3638. var current = $("#payForm").find("div.pay-item").last();
  3639. var patientId = $("#patientIdHaveTally").val();
  3640. var times = $("#timesHaveTally").val();
  3641. var chequeType = $(current).find("select").val();
  3642. var amt = parseFloat($(current).find("input.money").val());
  3643. $.ajax({
  3644. type: "POST",
  3645. url: '/thmz/consume',
  3646. contentType: "application/json;charset=UTF-8",
  3647. dataType: "json",
  3648. data: JSON.stringify({
  3649. "patientId": patientId,
  3650. "times": times,
  3651. "chequeType": chequeType,
  3652. "amt": amt,
  3653. "type": 0
  3654. }),
  3655. headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3656. success: function (res) {
  3657. if (res == '401' || res == 401) {
  3658. window.location.href = '/thmz/login/view'
  3659. return;
  3660. }
  3661. if (res.code == 0) {
  3662. successMesage(res);
  3663. $(current).find("input.refNo").val(res.data.refNo);
  3664. $(current).find("input.transDate").val(res.data.transDate);
  3665. $(current).find("input.payChannel").val(res.data.payChannel);
  3666. $(current).find("input.qrCodeParam").val(res.data.wxAliPayOrderNo);
  3667. $(current).find("input.traceNo").val(res.data.traceNo);
  3668. } else {
  3669. errorMesage(res);
  3670. }
  3671. $("#saveConfirmFee").attr("disabled", false);
  3672. $("#consume").attr("disabled", false);
  3673. }
  3674. });
  3675. }
  3676. /**
  3677. * 查看缴费方式列表
  3678. * @param patientId
  3679. * @param times
  3680. * @param receiptNo
  3681. */
  3682. function depositFileList(patientId, times, receiptNo) {
  3683. var payMarkGroup = getIndex("pay_mark_group");
  3684. var payMark = 0;
  3685. if (payMarkGroup == 2) {
  3686. payMark = 1;
  3687. }
  3688. $("#depositFileListModal").modal();
  3689. $('#deposit_fileList_table').bootstrapTable("destroy");
  3690. $('#deposit_fileList_table').bootstrapTable({
  3691. url: '/thmz/getMzDepositFileList', //请求后台的URL(*)
  3692. method: 'post', //请求方式(*)
  3693. toolbar: '#toolbar', //工具按钮用哪个容器
  3694. striped: true, //是否显示行间隔色
  3695. cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
  3696. pagination: true, //是否显示分页(*)
  3697. sortable: true, //是否启用排序
  3698. sortOrder: "asc", //排序方式
  3699. queryParams: {"patientId": patientId, "times": times, "receiptNo": Math.abs(receiptNo), "payMark": payMark}, //传递参数(*)
  3700. sidePagination: "client", //分页方式:client客户端分页,server服务端分页(*)
  3701. pageNumber: 1, //初始化加载第一页,默认第一页
  3702. pageSize: 5, //每页的记录行数(*)
  3703. pageList: [5, 10, 25, 50, 100], //可供选择的每页的行数(*)
  3704. search: false, //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大
  3705. strictSearch: true,
  3706. showColumns: false, //是否显示所有的列
  3707. showRefresh: false, //是否显示刷新按钮
  3708. minimumCountColumns: 2, //最少允许的列数
  3709. clickToSelect: true, //是否启用点击选中行
  3710. uniqueId: "ID", //每一行的唯一标识,一般为主键列
  3711. showToggle: false, //是否显示详细视图和列表视图的切换按钮
  3712. cardView: false, //是否显示详细视图
  3713. detailView: false,
  3714. //rowStyle:rowStyle,//通过自定义函数设置行样式
  3715. ajaxOptions: {
  3716. headers: {
  3717. 'Accept': 'application/json',
  3718. 'Authorization': 'Bearer ' + localStorage.getItem("token")
  3719. }
  3720. },
  3721. columns: [
  3722. {
  3723. field: 'patientId',
  3724. title: '患者编号',
  3725. align: "center",
  3726. valign: 'middle',
  3727. }, {
  3728. field: 'times',
  3729. title: '就诊次数',
  3730. align: "center",
  3731. valign: 'middle',
  3732. }, {
  3733. field: 'receiptNo',
  3734. title: '结算次数',
  3735. align: "center",
  3736. valign: 'middle',
  3737. formatter: function (value, row, index) {
  3738. return Math.abs(value);
  3739. }
  3740. }, {
  3741. field: 'chequeType',
  3742. title: '支付方式',
  3743. align: "center",
  3744. valign: 'middle'
  3745. }, {
  3746. field: 'amount',
  3747. title: '金额(元)',
  3748. align: "center",
  3749. valign: 'middle',
  3750. formatter: function (value, row, index) {
  3751. return Math.abs(value).toFixed(2);
  3752. }
  3753. }, {
  3754. title: '操作',
  3755. align: "center",
  3756. valign: 'middle',
  3757. // sortable: true,
  3758. formatter: function (value, row, index) {
  3759. if (payMarkGroup == 0) {
  3760. return '';
  3761. }
  3762. var html = '';
  3763. if (payMarkGroup > 0) {
  3764. if ((row.chequeType == '银联卡' || row.chequeType == '聚合支付') && row.psordnum != null && row.psordnum != "" && row.psordnum != "null") {
  3765. html += '<button type="button" class="registration-no-color-foot-button" title="智能支付参数与条形码" onclick="createBarcode(\'' + row.chequeType + '\',\'' + row.psordnum + '\',\'' + row.agtordnum + '\',\'' + row.parChannel + '\',\'' + row.traceNo + '\',\'' + row.patientId + '\',' + row.times + ',\'' + row.amountStr + '\',\'' + row.transDate + '\')"><i class="fa fa-barcode"></i></button>';
  3766. }
  3767. }
  3768. return html;
  3769. }
  3770. }
  3771. ],
  3772. responseHandler: function (res) {
  3773. if (res == '401' || res == 401) {
  3774. window.location.href = '/thmz/login/view'
  3775. return;
  3776. }
  3777. var ress = eval(res);
  3778. if (ress.code == -1) {
  3779. if (ress.message != null && ress.message != '') {
  3780. errorMesage(ress);
  3781. }
  3782. return {
  3783. "total": 0,//总页数
  3784. "rows": {} //数据
  3785. };
  3786. }
  3787. return {
  3788. "total": ress.data.length,//总页数
  3789. "rows": ress.data //数据
  3790. };
  3791. },
  3792. });
  3793. }
  3794. /**
  3795. * 创建退款条形码
  3796. * @param chequeType
  3797. * @param psordnum
  3798. * @param agtordnum
  3799. * @param parChannel
  3800. * @param traceNo
  3801. * @param patientId
  3802. * @param times
  3803. * @param amount
  3804. * @param transDate
  3805. */
  3806. function createBarcode(chequeType, psordnum, agtordnum, parChannel, traceNo, patientId, times, amount, transDate) {
  3807. var payMarkGroup = getIndex("pay_mark_group");
  3808. $("#depositFileListModal").modal('hide');
  3809. $("#parChannel").val('否');
  3810. if (traceNo == null || traceNo == 'null') {
  3811. traceNo = '';
  3812. }
  3813. $("#traceNo").val(traceNo);
  3814. $("#transDate").val(transDate);
  3815. amount = amount.replace("-", "");
  3816. if (chequeType == "银联卡") {
  3817. if (psordnum != null && psordnum != "" && psordnum != "null") {
  3818. if (payMarkGroup == 1) {
  3819. $("#plId").val(patientId + "_" + times + "_3");
  3820. } else {
  3821. $("#plId").val(psordnum + "_" + amount);
  3822. }
  3823. $("#refNo").val(psordnum);
  3824. JsBarcode("#barcode", 'no barcode');
  3825. $("#barcodeModal").modal();
  3826. }
  3827. return;
  3828. }
  3829. if (agtordnum != null && agtordnum != "" && agtordnum != "null") {
  3830. if (payMarkGroup == 1) {
  3831. $("#plId").val(patientId + "_" + times + "_O");
  3832. //此时是未退费状态,不加载可退费的条形码,以免误操作退费
  3833. JsBarcode("#barcode", 'no barcode');
  3834. } else {
  3835. JsBarcode("#barcode", agtordnum);
  3836. $("#plId").val(psordnum + "_" + amount);
  3837. }
  3838. $("#refNo").val(psordnum);
  3839. if (parChannel != null && parChannel == 'DIGITAL_CASH') {
  3840. $("#parChannel").val('是');
  3841. }
  3842. $("#barcodeModal").modal();
  3843. } else {
  3844. $("#messageModal").modal();
  3845. $("#messageContent").html("当前操作的缴费记录支付方式非聚合支付,无法生成对应的支付条形码!");
  3846. return;
  3847. }
  3848. }
  3849. //
  3850. //
  3851. // /**
  3852. // * 签到
  3853. // */
  3854. // function sign() {
  3855. // $.ajax({
  3856. // type: "GET",
  3857. // url: '/thmz/sign',
  3858. // contentType: "application/json;charset=UTF-8",
  3859. // dataType: "json",
  3860. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3861. // success: function (res) {
  3862. // if (res == '401' || res == 401) {
  3863. // window.location.href = '/thmz/login/view'
  3864. // return;
  3865. // }
  3866. // if (res.code == 0) {
  3867. // successMesage(res);
  3868. // } else {
  3869. // errorMesage(res);
  3870. // }
  3871. // }
  3872. // });
  3873. // }
  3874. //
  3875. //
  3876. //
  3877. // /**
  3878. // * 查余
  3879. // */
  3880. // function balance() {
  3881. // $.ajax({
  3882. // type: "GET",
  3883. // url: '/thmz/balance',
  3884. // contentType: "application/json;charset=UTF-8",
  3885. // dataType: "json",
  3886. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3887. // success: function (res) {
  3888. // if (res == '401' || res == 401) {
  3889. // window.location.href = '/thmz/login/view'
  3890. // return;
  3891. // }
  3892. // if (res.code == 0) {
  3893. // successMesage(res);
  3894. // } else {
  3895. // errorMesage(res);
  3896. // }
  3897. // }
  3898. // });
  3899. // }
  3900. //
  3901. // /**
  3902. // * 打开刷卡消费页面
  3903. // */
  3904. // function consumeModal() {
  3905. // $("#toolsModal").modal('hide');
  3906. // $("#consumeModal").modal();
  3907. // }
  3908. //
  3909. // /**
  3910. // * 刷卡/扫码,财务工具调用
  3911. // */
  3912. // function consumeCommon() {
  3913. // var chequeType = $("#consumeChequeType").val();
  3914. // var amt = $("#consumeAmount").val();
  3915. // $.ajax({
  3916. // type: "POST",
  3917. // url: '/thmz/consumeCommon',
  3918. // contentType: "application/json;charset=UTF-8",
  3919. // dataType: "json",
  3920. // data: JSON.stringify({
  3921. // "chequeType": chequeType,
  3922. // "amt": amt
  3923. // }),
  3924. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3925. // success: function (res) {
  3926. // if (res == '401' || res == 401) {
  3927. // window.location.href = '/thmz/login/view'
  3928. // return;
  3929. // }
  3930. // if (res.code == 0) {
  3931. // successMesage(res);
  3932. // } else {
  3933. // errorMesage(res);
  3934. // }
  3935. // }
  3936. // });
  3937. // }
  3938. //
  3939. // /**
  3940. // * 打开退费窗口
  3941. // */
  3942. // function refundModal() {
  3943. // $("#toolsModal").modal('hide');
  3944. // $("#refundModal").modal();
  3945. // }
  3946. //
  3947. // /**
  3948. // * 退费
  3949. // */
  3950. // function refund() {
  3951. // var chequeType = $("#consumeChequeTypeRefund").val();
  3952. // var amt = $("#refundPosAmount").val();
  3953. // var parChannel = $("#parChannelRefund").val();
  3954. // var psordnum = $("#refNoRefund").val();
  3955. // var transDate = $("#transDateRefund").val();
  3956. // var agtordnum = $("#barcodeRefund").val();
  3957. // $.ajax({
  3958. // type: "POST",
  3959. // url: '/thmz/refund',
  3960. // contentType: "application/json;charset=UTF-8",
  3961. // dataType: "json",
  3962. // data: JSON.stringify({
  3963. // "chequeType": chequeType,
  3964. // "amt": amt,
  3965. // "parChannel": parChannel,
  3966. // "psordnum": psordnum,
  3967. // "transDate": transDate,
  3968. // "agtordnum": agtordnum
  3969. // }),
  3970. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  3971. // success: function (res) {
  3972. // if (res == '401' || res == 401) {
  3973. // window.location.href = '/thmz/login/view'
  3974. // return;
  3975. // }
  3976. // if (res.code == 0) {
  3977. // successMesage(res);
  3978. // } else {
  3979. // errorMesage(res);
  3980. // }
  3981. // }
  3982. // });
  3983. // }
  3984. //
  3985. // /**
  3986. // * 打开重印窗口
  3987. // */
  3988. // function reprintModal() {
  3989. // $("#toolsModal").modal('hide');
  3990. // $("#reprintModal").modal();
  3991. // }
  3992. //
  3993. //
  3994. // /**
  3995. // * 重印
  3996. // */
  3997. // function reprint() {
  3998. // var traceNoReprint=$("#traceNoReprint").val();
  3999. // $.ajax({
  4000. // type: "GET",
  4001. // url: '/thmz/reprint?traceNo='+traceNoReprint,
  4002. // contentType: "application/json;charset=UTF-8",
  4003. // dataType: "json",
  4004. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4005. // success: function (res) {
  4006. // if (res == '401' || res == 401) {
  4007. // window.location.href = '/thmz/login/view'
  4008. // return;
  4009. // }
  4010. // if (res.code == 0) {
  4011. // successMesage(res);
  4012. // } else {
  4013. // errorMesage(res);
  4014. // }
  4015. // }
  4016. // });
  4017. // }
  4018. //
  4019. // /**
  4020. // * 打开交易查询页面
  4021. // */
  4022. // function queryModal() {
  4023. // $("#toolsModal").modal('hide');
  4024. // $("#queryModal").modal();
  4025. // }
  4026. //
  4027. //
  4028. // /**
  4029. // * 交易查询
  4030. // */
  4031. // function query() {
  4032. // var plId=$("#plIdReprint").val();
  4033. // $.ajax({
  4034. // type: "GET",
  4035. // url: '/thmz/query?plId='+plId,
  4036. // contentType: "application/json;charset=UTF-8",
  4037. // dataType: "json",
  4038. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4039. // success: function (res) {
  4040. // if (res == '401' || res == 401) {
  4041. // window.location.href = '/thmz/login/view'
  4042. // return;
  4043. // }
  4044. // if (res.code == 0) {
  4045. // alert(res.data);
  4046. // successMesage(res);
  4047. // } else {
  4048. // errorMesage(res);
  4049. // }
  4050. // }
  4051. // });
  4052. // }
  4053. //
  4054. //
  4055. // /**
  4056. // * 结算
  4057. // */
  4058. // function settle() {
  4059. // $.ajax({
  4060. // type: "GET",
  4061. // url: '/thmz/settle',
  4062. // contentType: "application/json;charset=UTF-8",
  4063. // dataType: "json",
  4064. // headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},
  4065. // success: function (res) {
  4066. // if (res == '401' || res == 401) {
  4067. // window.location.href = '/thmz/login/view'
  4068. // return;
  4069. // }
  4070. // if (res.code == 0) {
  4071. // successMesage(res);
  4072. // } else {
  4073. // errorMesage(res);
  4074. // }
  4075. // }
  4076. // });
  4077. // }
  4078. //
  4079. //
  4080. //
  4081. // /**
  4082. // * 初始化财务工具的收费方式下拉选
  4083. // */
  4084. // function initConsumeChequeType() {
  4085. // var html="<option value='3'>银联卡</option><option value='O'>聚合支付</option>";
  4086. // $("#consumeChequeType").html(html);
  4087. // $('#consumeChequeType').selectpicker('refresh');
  4088. // $("#consumeChequeTypeRefund").html(html);
  4089. // $('#consumeChequeTypeRefund').selectpicker('refresh');
  4090. // $("#parChannelRefund").html("<option value='0'>否</option><option value='1'>是</option>");
  4091. // $('#parChannelRefund').selectpicker('refresh');
  4092. // }
  4093. //
  4094. //
  4095. // /**
  4096. // * 退货方式改变事件
  4097. // */
  4098. // function consumeChequeTypeRefundChange() {
  4099. // var consumeChequeTypeRefund=$("#consumeChequeTypeRefund").val();
  4100. // if(consumeChequeTypeRefund=='3'){
  4101. // $("#barcodeRefundDiv").removeClass("in").addClass("hide");
  4102. // $("#parChannelRefundDiv").removeClass("in").addClass("hide");
  4103. // $("#refNoRefundDiv").removeClass("hide").addClass("in");
  4104. // $("#transDateRefundDiv").removeClass("hide").addClass("in");
  4105. // }else {
  4106. // $("#barcodeRefundDiv").removeClass("hide").addClass("in");
  4107. // $("#parChannelRefundDiv").removeClass("hide").addClass("in");
  4108. // $("#refNoRefundDiv").removeClass("in").addClass("hide");
  4109. // $("#transDateRefundDiv").removeClass("in").addClass("hide");
  4110. // }
  4111. // }