| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311 | //@ sourceURL=toll_administration.jsvar LODOP; //声明为全局变量//默认打印机下标var printIndex = -1;//选中的要退的费用收费编码var chargeItemCodes = null;//门诊结算单地址var mzjsdHost = null;var readPatientId ='';var readTimes = nullvar fpVsesionNo = 0;var hospitalName ='沭阳铭和医院'$(function () {    getAjaxRequst("/thmz/queryHospitalName",{},true,function (res) {        hospitalName = res.data    })    //默认光标在卡号输入框    $("#cardNo").focus();    init_daterangepicker();    initFpVersion();    initSelect();    // initConsumeChequeType();    initFeeTable();    //卡号输入改变事件    cardNoChange();    //重置查询参数    $('#btn_clean').click(function () {        cleanParams();    });    //初始化页面上面的按钮事件    //查询    $('#btn_query').click(function () {        initFeeTable();    });    // //财务工具包    // $('#btn_tools').click(function () {    //     $("#toolsModal").modal();    // });    /**     * 增加收款方式按钮事件     */    $("#addPayType").on("click", function () {        addPayType(null);    });    //初始门诊收银方式下拉选    initChequeType("payType");    //初始门诊收银方式下拉选    initChequeType("payTypeEditPayMode");    setTimeout(function () {        getLodop();    }, 800);    /**     * 核酸检测跳转过来的直接刷新待收费列表     */    if (patientIdFullForNucleicAcid != null && patientIdFullForNucleicAcid != "") {        $("#cardNo").val(patientIdFullForNucleicAcid);        $("#patientId").val(patientIdFullForNucleicAcid);        initFeeTable();    }    /**     * 医保电子凭证读卡     */    $("#siReadCard").on("click", function (t) {        // siReadCard("qrcode_01101");        siReadCard("jiangsu_qrcode_01101");    });    /**     * 医保刷脸     */    $("#siReadCardFace").on("click", function (t) {        // siReadCard("face_01101");        siReadCard("jiangsu_face_01101");    });    //获取门诊医保结算单打印服务地址    $.ajax({        type: "GET",        url: '/thmz/getMzjsdHost',        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            mzjsdHost = res.data;        }    });    /**     * 刷卡/扫码     */    $("#consume").on("click", function (t) {        consume();    });});function getCurrentTime() {    const now = new Date();    const year = now.getFullYear().toString();    const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从0开始    const day = String(now.getDate()).padStart(2, '0');    const hours = String(now.getHours()).padStart(2, '0');    const minutes = String(now.getMinutes()).padStart(2, '0');    const seconds = String(now.getSeconds()).padStart(2, '0');    return `${year}${month}${day}${hours}${minutes}${seconds}`;};function getEBill(serialNo) {    $.ajax({        type: "POST",        url: 'http://130.150.161.72:9206/thyy/api/public/ebill/invoicequery',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({            "timestamp":this.getCurrentTime(),            "busseqno":serialNo,        }),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            // console.log('getEBill',res);            if(res.code == 1 && res.data.invoice_url){                successMesageSimaple("电子发票查询成功!")            }        }    })};function downloadEBill(serialNo) {    $.ajax({        type: "POST",        url: 'http://130.150.161.72:9206/thyy/api/public/ebill/invoicedownload',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({            "timestamp":this.getCurrentTime(),            "busseqno": serialNo,        }),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if(res.code == 1 && res.data.invoicefiledata){                base64toPDF(res.data.invoicefiledata)            }        }    })};//function issueEBill(realNo,amount,name,doctorCode) {//    $.ajax({//        type: "POST",//        url: 'http://localhost:9206/thyy/api/public/ebill/invoicehisissue',//        contentType: "application/json;charset=UTF-8",//        dataType: "json",//        data: JSON.stringify({//            "timestamp":this.getCurrentTime(),//            "busseqno":realNo,//            "bustype": "02",//            "totalAmount":amount,//            "payerPartyType":"1",//            "payerPartyName":name,//            "bizcode":realNo,//            "handlingPerson":doctorCode,//////        }),//        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//        success: function (res) {//            console.log('issueEBill',res);//            if(res.code == 1 && res.data.invoice_url){////                // successMesageSimaple("电子发票查询成功!")//            }//        }//    })//};/** * 列表类型按钮切换事件 * @param object */function payMarkButtonChange(object) {    $("#pay_mark_group").find("button").each(function (index, element) {        if ($(element).hasClass("btn-primary")) {            $(element).removeClass("btn-primary").addClass("btn-default");        }    });    $(object).removeClass("btn-default").addClass("btn-primary");    initFeeTable();}/** * 收费明细类型按钮切换事件 * @param object */function billItemButtonChange(object) {    $("#bill_item_group").find("button").each(function (index, element) {        if ($(element).hasClass("btn-primary")) {            $(element).removeClass("btn-primary").addClass("btn-default");        }    });    $(object).removeClass("btn-default").addClass("btn-primary");    initChargeDetailTable();    //默认光标在卡号输入框    $("#cardNo").focus();}/** * 收费明细类型按钮切换事件 * @param object */function refundBillItemButtonChange(object) {    $("#refund_bill_item_group").find("button").each(function (index, element) {        if ($(element).hasClass("btn-primary")) {            $(element).removeClass("btn-primary").addClass("btn-default");        }    });    $(object).removeClass("btn-default").addClass("btn-primary");    initMzChargeDetailByBillItem(false);}//初始化版本电子发票版本function initFpVersion() {    getAjaxRequst("/thmz/queryFpVersion",{},true,function (res) {        console.log('发票版本=',res.data)        fpVsesionNo = res.data;    })}/** * 初始化下拉选 */function initSelect() {    $(".selectpicker").selectpicker({        dropuAuto: false    });    initDeptSelect();    initDoctorSelect();    initCooperativeEnterprisesSelect();    initMztczfSiReadCardTypeSelect();    initTfGrzhzfSelect()}/** * 初始化读卡类型 */function initMztczfSiReadCardTypeSelect() {    // // $('#mztczfSiReadCardType').html("<option value='03'>社保卡</option><option value='01'>电子凭证</option><option value='02'>身份证</option><option value='04'>刷脸</option>");    // $('#mztczfSiReadCardType').html("<option value='03'>社保卡</option><option value='01'>电子凭证</option><option value='04'>刷脸</option>");    // $('#mztczfSiReadCardType').selectpicker('refresh');    // var selectHtml = '<option value="0">否</option><option value="1">使用个账</option><option value="2">使用共济账户</option>';    // $('#grzhzf').html(selectHtml);    // $('#grzhzf').selectpicker('refresh');    // 读卡类型和个账支付已改为单选框,不需要初始化下拉框    initAdvmPro('mztczfAdvmPro')}function initTfGrzhzfSelect() {    var selectHtml = '<option value="0">否</option><option value="1">使用个账</option><option value="2">使用共济账户</option>';    $('#tfGrzhzf').html(selectHtml);    $('#tfGrzhzf').selectpicker('refresh');    initAdvmPro('tfAdvmPro')}//初始化参保地省function initAdvmPro(proId) {   getAjaxRequst("/thmz/queryProvinceCodes",{},true,function (res) {      if(res.code == 0 && res.data !=null && res.data.length > 0){          let selectHtml = '';          for (let i=0 ; i <res.data.length; i++ ){              // 如果是医保读卡弹窗的省份选择,默认选中江苏省              let selected = (proId === 'mztczfAdvmPro' && res.data[i].code === '320000') ? ' selected' : '';              selectHtml+= `<option value="${res.data[i].code}"${selected}>${res.data[i].code} ${res.data[i].name}</option>`          }          $('#'+proId).html(selectHtml);          $('#'+proId).selectpicker('refresh');                    // 如果是医保读卡弹窗且选中了江苏省,自动加载城市列表          if(proId === 'mztczfAdvmPro' && $('#'+proId).val() === '320000') {              cityChange('mztczfAdvmPro', 'mztczfAdvmCity');          }      }   })}//初始化参保地市function cityChange(proId,cityId) {   let code = $('#'+proId).val()    postAjaxJsonHttpRequst("/thmz/queryCityCodes",{code:code},true,function (res) {        if(res.code == 0 && res.data !=null && res.data.length > 0){            let selectHtml = '';            let suqianCityCode = null; // 用于存储宿迁市的code                        for (let i=0 ; i <res.data.length; i++ ){                selectHtml+= `<option value="${res.data[i].code}">${res.data[i].code} ${res.data[i].name}</option>`                                // 查找宿迁市的code,优先使用code匹配,其次使用name匹配                if(cityId === 'mztczfAdvmCity') {                    if(res.data[i].code === '321300' || res.data[i].name.includes('宿迁市')) {                        suqianCityCode = res.data[i].code;                    }                }            }                        $('#'+cityId).html(selectHtml);            $('#'+cityId).selectpicker('refresh');                        // 如果是医保读卡弹窗且找到了宿迁市,设置为默认选中            if(cityId === 'mztczfAdvmCity' && suqianCityCode) {                $('#'+cityId).selectpicker('val', suqianCityCode);                $('#'+cityId).selectpicker('refresh');            }        }    })}/** * 挂号列表中的科室列表 */function initDeptSelect() {    //科室列表    $.ajax({        type: "GET",        url: '/thmz/allMzUnitCode',        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (data) {            if (data == '401' || data == 401) {                window.location.href = '/thmz/login/view'                return;            }            var html = '';            $.each(data.data, function (commentIndex, comment) {                html += '<option value="' + comment.code + '">' + comment.name + '(' + comment.pyCode + ')</option>';            });            $('#deptNoParam').empty();            $('#deptNoParam').html(html);            $('#deptNoParam').selectpicker('refresh');        }    });}/** * 挂号列表中的医生列表初始化 */function initDoctorSelect() {    //医生列表    $.ajax({        type: "GET",        url: '/thmz/listEmployeeByDepts?depts=' + $('#deptNoParam').val(),        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var html = '';            $.each(res.data, function (commentIndex, comment) {                html += '<option value="' + comment.employeeCode + '">' + comment.employeeName + '</option>';            });            $('#doctorParam').empty();            $('#doctorParam').html(html);            $('#doctorParam').selectpicker('destroy').selectpicker('refresh');        }    });}/** * 合作企业列表 */function initCooperativeEnterprisesSelect() {    $.ajax({        type: "GET",        url: '/thmz/getAllCooperativeEnterprises',        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var html = '';            $.each(res.data, function (commentIndex, comment) {                html += '<option value="' + comment.id + '">' + comment.projectName + " " + comment.contractNo + '</option>';            });            $('#project').empty();            $('#project').html(html);            $('#project').selectpicker('destroy').selectpicker('refresh');            $('#projectCharged').empty();            $('#projectCharged').html(html);            $('#projectCharged').selectpicker('destroy').selectpicker('refresh');        }    });}var $table_1;/** * 初始化收费表格 */function initFeeTable() {    var payMarkGroup = getIndex("pay_mark_group");    var timeColumusName = "处方时间";    var timeColumus = "priceTime";    $("#refundFeeTip").removeClass("in").addClass("hide");    $("#chargeFeeTip").removeClass("hide").addClass("in");    if (payMarkGroup == 1) {        timeColumusName = "缴费时间";        timeColumus = "chargeDate";        $("#refundFeeTip").removeClass("hide").addClass("in");        $("#chargeFeeTip").removeClass("in").addClass("hide");    } else if (payMarkGroup == 2) {        timeColumusName = "退费时间";        timeColumus = "inputDate";    }    var patientId = $("#patientId").val();    //查询记账信息    if (payMarkGroup == 0 && patientId != null && patientId != '') {        $("#patientIdHaveTally").val(patientId);        $.ajax({            type: "GET",            url: '/thmz/getTallyTotalCharge?patientId=' + patientId,            contentType: "application/json;charset=UTF-8",            dataType: "json",            headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},            success: function (res) {                if (res == '401' || res == 401) {                    window.location.href = '/thmz/login/view'                    return;                }                if (res.code == 0) {                    if (res.data != null && res.data > 0) {                        $("#haveTallyModal").modal();                        $("#totalTallyAmount").text(res.data.toFixed(2));                    } else {                        $("#haveTallyModal").modal('hide');                    }                } else {                    new PNotify({                        title: '错误提示',                        text: res.message,                        type: 'error',                        hide: true,                        styling: 'bootstrap3'                    });                }            }        });    }    $('#tb_table').bootstrapTable("destroy");    $table_1 = $('#tb_table').bootstrapTable({        url: '/thmz/listMzChargeDetail',         //请求后台的URL(*)        method: 'post',                      //请求方式(*)        toolbar: '#toolbar',                //工具按钮用哪个容器        striped: true,                      //是否显示行间隔色        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)        pagination: true,                   //是否显示分页(*)        sortable: true,                     //是否启用排序        sortOrder: "asc",                   //排序方式        queryParams: queryParams,           //传递参数(*)        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)        pageNumber: 1,                       //初始化加载第一页,默认第一页        pageSize: 5,                       //每页的记录行数(*)        pageList: [5, 10, 25, 50, 100],        //可供选择的每页的行数(*)        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大        strictSearch: true,        showColumns: false,                  //是否显示所有的列        showRefresh: false,                  //是否显示刷新按钮        minimumCountColumns: 2,             //最少允许的列数        clickToSelect: true,                //是否启用点击选中行        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮        cardView: false,                    //是否显示详细视图        detailView: false,        //rowStyle:rowStyle,//通过自定义函数设置行样式        ajaxOptions: {            headers: {                'Accept': 'application/json',                'Authorization': 'Bearer ' + localStorage.getItem("token")            }        },        columns: [            // {            //     checkbox: true            // },            {                field: 'realNo',                title: '缴费流水号',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value);                }            }, {                field: 'patientId',                title: '患者编号',                align: "center",                valign: 'middle',            }, {                field: 'name',                title: '患者姓名',                align: "center",                valign: 'middle',            },            {                field: 'times',                title: '就诊次数',                align: "center",                valign: 'middle',            }, {                field: 'visitTypeName',                title: '患者身份',                align: "center",                valign: 'middle',            },            {                field: 'orderTypeName',                title: '处方类型',                align: "center",                valign: 'middle',            },            {                field: 'receiptNo',                title: '结算次数',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value);                }            }, {                field: 'notDiscountAmount',                title: '订单金额(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value).toFixed(2);                }            }, {                field: 'discountAmount',                title: '优惠总额(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value).toFixed(2);                }            }, {                field: 'amount',                title: '应付金额(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value).toFixed(2);                }            }, {                field: 'warnDept',                title: '科室',                align: "center",                valign: 'middle',            }, {                field: 'doctorCode',                title: '医生',                align: "center",                valign: 'middle',            }, {                field: timeColumus,                title: timeColumusName,                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    if (value == null || value == "") {                        return "";                    }                    return format(value, "yyyy-MM-dd HH:mm:ss");                }            }, {                title: '操作',                align: "center",                valign: 'middle',                // sortable: true,                formatter: function (value, row, index) {                    var buttonCodes = localStorage.getItem("buttonCodes");                    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>';                    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>';                    var payMarkGroup = getIndex("pay_mark_group");                    if (payMarkGroup == 0) {                                if(row.countYbZf !=null && row.countYbZf > 0 ){                                    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>';                                    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>';                                }                        str += '<button type="button" class="registration-no-color-foot-button"title="确认收费" onclick="tipHaveTally(' + row.amount + ',\'' + row.patientId + '\',' + row.times + ',\'' + row.name + '\',' + row.receiptNo + ')"><i class="fa fa-rmb"></i></button>';                        if (buttonCodes != null) {                            if (isInArrayStr("init_clinic_for_exception", buttonCodes)) {                                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>';                            }                        }                        if(row.orderLockFlag != null && row.orderLockFlag == 1){                            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>';                        }                        return str;                    }                    if (payMarkGroup == 1) {                        // 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>' ;                        if(isInArrayStr("mz_refund", buttonCodes)){                            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>';                        }                        if (row.printFlag == 0 && fpVsesionNo == 0) {                            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>';                        } else if (row.printFlag == 1 && fpVsesionNo == 0) {                            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>';                            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>';                        }                        if(fpVsesionNo == 1){                            str += '<button type="button" class="registration-no-color-foot-button" title="上传电子发票" onclick="printDzfp(\'' + row.patientId + '\',' + row.times + ',' + row.receiptNo +',1'+ ');" style="color: #35D082;"><i class="fa fa-upload"></i></button>';//                            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>';                            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>';                            str += '<button type="button" class="registration-no-color-foot-button"title="查询电子发票" onclick="getEBill(\'' + row.serialNo+ '\',)"><i class="fa fa-search"></i></button>';//                            str += '<button type="button" class="registration-no-color-foot-button"title="下载电子发票" onclick="downloadEBill(\'' + row.serialNo+ '\',)"><i class="fa fa-download"></i></button>';                        }                        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>';                        //是否有权限设置合同编号                        if (buttonCodes != null) {                            if (isInArrayStr("contract_match", buttonCodes)) {                                str += '<button type="button" class="registration-no-color-foot-button" title="合作项目维护" onclick="matchProject(\'' + row.realNo + '\');"><i class="fa fa-plug"></i></button>';                            }                        }                        if (row.countYbZf > 0) {                            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>';                        }                        if (row.mztcbl > 0) {                            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>';                        }                        if (buttonCodes != null) {                            if (isInArrayStr("init_clinic_for_exception", buttonCodes)) {                                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>';                            }                        }                        return str;                    }                    if (payMarkGroup == 2) {                        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>';                        if(fpVsesionNo == 1){                            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>';                            str += '<button type="button" class="registration-no-color-foot-button"title="下载已作废的电子发票" onclick="openDzfpDownModal(\'' + row.mzyReqrec.patientId + '\',' + row.mzyReqrec.times +',\'' + row.mzyReqrec.serialNo + '\'' + ')"><i class="fa fa-download"></i></button>';                        }                        // 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>' ;                        return str;                    }                }            }        ],        responseHandler: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var ress = eval(res);            if (ress.code == -1) {                if (ress.message != null && ress.message != '') {                    new PNotify({                        title: '错误提示',                        text: ress.message,                        type: 'error',                        hide: true,                        styling: 'bootstrap3'                    });                }                return {                    "total": 0,//总页数                    "rows": {}   //数据                };            }            // if(ress.pageViewVo.total==0){            //     $("#cardNo").val(null);            //     $("#name").val(null);            // }            return {                "total": ress.pageViewVo.total,//总页数                "rows": ress.pageViewVo.data   //数据            };        },        /**         * @param {点击列的 field 名称} field         * @param {点击列的 value 值} value         * @param {点击列的整行数据} row         * @param {td 元素} $element         */        onClickCell: function (field, value, row, $element) {            var cardNo = $("#cardNo").val();            if (cardNo == '120' && field == 'name' && (payMarkGroup == 0 || payMarkGroup == 1)) {                $element.attr('contenteditable', true);                $element.html(null);                $element.focus();                $element.blur(function () {                    var index = $element.parent().data('index');                    var tdValue = $element.html();                    saveData(index, field, tdValue, row, $table_1);                })            }        },    });}/** * 更新病人缴费记录病人姓名 * @param index * @param field * @param value * @param row */function saveData(index, field, value, row, table) {    $.ajax({        type: "POST",        url: '/thmz/changePatientIdName',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({"patientId": row.patientId, "times": row.times, "name": value}),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        async: false,        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                table.bootstrapTable('updateCell', {                    index: index,       //行索引                    field: field,       //列名                    value: value        //cell值                })            } else {                table.bootstrapTable('updateCell', {                    index: index,       //行索引                    field: field,       //列名                    value: row.name        //cell值                })                errorMesage(res);            }        }    });}/** * 构建列表查询参数 * @param params * @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}} */function queryParams(params) {    var rePortRangeArr = getRePortRangeArr();    var payMarkGroup = getIndex("pay_mark_group");    var temp = {        mzChargeDetail: {            patientId: $("#patientId").val(),            warnDept: $("#deptNoParam").val(),            doctorCode: $("#doctorParam").val(),            name: $("#name").val(),            payMark: 5        },        beginTime: new Date(rePortRangeArr[0]),        endTime: new Date(rePortRangeArr[1]),        pageSize: params.limit,   //页面大小        pageIndex: params.offset / params.limit,  //页码        serialNo: $("#serialNo").val(),        ownData: $('#ownData').is(':checked') ? 0 : 1,    };    if (payMarkGroup == 1) {        temp.mzChargeDetail.payMark = 0;    } else if (payMarkGroup == 2) {        temp.mzChargeDetail.payMark = 1;    }    console.log('param=', temp)    return temp;};function initChargeDetailTable() {    initChargeDetailTablePublic('/thmz/getMzChargeDetailByBillItem', $('#charge_detail_table'), queryParamsForDetail);}function initMzChargeDetailByBillItem(flag) {    if (flag) {        $("#refund_bill_item_group").removeClass("hide").addClass("in");        if ($("#plusOrMinus").hasClass("fa-plus")) {            $("#plusOrMinus").removeClass("fa-plus").addClass("fa-minus");            initChargeDetailTablePublic('/thmz/getNewListForRefundFeeByBillItem', $('#refund_fee_bill_table'), queryParamsForRefundByBillItem);        } else if ($("#plusOrMinus").hasClass("fa-minus")) {            $("#plusOrMinus").removeClass("fa-minus").addClass("fa-plus");            $("#refund_bill_item_group").removeClass("in").addClass("hide");            $('#refund_fee_bill_table').bootstrapTable("destroy");        }    } else {        initChargeDetailTablePublic('/thmz/getNewListForRefundFeeByBillItem', $('#refund_fee_bill_table'), queryParamsForRefundByBillItem);    }}//撤销医保重新 申请医保电子凭证function reqYb() {    let tfReadType = $("#tfReadType").val();    if(!stringNotBlank($("#tfGrzhzf").val())){        errorMesageSimaple('请选择是否使用个账或共济账户支付')        return    }    if(!stringNotBlank(tfReadType)){        errorMesageSimaple('请选择读卡类型')        return    }   if(tfReadType == '02'){       sfzReadCard()   }else {       let  param = {           patientId :$("#patientIdRefund").val(),           times :$("#timesRefund").val()       }       postAjaxJsonHttpRequst("/thmz/retractYbFees",param,true,function (res) {           if (res == '401' || res == 401) {               window.location.href = '/thmz/login/view'               return;           }           if(res.code == 0){               successMesageSimaple('医保费用撤销成功!')               reSiReadCard(false,tfReadType);           }else {               errorMesage(res)           }       })   }}function sfzReadCard() {    let tfAdvmCity = $("#tfAdvmCity").val()    if(!stringNotBlank(tfAdvmCity)){        errorMesageSimaple("请选择参保地")        return    }    $.ajax({        type: "GET",        // url: 'http://localhost:8321/readcard/entry?param=idcard_01101',        url: 'http://localhost:8321/readcard/entry?param=huashi_readcard',        contentType: "application/json;charset=UTF-8",        dataType: "json",        async: true,        headers: {            'Accept': 'application/json',            'Authorization': 'Bearer ' + localStorage.getItem("token")        },        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 200) {                $("#cdReadCardResult").val(res.data);                var str =  res.data.split("^");                var str1=  str.filter(item=>item !='');                let IDNumber = str1[0];                postAjaxJsonHttpRequst("/thmz/queryNewInsuinfo",{                    patientId :$("#patientIdRefund").val(),                    times :$("#timesRefund").val(),                    admdvs:tfAdvmCity,                    socialNo:IDNumber                },true,function (res) {                    if (res == '401' || res == 401) {                        window.location.href = '/thmz/login/view'                        return;                    }                    if(res.code == 0){                        let  param = {                            patientId :$("#patientIdRefund").val(),                            times :$("#timesRefund").val()                        }                        postAjaxJsonHttpRequst("/thmz/retractYbFees",param,true,function (res) {                            if (res == '401' || res == 401) {                                window.location.href = '/thmz/login/view'                                return;                            }                            if(res.code == 0){                                successMesageSimaple("撤销医保费用成功")                            }else {                                errorMesage(res)                            }                        })                    }else {                        errorMesage(res)                    }                })            } else {                errorMesage(res);            }        },        error: function (XMLHttpRequest, textStatus, errorThrown) {            errorMesageSimaple("读卡错误")        }    });}function reSiReadCard(asyncFlag,tfReadType) {    let params ='';    let url = '';        if(tfReadType == '03'){        // 江苏医保读取社保卡使用专用地址        url = 'http://localhost:8321/readcard/jiangsu/readcard_auto';    }else if(tfReadType == '01'){        // params ='qrcode_01101';        params ='jiangsu_qrcode_01101';        // url = 'http://localhost:8321/readcard/entry?param=' + params;        url = 'http://localhost:8321/api/entry?param=' + params;    }else if(tfReadType =='02'){        // params ='idcard_01101'        params ='huashi_readcard';        url = 'http://localhost:8321/readcard/entry?param=' + params;    }        $.ajax({        type: "GET",        url: url,        contentType: "application/json;charset=UTF-8",        dataType: "json",        async: asyncFlag,        headers: {            'Accept': 'application/json',            'Authorization': 'Bearer ' + localStorage.getItem("token")        },        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 200) {                successMesageSimaple('读卡成功')                if(tfReadType == '01'){                    var data = JSON.parse(res.data);                    $("#cdReadCardResult").val(JSON.stringify(data.data));                }else {                    $("#cdReadCardResult").val(res.data);                }            } else {                errorMesage(res);            }        },        error: function (XMLHttpRequest, textStatus, errorThrown) {          errorMesageSimaple("读卡错误")        }    });}/** * 初始化收费明细表格 */function initChargeDetailTablePublic(url, obj, params) {    $(obj).bootstrapTable("destroy");    $(obj).bootstrapTable({        url: url,         //请求后台的URL(*)        method: 'post',                      //请求方式(*)        toolbar: '#toolbar',                //工具按钮用哪个容器        striped: true,                      //是否显示行间隔色        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)        pagination: true,                   //是否显示分页(*)        sortable: true,                     //是否启用排序        sortOrder: "asc",                   //排序方式        // sortName: 'orderNo',                //排序字段        queryParams: params,           //传递参数(*)        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)        pageNumber: 1,                       //初始化加载第一页,默认第一页        pageSize: 5,                       //每页的记录行数(*)        pageList: [5, 10, 25, 50, 100],        //可供选择的每页的行数(*)        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大        strictSearch: true,        showColumns: false,                  //是否显示所有的列        showRefresh: false,                  //是否显示刷新按钮        minimumCountColumns: 2,             //最少允许的列数        clickToSelect: true,                //是否启用点击选中行        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮        cardView: false,                    //是否显示详细视图        detailView: false,        //rowStyle:rowStyle,//通过自定义函数设置行样式        ajaxOptions: {            headers: {                'Accept': 'application/json',                'Authorization': 'Bearer ' + localStorage.getItem("token")            }        },        columns: [            // {            //     checkbox: true            // },            {                field: 'orderNo',                title: '处方号',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value);                }            }, {                field: 'chargeItemCode',                title: '编码',                align: "center",                valign: 'middle',            }, {                field: 'tcName',                title: '项目',                align: "center",                valign: 'middle',            },            // {            //     field: 'times',            //     title: '规格',            //     align: "center",            //     valign: 'middle',            // },            {                field: 'quantity',                title: '数量',                align: "center",                valign: 'middle'            }, {                field: 'drugWin',                title: '副数',                align: "center",                valign: 'middle',            }, {                field: 'origPrice',                title: '原单价(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    if (value != undefined && value != null) {                        return value.toFixed(2);                    }                }            }, {                field: 'unitPrice',                title: '折后单价(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return value.toFixed(2);                }            }, {                field: 'amount',                title: '总金额(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return value.toFixed(2);                }            }        ],        responseHandler: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var ress = eval(res);            if (ress.code == -1) {                new PNotify({                    title: '错误提示',                    text: ress.message,                    type: 'error',                    hide: true,                    styling: 'bootstrap3'                });                return {                    "total": 0,//总页数                    "rows": {}   //数据                };            }            return {                //"total": ress.pageViewVo.total,//总页数                "rows": ress.data   //数据            };        },    });}/** * 构建列表查询参数 * @param params * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}} */function queryParamsForDetail(params) {    var billItemGroup = getIndex("bill_item_group");    var payMarkGroup = getIndex("pay_mark_group");    var temp = {        patientId: $("#patientIdChargeItem").val(),        times: $("#timesChargeItem").val(),        receiptNo: $("#receiptNoChargeItem").val(),        billItemCode: billItemGroup,        payMark: 5    };    if (payMarkGroup == 1) {        temp.payMark = 0;    } else if (payMarkGroup == 2) {        temp.payMark = 1;    }    return temp;};/** * 构建列表查询参数 * @param params * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}} */function queryParamsForRefundByBillItem(params) {    var billItemGroup = getIndex("refund_bill_item_group");    return {        patientId: $("#patientIdRefund").val(),        times: $("#timesRefund").val(),        receiptNo: $("#receiptNoRefund").val(),        chargeItemCodes: chargeItemCodes,        billItemCode: billItemGroup    };};/** * 卡号输入改变事件 */function cardNoChange() {    if (window.ActiveXObject || "ActiveXObject" in window) {        $("#cardNo").on('input propertychange', function () {            queryUserInfoByCardNo();        });    } else {        $("#cardNo").on('input οninput', function () {            queryUserInfoByCardNo();        });    }}/** * 卡号有变化后查询病人信息 */function queryUserInfoByCardNo() {    var cardNo = $("#cardNo").val();    var index = cardNo.indexOf("-");    if ((index > 0 && index === cardNo.length - 2) || true) {        $("#patientId").val(cardNo);        initFeeTable();    } else if (cardNo == '120' || cardNo.length == 8) {        $("#cardNo").attr("title", cardNo);        $.ajax({            type: "GET",            url: '/thmz/getByIcCardNo?icCardNo=' + cardNo,            contentType: "application/json;charset=UTF-8",            dataType: "json",            headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},            success: function (res) {                if (res == '401' || res == 401) {                    window.location.href = '/thmz/login/view'                    return;                }                if (res.code == 0) {                    if (res.data != null) {                        $("#patientId").val(res.data.patientId);                        initFeeTable();                    }                } else {                    new PNotify({                        title: '错误提示',                        text: res.message,                        type: 'error',                        hide: true,                        styling: 'bootstrap3'                    });                }            }        });    } else if (cardNo == null || cardNo == "") {        cleanParams();    }}/** * 获取按钮组选择的下标 * @param id * @returns {number} */function getIndex(id) {    var index = 0;    var item = $("#" + id).find("button");    for (var i = 0; i <= item.length; i++) {        if ($(item[i]).hasClass("btn-primary")) {            index = i;            break;        }    }    return index;}/** * 获取时间选择器的时间数组 * @returns {string[]} */function getRePortRangeArr() {    var rePortRange = $('#reportrange span').html();    var rePortRangeArr = rePortRange.split(" - ");    rePortRangeArr[0] = rePortRangeArr[0] + " 00:00:00"    rePortRangeArr[1] = rePortRangeArr[1] + " 23:59:59"    return rePortRangeArr;}/** * 打开收费窗口 */function confirmFeeModal(times, totalCharge, receiptNo) {    var buttonCodes = localStorage.getItem("buttonCodes");    if (buttonCodes != null) {        if (isInArrayStr("contract_match", buttonCodes)) {            $("#projectDiv").removeClass("hide").addClass("in");        } else {            $("#projectDiv").removeClass("in").addClass("hide");        }    } else {        $("#projectDiv").removeClass("in").addClass("hide");    }    var payTypeList = $("#payType").children();    if (payTypeList.length == 1) {        $('#payType').selectpicker('val', 'Y');    } else {        $('#payType').selectpicker('val', 1);    }    $('#payType').selectpicker('refresh');    var data = parseFloat($("#dataIdHaveTally").val());    if (totalCharge != null && totalCharge > 0) {        data = totalCharge;        $("#timesHaveTally").val(times);        $("#receiptNoHaveTally").val(receiptNo);    }    var prevAll = $("#changeAmountParent").prevAll();    while (prevAll.length > 1) {        $("#changeAmountParent").prev().remove();        prevAll = $("#changeAmountParent").prevAll();    }    // $("#realMoney").val($("#amountMoneyConfirm").text());    // $("#cash").val($("#amountMoneyConfirm").text());    $("#tallyDetailModal").modal('hide');    $("#haveTallyModal").modal('hide');    $("#confirmFeeModal").modal();    $("#amountMoneyConfirm").text(data);    //医保报销金额    var fundPay = $("#fundPay").val();    //个人账户支付金额    var acctPay = $("#acctPay").val();    //医保卡类型    var cardType = $("#cardType").val();    var payTypeIndex = 0;    if (fundPay > 0) {        var payTypeId = "payType_" + payTypeIndex++;        addPayType(payTypeId);        $('#' + payTypeId).selectpicker('val', 2);        $('#' + payTypeId).selectpicker('refresh');        $('#' + payTypeId).parent().parent().next().children(':first').val(fundPay);        $('#' + payTypeId).parent().parent().next().next().children(':first').remove();        $('#' + payTypeId).attr("disabled", true);        $('#' + payTypeId).parent().parent().next().children(':first').attr("readonly", "readonly");        //payTypeIndex++;    }    if (acctPay > 0) {        var payTypeId = "payType_" + payTypeIndex++;        addPayType(payTypeId);        // var ybkType = 'T';        // if (cardType != null && (cardType == 2 || cardType == "2")) {        //     ybkType = 'P';        // }        $('#' + payTypeId).selectpicker('val', cardType);        $('#' + payTypeId).selectpicker('refresh');        $('#' + payTypeId).parent().parent().next().children(':first').val(acctPay);        $('#' + payTypeId).parent().parent().next().next().children(':first').remove();        $('#' + payTypeId).attr("disabled", true);        $('#' + payTypeId).parent().parent().next().children(':first').attr("readonly", "readonly");    }    $("#payTypeIndex").val(payTypeIndex);    //总金额减医保报销    var realMoney = Minus(data, fundPay);    //减完医保报销后减个人医保卡支付金额    realMoney = Minus(realMoney, acctPay);    $("#realMoney").val(data);    if (realMoney > 0) {        addPayType("payType");        $("#cash").val(realMoney);    }    // $("#cash").val(null);    setTimeout(function () {        //默认光标在现金输入框        $("#cash").focus();    }, 800);    if (payTypeList.length == 1) {        $('#payType').selectpicker('val', 'Y');    } else {        $('#payType').selectpicker('val', 'O');    }    $("#changeAmount").val(0.0);    $("#surplusAmount").val(0.0);    $("input.refNo").val(null);    $("input.transDate").val(null);    $("input.payChannel").val(null);    $("input.qrCodeParam").val(null);    $("input.traceNo").val(null);    sendPriceMessage(realMoney, 0.0, 0.0, $("#patientIdHaveTally").val());}/** * 打开收费明细窗口 * @param data */function chargeDetailModal(patientId, times, receiptNo) {    $("#patientIdChargeItem").val(patientId);    $("#timesChargeItem").val(times);    $("#receiptNoChargeItem").val(receiptNo);    $("#chargeDetailModal").modal();    initChargeDetailTable();}/** * 病人当前就诊次数的诊断查询 * @param data */function diagnoseQuery(patientId, times) {    $.ajax({        type: "POST",        url: '/thmz/getVisitTableByPatientIdAndTimes',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({"patientId": patientId, "times": times}),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        async: false,        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                if (res.data.icdText != null || res.data.icdText != '') {                    $("#diagnoseModal").modal();                    $("#diagnose").html(res.data.icdText);                } else {                    new PNotify({                        title: '操作提示',                        text: '当前病人诊断未知',                        type: 'warn',                        styling: 'bootstrap3'                    });                }            } else {                errorMesage(res);            }        }    });}// /**//  * 打开退费重收明细窗口//  * @param data//  */// function chargeRefundDetailModal(patientId, times) {//     // $("#patientIdChargeItem").val(patientId);//     // $("#timesChargeItem").val(times);//     initMzChargeDetailByBillItem();// }/** * 初始门诊收银方式下拉选 */function initChequeType(payType) {    $.ajax({        type: "GET",        url: '/thmz/getAllZdChequeTypeForMz',        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        async: false,        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var html = '';            $.each(res.data, function (commentIndex, comment) {                html += '<option value="' + comment.code + '">' + comment.name + '</option>';            });            $('#' + payType).empty();            $('#' + payType).html(html);            $('#' + payType).selectpicker('refresh');            if (res.data.length == 1) {                $('#' + payType).selectpicker('val', 'Y');            } else {                $('#' + payType).selectpicker('val', 'O');            }            $('#' + payType).selectpicker('refresh');        }    });}/** * 关闭当前这个付款方式 */function closeThisParent(obj) {    $(obj).parent().parent().parent().remove();    checkFee(false);}/** * 校验收款金额 * @param flag 是否是提交时候的校验,是的话,如果缴费金额不够,需要返回 false */function checkFee(flag) {    var realMoney = parseFloat($("#realMoney").val());    realMoney = toDecimal(realMoney);    $("#realMoney").val(realMoney);    var arr = $("#payForm").find("div.pay-item");    if (arr.length > 0) {        // //是否存在未使用的收款方式        // var hadNotFill=false;        //非现金收款总金额        var notCashAmount = 0;        //现金收款总额        var cashAmount = 0;        for (var i = 0; i < arr.length; i++) {            var temp = parseFloat($(arr[i]).find("input.money").val());            if (isNaN(temp)) {                temp = 0;                // hadNotFill=true;            }            if ($(arr[i]).find("select").val() != 1) {                notCashAmount = Add(notCashAmount, temp);            } else {                cashAmount = Add(cashAmount, temp);            }            for (var j = 0; j < arr.length; j++) {                if ($(arr[i]).find("select").val() == $(arr[j]).find("select").val() && i != j) {                    new PNotify({                        title: '错误提示',                        text: "已经存在相同的收款方式,请不要重复添加!",                        type: 'error',                        hide: true,                        styling: 'bootstrap3'                    });                    return;                }            }        }        var totalAmount = Add(cashAmount, notCashAmount);        $("#surplusAmount").val(0.0);        if (totalAmount < realMoney) {            if (flag) {                new PNotify({                    title: '错误提示',                    text: "收款金额不能少于实收金额,请调整收款金额或者增加收款方式!",                    type: 'error',                    hide: true,                    styling: 'bootstrap3'                });                return false;            }            if (totalAmount == 0) {                $("#addPayType").parent().removeClass("in").addClass("hide");            } else {                $("#addPayType").parent().removeClass("hide").addClass("in");            }            // if(!hadNotFill){            //     addPayType(null);            // }            $("#changeAmount").val(0.00);            var surplusAmount = Minus(realMoney, totalAmount);            $("#surplusAmount").val(surplusAmount);            return;        }        var changeAmount = 0.00;        if (totalAmount >= realMoney) {            changeAmount = Minus(totalAmount, realMoney);            //changeAmount = changeAmount.toFixed(2);            $("#changeAmount").val(changeAmount);            $("#addPayType").parent().removeClass("in").addClass("hide");            if (!flag) {                sendPriceMessage(realMoney, totalAmount, changeAmount, $("#patientIdHaveTally").val());            }        }        //设置收费首页找零与应收和实收金额        $("#payableAmount").text(realMoney);        $("#paidAmount").text(totalAmount);        $("#changedAmount").text(changeAmount);    }    //计算和设置折扣比例    var amountMoneyConfirm = parseFloat($("#amountMoneyConfirm").text());    var discount = 100;    if (realMoney < amountMoneyConfirm) {        discount = Division(realMoney, Multiply(amountMoneyConfirm, 100));    }    $("#discount").text(toDecimal(discount));    return true;}/** * 异常接诊数据修复 * @param patientId * @param times * @param payMark * @param receiptNo */function initClinicForException(patientId, times, payMark, receiptNo) {    $.ajax({        type: "GET",        url: '/thmz/initClinicForException?patientId=' + patientId + '×=' + times+ '&receiptNo=' + receiptNo + "&payMark=" + payMark,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                successMesage(res);            } else {                errorMesage(res);            }        }    });}/** * 提示有记账记录 */function tipHaveTally(data, patientId, times, name, receiptNo) {    addOrderLock(patientId,times,null)    closeConfirmFeeModal();    if (patientId == null || patientId == "") {        return;    }    $("#patientIdHaveTally").val(patientId);    $("#nameHaveTally").val(name);    $("#dataIdHaveTally").val(data);    $("#timesHaveTally").val(times);    $("#receiptNoHaveTally").val(receiptNo);    saveFeeGzzf()    // postAjaxJsonHttpRequst("/thmz/queryCountYbZf",{"patientId": patientId, "times": times},true,function (rs) {    //     if (rs == '401' || rs == 401) {    //         window.location.href = '/thmz/login/view'    //         return;    //     }    //     if(rs.code == 0){    //         if(rs.data > 0){    //    //         }    //     }else {    //         errorMesage(rs);    //     }    //    // })}//收费时保存个账支付选择function saveFeeGzzf() {    $.ajax({        type: "POST",        url: '/thmz/getTmFee',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({"patientId": $("#patientIdHaveTally").val(), "times": $("#timesHaveTally").val(), "receiptNo": $("#receiptNoHaveTally").val()}),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        async: false,        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                if (res.data != undefined && res.data != null) {                    $("#fundPay").val(res.data.fundPay);                    $("#acctPay").val(res.data.acctPay);                    $("#cardType").val(res.data.ybkType);                    //$("#realMoney").val(res.data.selfPay);                } else {                    $("#fundPay").val(0.0);                    $("#acctPay").val(0.0);                    $("#cardType").val(null);                }            } else {                errorMesage(res);            }            $("#saveConfirmFee").attr("disabled", false);        }    });    confirmFeeModal(null, null, null);}var $tally_detail_table;/** * 初始化本院记账明细表格 */function initTallyDetailTable() {    $("#haveTallyModal").modal('hide');    var patientId = $("#patientIdHaveTally").val();    // var name = $("#nameHaveTally").val();    if (patientId == null || patientId == '') {        return;    }    $("#tallyDetailModal").modal();    $('#tally_detail_table').bootstrapTable("destroy");    $tally_detail_table = $('#tally_detail_table').bootstrapTable({        url: '/thmz/getTallyReceiptSerial?patientId=' + patientId,         //请求后台的URL(*)        method: 'get',                      //请求方式(*)        toolbar: '#toolbar',                //工具按钮用哪个容器        striped: true,                      //是否显示行间隔色        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)        pagination: false,                   //是否显示分页(*)        sortable: true,                     //是否启用排序        sortOrder: "asc",                   //排序方式        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)        pageNumber: 1,                       //初始化加载第一页,默认第一页        pageSize: 10,                       //每页的记录行数(*)        pageList: [10, 25, 50, 100],        //可供选择的每页的行数(*)        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大        strictSearch: true,        showColumns: false,                  //是否显示所有的列        showRefresh: false,                  //是否显示刷新按钮        minimumCountColumns: 2,             //最少允许的列数        clickToSelect: true,                //是否启用点击选中行        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮        cardView: false,                    //是否显示详细视图        detailView: false,        //rowStyle:rowStyle,//通过自定义函数设置行样式        ajaxOptions: {            headers: {                'Accept': 'application/json',                'Authorization': 'Bearer ' + localStorage.getItem("token")            }        },        columns: [            // {            //     checkbox: true,            // },            {                field: 'patientId',                title: '病人编号',                align: "center",                valign: 'middle'            }, {                field: 'name',                title: '病人姓名',                align: "center",                valign: 'middle',                // formatter: function (value, row, index) {                //     return name;                // }            }, {                field: 'times',                title: '就诊次数',                align: "center",                valign: 'middle',            },            {                field: 'totalCharge',                title: '总费用(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return value.toFixed(2);                }            },            {                field: 'chargeDate',                title: '记账时间',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return format(value, "yyyy-MM-dd HH:mm:ss");                }            }            // , {            //     title: '操作',            //     align: "center",            //     valign: 'middle',            //     // sortable: true,            //     formatter: function (value, row, index) {            //         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>';            //         return str;            //     }            // }        ],        /**         * @param {点击列的 field 名称} field         * @param {点击列的 value 值} value         * @param {点击列的整行数据} row         * @param {td 元素} $element         */        onClickCell: function (field, value, row, $element) {            var cardNo = $("#cardNo").val();            if (cardNo == '120' && field == 'name') {                $element.attr('contenteditable', true);                $element.html(null);                $element.focus();                $element.blur(function () {                    var index = $element.parent().data('index');                    var tdValue = $element.html();                    saveData(index, field, tdValue, row, $tally_detail_table);                })            }        },        onDblClickRow: function (row) {            confirmFeeModal(row.times, row.totalCharge, row.receiptNo);        },        responseHandler: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var ress = eval(res);            if (ress.code == -1) {                errorMesage(ress);                return {                    "total": 0,//总页数                    "rows": {}   //数据                };            }            if (ress.data == null || ress.data.length == 0) {                $("#tallyDetailModal").modal("hide");            }            return {                "rows": ress.data   //数据            };        },    });}/** * 提交缴费申请 */function saveConfirmFee() {    $("#saveConfirmFee").attr("disabled", true);    if (!checkFee(true)) {        $("#saveConfirmFee").attr("disabled", false);        return;    }    var project = $("#project").val();    let dyTgId = $("#dyTgId").val();    var jsonData = JSON.parse('{"patientId":"","times":"","receiptNo":"","mzDepositFiles":[]}');    var patientId = $("#patientIdHaveTally").val();    var times = $("#timesHaveTally").val();    var receiptNo = $("#receiptNoHaveTally").val();    jsonData.patientId = patientId;    jsonData.times = times;    jsonData.receiptNo = receiptNo;    var arr = $("#payForm").find("div.pay-item");    if (arr.length > 0) {        for (var i = 0; i < arr.length; i++) {            var temp = parseFloat($(arr[i]).find("input.money").val());            if (temp == null || temp == 0) {                continue;            }            var tempJson = JSON.parse('{"chequeType":"","amount":"","contractId":"","psordnum":"","agtordnum":"","parChannel":"","transDate":"","traceNo":"","dyTgNo":""}');            tempJson.chequeType = $(arr[i]).find("select").val();            tempJson.psordnum = $(arr[i]).find("input.refNo").val();            tempJson.agtordnum = $(arr[i]).find("input.qrCodeParam").val();            tempJson.parChannel = $(arr[i]).find("input.payChannel").val();            tempJson.transDate = $(arr[i]).find("input.transDate").val();            tempJson.traceNo = $(arr[i]).find("input.traceNo").val();            //现金有可能会多收,比入实收37,对方给了100,需要找零63. 所以必须减去找零金额,才是实收金额            if (tempJson.chequeType == "1") {                temp = temp - $("#changeAmount").val();                temp = temp.toFixed(2);            }            if (project != null && project != "null" && project != "") {                tempJson.contractId = project;            }            if(stringNotBlank(dyTgId)){                tempJson.dyTgNo = dyTgId;            }            tempJson.amount = temp;            jsonData.mzDepositFiles[jsonData.mzDepositFiles.length] = tempJson;        }    }    $.ajax({        type: "POST",        url: '/thmz/chargeFee',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify(jsonData),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                if(fpVsesionNo == 0){                    prn1Print(patientId, times, true, res.receiptNo);                }else {                    printDzfp(patientId, times,res.receiptNo,0)                }                successMesage(res);                closeConfirmFeeModal();                //缴费成功后清空全局参数                patientIdFullForNucleicAcid = null;                initFeeTable();                //默认光标在卡号输入框                $("#cardNo").focus();                // toEvaluation(patientId);                toNewEvaluation(patientId,times);            } else {                errorMesage(res);            }            $("#saveConfirmFee").attr("disabled", false);        }    });}/** * 关闭收费确认模态弹框 */function closeConfirmFeeModal() {    $("#confirmFeeModal").modal("hide");    $("#patientId").val(null);    $("#cardNo").val(null);    $("#name").val(null);    $("#fundPay").val(0);    $("#acctPay").val(0);    $("#cardType").val(null);}/** * 保存合作项目 */function saveProject() {    var projectRealNo = $("#projectRealNo").val();    var projectCharged = $("#projectCharged").val();    $.ajax({        type: "GET",        url: '/thmz/setMzDepositFileSetContractId?contractId=' + projectCharged + '&serialNo=' + projectRealNo,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                successMesage(res);                $("#projectRealNo").val(null);                $('#projectCharged').selectpicker('val', null);                $('#projectCharged').selectpicker('refresh');                $("#projectModal").modal("hide");            } else {                errorMesage(res);            }            $("#saveConfirmFee").attr("disabled", false);        }    });}//上传电子发票function printDzfp(patientId,times,receiptNo,loadingFlag) {    if(loadingFlag == 1){        $("#dzfpLoadingModal").modal('show');    }    postAjaxJsonHttpRequst("/thmz/getNewAllSerialForThisTime",{patientId:patientId,times:times,receiptNo:receiptNo},true,function (res) {        if(res.code == 0){            uploadMzInvoice(patientId,times,receiptNo,1,localStorage.getItem("userName"))        }else {            $("#dzfpLoadingModal").modal('hide');            errorMesage(res)        }    })}/** * * @param patientId * @param times * @param receiptNo * @param typeFlag 1 上传门诊蓝字发票 2上传红字发票 (作废) */function uploadMzInvoice(patientId,times,receiptNo,typeFlag) {    postAjaxJsonHttpRequst("/thmz/uploadMzInvoice",{patientId:patientId,times:times,receiptNo:receiptNo,ghFlag:false,typeFlag:typeFlag},true,function (rs) {        if(typeFlag == 1){            $("#dzfpLoadingModal").modal('hide');        }        if(rs.code ==0){            successMesageSimaple("电子发票上传成功!")            if(typeFlag == 1){                initFeeTable();            }        }else {            errorMesage(rs);        }    })}var dzfp_patientId ;var dzfp_times ;var dzfp_serialNo;//var dzfp_typeFlag;//打开电子发票弹窗function openDzfpDownModal(patientId,times,serialNo) {console.log("dfds",patientId,times,serialNo)    dzfp_patientId = patientId;    dzfp_times = times;    dzfp_serialNo = serialNo;//    dzfp_typeFlag = typeFlag;    $("#dzfpDownModal").modal();}/** * @param type 1 打印二维码  2 下载pdf */function downOrPrintDzfp(type) {//console.log("11111111111111111111111111111")//console.log("dfds",dzfp_patientId,dzfp_times,dzfp_serialNo)    downloadDzfp(dzfp_patientId,dzfp_times,dzfp_serialNo,type)}//下载电子发票function downloadDzfp(patientId,times,serialNo,type) {    setPrint();    postAjaxJsonHttpRequst("/thmz/selectDzfpUploadAboutSerialNo",{patientId:patientId,times:times,serialNo:serialNo},true,function (res) {        if(res.code == 0){            $("#dzfpDownModal").modal("hide");            if(res.data.resUrl){                if(type == 2 || !stringNotBlank(type)){                    window.open(res.data.resUrl)                }else {                //打印二维码                   let height = "70mm"                   let  bkimgWidth = "110mm"                    LODOP = getLodop();                    LODOP.PRINT_INITA(6, 0, bkimgWidth, height, hospitalName+"门诊电子发票二维码打印");                    //设置默认打印机                    LODOP.SET_PRINTER_INDEX(printIndex);                    LODOP.SET_SHOW_MODE("BKIMG_WIDTH", bkimgWidth);                    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);                    LODOP.SET_PRINT_PAGESIZE(1,bkimgWidth, height, "CreateCustomPage");                    LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊电子发票二维码");//对新建的纸张重命名                    LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小                    LODOP.ADD_PRINT_TEXT("6mm", "3mm", "60mm", "3mm", hospitalName+"发票二维码");                    LODOP.ADD_PRINT_IMAGE("10mm", "3mm", "50mm", "50mm", "data:image/png;base64,"+res.data.qrcode);                    LODOP.PRINT();                    // LODOP.PREVIEW();                }            } else {                errorMesage("未获取到电子发票,请重新上传发票!");            }        }else {            errorMesage(res)        }    })}/** * 直接打印发票 * @param patientId * @param times * @param chargeFeeFlag 收费 退费标记  true 收费和重打发票来源 false 退费来源 */function prn1PrintHand(patientId, times, chargeFeeFlag, receiptNo, realNo) {    $("#button_" + realNo).css("display", "none");    prn1Print(patientId, times, chargeFeeFlag, receiptNo);}/** * 直接打印发票 * @param patientId * @param times * @param chargeFeeFlag 收费 退费标记  true 收费和重打发票来源 false 退费来源 */function prn1Print(patientId, times, chargeFeeFlag, receiptNo) {    var url = '/thmz/getAllSerialForThisTime?patientId=' + patientId + "×=" + times + "&receiptNo=" + receiptNo;    printCommon(url, patientId, times, chargeFeeFlag);}/** * 重打发票 * @param patientId * @param times */function repPrint(patientId, times, receiptNo) {    $.ajax({        type: "GET",        url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "×=" + times + "&receiptNo=" + receiptNo,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                if (res.data.length == 1) {                    var message = "确定要重新打印发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认发票打印机即将要打印的发票编号";                    var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "×=" + times + "&obsolete=0&receiptBill=" + res.data[0].receiptBill;                    confirmMessage(patientId, times, message, url);                } else {                    $("#tip_message").text("请选择需要重新打印的发票号");                    $("#repPrintModal").modal();                    $("#repPrintTable").html(null);                    for (var i = 0; i < res.data.length; i++) {                        $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {                            $("#repPrintModal").modal("hide");                            var message = "确定要重新打印发票号码为【" + $(this).text() + "】的发票吗?请确认发票打印机即将要打印的发票编号";                            var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "×=" + times + "&obsolete=0&receiptBill=" + $(this).text();                            confirmMessage(patientId, times, message, url);                        });                    }                }            }        }    });}/** * 发票重打提示 * @param patientId * @param times * @param name */function confirmMessage(patientId, times, message, url) {    if (!confirm(message)) {        return;    }    //var url='/thmz/repPrintForThisTime?patientId=' + patientId + "×=" + times + "&obsolete=0" + "&receiptBill="+receiptBill;    printCommon(url, patientId, times, true);}/** * 作废重打发票 * @param patientId * @param times */function obsoleteAndRepPrint(patientId, times, receiptNo) {    $.ajax({        type: "GET",        url: '/thmz/getReceiptForThisTime?patientId=' + patientId + "×=" + times + "&receiptNo=" + receiptNo,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                if (res.data.length == 1) {                    var message = "确定要作废发票号码为【" + res.data[0].receiptBill + "】的发票吗?请确认需要作废发票编号";                    var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "×=" + times + "&obsolete=1&receiptBill=" + res.data[0].receiptBill;                    confirmMessage(patientId, times, message, url);                } else {                    $("#tip_message").text("请选择需要作废的发票号");                    $("#repPrintModal").modal();                    $("#repPrintTable").html(null);                    for (var i = 0; i < res.data.length; i++) {                        $("<tr><td>" + res.data[i].receiptBill + "</td></tr>").appendTo("#repPrintTable").bind('click', function () {                            $("#repPrintModal").modal("hide");                            var message = "确定要作废发票号码为【" + $(this).text() + "】的发票吗?请确认需要作废发票编号";                            var url = '/thmz/repPrintForThisTime?patientId=' + patientId + "×=" + times + "&obsolete=1&receiptBill=" + $(this).text();                            confirmMessage(patientId, times, message, url);                        });                    }                }            }        }    });}/** * 打印医保结算单 * @param patientId * @param times * @param receiptNo */function printYbjsd(patientId, times, receiptNo) {    if (mzjsdHost == null) {        errorMesageSimaple("医保结算单域名为空,操作失败!");        return;    }    const iframeEle = document.getElementById('ybjsdDiv');    const loadingEle = document.getElementById('loading');    //设置ififrame透明    iframeEle.style.opacity = 0;    loadingEle.style.display = 'block';    var url = mzjsdHost + "/siSettleDetailList/" + patientId + "/" + times;    $("#ybjsdDiv").attr("src", url);    iframeEle.addEventListener('load', function () {        // Hide the loading indicator        loadingEle.style.display = 'none';        // Bring the iframe back        iframeEle.style.opacity = 1;    });    $("#ybjsdModal").modal();}/** * 匹配合作项目 * @param realNo */function matchProject(realNo) {    $("#projectRealNo").val(realNo);    $("#projectModal").modal();    $.ajax({        type: "GET",        url: '/thmz/getMzDepositFileContractId?serialNo=' + realNo,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                $('#projectCharged').selectpicker('val', res.data);                $('#projectCharged').selectpicker('refresh');            }        }    });}/** * 打印发票通用方法 * @param patientId * @param times * @param chargeFeeFlag 收费 退费标记  true 收费和重打发票来源 false 退费来源 */function printCommon(url, patientId, times, chargeFeeFlag) {    setPrint();    var height = "93.15mm";    // if (countReceiot % 2 == 0) {    //     height = "93.2mm";    // }    $.ajax({        type: "GET",        url: url,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        async: false,        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                if (res.data == null || res.data.length == 0) {                    return;                }                // countReceiot++;                for (var i = 0; i < res.data.length; i++) {                    LODOP = getLodop();                    var temp = res.data[i].mzReceiptSerial;                    LODOP.PRINT_INITA(6, 0, "120mm", height, "铭和门诊发票打印");                    //设置默认打印机                    LODOP.SET_PRINTER_INDEX(printIndex);                    LODOP.SET_SHOW_MODE("BKIMG_WIDTH", "120mm");                    LODOP.SET_SHOW_MODE("BKIMG_HEIGHT", height);                    LODOP.SET_PRINT_PAGESIZE(1, "120mm", height, "CreateCustomPage");                    LODOP.SET_PRINT_MODE("CREATE_CUSTOM_PAGE_NAME", "门诊发票");//对新建的纸张重命名                    LODOP.SET_PRINT_STYLE("FontSize", 11); //字体大小                    LODOP.ADD_PRINT_TEXT("6mm", "0mm", "55mm", "3mm", hospitalName);                    LODOP.ADD_PRINT_TEXT("6mm", "59mm", "30mm", "3mm", "机制号:");                    LODOP.ADD_PRINT_TEXT("6mm", "72mm", "20mm", "3mm", temp.serialNo);                    LODOP.ADD_PRINT_TEXT("19mm", "0mm", "35mm", "3mm", temp.receiptBill);                    LODOP.ADD_PRINT_TEXT("25mm", "7mm", "40mm", "3mm", res.mzPatientMi.name);                    LODOP.ADD_PRINT_TEXT("25mm", "61mm", "27mm", "3mm", patientId);                    var feeList = res.data[i].feeList;                    if (feeList != null && feeList.length > 0) {                        var top = 32;                        var left = 6;                        for (var j = 0; j < feeList.length; j++) {                            var row = parseInt(j / 3);                            var tempTop = top + row * 5;                            var tempLeft = left;                            if (j % 3 == 1) {                                tempLeft = left + 30;                            } else if (j % 3 == 2) {                                tempLeft = left + 60;                            }                            LODOP.ADD_PRINT_TEXT(tempTop + "mm", tempLeft + "mm", "30mm", "3mm", feeList[j]);                        }                    }                    // LODOP.ADD_PRINT_TEXT("32mm","25mm","25mm","3mm","诊查费  10.00");                    // LODOP.ADD_PRINT_TEXT("32mm","50mm","25mm","3mm","中成药费30.10");                    // LODOP.ADD_PRINT_TEXT("37mm","25mm","25mm","3mm","治疗费  22.00");                    // LODOP.ADD_PRINT_TEXT("37mm","50mm","25mm","3mm","材料费  14.20");                    // LODOP.ADD_PRINT_TEXT("42mm","25mm","25mm","3mm","西药费 161.20");                    // var qyxxs = res.data[i].qyxxs;                    // if (qyxxs != null && qyxxs.length > 0) {                    //     var top = 54;                    //     for (var j = 0; j < qyxxs.length; j++) {                    //         var row = j / 3;                    //         var tempTop = top + row * 10;                    //         var qyxx = qyxxs[j];                    //         var arr = qyxx.split(",");                    //         LODOP.ADD_PRINT_TEXT(tempTop + "mm", "6mm", "50mm", "3mm", "取药窗口:" + arr[0]);                    //         LODOP.ADD_PRINT_TEXT(tempTop + "mm", "61mm", "50mm", "3mm", "取药号码:" + arr[1]);                    //     }                    // }                    var payInfo = res.data[i].payInfo;                    LODOP.ADD_PRINT_TEXT("54mm", "6mm", "100mm", "3mm", payInfo);                    // LODOP.ADD_PRINT_TEXT("54mm","25mm","50mm","3mm","取药窗口:西药房4号窗口");                    // LODOP.ADD_PRINT_TEXT("54mm","80mm","35mm","3mm","取药号码:408392");                    var totalCharge = temp.totalCharge + " 元 ";                    if (res.data[i].countYbZf > 0) {                        totalCharge = totalCharge + "城职普门"                    } else {                        totalCharge = totalCharge + "自费"                    }                    LODOP.ADD_PRINT_TEXT("65mm", "21mm", "65mm", "3mm", totalCharge);                    LODOP.ADD_PRINT_TEXT("72mm", "19mm", "65mm", "3mm", res.data[i].totalChargeStr);                    LODOP.ADD_PRINT_TEXT("79mm", "0mm", "15mm", "3mm", res.data[i].year);//年                    LODOP.ADD_PRINT_TEXT("79mm", "13mm", "10mm", "3mm", res.data[i].month);//月                    LODOP.ADD_PRINT_TEXT("79mm", "25mm", "10mm", "3mm", res.data[i].day);//日                    LODOP.ADD_PRINT_TEXT("79mm", "53mm", "50mm", "3mm", temp.operatorId);//收费员                    LODOP.PRINT();                    //LODOP.PREVIEW();                    initFeeTable();                }            } else if (res.code == -1) {                //退费就退出,不提示异常                if (!chargeFeeFlag) {                    return;                }                new PNotify({                    title: '错误提示',                    text: res.message,                    type: 'error',                    hide: true,                    styling: 'bootstrap3'                });            }        }    });}//// /**//  * 加载打印机列表//  * @constructor//  */// function CreatePrinterList() {//     LODOP = getLodop();//     LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "铭和门诊发票打印");//     //获取打印机设备数,用于进行遍历//     var count = LODOP.GET_PRINTER_COUNT();//     var html = "";//     for (var i = 0; i < count; i++) {//         //根据设备序号获取设备名//         var msg = LODOP.GET_PRINTER_NAME(i);//         html += "<option value='" + i + "'>" + msg + "</option>";//     }//     $('#printSelect').html(html);//     $('#printSelect').selectpicker('refresh');//     $.ajax({//         type: "GET",//         url: '/thmz/getLastWindowsByCurrentUser',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 $('#printSelect').selectpicker('val', res.data.printIndex);//                 $('#printSelect').selectpicker('refresh');//                 printIndex=res.data.printIndex;//             }//         }//     });// }////// /**//  * 保存窗口号//  */// function saveWindows() {//     $.ajax({//         type: "POST",//         url: '/thmz/saveWindows',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         data: JSON.stringify({"windowsNo": $("#windowsNum").val()}),//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             $('#editWindowsModal').modal('hide');//             if (res.code == 0) {//                 new PNotify({//                     title: '操作提示',//                     text: res.message,//                     type: 'success',//                     hide: true,//                     styling: 'bootstrap3'//                 });//             } else {//                 new PNotify({//                     title: '错误提示',//                     text: res.message,//                     type: 'error',//                     hide: true,//                     styling: 'bootstrap3'//                 });//             }//         }//     });// }//////// /**//  * 保存打印机//  */// function savePrint() {//     $.ajax({//         type: "POST",//         url: '/thmz/savePrintIndex',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         data: JSON.stringify({"printIndex": $("#printSelect").val()}),//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             LODOP = getLodop();//             LODOP.PRINT_INITA(6, 0, "92mm", "120mm", "铭和门诊发票打印");//             LODOP.SET_PRINTER_INDEX($("#printSelect").val());//             printIndex=$("#printSelect").val();//             $('#editPrintModal').modal('hide');//             if (res.code == 0) {//                 new PNotify({//                     title: '操作提示',//                     text: res.message,//                     type: 'success',//                     hide: true,//                     styling: 'bootstrap3'//                 });//             } else {//                 new PNotify({//                     title: '错误提示',//                     text: res.message,//                     type: 'error',//                     hide: true,//                     styling: 'bootstrap3'//                 });//             }//         }//     });// }/** * 查询默认打印机 */function setPrint() {    if (printIndex >= 0) {        return;    }    $.ajax({        type: "GET",        url: '/thmz/getLastWindowsByCurrentUser',        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        async: false,        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                printIndex = res.data.printIndex;            } else {                printIndex = -1;            }        }    });}/** * 退费操作 */function refundFee(patientId, times, receiptNo, printFlag,orderTypeName) {    if(orderTypeName =='商城处方'){        errorMesageSimaple('商城处方不能退费')        return    }    $("#refundFeePrepare").text(0.00);    $("#refundFeeDetailModal").modal();    $("#refund_bill_item_group").removeClass("in").addClass("hide");    $('#refund_fee_bill_table').bootstrapTable("destroy");    initRefundFeeDetailTable(patientId, times, receiptNo);}/** * 初始化退费明细表格 * @param patientId * @param times * @param receiptNo */function initRefundFeeDetailTable(patientId, times, receiptNo) {    $("#patientIdRefund").val(patientId);    $("#timesRefund").val(times);    $("#receiptNoRefund").val(receiptNo);    $('#refund_fee_detail_table').bootstrapTable("destroy");    $('#refund_fee_detail_table').bootstrapTable({        url: '/thmz/getRefundFeeDetail',         //请求后台的URL(*)        method: 'post',                      //请求方式(*)        toolbar: '#toolbar',                //工具按钮用哪个容器        striped: true,                      //是否显示行间隔色        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)        pagination: false,                   //是否显示分页(*)        sortable: true,                     //是否启用排序        sortOrder: "asc",                   //排序方式        // sortName: 'orderNo',                //排序字段        queryParams: queryParamsForRefundFee(patientId, times, receiptNo),           //传递参数(*)        sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)        pageNumber: 1,                       //初始化加载第一页,默认第一页        pageSize: 10,                       //每页的记录行数(*)        pageList: [10, 25, 50, 100],        //可供选择的每页的行数(*)        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大        strictSearch: true,        showColumns: false,                  //是否显示所有的列        showRefresh: false,                  //是否显示刷新按钮        minimumCountColumns: 2,             //最少允许的列数        clickToSelect: true,                //是否启用点击选中行        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮        cardView: false,                    //是否显示详细视图        detailView: false,        //rowStyle:rowStyle,//通过自定义函数设置行样式        ajaxOptions: {            headers: {                'Accept': 'application/json',                'Authorization': 'Bearer ' + localStorage.getItem("token")            }        },        columns: [            {                checkbox: true,                formatter: function (value, row, index) {                    if (row.confirmFlag == 1) {                        return {                            disabled: true, //设置是否可用                            checked: false//设置选中                        }                    }                    if (row.confirmFlag == 3) {                        //getRefundFee();                        return {                            disabled: true, //设置是否可用                            checked: true//设置选中                        }                    }                }            },            {                field: 'orderNo',                title: '处方号',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value);                }            }, {                field: '',                title: '项目号',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return index + 1;                }            }, {                field: 'billItemCode',                title: '分类名称',                align: "center",                valign: 'middle',            },            {                field: 'yjName',                title: '医技项目名称',                align: "center",                valign: 'middle',            },{                field: 'chargeItemCode',                title: '收费编码',                align: "center",                valign: 'middle',            }, {                field: 'tcName',                title: '项目',                align: "center",                valign: 'middle',            },            {                field: 'quantity',                title: '数量',                align: "center",                valign: 'middle'                ,                formatter: function (value, row, index) {                    return value * row.drugWin;                }            }, {                field: 'unitPrice',                title: '单价(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return value.toFixed(2);                }            }, {                field: 'amount',                title: '总金额(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return value.toFixed(2);                }            }, {                field: 'confirmFlag',                title: '确认标志',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    if (value == 0) {                        return "待确认";                    }                    if (value == 1) {                        return "已确认";                    }                    if (value == 3) {                        return "已取消";                    }                    if (value == 4) {                        return "已退费";                    }                }            }, {                field: 'decAmount',                title: '退药量',                align: "center",                valign: 'middle',                // formatter: function (value, row, index) {                //     return value.toFixed(2);                // }            }, {                field: 'execDept',                title: '确认科室',                align: "center",                valign: 'middle'            }, {                field: 'confirmTime',                title: '确认时间',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    if (value != null && value != "") {                        return format(value, "yyyy-MM-dd HH:mm:ss");                    }                    return "";                }            }        ],        //点击全选框时触发的操作        onCheckAll: function (rows) {            getRefundFee();        },        //取消所有        onUncheckAll: function (row) {            getRefundFee();        },        //点击每一个单选框时触发的操作        onCheck: function (row) {            getRefundFee();        },        //取消每一个单选框时对应的操作;        onUncheck: function (row) {            getRefundFee();        },        responseHandler: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var ress = eval(res);            if (ress.code == -1) {                new PNotify({                    title: '错误提示',                    text: ress.message,                    type: 'error',                    hide: true,                    styling: 'bootstrap3'                });                return {                    "total": 0,//总页数                    "rows": {}   //数据                };            }            return {                //"total": ress.pageViewVo.total,//总页数                "rows": ress.data   //数据            };        },        //加载完成事件        onLoadSuccess: function (data) {            getRefundFee();        }    });}/** * 退费列表参数 * @param patientId * @param times * @returns {{patientId: *, times: *}} */function queryParamsForRefundFee(patientId, times, receiptNo) {    var temp = {        patientId: patientId,        times: times,        receiptNo: receiptNo    };    return temp;};/** * 每次选择费用清单明细时计算实际应退金额 */function getRefundFee() {    extracted();    if (chargeItemCodes == null) {        $("#refundFeePrepare").text(0.00);        return;    }    $.ajax({        type: "POST",        url: '/thmz/getNewListForRefundFee',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({            patientId: $("#patientIdRefund").val(),            times: $("#timesRefund").val(),            receiptNo: $("#receiptNoRefund").val(),            chargeItemCodes: chargeItemCodes        }),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                $("#refundFeePrepare").text(res.pageViewVo.data[0].refundFee.toFixed(2));            } else {                new PNotify({                    title: '错误提示',                    text: res.message,                    type: 'error',                    hide: true,                    styling: 'bootstrap3'                });            }        }    });}/** * 发起预退费 */function readyRefundFee() {    extracted();    $("#refundFeeModal").modal();    initRefundChargeDetailTable(chargeItemCodes);    $("#refundFeeDetailModal").modal("hide");}/** * 获取预退费金额 * @returns {*} */function extracted() {    var allSelecteds = $('#refund_fee_detail_table').bootstrapTable('getAllSelections');    chargeItemCodes = null;    if (allSelecteds != null && allSelecteds.length > 0) {        for (var i = 0; i < allSelecteds.length; i++) {            var temp = allSelecteds[i].orderNo + "_" + allSelecteds[i].itemNo + "_" + allSelecteds[i].chargeItemCode;            if (chargeItemCodes == null) {                chargeItemCodes = temp;            } else {                chargeItemCodes += "," + temp;            }        }    }}/** * 初始化退费重收费明细表格 */function initRefundChargeDetailTable(chargeItemCodes) {    $('#refund_fee_table').bootstrapTable("destroy");    $('#refund_fee_table').bootstrapTable({        url: '/thmz/getNewListForRefundFee',         //请求后台的URL(*)        method: 'post',                      //请求方式(*)        toolbar: '#toolbar',                //工具按钮用哪个容器        striped: true,                      //是否显示行间隔色        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)        pagination: false,                   //是否显示分页(*)        sortable: true,                     //是否启用排序        sortOrder: "asc",                   //排序方式        // sortName: 'orderNo',                //排序字段        queryParams: queryParamsForRefundDetail(chargeItemCodes),           //传递参数(*)        sidePagination: "server",           //分页方式:client客户端分页,server服务端分页(*)        pageNumber: 1,                       //初始化加载第一页,默认第一页        pageSize: 10,                       //每页的记录行数(*)        pageList: [10, 25, 50, 100],        //可供选择的每页的行数(*)        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大        strictSearch: true,        showColumns: false,                  //是否显示所有的列        showRefresh: false,                  //是否显示刷新按钮        minimumCountColumns: 2,             //最少允许的列数        clickToSelect: true,                //是否启用点击选中行        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮        cardView: false,                    //是否显示详细视图        detailView: false,        //rowStyle:rowStyle,//通过自定义函数设置行样式        ajaxOptions: {            headers: {                'Accept': 'application/json',                'Authorization': 'Bearer ' + localStorage.getItem("token")            }        },        columns: [            // {            //     checkbox: true            // },            {                field: 'patientId',                title: '患者编号',                align: "center",                valign: 'middle',            }, {                field: 'name',                title: '患者姓名',                align: "center",                valign: 'middle',            }, {                field: 'oriAmount',                title: '已收金额(元)',                align: "center",                valign: 'middle',            }, {                field: 'refundFee',                title: '应退金额(元)',                align: "center",                valign: 'middle'            }, {                field: 'amount',                title: '应收金额(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value);                }            }, {                title: '操作',                align: "center",                valign: 'middle',                // sortable: true,                formatter: function (value, row, index) {                    var str = "";                    if (row.amount == 0 || row.amount == null || row.amount == undefined) {                        str = '<button type="button" class="can-not-used" title="费用明细" ><i id="plusOrMinus" class="fa fa-plus"></i></button>';                    } else {                        str = '<button type="button" class="registration-no-color-foot-button" title="费用明细" onclick="initMzChargeDetailByBillItem(true)"><i id="plusOrMinus" class="fa fa-plus"></i></button>';                    }                    if((row.amount == 0 || row.amount == null || row.amount == undefined) || row.ybZfFlag == null || row.ybZfFlag =='0'){                        str += '<button type="button" class="can-not-used" title="撤销医保重新登记医保" ><i class="fa fa-server"></i></button>';                    }else {                        str += '<button type="button" class="registration-no-color-foot-button" title="撤销医保重新登记医保" onclick="reqYb()"><i  class="fa fa-server"></i></button>';                    }                    if(row.mipOrderFlag == 1){                        str += `<button type="button" class="registration-no-color-foot-button"title="读取电子凭证" onclick="reSiReadCard(true,'01')"><i class="fa fa-newspaper-o"></i></button>`;                    }                    str += '<button type="button" class="registration-no-color-foot-button"title="普通退费" onclick="saveRefundFee(0)"><i class="fa fa-check"></i></button>';                    str += '<button type="button" class="registration-no-color-foot-button"title="原路退费" onclick="saveRefundFee(1)"><i class="fa fa-exchange"></i></button>';                    return str;                }            }        ],        responseHandler: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var ress = eval(res);            if (ress.code == -1) {                new PNotify({                    title: '错误提示',                    text: ress.message,                    type: 'error',                    hide: true,                    styling: 'bootstrap3'                });                return {                    "total": 0,//总页数                    "rows": {}   //数据                };            }            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)){                $("#tfGrzhzfDiv").removeClass("hide").addClass("in");            }else {                $("#tfGrzhzfDiv").removeClass("in").addClass("hide");            }            $("#oriAmount").text(ress.pageViewVo.data[0].oriAmount);            $("#newAmount").text(ress.pageViewVo.data[0].amount);            $("#refundAmount").text(ress.pageViewVo.data[0].refundFee);            return {                "total": ress.pageViewVo.total,//总页数                "rows": ress.pageViewVo.data   //数据            };        },    });}/** * 构建列表查询参数 * @param chargeItemCodes * @returns {{patientId: string | number | string[] | undefined | jQuery, times: string | number | string[] | undefined | jQuery, billItemCode: number}} */function queryParamsForRefundDetail(chargeItemCodes) {    return {        patientId: $("#patientIdRefund").val(),        times: $("#timesRefund").val(),        receiptNo: $("#receiptNoRefund").val(),        chargeItemCodes: chargeItemCodes    };};/** * 关闭预退费窗口 */function closeRefundFeeDetailModal() {    $("#refundFeeDetailModal").modal("hide");}/** * 提交退费操作 * @param refundType 0 现金退费 1 原路退费 */function saveRefundFee(refundType) {    var params = queryParamsForRefundByBillItem(null);    params.refundType = refundType;    params['readCardResult'] = $("#cdReadCardResult").val()    params['acctUsedFlag'] = $("#tfGrzhzf").val()    params['readCardType'] = $("#tfReadType").val()    $.ajax({        type: "POST",        url: '/thmz/saveRefundFee',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify(params),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            $("#cdReadCardResult").val(null)            if (res.code == 0 || res.code == -2) {                successMesage(res);                $("#refundFeeModal").modal("hide");                var refundMzDepositFiles = res.refundMzDepositFiles;                if (refundMzDepositFiles != null && refundMzDepositFiles.length > 0) {                    var html = '';                    for (var i = 0; i < refundMzDepositFiles.length; i++) {                        var mzDepositFile = refundMzDepositFiles[i];                        html += '<div class="item form-group col-md-12 col-sm-12 col-xs-12">';                        html += '<label style="padding-left: 0px;" class="control-label col-md-2 col-sm-2 col-xs-2">';                        html += mzDepositFile.chequeType;                        html += '</label>';                        html += '<div class="col-md-6 col-sm-6 col-xs-6">';                        html += '<input type="text" class="form-control" readonly value="' + Math.abs(mzDepositFile.amount) + '">';                        html += '</div>';                        html += '<label style="text-align: left;" class="control-label col-md-1 col-sm-1 col-xs-1">元</label>';                        html += '<label style="text-align: left;color: red" class="control-label col-md-3 col-sm-3 col-xs-3">';                        if(res.mipOrdeFlag !=null && res.mipOrdeFlag == 1){                            html += "原路退回";                        }                       else if ((refundType == 1 && (mzDepositFile.chequeType == "银联卡" || mzDepositFile.chequeType == "聚合支付")) || mzDepositFile.chequeType == "医保记账" || mzDepositFile.chequeType == "省医保个账" || mzDepositFile.chequeType == "市医保个账") {                            html += "原路退回";                        }                        html += '</label>';                        html += '</div>';                    }                    $("#refundPayDetailForm").html(html);                    $("#refundPayDetailModal").modal();                }                //作废电子发票                if(fpVsesionNo == 1){                    uploadMzInvoice(params.patientId, params.times,params.receiptNo,2);                }                if (res.times > 0) {                    let fpTitle = fpVsesionNo == 0 ? '打印' : '上传';                    if(confirm(`是否${fpTitle}发票?`)){                        if(fpVsesionNo == 0){                            prn1Print(res.patientId, res.times, false, 1);                        }else {                            printDzfp(res.patientId, res.times,1,0)                        }                    }                } else {                    initFeeTable();                }            } else {                errorMesage(res);            }        }    });}/** * 清空查询条件 */function cleanParams() {    $("#deptNoParam").selectpicker('val', null);//默认选中    $("#deptNoParam").selectpicker('refresh');    $("#doctorParam").selectpicker('val', null);//默认选中    $("#doctorParam").selectpicker('refresh');    $("#cardNo").val(null);    $("#name").val(null);    $('#reportrange span').html(moment().format('YYYY-MM-DD') + ' - ' + moment().format('YYYY-MM-DD'));    $("#patientId").val(null);    //默认光标在卡号输入框    $("#cardNo").focus();    $("#serialNo").val(null);    $("#ownData").removeAttr("checked");}/** * 增加收费方式 */function addPayType(id) {    // var arr = $("#payForm").find("div.pay-item");    // if (arr.length > 0) {    //     for (var i = 0; i < arr.length; i++) {    //         var temp = parseFloat($(arr[i]).find("input").val());    //         if (temp == 0) {    //             new PNotify({    //                 title: '错误提示',    //                 text: "存在未使用的收款方式,请不要重复添加!",    //                 type: 'error',    //                 hide: true,    //                 styling: 'bootstrap3'    //             });    //             return;    //         }    //     }    // }    var payTypeId = null;    if (id != undefined && id != null) {        payTypeId = id;    } else {        var payTypeIndex = $("#payTypeIndex").val();        payTypeId = "payType_" + payTypeIndex;    }    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)" ';    if ("payType" == id) {        html += " id='cash' ";    }    html += '></div><div class="col-md-1 col-sm-1 col-xs-12" style="line-height: 34px;">元  <a style="line-height: 34px;cursor: pointer;" onclick="closeThisParent(this)"><i class="fa fa-close"></i></a></div></div></div>';    $("#changeAmountParent").before(html);    initChequeType(payTypeId)    if (payTypeIndex != undefined && payTypeIndex != null) {        payTypeIndex = Add(payTypeIndex, 1);        $("#payTypeIndex").val(payTypeIndex);    }    $("#addPayType").parent().removeClass("in").addClass("hide");}// /**//  * 取消费用上传//  */// function cancelFee() {//     var patientId = $("#patientIdHaveTally").val();//     var times = $("#timesHaveTally").val();//     var receiptNo = $("#receiptNoHaveTally").val();//     $.ajax({//         type: "POST",//         url: '/thmz/cancelTmFee',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         async: false,//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 $("#fundPay").val(0);//             } else {//                 new PNotify({//                     title: '错误提示',//                     text: res.message,//                     type: 'error',//                     hide: true,//                     styling: 'bootstrap3'//                 });//             }//         }//     });// }/** * 查询当前门诊缴费订单的所有缴费方式列表 * @param patientId * @param times * @param receiptNo */function showChequType(patientId, times, receiptNo) {    $("#depositFileModal").modal();    $('#deposit_file_detail_table').bootstrapTable("destroy");    $('#deposit_file_detail_table').bootstrapTable({        url: '/thmz/getAllDepositFileForThisTime?patientId=' + patientId + "×=" + times + "&receiptNo=" + Math.abs(receiptNo),         //请求后台的URL(*)        method: 'get',                      //请求方式(*)        toolbar: '#toolbar',                //工具按钮用哪个容器        striped: true,                      //是否显示行间隔色        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)        pagination: false,                   //是否显示分页(*)        sortable: true,                     //是否启用排序        sortOrder: "asc",                   //排序方式        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)        pageNumber: 1,                       //初始化加载第一页,默认第一页        pageSize: 5,                       //每页的记录行数(*)        pageList: [10, 25, 50, 100],        //可供选择的每页的行数(*)        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大        strictSearch: true,        showColumns: false,                  //是否显示所有的列        showRefresh: false,                  //是否显示刷新按钮        minimumCountColumns: 2,             //最少允许的列数        clickToSelect: true,                //是否启用点击选中行        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮        cardView: false,                    //是否显示详细视图        detailView: false,        //rowStyle:rowStyle,//通过自定义函数设置行样式        ajaxOptions: {            headers: {                'Accept': 'application/json',                'Authorization': 'Bearer ' + localStorage.getItem("token")            }        },        columns: [            // {            //     checkbox: true,            // },            {                field: 'patientId',                title: '病人编号',                align: "center",                valign: 'middle'            }, {                field: 'times',                title: '就诊次数',                align: "center",                valign: 'middle',            }, {                field: 'amount',                title: '支付金额(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return value.toFixed(2);                }            },            {                field: 'chequeTypeName',                title: '支付方式',                align: "center",                valign: 'middle'            }        ],        onDblClickRow: function (row) {            editChequType(row.receiptSn, row.chequeType, row.dcountNo, row.chequeTypeName);        },        responseHandler: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var ress = eval(res);            if (ress.code == -1) {                new PNotify({                    title: '错误提示',                    text: ress.message,                    type: 'error',                    hide: true,                    styling: 'bootstrap3'                });                return {                    "total": 0,//总页数                    "rows": {}   //数据                };            }            if (ress.data == null || ress.data.length == 0) {                $("#tallyDetailModal").modal("hide");            }            return {                "rows": ress.data   //数据            };        },    });}/** * 修改收款方式 * @param patientId * @param times * @param paymode */function editChequType(receiptSn, chequType, dcountNo, chequeTypeName) {    var message = "当前病人本次门诊缴费的支付方式为【" + chequeTypeName + "】,确定需要修改吗?";    if (dcountNo == 1) {        message = "当前病人本次门诊缴费的支付方式为【" + chequeTypeName + "】,且本次缴费已经结算,确定需要修改吗?如仍需继续修改,会影响已经结算的报表,请重新打印本次缴费所在日期的【日结报表】!";    }    $("#editPayModeTip").html(message);    $("#receiptSn").val(receiptSn);    $("#chequType").val(chequType);    $('#payTypeEditPayMode').selectpicker('val', 1);    $('#payTypeEditPayMode').selectpicker('refresh');    $("#editPayModeModal").modal();    $("#depositFileModal").modal("hide");}/** * 提交修改收款方式 */function saveEditPayMode() {    $.ajax({        type: "GET",        url: '/thmz/updateChequType?oldChequeType=' + $("#chequType").val() + "&receiptSn=" + $("#receiptSn").val() + "&chequeType=" + $("#payTypeEditPayMode").val(),        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                successMesage(res);                clearEditPayMode();                $("#editPayModeModal").modal("hide");            } else if (res.code == -1) {                new PNotify({                    title: '错误提示',                    text: res.message,                    type: 'error',                    hide: true,                    styling: 'bootstrap3'                });            }        }    });}/** * 清空 */function clearEditPayMode() {    $("#receiptSn").val(null);    $("#chequType").val(null);}//// /**//  * 反写备份表的数据到正式表中,记账的数据在备分表//  * @param patientId//  * @param times//  * @param receiptNo//  */// function reInsertDetailModal(patientId,times ,receiptNo) {//     $.ajax({//         type: "POST",//         url: '/thmz/reSaveDetailForByjz',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         data: JSON.stringify({"patientId": patientId, "times": times, "receiptNo": receiptNo}),//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         async: false,//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                successMesage(res);//                initFeeTable();//             } else {//                 new PNotify({//                     title: '错误提示',//                     text: res.message,//                     type: 'error',//                     hide: true,//                     styling: 'bootstrap3'//                 });//             }//         }//     });// }/** * 医保电子凭证读卡 * @param params */function siReadCard(params) {    $.ajax({        type: "GET",        url: params && params.startsWith('jiangsu_qrcode') ? 'http://localhost:8321/api/entry?param=' + params : 'http://localhost:8321/readcard/entry?param=' + params,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            //console.log(res);            if (res.code == 200) {                var data = JSON.parse(res.data);                queryUserInfoBySocialNoNotFillPatient('cardNo', "" + data.data.idNo + "", initFeeTable, null);            } else {                errorMesage(res);            }        }    });    // window.open('ReadCard://'+prm, '_self')}/** * 读卡类型改变事件 */// function mztczfSiReadCardTypeChange() {//     var grzhzf = $("#grzhzf").val();//     if (grzhzf == null || grzhzf == "") {//         errorMesageSimaple("请先选择是否使用个人账户余额支付剩余门诊费用!")//         $('#mztczfSiReadCardType').selectpicker('val', null);//         $('#mztczfSiReadCardType').selectpicker('refresh');//         return;//     }//     var mztczfSiReadCardType = $("#mztczfSiReadCardType").val();//     if (mztczfSiReadCardType == null || mztczfSiReadCardType == "") {//         return;//     }//     let admdvs =  $('#mztczfAdvmCity').val()//     if(!stringNotBlank(admdvs)){//         errorMesageSimaple("请选择参保地!")//         $('#mztczfSiReadCardType').selectpicker('val', null);//         $('#mztczfSiReadCardType').selectpicker('refresh');//         return;//     }//     postAjaxJsonHttpRequst("/thmz/queryNewInsuinfo",{//         patientId :readPatientId,//         times :readTimes,//         admdvs:admdvs//     },true,function (sfzRes) {//         if (sfzRes == '401' || sfzRes == 401) {//             window.location.href = '/thmz/login/view'//             return;//         }//         if(sfzRes.code == 0){//             var url = "http://localhost:8321/readcard/entry?param=";//             if (mztczfSiReadCardType == "03") {//                 // url += 'sicard_01101';//                 url = "http://localhost:8321/readcard/jiangsu/readcard_auto";//                 // url += 'readcard_auto';//             } else if (mztczfSiReadCardType == "01") {//                 // url += 'qrcode_01101';//                 url = "http://localhost:8321/api/entry?param=";//                 url += 'jiangsu_qrcode_01101';//             } else if (mztczfSiReadCardType == "02") {//                 // url += 'idcard_01101';//                 url += 'huashi_readcard';//             }else if (mztczfSiReadCardType == "04") {//                 url += 'face_01101';//                 url += 'jiangsu_face_01101';//             }//             $.ajax({//                 type: "GET",//                 url: url,//                 contentType: "application/json;charset=UTF-8",//                 dataType: "json",//                 headers: {//                     'Accept': 'application/json',//                     'Authorization': 'Bearer ' + localStorage.getItem("token")//                 },//                 success: function (res) {//                     if (res == '401' || res == 401) {//                         window.location.href = '/thmz/login/view'//                         return;//                     }//                     if (res.code == 200) {//                         if (mztczfSiReadCardType == "03") {//                             $("#readCardResult").val(res.rawCardData);//                             $("#pBusiCardInfo").val(res.rawBusiData);//                         } else if (mztczfSiReadCardType == "01") {//                             var data = JSON.parse(res.data);//                             $("#readCardResult").val(JSON.stringify(data.data));//                         } else {//                             $("#readCardResult").val(res.data);//                         }//                         successMesageSimaple("读卡成功,可以进行医保结算操作。");//                         $("#mztczfSiReadCardModal").modal("hide");//                     } else {//                         warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!")//                         console.log(res);//                     }//                 },//                 error: function (XMLHttpRequest, textStatus, errorThrown) {//                     warningMesageSimaple("读卡异常,可以稍后重试或者自费结算(不享受门诊统筹)!")//                 }//             });//         }else {//             errorMesage(sfzRes)//         }//     })// }function mztczfSiReadCardTypeChange() {    // 显示loading效果    $("#readLoadingModal").modal('show');        // var grzhzf = $("#grzhzf").val();    // if (grzhzf == null || grzhzf == "") {    //     errorMesageSimaple("请先选择是否使用个人账户余额支付剩余门诊费用!");    //     $('#mztczfSiReadCardType').selectpicker('val', null);    //     $('#mztczfSiReadCardType').selectpicker('refresh');    //     $("#readLoadingModal").modal('hide'); // 隐藏loading    //     return;    // }    // var mztczfSiReadCardType = $("#mztczfSiReadCardType").val();    // if (mztczfSiReadCardType == null || mztczfSiReadCardType == "") {    //     $("#readLoadingModal").modal('hide'); // 隐藏loading    //     return;    // }    // let admdvs = $('#mztczfAdvmCity').val();    // if (!stringNotBlank(admdvs)) {    //     errorMesageSimaple("请选择参保地!");    //     $('#mztczfSiReadCardType').selectpicker('val', null);    //     $('#mztczfSiReadCardType').selectpicker('refresh');    //     $("#readLoadingModal").modal('hide'); // 隐藏loading    //     return;    // }    var grzhzf = $('input[name="grzhzf"]:checked').val();    if (grzhzf == null || grzhzf == "") {        errorMesageSimaple("请先选择是否使用个人账户余额支付剩余门诊费用!");        $('input[name="grzhzf"]').prop('checked', false);        $("#grzhzf_0").prop('checked', true);        $("#readLoadingModal").modal('hide'); // 隐藏loading        return;    }    var mztczfSiReadCardType = $('input[name="mztczfSiReadCardType"]:checked').val();    if (mztczfSiReadCardType == null || mztczfSiReadCardType == "") {        errorMesageSimaple("请选择读卡类型!");        $("#readLoadingModal").modal('hide'); // 隐藏loading        return;    }    let admdvs = $('#mztczfAdvmCity').val();    if (!stringNotBlank(admdvs)) {        errorMesageSimaple("请选择参保地!");        $('input[name="mztczfSiReadCardType"]').prop('checked', false);        $("#mztczfSiReadCardType_03").prop('checked', true);        $("#readLoadingModal").modal('hide'); // 隐藏loading        return;    }    postAjaxJsonHttpRequst("/thmz/queryNewInsuinfo", {        patientId: readPatientId,        times: readTimes,        admdvs: admdvs    }, true, function (sfzRes) {        if (sfzRes == '401' || sfzRes == 401) {            window.location.href = '/thmz/login/view';            $("#readLoadingModal").modal('hide'); // 隐藏loading            return;        }        if (sfzRes.code == 0) {            var url = "";            if (mztczfSiReadCardType == "03") {                url = "http://localhost:8321/readcard/jiangsu/readcard_auto";            } else if (mztczfSiReadCardType == "01") {                url = "http://localhost:8321/api/entry?param=jiangsu_qrcode_01101";            } else if (mztczfSiReadCardType == "02") {                url = "http://localhost:8321/readcard/entry?param=huashi_readcard";            } else if (mztczfSiReadCardType == "04") {                // url = "http://localhost:8321/readcard/entry?param=face_01101";                url = "http://localhost:8321/readcard/entry?param=jiangsu_face_01101";            }            // 社保卡使用自动重试机制,其他读卡类型不使用重试            if (mztczfSiReadCardType == "03") {                // 社保卡:使用自动重试机制                callReadCardWithRetry(url, 5, 500, function (res) {                    // 成功回调                    $("#readLoadingModal").modal('hide'); // 隐藏loading                    $("#readCardResult").val(res.rawCardData);                    $("#pBusiCardInfo").val(res.rawBusiData);                    successMesageSimaple("读卡成功,可以进行医保结算操作。");                    $("#mztczfSiReadCardModal").modal("hide");                }, function (err) {                    $("#readLoadingModal").modal('hide'); // 隐藏loading                    warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!");                    console.log(err);                });            } else {                // 其他读卡类型:不使用重试,直接请求一次                $.ajax({                    type: "GET",                    url: url,                    contentType: "application/json;charset=UTF-8",                    dataType: "json",                    headers: {                        'Accept': 'application/json',                        'Authorization': 'Bearer ' + localStorage.getItem("token")                    },                    success: function (res) {                        $("#readLoadingModal").modal('hide'); // 隐藏loading                        if (res.code == 200) {                            if (mztczfSiReadCardType == "01") {                                var data = JSON.parse(res.data);                                $("#readCardResult").val(JSON.stringify(data.data));                            } else {                                $("#readCardResult").val(res.data);                            }                            successMesageSimaple("读卡成功,可以进行医保结算操作。");                            $("#mztczfSiReadCardModal").modal("hide");                        } else {                            warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!");                        }                    },                    error: function (XMLHttpRequest, textStatus, errorThrown) {                        $("#readLoadingModal").modal('hide'); // 隐藏loading                        warningMesageSimaple("读卡失败,可以稍后重试或者自费结算(不享受门诊统筹)!");                        console.log("读卡异常:", textStatus, errorThrown);                    }                });            }        } else {            $("#readLoadingModal").modal('hide'); // 隐藏loading            errorMesage(sfzRes);        }    });}// 自动重试的通用函数function callReadCardWithRetry(url, retryCount, retryDelay, successCallback, errorCallback) {    $.ajax({        type: "GET",        url: url,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {            'Accept': 'application/json',            'Authorization': 'Bearer ' + localStorage.getItem("token")        },        success: function (res) {            if (res.code == 200) {                successCallback(res);            } else if (retryCount > 0) {                // 重试时保持loading状态,不隐藏                setTimeout(function () {                    callReadCardWithRetry(url, retryCount - 1, retryDelay, successCallback, errorCallback);                }, retryDelay);            } else {                errorCallback(res);            }        },        error: function (XMLHttpRequest, textStatus, errorThrown) {            if (retryCount > 0) {                // 重试时保持loading状态,不隐藏                setTimeout(function () {                    callReadCardWithRetry(url, retryCount - 1, retryDelay, successCallback, errorCallback);                }, retryDelay);            } else {                errorCallback({ message: "读卡异常" });            }        }    });}/** * 打开读卡类型弹窗 */function mztczfSiReadCardTypeModel(patientId,times) {    addOrderLock(patientId,times,null)    $("#readCardResult").val(null);    $("#pBusiCardInfo").val(null);    readPatientId = patientId    readTimes = times    // $('#mztczfSiReadCardType').selectpicker('val', null);    // $('#mztczfSiReadCardType').selectpicker('refresh');    // $('#grzhzf').selectpicker('val', null);    // $('#grzhzf').selectpicker('refresh');    // 重置单选框状态    $('input[name="mztczfSiReadCardType"]').prop('checked', false);    $("#mztczfSiReadCardType_03").prop('checked', true);    $('input[name="grzhzf"]').prop('checked', false);    $("#grzhzf_0").prop('checked', true);        // 确保参保地已正确设置为江苏省宿迁市(如果还未设置)    if($('#mztczfAdvmPro').val() !== '320000') {        $('#mztczfAdvmPro').selectpicker('val', '320000');        $('#mztczfAdvmPro').selectpicker('refresh');        cityChange('mztczfAdvmPro', 'mztczfAdvmCity');    }        $("#mztczfSiReadCardModal").modal();}/** * 处方加锁 */function addOrderLock(patientId,times,receiptNo) {   postAjaxJsonHttpRequst("/thmz/addOrderLock",{patientId:patientId,times:times,receiptNo:receiptNo},true,function (res) {   })}/** * 处方解锁 */function deleteOrderLock(patientId,times,receiptNo) {    postAjaxJsonHttpRequst("/thmz/deleteOrderLock",{patientId:patientId,times:times,receiptNo:receiptNo},true,function (res) {        if(res.code == 0){            successMesageSimaple('处方解锁成功')        }    })}/** * 医保结算 * @param patientId * @param times */function directRegistration(patientId, times) {    //显示弹层    $("#loadingModal").modal('show');    $.ajax({        type: "POST",        url: '/thmz/directRegistration',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({            patientId: patientId,            times: times,            readCardResult: $("#readCardResult").val(),            busCardInfo: $("#pBusiCardInfo").val(),            // grzhzf: $("#grzhzf").val(),            // readCardType: $("#mztczfSiReadCardType").val()            grzhzf: $('input[name="grzhzf"]:checked').val(),            readCardType: $('input[name="mztczfSiReadCardType"]:checked').val()        }),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            //隐藏            $("#loadingModal").modal('hide');            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                successMesage(res);            } else {                errorMesage(res);            }        }    });}/** * 门诊统筹补录 * @param patientId * @param times * @param receiptNo */function mztcbl(patientId, times, receiptNo) {    $.ajax({        type: "GET",        url: '/thmz/mztcblInfo?patientId=' + patientId + "×=" + times + "&receiptNo=" + receiptNo,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {            'Accept': 'application/json',            'Authorization': 'Bearer ' + localStorage.getItem("token")        },        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                $("#changedTotalAmount").val(res.data.totalAmount);                $("#ybjzAmount").val(res.data.fund_pay_sumamt);                $("#accAmount").val(res.data.acct_pay);                $("#needRefundAmount").val(res.data.refundFee);                $("#mzblPatientId").val(patientId);                $("#mzblTimes").val(times);                $("#mzblReceiptNo").val(receiptNo);                //successMesage(res);            } else {                errorMesage(res);            }        },        error: function (XMLHttpRequest, textStatus, errorThrown) {        }    });    $("#mzblModal").modal();}/** * 提交门诊补录申请 */function chargeFeeForMztcbl() {    if (!confirm("确定要对当前费用进行门诊统筹补录操作吗?")) {        return;    }    var patientId = $("#mzblPatientId").val();    var times = $("#mzblTimes").val();    var receiptNo = $("#mzblReceiptNo").val();    $.ajax({        type: "GET",        url: '/thmz/chargeFeeForMztcbl?patientId=' + patientId + "×=" + times + "&receiptNo=" + receiptNo,        contentType: "application/json;charset=UTF-8",        dataType: "json",        headers: {            'Accept': 'application/json',            'Authorization': 'Bearer ' + localStorage.getItem("token")        },        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                $("#mzblModal").modal("hide");                clearMztcbl();                if(fpVsesionNo == 0){                    prn1Print(patientId, times, false, res.receiptNo);                }else {                    printDzfp(patientId, times,res.receiptNo,0)                }            } else {                errorMesage(res);            }        },        error: function (XMLHttpRequest, textStatus, errorThrown) {        }    });}/** * 清空门诊统筹补录 */function clearMztcbl() {    $("#changedTotalAmount").val(null);    $("#ybjzAmount").val(null);    $("#accAmount").val(null);    $("#needRefundAmount").val(null);    $("#mzblPatientId").val(null);    $("#mzblTimes").val(null);    $("#mzblReceiptNo").val(null);}function queryCodePay() {    $.ajax({        type: "GET",        url: '/thmz/NongPay/query?mchOrderNo=202507221753175802948&type=0',        dataType: "json",        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }        }    });}function codePay() {    const moneyValues = [];    $('.pay-item').each(function() {        const $this = $(this);        const $select = $this.find('select');        const isAggregatePay = $select.find('option:selected').text() === '聚合支付';        if (isAggregatePay) {            const $moneyInput = $this.find('input.money');            const moneyValue = parseFloat($moneyInput.val()) || 0;            moneyValues.push(moneyValue);        }    });    var authCode = $('#paymentCode').val();    $.ajax({        type: "POST",        url: '/thmz/NongPay/unifiedOrder',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({            "amount": moneyValues[0],            "authCode": authCode,            "subject": "门诊收费",            "body": "门诊收费"        }),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res.code === 9000) {                if(res.data && (res.data.state === 2 || res.data.orderState === 2)) {                    alert("付款成功");                }            }        }    });}/*function debounce(func, delay = 500) {    let timer = null;    return function(...args) {        clearTimeout(timer);        timer = setTimeout(() => {            func.apply(this, args); // 执行目标方法        }, delay);    };}$('#paymentCode').on('input', debounce(codePay, 500));*//** * 刷卡/扫码,正常收费的的接口 */function consume() {    $("#consume").attr("disabled", true);    $("#saveConfirmFee").attr("disabled", true);    var current = $("#payForm").find("div.pay-item").last();    var patientId = $("#patientIdHaveTally").val();    var times = $("#timesHaveTally").val();    var chequeType = $(current).find("select").val();    var amt = parseFloat($(current).find("input.money").val());    $.ajax({        type: "POST",        url: '/thmz/consume',        contentType: "application/json;charset=UTF-8",        dataType: "json",        data: JSON.stringify({            "patientId": patientId,            "times": times,            "chequeType": chequeType,            "amt": amt,            "type": 0        }),        headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},        success: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            if (res.code == 0) {                successMesage(res);                $(current).find("input.refNo").val(res.data.refNo);                $(current).find("input.transDate").val(res.data.transDate);                $(current).find("input.payChannel").val(res.data.payChannel);                $(current).find("input.qrCodeParam").val(res.data.wxAliPayOrderNo);                $(current).find("input.traceNo").val(res.data.traceNo);            } else {                errorMesage(res);            }            $("#saveConfirmFee").attr("disabled", false);            $("#consume").attr("disabled", false);        }    });}/** * 查看缴费方式列表 * @param patientId * @param times * @param receiptNo */function depositFileList(patientId, times, receiptNo) {    var payMarkGroup = getIndex("pay_mark_group");    var payMark = 0;    if (payMarkGroup == 2) {        payMark = 1;    }    $("#depositFileListModal").modal();    $('#deposit_fileList_table').bootstrapTable("destroy");    $('#deposit_fileList_table').bootstrapTable({        url: '/thmz/getMzDepositFileList',         //请求后台的URL(*)        method: 'post',                      //请求方式(*)        toolbar: '#toolbar',                //工具按钮用哪个容器        striped: true,                      //是否显示行间隔色        cache: false,                       //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)        pagination: true,                   //是否显示分页(*)        sortable: true,                     //是否启用排序        sortOrder: "asc",                   //排序方式        queryParams: {"patientId": patientId, "times": times, "receiptNo": Math.abs(receiptNo), "payMark": payMark},           //传递参数(*)        sidePagination: "client",           //分页方式:client客户端分页,server服务端分页(*)        pageNumber: 1,                       //初始化加载第一页,默认第一页        pageSize: 5,                       //每页的记录行数(*)        pageList: [5, 10, 25, 50, 100],        //可供选择的每页的行数(*)        search: false,                       //是否显示表格搜索,此搜索是客户端搜索,不会进服务端,所以,个人感觉意义不大        strictSearch: true,        showColumns: false,                  //是否显示所有的列        showRefresh: false,                  //是否显示刷新按钮        minimumCountColumns: 2,             //最少允许的列数        clickToSelect: true,                //是否启用点击选中行        uniqueId: "ID",                     //每一行的唯一标识,一般为主键列        showToggle: false,                    //是否显示详细视图和列表视图的切换按钮        cardView: false,                    //是否显示详细视图        detailView: false,        //rowStyle:rowStyle,//通过自定义函数设置行样式        ajaxOptions: {            headers: {                'Accept': 'application/json',                'Authorization': 'Bearer ' + localStorage.getItem("token")            }        },        columns: [            {                field: 'patientId',                title: '患者编号',                align: "center",                valign: 'middle',            }, {                field: 'times',                title: '就诊次数',                align: "center",                valign: 'middle',            }, {                field: 'receiptNo',                title: '结算次数',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value);                }            }, {                field: 'chequeType',                title: '支付方式',                align: "center",                valign: 'middle'            }, {                field: 'amount',                title: '金额(元)',                align: "center",                valign: 'middle',                formatter: function (value, row, index) {                    return Math.abs(value).toFixed(2);                }            }, {                title: '操作',                align: "center",                valign: 'middle',                // sortable: true,                formatter: function (value, row, index) {                    if (payMarkGroup == 0) {                        return '';                    }                    var html = '';                    if (payMarkGroup > 0) {                        if ((row.chequeType == '银联卡' || row.chequeType == '聚合支付') && row.psordnum != null && row.psordnum != "" && row.psordnum != "null") {                            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>';                        }                    }                    return html;                }            }        ],        responseHandler: function (res) {            if (res == '401' || res == 401) {                window.location.href = '/thmz/login/view'                return;            }            var ress = eval(res);            if (ress.code == -1) {                if (ress.message != null && ress.message != '') {                    errorMesage(ress);                }                return {                    "total": 0,//总页数                    "rows": {}   //数据                };            }            return {                "total": ress.data.length,//总页数                "rows": ress.data   //数据            };        },    });}/** * 创建退款条形码 * @param chequeType * @param psordnum * @param agtordnum * @param parChannel * @param traceNo * @param patientId * @param times * @param amount * @param transDate */function createBarcode(chequeType, psordnum, agtordnum, parChannel, traceNo, patientId, times, amount, transDate) {    var payMarkGroup = getIndex("pay_mark_group");    $("#depositFileListModal").modal('hide');    $("#parChannel").val('否');    if (traceNo == null || traceNo == 'null') {        traceNo = '';    }    $("#traceNo").val(traceNo);    $("#transDate").val(transDate);    amount = amount.replace("-", "");    if (chequeType == "银联卡") {        if (psordnum != null && psordnum != "" && psordnum != "null") {            if (payMarkGroup == 1) {                $("#plId").val(patientId + "_" + times + "_3");            } else {                $("#plId").val(psordnum + "_" + amount);            }            $("#refNo").val(psordnum);            JsBarcode("#barcode", 'no barcode');            $("#barcodeModal").modal();        }        return;    }    if (agtordnum != null && agtordnum != "" && agtordnum != "null") {        if (payMarkGroup == 1) {            $("#plId").val(patientId + "_" + times + "_O");            //此时是未退费状态,不加载可退费的条形码,以免误操作退费            JsBarcode("#barcode", 'no barcode');        } else {            JsBarcode("#barcode", agtordnum);            $("#plId").val(psordnum + "_" + amount);        }        $("#refNo").val(psordnum);        if (parChannel != null && parChannel == 'DIGITAL_CASH') {            $("#parChannel").val('是');        }        $("#barcodeModal").modal();    } else {        $("#messageModal").modal();        $("#messageContent").html("当前操作的缴费记录支付方式非聚合支付,无法生成对应的支付条形码!");        return;    }}////// /**//  * 签到//  */// function sign() {//     $.ajax({//         type: "GET",//         url: '/thmz/sign',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 successMesage(res);//             } else {//                 errorMesage(res);//             }//         }//     });// }//////// /**//  * 查余//  */// function balance() {//     $.ajax({//         type: "GET",//         url: '/thmz/balance',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 successMesage(res);//             } else {//                 errorMesage(res);//             }//         }//     });// }//// /**//  * 打开刷卡消费页面//  */// function consumeModal() {//     $("#toolsModal").modal('hide');//     $("#consumeModal").modal();// }//// /**//  * 刷卡/扫码,财务工具调用//  */// function consumeCommon() {//     var chequeType = $("#consumeChequeType").val();//     var amt = $("#consumeAmount").val();//     $.ajax({//         type: "POST",//         url: '/thmz/consumeCommon',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         data: JSON.stringify({//             "chequeType": chequeType,//             "amt": amt//         }),//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 successMesage(res);//             } else {//                 errorMesage(res);//             }//         }//     });// }//// /**//  * 打开退费窗口//  */// function refundModal() {//     $("#toolsModal").modal('hide');//     $("#refundModal").modal();// }//// /**//  * 退费//  */// function refund() {//     var chequeType = $("#consumeChequeTypeRefund").val();//     var amt = $("#refundPosAmount").val();//     var parChannel = $("#parChannelRefund").val();//     var psordnum = $("#refNoRefund").val();//     var transDate = $("#transDateRefund").val();//     var agtordnum = $("#barcodeRefund").val();//     $.ajax({//         type: "POST",//         url: '/thmz/refund',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         data: JSON.stringify({//             "chequeType": chequeType,//             "amt": amt,//             "parChannel": parChannel,//             "psordnum": psordnum,//             "transDate": transDate,//             "agtordnum": agtordnum//         }),//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 successMesage(res);//             } else {//                 errorMesage(res);//             }//         }//     });// }//// /**//  * 打开重印窗口//  */// function reprintModal() {//     $("#toolsModal").modal('hide');//     $("#reprintModal").modal();// }////// /**//  * 重印//  */// function reprint() {//     var traceNoReprint=$("#traceNoReprint").val();//     $.ajax({//         type: "GET",//         url: '/thmz/reprint?traceNo='+traceNoReprint,//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 successMesage(res);//             } else {//                 errorMesage(res);//             }//         }//     });// }//// /**//  * 打开交易查询页面//  */// function queryModal() {//     $("#toolsModal").modal('hide');//     $("#queryModal").modal();// }////// /**//  * 交易查询//  */// function query() {//     var plId=$("#plIdReprint").val();//     $.ajax({//         type: "GET",//         url: '/thmz/query?plId='+plId,//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 alert(res.data);//                 successMesage(res);//             } else {//                 errorMesage(res);//             }//         }//     });// }////// /**//  * 结算//  */// function settle() {//     $.ajax({//         type: "GET",//         url: '/thmz/settle',//         contentType: "application/json;charset=UTF-8",//         dataType: "json",//         headers: {'Accept': 'application/json', 'Authorization': 'Bearer ' + localStorage.getItem("token")},//         success: function (res) {//             if (res == '401' || res == 401) {//                 window.location.href = '/thmz/login/view'//                 return;//             }//             if (res.code == 0) {//                 successMesage(res);//             } else {//                 errorMesage(res);//             }//         }//     });// }//////// /**//  * 初始化财务工具的收费方式下拉选//  */// function initConsumeChequeType() {//     var html="<option value='3'>银联卡</option><option value='O'>聚合支付</option>";//     $("#consumeChequeType").html(html);//     $('#consumeChequeType').selectpicker('refresh');//     $("#consumeChequeTypeRefund").html(html);//     $('#consumeChequeTypeRefund').selectpicker('refresh');//     $("#parChannelRefund").html("<option value='0'>否</option><option value='1'>是</option>");//     $('#parChannelRefund').selectpicker('refresh');// }////// /**//  * 退货方式改变事件//  */// function consumeChequeTypeRefundChange() {//     var consumeChequeTypeRefund=$("#consumeChequeTypeRefund").val();//     if(consumeChequeTypeRefund=='3'){//         $("#barcodeRefundDiv").removeClass("in").addClass("hide");//         $("#parChannelRefundDiv").removeClass("in").addClass("hide");//         $("#refNoRefundDiv").removeClass("hide").addClass("in");//         $("#transDateRefundDiv").removeClass("hide").addClass("in");//     }else {//         $("#barcodeRefundDiv").removeClass("hide").addClass("in");//         $("#parChannelRefundDiv").removeClass("hide").addClass("in");//         $("#refNoRefundDiv").removeClass("in").addClass("hide");//         $("#transDateRefundDiv").removeClass("in").addClass("hide");//     }// }
 |