toll_administration.js 171 KB

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