main.go 272KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455
  1. package main
  2. import (
  3. _ "gdyb/routers"
  4. "gdyb/service"
  5. "gdyb/models"
  6. //"gdyb/controllers/sg"
  7. "time"
  8. "strings"
  9. "strconv"
  10. "encoding/json"
  11. "gdyb/utils"
  12. "os"
  13. "fmt"
  14. "github.com/astaxie/beego"
  15. "github.com/shopspring/decimal"
  16. "net/http"
  17. "bytes"
  18. "io/ioutil"
  19. )
  20. type ResultSeventeenOther struct {
  21. ErrMsg string `json:"err_msg"`
  22. InfRefmsgid string `json:"inf_refmsgid"`
  23. Infcode string `json:"infcode"`
  24. Output struct {
  25. SetlListId string `json:"setl_list_id"`
  26. } `json:"output"`
  27. RefmsgTime string `json:"refmsg_time"`
  28. RespondTime string `json:"respond_time"`
  29. Signtype string `json:"signtype"`
  30. WarnInfo string `json:"warn_info"`
  31. }
  32. type ResultSix struct {
  33. Cainfo interface{} `json:"cainfo"`
  34. ErrMsg string `json:"err_msg"`
  35. InfRefmsgid string `json:"inf_refmsgid"`
  36. Infcode int64 `json:"infcode"`
  37. Output struct {
  38. } `json:"output"`
  39. RefmsgTime string `json:"refmsg_time"`
  40. RespondTime string `json:"respond_time"`
  41. Signtype interface{} `json:"signtype"`
  42. WarnMsg interface{} `json:"warn_msg"`
  43. }
  44. type ResultEmpty10265 struct {
  45. Cainfo interface{} `json:"cainfo"`
  46. ErrMsg string `json:"err_msg"`
  47. InfRefmsgid string `json:"inf_refmsgid"`
  48. Infcode string `json:"infcode"`
  49. Output struct {
  50. } `json:"output"`
  51. RefmsgTime string `json:"refmsg_time"`
  52. RespondTime string `json:"respond_time"`
  53. Signtype interface{} `json:"signtype"`
  54. WarnMsg interface{} `json:"warn_msg"`
  55. }
  56. func init() {
  57. //service.ConnectNMMSDB()
  58. service.ConnectDB()
  59. org_id, _ := beego.AppConfig.Int64("org_id")
  60. miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  61. //CreateLog(miConfig)
  62. //UploadLog(miConfig)31
  63. if org_id == 10191 {
  64. service.GetFjAuthorizationInfo(miConfig.Code)
  65. }
  66. }
  67. func main() {
  68. //service.AutoCreateStock()
  69. //service.AutoGdybCreateStock()
  70. //service.AutoUploadData
  71. //台山百伦清单上传方法
  72. //GetBatchSettleList()
  73. //深圳百霖
  74. //GetblBatchSettleList()
  75. //GetblpgBatchSettleList()
  76. //GetgaBatchSettleList()
  77. //GetlsBatchSettleList()
  78. //GetblbrBatchSettleList()
  79. //深圳百霖贝尔
  80. //GetblbrBatchSettleList()
  81. //a, _ := service.GetResultRecord("2023-01-01")
  82. //ticker := time.Tick(2 * time.Hour)
  83. //// 无限循环,等待定时器触发
  84. //for {
  85. // select {
  86. // case <-ticker:
  87. // sg.ChangeDrugTenone()
  88. // }
  89. //}
  90. //utils.ErrorLog("接口返回数据解析JSON失败: %v", a)
  91. //赤峰费森
  92. //GetcfBatchSettleList()
  93. //GetNMSettleListHospital()
  94. //Get4202()
  95. beego.Run()
  96. }
  97. type CustomFundPay struct {
  98. FundPayType string `json:"fund_pay_type"`
  99. FundPayamt float64 `json:"fund_payamt"`
  100. }
  101. type ResultSeventeen struct {
  102. ErrMsg string `json:"err_msg"`
  103. InfRefmsgid string `json:"inf_refmsgid"`
  104. Infcode int64 `json:"infcode"`
  105. Output struct {
  106. SetlListId string `json:"setl_list_id"`
  107. } `json:"output"`
  108. RefmsgTime string `json:"refmsg_time"`
  109. RespondTime string `json:"respond_time"`
  110. Signtype string `json:"signtype"`
  111. WarnInfo string `json:"warn_info"`
  112. }
  113. //func GetcfBatchSettleList() {
  114. // orders, _ := service.GetAllHisOrder10265()
  115. //
  116. // for _, item := range orders{
  117. // order, _ := service.GetHisOrderByIDTwo(item.ID)
  118. // roles, _ := service.GetDoctorListTwo(item.UserOrgId)
  119. // his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
  120. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  121. // curRoles, _ := service.GetAdminUserInfoByID(item.UserOrgId, 2738)
  122. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  123. // miConfig, _ := service.FindMedicalInsuranceInfo(item.UserOrgId)
  124. //
  125. // if order.ID == 0 {
  126. // c.ServeFailJSONWithSGJErrorCode(enu8ms.ErrorCodeHisOrderNoExistParamWrong)
  127. // return
  128. // }
  129. //
  130. // last_order, _ := service.GetLastHisOrder(c.GetAdminUserInfo().CurrentOrgId)
  131. // max_order, _ := service.GetLastHisOrderTwo(c.GetAdminUserInfo().CurrentOrgId)
  132. // count, _ := strconv.ParseInt(max_order.FaPiaoNumber, 10, 64)
  133. // fmt.Println(count)
  134. // var zero string
  135. // number := count + 1
  136. // if number >= 1000 {
  137. // zero = "0000" + strconv.FormatInt(number, 10)
  138. // } else if number >= 10000 {
  139. // zero = "000" + strconv.FormatInt(number, 10)
  140. // } else if number >= 100000 {
  141. // zero = "00" + strconv.FormatInt(number, 10)
  142. // } else if number >= 1000000 {
  143. // zero = "0" + strconv.FormatInt(number, 10)
  144. // } else {
  145. // zero = strconv.FormatInt(number, 10)
  146. // }
  147. // fmt.Println(zero)
  148. //
  149. // struct4101 := service.Struct4101{
  150. // PsnNo: order.PsnNo,
  151. // MdtrtId: order.MdtrtId,
  152. // SetlId: order.SetlId,
  153. // PsnName: order.PsnName,
  154. // Gend: order.Gend,
  155. // Brdy: his.Brdy,
  156. // Age: int64(order.Age),
  157. // Naty: order.Naty,
  158. // PatnCertType: "01",
  159. // Certno: order.Certno,
  160. // Prfs: "90",
  161. // ConerName: roles[0].UserName,
  162. // PatnRlts: "99",
  163. // ConerAddr: miConfig.OrgName,
  164. // ConerTel: admin.Mobile,
  165. // HiType: order.Insutype,
  166. // Insuplc: miConfig.InsuplcAdmdvs,
  167. // MaindiagFlag: "1",
  168. // BillCode: order.SetlId,
  169. // BillNo: order.SetlId,
  170. // BizSn: order.Number,
  171. // PsnSelfPay: order.PsnPartAmt,
  172. // PsnOwnPay: order.PsnPartAmt,
  173. // AcctPay: order.AcctPay,
  174. // PsnCashpay: order.PsnCashPay,
  175. // HiPaymtd: "1",
  176. // Hsorg: miConfig.InsuplcAdmdvs,
  177. // HsorgOpter: miConfig.InsuplcAdmdvs,
  178. // MedinsFillPsn: curRoles.UserName,
  179. // MedinsFillDept: depart.Name,
  180. // IptMedType: "2",
  181. // AdmTime: his.InHosptialTime,
  182. // AdmEndTime: his.OutHosptialTime,
  183. // }
  184. // struct4101.SetlBegnDate = order.SetlTime
  185. // struct4101.SetlEndDate = order.SetlTime
  186. //
  187. // var rf []CustomFundPay
  188. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  189. //
  190. // var tempFunPays []service.CustomStruct
  191. // for _, item := range rf {
  192. // var tempFunPay service.CustomStruct
  193. // tempFunPay.FundPayamt = item.FundPayamt
  194. // tempFunPay.FundPayType = item.FundPayType
  195. // tempFunPays = append(tempFunPays, tempFunPay)
  196. // }
  197. // struct4101.CustomStruct = tempFunPays
  198. //
  199. // var tempDiaginfos []service.DiaginfoStructTwo
  200. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  201. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  202. // infos, _ := service.FindLastPatientPrescriptionInfoTwo2(c.GetAdminUserInfo().CurrentOrgId, his.PatientId,strings.Split(his.InHosptialTime," ")[0],strings.Split(his.OutHosptialTime," ")[0])
  203. // for _, item := range infos{
  204. // his.Diagnosis = his.Diagnosis+","+ item.Diagnosis
  205. // }
  206. // diagnosis_ids_arr := strings.Split(his.Diagnosis, ",")
  207. // diagnosis_ids_arr = RemoveRepeatedPurviewElement2(diagnosis_ids_arr)
  208. // //diagnosis_ids := strings.Split(his.Diagnosis, ",")
  209. // fmt.Println(diagnosis_ids_arr)
  210. // var config []*models.HisXtDiagnoseConfig
  211. // for _, item := range diagnosis_ids_arr {
  212. // id, _ := strconv.ParseInt(item, 10, 64)
  213. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  214. // if diagnosisConfig.ID > 0 {
  215. // config = append(config, &diagnosisConfig)
  216. // }
  217. // }
  218. //
  219. // for index, item := range config {
  220. // if item.ID > 0 {
  221. // if index == 0 {
  222. // var tempDiaginfo service.DiaginfoStructTwo
  223. // tempDiaginfo.DiagCode = item.CountryCode
  224. // tempDiaginfo.DiagName = item.CountryContentName
  225. // tempDiaginfo.DiagType = "1"
  226. // tempDiaginfo.MaindiagFlag = "1"
  227. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  228. // } else {
  229. //
  230. // var tempDiaginfo service.DiaginfoStructTwo
  231. // tempDiaginfo.DiagCode = item.CountryCode
  232. // tempDiaginfo.DiagName = item.CountryContentName
  233. // tempDiaginfo.DiagType = "2"
  234. // tempDiaginfo.MaindiagFlag = "0"
  235. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  236. // }
  237. // }
  238. // }
  239. // struct4101.Diseinfo = tempDiaginfos
  240. //
  241. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  242. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  243. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  244. // tempOpspdiseinfo2.OprnOprtCode = ""
  245. // tempOpspdiseinfo2.OprnOprtName = ""
  246. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  247. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  248. //
  249. // var iteminfo service.IteminfoStruct
  250. //
  251. // var bedCostTotal float64 = 0 //床位总费
  252. // var bedCostSelfTotal float64 = 0 //床位自费
  253. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  254. //
  255. // var operationCostTotal float64 = 0 //手术费
  256. // var operationCostSelfTotal float64 = 0 //手术费
  257. // var operationCostPartSelfTotal float64 = 0 //手术费
  258. //
  259. // var otherCostTotal float64 = 0 //其他费用
  260. // var otherCostSelfTotal float64 = 0 //其他费用
  261. // var otherCostPartSelfTotal float64 = 0 //其他费用
  262. //
  263. // var materialCostTotal float64 = 0 //材料费
  264. // var materialCostSelfTotal float64 = 0 //材料费
  265. // var materialCostPartSelfTotal float64 = 0 //材料费
  266. //
  267. // var westernMedicineCostTotal float64 = 0 //西药费
  268. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  269. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  270. //
  271. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  272. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  273. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  274. //
  275. // var checkCostTotal float64 = 0 //检查费
  276. // var checkCostSelfTotal float64 = 0 //检查费
  277. // var checkCostPartSelfTotal float64 = 0 //检查费
  278. //
  279. // var laboratoryCostTotal float64 = 0 //化验费
  280. // var laboratoryCostSelfTotal float64 = 0 //化验费
  281. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  282. //
  283. // var treatCostTotal float64 = 0 //治疗费用
  284. // var treatCostSelfTotal float64 = 0 //治疗费用
  285. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  286. //
  287. // decimal.DivisionPrecision = 2
  288. //
  289. // var bed_fulamt_ownpay_amt float64 = 0
  290. // var operation_fulamt_ownpay_amt float64 = 0
  291. // var other_fulamt_ownpay_amt float64 = 0
  292. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  293. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  294. // var check_fulamt_ownpay_amt float64 = 0
  295. // var material_fulamt_ownpay_amt float64 = 0
  296. // var laboratory_fulamt_ownpay_amt float64 = 0
  297. // var treat_fulamt_ownpay_amt float64 = 0
  298. //
  299. // var bed_claa_sunmfee float64 = 0
  300. // var bed_clab_amt float64 = 0
  301. // var bed_other_amt float64 = 0
  302. //
  303. // var operation_claa_sunmfee float64 = 0
  304. // var operation_clab_amt float64 = 0
  305. // var operation_other_amt float64 = 0
  306. //
  307. // var other_claa_sunmfee float64 = 0
  308. // var other_clab_amt float64 = 0
  309. // var other_other_amt float64 = 0
  310. //
  311. // var westernMedicine_claa_sunmfee float64 = 0
  312. // var westernMedicine_clab_amt float64 = 0
  313. // var westernMedicine_other_amt float64 = 0
  314. //
  315. // var chineseTraditional_claa_sunmfee float64 = 0
  316. // var chineseTraditional_clab_amt float64 = 0
  317. // var chineseTraditional_other_amt float64 = 0
  318. //
  319. // var check_claa_sunmfee float64 = 0
  320. // var check_clab_amt float64 = 0
  321. // var check_other_amt float64 = 0
  322. //
  323. // var material_claa_sunmfee float64 = 0
  324. // var material_clab_amt float64 = 0
  325. // var material_other_amt float64 = 0
  326. //
  327. // var laboratory_claa_sunmfee float64 = 0
  328. // var laboratory_clab_amt float64 = 0
  329. // var laboratory_other_amt float64 = 0
  330. //
  331. // var treat_claa_sunmfee float64 = 0
  332. // var treat_clab_amt float64 = 0
  333. // var treat_other_amt float64 = 0
  334. //
  335. // for _, item := range order.HisOrderInfo {
  336. // if item.MedChrgitmType == "01" { //床位费
  337. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  338. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  339. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  340. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  341. // if item.ChrgitmLv == "1" {
  342. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  343. // }
  344. // if item.ChrgitmLv == "2" {
  345. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  346. //
  347. // }
  348. // if item.ChrgitmLv == "3" {
  349. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  350. // }
  351. //
  352. // }
  353. //
  354. // if item.MedChrgitmType == "03" { //检查费
  355. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  356. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  357. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  358. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  359. // if item.ChrgitmLv == "1" {
  360. //
  361. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  362. //
  363. // }
  364. // if item.ChrgitmLv == "2" {
  365. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  366. //
  367. // }
  368. // if item.ChrgitmLv == "3" {
  369. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  370. // }
  371. // }
  372. //
  373. // if item.MedChrgitmType == "04" { //化验费
  374. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  375. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  376. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  377. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  378. // if item.ChrgitmLv == "1" {
  379. //
  380. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  381. //
  382. // }
  383. // if item.ChrgitmLv == "2" {
  384. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  385. //
  386. // }
  387. // if item.ChrgitmLv == "3" {
  388. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  389. // }
  390. // }
  391. //
  392. // if item.MedChrgitmType == "05" { //治疗费
  393. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  394. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  395. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  396. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  397. // if item.ChrgitmLv == "1" {
  398. //
  399. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  400. //
  401. // }
  402. // if item.ChrgitmLv == "2" {
  403. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  404. //
  405. // }
  406. // if item.ChrgitmLv == "3" {
  407. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  408. // }
  409. // }
  410. //
  411. // if item.MedChrgitmType == "06" { //手术费
  412. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  413. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  414. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  415. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  416. //
  417. // if item.ChrgitmLv == "1" {
  418. //
  419. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  420. //
  421. // }
  422. // if item.ChrgitmLv == "2" {
  423. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  424. //
  425. // }
  426. // if item.ChrgitmLv == "3" {
  427. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  428. // }
  429. // }
  430. //
  431. // if item.MedChrgitmType == "08" { //材料费
  432. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  433. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  434. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  435. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  436. // if item.ChrgitmLv == "1" {
  437. //
  438. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  439. //
  440. // }
  441. // if item.ChrgitmLv == "2" {
  442. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  443. //
  444. // }
  445. // if item.ChrgitmLv == "3" {
  446. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  447. // }
  448. // }
  449. //
  450. // if item.MedChrgitmType == "09" { //西药费
  451. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  452. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  453. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  454. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  455. // if item.ChrgitmLv == "1" {
  456. //
  457. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  458. //
  459. // }
  460. // if item.ChrgitmLv == "2" {
  461. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  462. //
  463. // }
  464. // if item.ChrgitmLv == "3" {
  465. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  466. // }
  467. // }
  468. //
  469. // if item.MedChrgitmType == "11" { //中成费
  470. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  471. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  472. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  473. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  474. // if item.ChrgitmLv == "1" {
  475. //
  476. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  477. //
  478. // }
  479. // if item.ChrgitmLv == "2" {
  480. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  481. //
  482. // }
  483. // if item.ChrgitmLv == "3" {
  484. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  485. // }
  486. // }
  487. //
  488. // if item.MedChrgitmType == "14" { //其他费
  489. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  490. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  491. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  492. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  493. // if item.ChrgitmLv == "1" {
  494. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  495. //
  496. // }
  497. // if item.ChrgitmLv == "2" {
  498. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  499. //
  500. // }
  501. // if item.ChrgitmLv == "3" {
  502. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  503. // }
  504. // }
  505. //
  506. // }
  507. //
  508. // var iteminfoStructs []service.IteminfoStruct
  509. //
  510. // if bedCostTotal != 0 {
  511. // iteminfo.MedChrgitm = "01"
  512. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  513. // iteminfo.Amt = bedCostTotal
  514. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  515. // iteminfo.ClabAmt = bed_clab_amt
  516. // iteminfo.OthAmt = bed_other_amt
  517. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  518. // }
  519. //
  520. // if checkCostTotal != 0 {
  521. // iteminfo.MedChrgitm = "03"
  522. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  523. // iteminfo.Amt = checkCostTotal
  524. // iteminfo.ClaaSumfee = check_claa_sunmfee
  525. // iteminfo.ClabAmt = check_clab_amt
  526. // iteminfo.OthAmt = check_other_amt
  527. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  528. //
  529. // }
  530. //
  531. // if laboratoryCostTotal != 0 {
  532. // iteminfo.MedChrgitm = "04"
  533. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  534. // iteminfo.Amt = laboratoryCostTotal
  535. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  536. // iteminfo.ClabAmt = laboratory_clab_amt
  537. // iteminfo.OthAmt = laboratory_other_amt
  538. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  539. //
  540. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  541. //
  542. // }
  543. //
  544. // if treatCostTotal != 0 {
  545. // iteminfo.MedChrgitm = "05"
  546. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  547. // iteminfo.Amt = treatCostTotal
  548. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  549. // iteminfo.ClabAmt = treat_clab_amt
  550. // iteminfo.OthAmt = treat_other_amt
  551. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  552. // //(struct4101.IteminfoStruct, iteminfo)
  553. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  554. // }
  555. //
  556. // if operationCostTotal != 0 {
  557. // iteminfo.MedChrgitm = "06"
  558. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  559. // iteminfo.Amt = operationCostTotal
  560. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  561. // iteminfo.ClabAmt = operation_clab_amt
  562. // iteminfo.OthAmt = operation_other_amt
  563. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  564. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  565. // }
  566. //
  567. // if materialCostTotal != 0 {
  568. // iteminfo.MedChrgitm = "08"
  569. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  570. // iteminfo.Amt = materialCostTotal
  571. // iteminfo.ClaaSumfee = material_claa_sunmfee
  572. // iteminfo.ClabAmt = material_clab_amt
  573. // iteminfo.OthAmt = material_other_amt
  574. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  575. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  576. // }
  577. //
  578. // if westernMedicineCostTotal != 0 {
  579. // iteminfo.MedChrgitm = "09"
  580. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  581. // iteminfo.Amt = westernMedicineCostTotal
  582. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  583. // iteminfo.ClabAmt = westernMedicine_clab_amt
  584. // iteminfo.OthAmt = westernMedicine_other_amt
  585. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  586. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  587. //
  588. // }
  589. // if chineseTraditionalMedicineCostTotal != 0 {
  590. // iteminfo.MedChrgitm = "11"
  591. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  592. // iteminfo.Amt = westernMedicineCostTotal
  593. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  594. // iteminfo.ClabAmt = westernMedicine_clab_amt
  595. // iteminfo.OthAmt = westernMedicine_other_amt
  596. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  597. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  598. //
  599. // }
  600. // if otherCostTotal != 0 {
  601. // iteminfo.MedChrgitm = "14"
  602. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  603. // iteminfo.Amt = otherCostTotal
  604. // iteminfo.ClaaSumfee = other_claa_sunmfee
  605. // iteminfo.ClabAmt = other_clab_amt
  606. // iteminfo.OthAmt = other_other_amt
  607. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  608. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  609. //
  610. // }
  611. // struct4101.IteminfoStruct = iteminfoStructs
  612. // struct4101.Ntly = "中国"
  613. // struct4101.AdmCaty = "A03.06"
  614. // var resOther ResultSeventeenOther
  615. // var res ResultSeventeen
  616. // if miConfig.MdtrtareaAdmvs == "150499" {
  617. // var pp models.PublicParams
  618. // pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  619. // pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  620. // pp.FixmedinsName = miConfig.OrgName
  621. // pp.FixmedinsCode = miConfig.Code
  622. // pp.RequestUrl = miConfig.Url
  623. // pp.Cainfo = miConfig.Cainfo
  624. // pp.SecretKey = miConfig.SecretKey
  625. // pp.AccessKey = miConfig.AccessKey
  626. // pp.OpterName = curRoles.UserName
  627. // client := &http.Client{}
  628. // var req *http.Request
  629. // data := make(map[string]interface{})
  630. // data["struct4101"] = struct4101
  631. // data["pp"] = pp
  632. // bytesData, _ := json.Marshal(data)
  633. // req, _ = http.NewRequest("POST", "http://172.16.13.254:9532/"+"nmyb/4101", bytes.NewReader(bytesData))
  634. // resp, _ := client.Do(req)
  635. // defer resp.Body.Close()
  636. // body, ioErr := ioutil.ReadAll(resp.Body)
  637. // if ioErr != nil {
  638. // utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  639. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  640. // return
  641. // }
  642. // var respJSON map[string]interface{}
  643. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  644. // utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  645. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  646. // return
  647. // }
  648. //
  649. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  650. // userJSONBytes, _ := json.Marshal(respJSON)
  651. // if err := json.Unmarshal(userJSONBytes, &resOther); err != nil {
  652. // utils.ErrorLog("解析失败:%v", err)
  653. // c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  654. // return
  655. // }
  656. // res.InfRefmsgid = resOther.InfRefmsgid
  657. // res.Output = resOther.Output
  658. // res.ErrMsg = resOther.ErrMsg
  659. // infocode, _ := strconv.ParseInt(resOther.Infcode, 10, 64)
  660. // res.Infcode = infocode
  661. // }
  662. // if res.Infcode != 0 {
  663. // c.ServeSuccessJSON(map[string]interface{}{
  664. // "failed_code": -10,
  665. // "msg": res.ErrMsg,
  666. // })
  667. // return
  668. // } else {
  669. // if miConfig.MdtrtareaAdmvs != "150499" {
  670. // order.FaPiaoNumber = zero
  671. // order.FaPiaoCode = last_order.FaPiaoCode
  672. // service.UpdateOrder(order)
  673. // }
  674. // hisFundSettleListResult := &models.HisFundSettleListResult{
  675. // Number: res.Output.SetlListId,
  676. // Status: 1,
  677. // Ctime: time.Now().Unix(),
  678. // Mtime: time.Now().Unix(),
  679. // UserOrgId: c.GetAdminUserInfo().CurrentOrgId,
  680. // IsUpload: 1,
  681. // OrderId: order_id,
  682. // }
  683. // service.CreateUploadRecord(hisFundSettleListResult)
  684. // c.ServeSuccessJSON(map[string]interface{}{
  685. // "msg": "上传成功",
  686. // "result": hisFundSettleListResult,
  687. // })
  688. // return
  689. // }
  690. //}GetAllHisOrder10138
  691. //
  692. //
  693. func GetblBatchSettleList() {
  694. org_id, _ := beego.AppConfig.Int64("org_id")
  695. org_id = 10138
  696. var orders []*models.HisOrder
  697. //var orders []*models.HisOrderError
  698. orders, _ = service.GetAllHisOrder10138()
  699. for _, item := range orders {
  700. order_id := item.ID
  701. order, _ := service.GetHisOrderByIDTwo(order_id)
  702. if order.MedType == "14" {
  703. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  704. var patientPrescription models.HisPrescriptionInfo
  705. patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  706. doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  707. department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  708. miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  709. var configTwo []*models.HisXtDiagnoseConfig
  710. diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  711. curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  712. for _, item := range diagnosis_idstwo {
  713. id, _ := strconv.ParseInt(item, 10, 64)
  714. diagnosisConfig, _ := service.FindDiagnoseById(id)
  715. configTwo = append(configTwo, &diagnosisConfig)
  716. }
  717. patient, _ := service.GetPatientByIDTwo(10138, order.PatientId)
  718. sickConfig, _ := service.FindSickById(his.SickType)
  719. //if order.MedType == "1111" || order.MedType == "1112" {
  720. // order.MedType = "11"
  721. //}
  722. service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
  723. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  724. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  725. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  726. if order.ID == 0 {
  727. return
  728. }
  729. if his.BalanceAccountsType == 2 {
  730. continue
  731. }
  732. ID := strconv.FormatInt(int64(order.ID), 10)
  733. struct4101 := service.Struct4101{
  734. PsnNo: order.PsnNo,
  735. MdtrtId: order.MdtrtId,
  736. SetlId: order.SetlId,
  737. PsnName: order.PsnName,
  738. Gend: order.Gend,
  739. Brdy: his.Brdy,
  740. Age: his.Age,
  741. Naty: order.Naty,
  742. PatnCertType: order.PsnCertType,
  743. Certno: order.Certno,
  744. Prfs: "90",
  745. ConerName: "",
  746. PatnRlts: "",
  747. ConerAddr: "",
  748. ConerTel: "",
  749. HiType: order.Insutype,
  750. Insuplc: his.InsuplcAdmdvs,
  751. MaindiagFlag: "1",
  752. BillCode: "000"+ID,
  753. BillNo: "000"+ID,
  754. BizSn: order.Number,
  755. PsnSelfPay: order.PsnPartAmt,
  756. PsnOwnPay: order.PsnPartAmt,
  757. AcctPay: order.AcctPay,
  758. PsnCashpay: order.PsnCashPay,
  759. HiPaymtd: "1",
  760. Hsorg: his.InsuplcAdmdvs,
  761. HsorgOpter: his.InsuplcAdmdvs,
  762. MedinsFillPsn: curRoles.UserName,
  763. MedinsFillDept: depart.Name,
  764. IptMedType: "2",
  765. CurAddr: patient.HomeAddress,
  766. }
  767. struct4101.SetlBegnDate = order.SetlTime
  768. struct4101.SetlEndDate = order.SetlTime
  769. var rf []CustomFundPay
  770. json.Unmarshal([]byte(order.SetlDetail), &rf)
  771. //var tempFunPays []service.CustomStruct
  772. //var tempFunPay610100 service.CustomStruct
  773. //for _, item := range rf {
  774. // if item.FundPayType == "610100" {
  775. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  776. // tempFunPay610100.FundPayType = item.FundPayType
  777. // } else {
  778. // var tempFunPay service.CustomStruct
  779. // tempFunPay.FundPayamt = item.FundPayamt
  780. // tempFunPay.FundPayType = item.FundPayType
  781. // tempFunPays = append(tempFunPays, tempFunPay)
  782. // }
  783. //}
  784. //tempFunPays = append(tempFunPays, tempFunPay610100)
  785. //struct4101.CustomStruct = tempFunPays
  786. var tempDiaginfos []service.DiaginfoStructTwo
  787. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  788. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  789. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  790. var config []*models.HisXtDiagnoseConfig
  791. for _, item := range diagnosis_ids {
  792. id, _ := strconv.ParseInt(item, 10, 64)
  793. if id == 24 {
  794. diagnosisConfig, _ := service.FindDiagnoseById(id)
  795. config = append(config, &diagnosisConfig)
  796. }
  797. }
  798. for _, item := range diagnosis_ids {
  799. id, _ := strconv.ParseInt(item, 10, 64)
  800. if id != 24 {
  801. diagnosisConfig, _ := service.FindDiagnoseById(id)
  802. config = append(config, &diagnosisConfig)
  803. }
  804. }
  805. for index, item := range config {
  806. if index == 0 {
  807. var tempDiaginfo service.DiaginfoStructTwo
  808. tempDiaginfo.DiagCode = item.CountryCode
  809. tempDiaginfo.DiagName = item.CountryContentName
  810. tempDiaginfo.DiagType = "1"
  811. tempDiaginfo.MaindiagFlag = "1"
  812. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  813. } else {
  814. var tempDiaginfo service.DiaginfoStructTwo
  815. tempDiaginfo.DiagCode = item.CountryCode
  816. tempDiaginfo.DiagName = item.CountryContentName
  817. tempDiaginfo.DiagType = "1"
  818. tempDiaginfo.MaindiagFlag = "0"
  819. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  820. }
  821. }
  822. struct4101.Diseinfo = tempDiaginfos
  823. sickConfigTwo, _ := service.FindSickById(his.SickType)
  824. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  825. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  826. tempOpspdiseinfo2.OprnOprtCode = ""
  827. tempOpspdiseinfo2.OprnOprtName = ""
  828. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  829. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  830. time_arr := strings.Split(order.SetlTime, " ")
  831. struct4101.AdmTime = time_arr[0]
  832. struct4101.AdmEndTime = time_arr[0]
  833. struct4101.DoctorName = doctor.UserName
  834. struct4101.DoctorCode = doctor.DoctorNumber
  835. struct4101.Ntly = "CHN"
  836. struct4101.AdmCaty = "A03.06"
  837. var res ResultSeventeen
  838. result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  839. fmt.Println(result)
  840. saveLog(result, request, "4101A", "清单上传")
  841. var dat map[string]interface{}
  842. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  843. fmt.Println(dat)
  844. } else {
  845. fmt.Println(err)
  846. }
  847. userJSONBytes, _ := json.Marshal(dat)
  848. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  849. //utils.ErrorLog("解析失败:%v", err)
  850. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  851. //adminUser := c.GetAdminUserInfo()
  852. errlog := &models.HisOrderError{
  853. UserOrgId: org_id,
  854. Ctime: time.Now().Unix(),
  855. Mtime: time.Now().Unix(),
  856. ErrMsg: res.ErrMsg + "解析失败",
  857. Status: 1,
  858. PatientId: order_id,
  859. Stage: 10138600,
  860. }
  861. service.CreateErrMsgLog(errlog)
  862. continue
  863. }
  864. if res.Infcode != 0 {
  865. //adminUser := c.GetAdminUserInfo()
  866. errlog := &models.HisOrderError{
  867. UserOrgId: org_id,
  868. Ctime: time.Now().Unix(),
  869. Mtime: time.Now().Unix(),
  870. ErrMsg: res.ErrMsg,
  871. Status: 1,
  872. PatientId: order_id,
  873. Stage: 10138600,
  874. }
  875. service.CreateErrMsgLog(errlog)
  876. continue
  877. } else {
  878. hisFundSettleListResult := &models.HisFundSettleListResult{
  879. Number: res.Output.SetlListId,
  880. Status: 1,
  881. Ctime: time.Now().Unix(),
  882. Mtime: time.Now().Unix(),
  883. UserOrgId: org_id,
  884. IsUpload: 1,
  885. OrderId: order_id,
  886. }
  887. service.CreateUploadRecord(hisFundSettleListResult)
  888. continue
  889. }
  890. }
  891. }
  892. }
  893. func GetgaBatchSettleList() {
  894. org_id, _ := beego.AppConfig.Int64("org_id")
  895. org_id = 9504
  896. var orders []*models.HisOrder
  897. //var orders []*models.HisOrderError
  898. orders, _ = service.GetAllHisOrder9504()
  899. for _, item := range orders {
  900. order_id := item.ID
  901. order, _ := service.GetHisOrderByIDTwo(order_id)
  902. if order.MedType == "14" {
  903. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  904. var patientPrescription models.HisPrescriptionInfo
  905. patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  906. doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  907. department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  908. miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  909. var configTwo []*models.HisXtDiagnoseConfig
  910. diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  911. curRoles, _ := service.GetAdminUserInfoByID(org_id, 5488)
  912. for _, item := range diagnosis_idstwo {
  913. id, _ := strconv.ParseInt(item, 10, 64)
  914. diagnosisConfig, _ := service.FindDiagnoseById(id)
  915. configTwo = append(configTwo, &diagnosisConfig)
  916. }
  917. patient, _ := service.GetPatientByIDTwo(9504, order.PatientId)
  918. sickConfig, _ := service.FindSickById(his.SickType)
  919. //if order.MedType == "1111" || order.MedType == "1112" {
  920. // order.MedType = "11"
  921. //}
  922. service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
  923. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  924. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  925. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  926. if order.ID == 0 {
  927. return
  928. }
  929. if his.BalanceAccountsType == 2 {
  930. continue
  931. }
  932. ID := strconv.FormatInt(int64(order.ID), 10)
  933. struct4101 := service.Struct4101{
  934. PsnNo: order.PsnNo,
  935. MdtrtId: order.MdtrtId,
  936. SetlId: order.SetlId,
  937. PsnName: order.PsnName,
  938. Gend: order.Gend,
  939. Brdy: his.Brdy,
  940. Age: his.Age,
  941. Naty: order.Naty,
  942. PatnCertType: order.PsnCertType,
  943. Certno: order.Certno,
  944. Prfs: "90",
  945. ConerName: "",
  946. PatnRlts: "",
  947. ConerAddr: "",
  948. ConerTel: "",
  949. HiType: order.Insutype,
  950. Insuplc: his.InsuplcAdmdvs,
  951. MaindiagFlag: "1",
  952. BillCode: "000"+ID,
  953. BillNo: "000"+ID,
  954. BizSn: order.Number,
  955. PsnSelfPay: order.PsnPartAmt,
  956. PsnOwnPay: order.PsnPartAmt,
  957. AcctPay: order.AcctPay,
  958. PsnCashpay: order.PsnCashPay,
  959. HiPaymtd: "1",
  960. Hsorg: his.InsuplcAdmdvs,
  961. HsorgOpter: his.InsuplcAdmdvs,
  962. MedinsFillPsn: curRoles.UserName,
  963. MedinsFillDept: depart.Name,
  964. IptMedType: "2",
  965. CurAddr: patient.HomeAddress,
  966. }
  967. struct4101.SetlBegnDate = order.SetlTime
  968. struct4101.SetlEndDate = order.SetlTime
  969. var rf []CustomFundPay
  970. json.Unmarshal([]byte(order.SetlDetail), &rf)
  971. //var tempFunPays []service.CustomStruct
  972. //var tempFunPay610100 service.CustomStruct
  973. //for _, item := range rf {
  974. // if item.FundPayType == "610100" {
  975. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  976. // tempFunPay610100.FundPayType = item.FundPayType
  977. // } else {
  978. // var tempFunPay service.CustomStruct
  979. // tempFunPay.FundPayamt = item.FundPayamt
  980. // tempFunPay.FundPayType = item.FundPayType
  981. // tempFunPays = append(tempFunPays, tempFunPay)
  982. // }
  983. //}
  984. //tempFunPays = append(tempFunPays, tempFunPay610100)
  985. //struct4101.CustomStruct = tempFunPays
  986. var tempDiaginfos []service.DiaginfoStructTwo
  987. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  988. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  989. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  990. var config []*models.HisXtDiagnoseConfig
  991. for _, item := range diagnosis_ids {
  992. id, _ := strconv.ParseInt(item, 10, 64)
  993. if id == 24 {
  994. diagnosisConfig, _ := service.FindDiagnoseById(id)
  995. config = append(config, &diagnosisConfig)
  996. }
  997. }
  998. for _, item := range diagnosis_ids {
  999. id, _ := strconv.ParseInt(item, 10, 64)
  1000. if id != 24 {
  1001. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1002. config = append(config, &diagnosisConfig)
  1003. }
  1004. }
  1005. for index, item := range config {
  1006. if index == 0 {
  1007. var tempDiaginfo service.DiaginfoStructTwo
  1008. tempDiaginfo.DiagCode = item.CountryCode
  1009. tempDiaginfo.DiagName = item.CountryContentName
  1010. tempDiaginfo.DiagType = "1"
  1011. tempDiaginfo.MaindiagFlag = "1"
  1012. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1013. } else {
  1014. var tempDiaginfo service.DiaginfoStructTwo
  1015. tempDiaginfo.DiagCode = item.CountryCode
  1016. tempDiaginfo.DiagName = item.CountryContentName
  1017. tempDiaginfo.DiagType = "1"
  1018. tempDiaginfo.MaindiagFlag = "0"
  1019. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1020. }
  1021. }
  1022. struct4101.Diseinfo = tempDiaginfos
  1023. sickConfigTwo, _ := service.FindSickById(his.SickType)
  1024. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  1025. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  1026. tempOpspdiseinfo2.OprnOprtCode = ""
  1027. tempOpspdiseinfo2.OprnOprtName = ""
  1028. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  1029. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  1030. time_arr := strings.Split(order.SetlTime, " ")
  1031. struct4101.AdmTime = time_arr[0]
  1032. struct4101.AdmEndTime = time_arr[0]
  1033. struct4101.DoctorName = doctor.UserName
  1034. struct4101.DoctorCode = doctor.DoctorNumber
  1035. struct4101.Ntly = "CHN"
  1036. struct4101.AdmCaty = "A03.06"
  1037. var res ResultSeventeen
  1038. result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  1039. fmt.Println(result)
  1040. saveLog(result, request, "4101A", "清单上传")
  1041. var dat map[string]interface{}
  1042. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1043. fmt.Println(dat)
  1044. } else {
  1045. fmt.Println(err)
  1046. }
  1047. userJSONBytes, _ := json.Marshal(dat)
  1048. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1049. //utils.ErrorLog("解析失败:%v", err)
  1050. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1051. //adminUser := c.GetAdminUserInfo()
  1052. errlog := &models.HisOrderError{
  1053. UserOrgId: org_id,
  1054. Ctime: time.Now().Unix(),
  1055. Mtime: time.Now().Unix(),
  1056. ErrMsg: res.ErrMsg + "解析失败",
  1057. Status: 1,
  1058. PatientId: order_id,
  1059. Stage: 10138600,
  1060. }
  1061. service.CreateErrMsgLog(errlog)
  1062. continue
  1063. }
  1064. if res.Infcode != 0 {
  1065. //adminUser := c.GetAdminUserInfo()
  1066. errlog := &models.HisOrderError{
  1067. UserOrgId: org_id,
  1068. Ctime: time.Now().Unix(),
  1069. Mtime: time.Now().Unix(),
  1070. ErrMsg: res.ErrMsg,
  1071. Status: 1,
  1072. PatientId: order_id,
  1073. Stage: 10138600,
  1074. }
  1075. service.CreateErrMsgLog(errlog)
  1076. continue
  1077. } else {
  1078. hisFundSettleListResult := &models.HisFundSettleListResult{
  1079. Number: res.Output.SetlListId,
  1080. Status: 1,
  1081. Ctime: time.Now().Unix(),
  1082. Mtime: time.Now().Unix(),
  1083. UserOrgId: org_id,
  1084. IsUpload: 1,
  1085. OrderId: order_id,
  1086. }
  1087. service.CreateUploadRecord(hisFundSettleListResult)
  1088. continue
  1089. }
  1090. }
  1091. }
  1092. }
  1093. func GetlsBatchSettleList() {
  1094. org_id, _ := beego.AppConfig.Int64("org_id")
  1095. org_id = 10028
  1096. var orders []*models.HisOrder
  1097. //var orders []*models.HisOrderError
  1098. orders, _ = service.GetAllHisOrder10028()
  1099. for _, item := range orders {
  1100. order_id := item.ID
  1101. order, _ := service.GetHisOrderByIDTwo(order_id)
  1102. if order.MedType == "14" {
  1103. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  1104. var patientPrescription models.HisPrescriptionInfo
  1105. patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  1106. doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  1107. department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  1108. miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  1109. var configTwo []*models.HisXtDiagnoseConfig
  1110. diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  1111. curRoles, _ := service.GetAdminUserInfoByID(org_id, 5320)
  1112. for _, item := range diagnosis_idstwo {
  1113. id, _ := strconv.ParseInt(item, 10, 64)
  1114. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1115. configTwo = append(configTwo, &diagnosisConfig)
  1116. }
  1117. patient, _ := service.GetPatientByIDTwo(10028, order.PatientId)
  1118. sickConfig, _ := service.FindSickById(his.SickType)
  1119. //if order.MedType == "1111" || order.MedType == "1112" {
  1120. // order.MedType = "11"
  1121. //}
  1122. service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
  1123. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  1124. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  1125. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  1126. if order.ID == 0 {
  1127. return
  1128. }
  1129. if his.BalanceAccountsType == 2 {
  1130. continue
  1131. }
  1132. ID := strconv.FormatInt(int64(order.ID), 10)
  1133. struct4101 := service.Struct4101{
  1134. PsnNo: order.PsnNo,
  1135. MdtrtId: order.MdtrtId,
  1136. SetlId: order.SetlId,
  1137. PsnName: order.PsnName,
  1138. Gend: order.Gend,
  1139. Brdy: his.Brdy,
  1140. Age: his.Age,
  1141. Naty: order.Naty,
  1142. PatnCertType: order.PsnCertType,
  1143. Certno: order.Certno,
  1144. Prfs: "90",
  1145. ConerName: "",
  1146. PatnRlts: "",
  1147. ConerAddr: "",
  1148. ConerTel: "",
  1149. HiType: order.Insutype,
  1150. Insuplc: his.InsuplcAdmdvs,
  1151. MaindiagFlag: "1",
  1152. BillCode: "000"+ID,
  1153. BillNo: "000"+ID,
  1154. BizSn: order.Number,
  1155. PsnSelfPay: order.PsnPartAmt,
  1156. PsnOwnPay: order.PsnPartAmt,
  1157. AcctPay: order.AcctPay,
  1158. PsnCashpay: order.PsnCashPay,
  1159. HiPaymtd: "1",
  1160. Hsorg: his.InsuplcAdmdvs,
  1161. HsorgOpter: his.InsuplcAdmdvs,
  1162. MedinsFillPsn: curRoles.UserName,
  1163. MedinsFillDept: depart.Name,
  1164. IptMedType: "2",
  1165. CurAddr: patient.HomeAddress,
  1166. }
  1167. struct4101.SetlBegnDate = order.SetlTime
  1168. struct4101.SetlEndDate = order.SetlTime
  1169. var rf []CustomFundPay
  1170. json.Unmarshal([]byte(order.SetlDetail), &rf)
  1171. //var tempFunPays []service.CustomStruct
  1172. //var tempFunPay610100 service.CustomStruct
  1173. //for _, item := range rf {
  1174. // if item.FundPayType == "610100" {
  1175. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  1176. // tempFunPay610100.FundPayType = item.FundPayType
  1177. // } else {
  1178. // var tempFunPay service.CustomStruct
  1179. // tempFunPay.FundPayamt = item.FundPayamt
  1180. // tempFunPay.FundPayType = item.FundPayType
  1181. // tempFunPays = append(tempFunPays, tempFunPay)
  1182. // }
  1183. //}
  1184. //tempFunPays = append(tempFunPays, tempFunPay610100)
  1185. //struct4101.CustomStruct = tempFunPays
  1186. var tempDiaginfos []service.DiaginfoStructTwo
  1187. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  1188. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  1189. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  1190. var config []*models.HisXtDiagnoseConfig
  1191. for _, item := range diagnosis_ids {
  1192. id, _ := strconv.ParseInt(item, 10, 64)
  1193. if id == 24 {
  1194. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1195. config = append(config, &diagnosisConfig)
  1196. }
  1197. }
  1198. for _, item := range diagnosis_ids {
  1199. id, _ := strconv.ParseInt(item, 10, 64)
  1200. if id != 24 {
  1201. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1202. config = append(config, &diagnosisConfig)
  1203. }
  1204. }
  1205. for index, item := range config {
  1206. if index == 0 {
  1207. var tempDiaginfo service.DiaginfoStructTwo
  1208. tempDiaginfo.DiagCode = item.CountryCode
  1209. tempDiaginfo.DiagName = item.CountryContentName
  1210. tempDiaginfo.DiagType = "1"
  1211. tempDiaginfo.MaindiagFlag = "1"
  1212. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1213. } else {
  1214. var tempDiaginfo service.DiaginfoStructTwo
  1215. tempDiaginfo.DiagCode = item.CountryCode
  1216. tempDiaginfo.DiagName = item.CountryContentName
  1217. tempDiaginfo.DiagType = "1"
  1218. tempDiaginfo.MaindiagFlag = "0"
  1219. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1220. }
  1221. }
  1222. struct4101.Diseinfo = tempDiaginfos
  1223. sickConfigTwo, _ := service.FindSickById(his.SickType)
  1224. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  1225. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  1226. tempOpspdiseinfo2.OprnOprtCode = ""
  1227. tempOpspdiseinfo2.OprnOprtName = ""
  1228. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  1229. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  1230. time_arr := strings.Split(order.SetlTime, " ")
  1231. struct4101.AdmTime = time_arr[0]
  1232. struct4101.AdmEndTime = time_arr[0]
  1233. struct4101.DoctorName = doctor.UserName
  1234. struct4101.DoctorCode = doctor.DoctorNumber
  1235. struct4101.Ntly = "CHN"
  1236. struct4101.AdmCaty = "A03.06"
  1237. var res ResultSeventeen
  1238. result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  1239. fmt.Println(result)
  1240. saveLog(result, request, "4101A", "清单上传")
  1241. var dat map[string]interface{}
  1242. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1243. fmt.Println(dat)
  1244. } else {
  1245. fmt.Println(err)
  1246. }
  1247. userJSONBytes, _ := json.Marshal(dat)
  1248. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1249. //utils.ErrorLog("解析失败:%v", err)
  1250. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1251. //adminUser := c.GetAdminUserInfo()
  1252. errlog := &models.HisOrderError{
  1253. UserOrgId: org_id,
  1254. Ctime: time.Now().Unix(),
  1255. Mtime: time.Now().Unix(),
  1256. ErrMsg: res.ErrMsg + "解析失败",
  1257. Status: 1,
  1258. PatientId: order_id,
  1259. Stage: 10138600,
  1260. }
  1261. service.CreateErrMsgLog(errlog)
  1262. continue
  1263. }
  1264. if res.Infcode != 0 {
  1265. //adminUser := c.GetAdminUserInfo()
  1266. errlog := &models.HisOrderError{
  1267. UserOrgId: org_id,
  1268. Ctime: time.Now().Unix(),
  1269. Mtime: time.Now().Unix(),
  1270. ErrMsg: res.ErrMsg,
  1271. Status: 1,
  1272. PatientId: order_id,
  1273. Stage: 10138600,
  1274. }
  1275. service.CreateErrMsgLog(errlog)
  1276. continue
  1277. } else {
  1278. hisFundSettleListResult := &models.HisFundSettleListResult{
  1279. Number: res.Output.SetlListId,
  1280. Status: 1,
  1281. Ctime: time.Now().Unix(),
  1282. Mtime: time.Now().Unix(),
  1283. UserOrgId: org_id,
  1284. IsUpload: 1,
  1285. OrderId: order_id,
  1286. }
  1287. service.CreateUploadRecord(hisFundSettleListResult)
  1288. continue
  1289. }
  1290. }
  1291. }
  1292. }
  1293. func GetblpgBatchSettleList() {
  1294. org_id, _ := beego.AppConfig.Int64("org_id")
  1295. org_id = 10610
  1296. var orders []*models.HisOrder
  1297. //var orders []*models.HisOrderError
  1298. orders, _ = service.GetAllHisOrder10610()
  1299. for _, item := range orders {
  1300. order_id := item.ID
  1301. order, _ := service.GetHisOrderByIDTwo(order_id)
  1302. if order.MedType == "14" {
  1303. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  1304. var patientPrescription models.HisPrescriptionInfo
  1305. patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  1306. doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  1307. department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  1308. miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  1309. var configTwo []*models.HisXtDiagnoseConfig
  1310. diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  1311. curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  1312. for _, item := range diagnosis_idstwo {
  1313. id, _ := strconv.ParseInt(item, 10, 64)
  1314. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1315. configTwo = append(configTwo, &diagnosisConfig)
  1316. }
  1317. patient, _ := service.GetPatientByIDTwo(10610, order.PatientId)
  1318. sickConfig, _ := service.FindSickById(his.SickType)
  1319. //if order.MedType == "1111" || order.MedType == "1112" {
  1320. // order.MedType = "11"
  1321. //}
  1322. service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
  1323. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  1324. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  1325. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  1326. if order.ID == 0 {
  1327. return
  1328. }
  1329. if his.BalanceAccountsType == 2 {
  1330. continue
  1331. }
  1332. ID := strconv.FormatInt(int64(order.ID), 10)
  1333. struct4101 := service.Struct4101{
  1334. PsnNo: order.PsnNo,
  1335. MdtrtId: order.MdtrtId,
  1336. SetlId: order.SetlId,
  1337. PsnName: order.PsnName,
  1338. Gend: order.Gend,
  1339. Brdy: his.Brdy,
  1340. Age: his.Age,
  1341. Naty: order.Naty,
  1342. PatnCertType: order.PsnCertType,
  1343. Certno: order.Certno,
  1344. Prfs: "90",
  1345. ConerName: "",
  1346. PatnRlts: "",
  1347. ConerAddr: "",
  1348. ConerTel: "",
  1349. HiType: order.Insutype,
  1350. Insuplc: his.InsuplcAdmdvs,
  1351. MaindiagFlag: "1",
  1352. BillCode: "000" +ID,
  1353. BillNo: "000" +ID,
  1354. BizSn: order.Number,
  1355. PsnSelfPay: order.PsnPartAmt,
  1356. PsnOwnPay: order.PsnPartAmt,
  1357. AcctPay: order.AcctPay,
  1358. PsnCashpay: order.PsnCashPay,
  1359. HiPaymtd: "1",
  1360. Hsorg: his.InsuplcAdmdvs,
  1361. HsorgOpter: his.InsuplcAdmdvs,
  1362. MedinsFillPsn: curRoles.UserName,
  1363. MedinsFillDept: depart.Name,
  1364. IptMedType: "2",
  1365. CurAddr: patient.HomeAddress,
  1366. }
  1367. struct4101.SetlBegnDate = order.SetlTime
  1368. struct4101.SetlEndDate = order.SetlTime
  1369. var rf []CustomFundPay
  1370. json.Unmarshal([]byte(order.SetlDetail), &rf)
  1371. //var tempFunPays []service.CustomStruct
  1372. //var tempFunPay610100 service.CustomStruct
  1373. //for _, item := range rf {
  1374. // if item.FundPayType == "610100" {
  1375. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  1376. // tempFunPay610100.FundPayType = item.FundPayType
  1377. // } else {
  1378. // var tempFunPay service.CustomStruct
  1379. // tempFunPay.FundPayamt = item.FundPayamt
  1380. // tempFunPay.FundPayType = item.FundPayType
  1381. // tempFunPays = append(tempFunPays, tempFunPay)
  1382. // }
  1383. //}
  1384. //tempFunPays = append(tempFunPays, tempFunPay610100)
  1385. //struct4101.CustomStruct = tempFunPays
  1386. var tempDiaginfos []service.DiaginfoStructTwo
  1387. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  1388. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  1389. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  1390. var config []*models.HisXtDiagnoseConfig
  1391. for _, item := range diagnosis_ids {
  1392. id, _ := strconv.ParseInt(item, 10, 64)
  1393. if id == 24 {
  1394. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1395. config = append(config, &diagnosisConfig)
  1396. }
  1397. }
  1398. for _, item := range diagnosis_ids {
  1399. id, _ := strconv.ParseInt(item, 10, 64)
  1400. if id != 24 {
  1401. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1402. config = append(config, &diagnosisConfig)
  1403. }
  1404. }
  1405. for index, item := range config {
  1406. if index == 0 {
  1407. var tempDiaginfo service.DiaginfoStructTwo
  1408. tempDiaginfo.DiagCode = item.CountryCode
  1409. tempDiaginfo.DiagName = item.CountryContentName
  1410. tempDiaginfo.DiagType = "1"
  1411. tempDiaginfo.MaindiagFlag = "1"
  1412. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1413. } else {
  1414. var tempDiaginfo service.DiaginfoStructTwo
  1415. tempDiaginfo.DiagCode = item.CountryCode
  1416. tempDiaginfo.DiagName = item.CountryContentName
  1417. tempDiaginfo.DiagType = "1"
  1418. tempDiaginfo.MaindiagFlag = "0"
  1419. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1420. }
  1421. }
  1422. struct4101.Diseinfo = tempDiaginfos
  1423. sickConfigTwo, _ := service.FindSickById(his.SickType)
  1424. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  1425. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  1426. tempOpspdiseinfo2.OprnOprtCode = ""
  1427. tempOpspdiseinfo2.OprnOprtName = ""
  1428. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  1429. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  1430. time_arr := strings.Split(order.SetlTime, " ")
  1431. struct4101.AdmTime = time_arr[0]
  1432. struct4101.AdmEndTime = time_arr[0]
  1433. struct4101.DoctorName = doctor.UserName
  1434. struct4101.DoctorCode = doctor.DoctorNumber
  1435. struct4101.Ntly = "CHN"
  1436. struct4101.AdmCaty = "A03.06"
  1437. var res ResultSeventeen
  1438. result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  1439. fmt.Println(result)
  1440. saveLog(result, request, "4101A", "清单上传")
  1441. var dat map[string]interface{}
  1442. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1443. fmt.Println(dat)
  1444. } else {
  1445. fmt.Println(err)
  1446. }
  1447. userJSONBytes, _ := json.Marshal(dat)
  1448. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1449. //utils.ErrorLog("解析失败:%v", err)
  1450. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1451. //adminUser := c.GetAdminUserInfo()
  1452. errlog := &models.HisOrderError{
  1453. UserOrgId: org_id,
  1454. Ctime: time.Now().Unix(),
  1455. Mtime: time.Now().Unix(),
  1456. ErrMsg: res.ErrMsg + "解析失败",
  1457. Status: 1,
  1458. PatientId: order_id,
  1459. Stage: 10138600,
  1460. }
  1461. service.CreateErrMsgLog(errlog)
  1462. continue
  1463. }
  1464. if res.Infcode != 0 {
  1465. //adminUser := c.GetAdminUserInfo()
  1466. errlog := &models.HisOrderError{
  1467. UserOrgId: org_id,
  1468. Ctime: time.Now().Unix(),
  1469. Mtime: time.Now().Unix(),
  1470. ErrMsg: res.ErrMsg,
  1471. Status: 1,
  1472. PatientId: order_id,
  1473. Stage: 10138600,
  1474. }
  1475. service.CreateErrMsgLog(errlog)
  1476. continue
  1477. } else {
  1478. hisFundSettleListResult := &models.HisFundSettleListResult{
  1479. Number: res.Output.SetlListId,
  1480. Status: 1,
  1481. Ctime: time.Now().Unix(),
  1482. Mtime: time.Now().Unix(),
  1483. UserOrgId: org_id,
  1484. IsUpload: 1,
  1485. OrderId: order_id,
  1486. }
  1487. service.CreateUploadRecord(hisFundSettleListResult)
  1488. continue
  1489. }
  1490. }
  1491. }
  1492. }
  1493. func GetblbrBatchSettleList() {
  1494. org_id, _ := beego.AppConfig.Int64("org_id")
  1495. org_id = 10278
  1496. var orders []*models.HisOrder
  1497. //var orders []*models.HisOrderError
  1498. orders, _ = service.GetAllHisOrder10278()
  1499. for _, item := range orders {
  1500. order_id := item.ID
  1501. order, _ := service.GetHisOrderByIDTwo(order_id)
  1502. if order.MedType == "14" {
  1503. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  1504. //var patientPrescription models.HisPrescriptionInfo
  1505. //patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  1506. //doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  1507. //department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  1508. miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  1509. var configTwo []*models.HisXtDiagnoseConfig
  1510. diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  1511. curRoles, _ := service.GetAdminUserInfoByID(org_id, 2791)
  1512. for _, item := range diagnosis_idstwo {
  1513. id, _ := strconv.ParseInt(item, 10, 64)
  1514. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1515. configTwo = append(configTwo, &diagnosisConfig)
  1516. }
  1517. patient, _ := service.GetPatientByIDTwo(10278, order.PatientId)
  1518. //sickConfig, _ := service.FindSickById(his.SickType)
  1519. //if order.MedType == "1111" || order.MedType == "1112" {
  1520. // order.MedType = "11"
  1521. //}
  1522. //service.Gdyb2203d(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
  1523. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  1524. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  1525. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  1526. if order.ID == 0 {
  1527. return
  1528. }
  1529. if his.BalanceAccountsType == 2 {
  1530. continue
  1531. }
  1532. ID := strconv.FormatInt(int64(order.ID), 10)
  1533. struct4101 := service.Struct4101{
  1534. PsnNo: order.PsnNo,
  1535. MdtrtId: order.MdtrtId,
  1536. SetlId: order.SetlId,
  1537. PsnName: order.PsnName,
  1538. Gend: order.Gend,
  1539. Brdy: his.Brdy,
  1540. Age: his.Age,
  1541. Naty: order.Naty,
  1542. PatnCertType: order.PsnCertType,
  1543. Certno: order.Certno,
  1544. Prfs: "90",
  1545. ConerName: "",
  1546. PatnRlts: "",
  1547. ConerAddr: "",
  1548. ConerTel: "",
  1549. HiType: order.Insutype,
  1550. Insuplc: his.InsuplcAdmdvs,
  1551. MaindiagFlag: "1",
  1552. BillCode: "000" +ID,
  1553. BillNo: "000" +ID,
  1554. BizSn: order.Number,
  1555. PsnSelfPay: order.PsnPartAmt,
  1556. PsnOwnPay: order.PsnPartAmt,
  1557. AcctPay: order.AcctPay,
  1558. PsnCashpay: order.PsnCashPay,
  1559. HiPaymtd: "1",
  1560. Hsorg: his.InsuplcAdmdvs,
  1561. HsorgOpter: his.InsuplcAdmdvs,
  1562. MedinsFillPsn: curRoles.UserName,
  1563. MedinsFillDept: depart.Name,
  1564. IptMedType: "2",
  1565. CurAddr: patient.HomeAddress,
  1566. }
  1567. struct4101.SetlBegnDate = order.SetlTime
  1568. struct4101.SetlEndDate = order.SetlTime
  1569. var rf []CustomFundPay
  1570. json.Unmarshal([]byte(order.SetlDetail), &rf)
  1571. //var tempFunPays []service.CustomStruct
  1572. //var tempFunPay610100 service.CustomStruct
  1573. //for _, item := range rf {
  1574. // if item.FundPayType == "610100" {
  1575. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  1576. // tempFunPay610100.FundPayType = item.FundPayType
  1577. // } else {
  1578. // var tempFunPay service.CustomStruct
  1579. // tempFunPay.FundPayamt = item.FundPayamt
  1580. // tempFunPay.FundPayType = item.FundPayType
  1581. // tempFunPays = append(tempFunPays, tempFunPay)
  1582. // }
  1583. //}
  1584. //tempFunPays = append(tempFunPays, tempFunPay610100)
  1585. //struct4101.CustomStruct = tempFunPays
  1586. var tempDiaginfos []service.DiaginfoStructTwo
  1587. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  1588. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  1589. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  1590. var config []*models.HisXtDiagnoseConfig
  1591. for _, item := range diagnosis_ids {
  1592. id, _ := strconv.ParseInt(item, 10, 64)
  1593. if id == 24 {
  1594. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1595. config = append(config, &diagnosisConfig)
  1596. }
  1597. }
  1598. for _, item := range diagnosis_ids {
  1599. id, _ := strconv.ParseInt(item, 10, 64)
  1600. if id != 24 {
  1601. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1602. config = append(config, &diagnosisConfig)
  1603. }
  1604. }
  1605. for index, item := range config {
  1606. if index == 0 {
  1607. var tempDiaginfo service.DiaginfoStructTwo
  1608. tempDiaginfo.DiagCode = item.CountryCode
  1609. tempDiaginfo.DiagName = item.CountryContentName
  1610. tempDiaginfo.DiagType = "1"
  1611. tempDiaginfo.MaindiagFlag = "1"
  1612. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1613. } else {
  1614. var tempDiaginfo service.DiaginfoStructTwo
  1615. tempDiaginfo.DiagCode = item.CountryCode
  1616. tempDiaginfo.DiagName = item.CountryContentName
  1617. tempDiaginfo.DiagType = "1"
  1618. tempDiaginfo.MaindiagFlag = "0"
  1619. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1620. }
  1621. }
  1622. struct4101.Diseinfo = tempDiaginfos
  1623. sickConfigTwo, _ := service.FindSickById(his.SickType)
  1624. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  1625. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  1626. tempOpspdiseinfo2.OprnOprtCode = ""
  1627. tempOpspdiseinfo2.OprnOprtName = ""
  1628. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  1629. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  1630. time_arr := strings.Split(order.SetlTime, " ")
  1631. struct4101.AdmTime = time_arr[0]
  1632. struct4101.AdmEndTime = time_arr[0]
  1633. struct4101.DoctorName = doctor.UserName
  1634. struct4101.DoctorCode = doctor.DoctorNumber
  1635. struct4101.Ntly = "CHN"
  1636. struct4101.AdmCaty = "A03.06"
  1637. var res ResultSeventeen
  1638. result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  1639. fmt.Println(result)
  1640. saveLog(result, request, "4101A", "清单上传")
  1641. var dat map[string]interface{}
  1642. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1643. fmt.Println(dat)
  1644. } else {
  1645. fmt.Println(err)
  1646. }
  1647. userJSONBytes, _ := json.Marshal(dat)
  1648. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1649. //utils.ErrorLog("解析失败:%v", err)
  1650. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1651. //adminUser := c.GetAdminUserInfo()
  1652. errlog := &models.HisOrderError{
  1653. UserOrgId: org_id,
  1654. Ctime: time.Now().Unix(),
  1655. Mtime: time.Now().Unix(),
  1656. ErrMsg: res.ErrMsg + "解析失败",
  1657. Status: 1,
  1658. PatientId: order_id,
  1659. Stage: 10278600,
  1660. }
  1661. service.CreateErrMsgLog(errlog)
  1662. continue
  1663. }
  1664. if res.Infcode != 0 {
  1665. //adminUser := c.GetAdminUserInfo()
  1666. errlog := &models.HisOrderError{
  1667. UserOrgId: org_id,
  1668. Ctime: time.Now().Unix(),
  1669. Mtime: time.Now().Unix(),
  1670. ErrMsg: res.ErrMsg,
  1671. Status: 15,
  1672. PatientId: order_id,
  1673. Stage: 10278600,
  1674. }
  1675. service.CreateErrMsgLog(errlog)
  1676. continue
  1677. } else {
  1678. hisFundSettleListResult := &models.HisFundSettleListResult{
  1679. Number: res.Output.SetlListId,
  1680. Status: 1,
  1681. Ctime: time.Now().Unix(),
  1682. Mtime: time.Now().Unix(),
  1683. UserOrgId: org_id,
  1684. IsUpload: 1,
  1685. OrderId: order_id,
  1686. }
  1687. service.CreateUploadRecord(hisFundSettleListResult)
  1688. continue
  1689. }
  1690. }
  1691. }
  1692. }
  1693. //
  1694. ////func GetbrBatchSettleList() {
  1695. //// org_id, _ := beego.AppConfig.Int64("org_id")
  1696. //// var orders []*models.HisOrder
  1697. //// orders, _ = service.GetAllHisOrder10278()
  1698. //// for _, item := range orders {
  1699. //// order_id := item.ID
  1700. //// order, _ := service.GetHisOrderByIDTwo(order_id)
  1701. //// //roles, _ := service.GetDoctorListTwo(org_id)
  1702. //// his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  1703. //// var patientPrescription models.HisPrescriptionInfo
  1704. //// patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  1705. //// doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  1706. //// department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  1707. //// miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  1708. //// var configTwo []*models.HisXtDiagnoseConfig
  1709. //// diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  1710. //// curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  1711. //// for _, item := range diagnosis_idstwo {
  1712. //// id, _ := strconv.ParseInt(item, 10, 64)
  1713. //// diagnosisConfig, _ := service.FindDiagnoseById(id)
  1714. //// configTwo = append(configTwo, &diagnosisConfig)
  1715. //// }
  1716. ////
  1717. //// sickConfig, _ := service.FindSickById(his.SickType)
  1718. //// service.Gdyb2203A(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, "14", doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"))
  1719. ////
  1720. //// depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  1721. //// pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  1722. //// doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  1723. //// if order.ID == 0 {
  1724. //// return
  1725. //// }
  1726. //// if his.BalanceAccountsType == 2 {
  1727. //// continue
  1728. //// }
  1729. //// struct4101 := service.Struct4101{
  1730. //// PsnNo: order.PsnNo,
  1731. //// MdtrtId: order.MdtrtId,
  1732. //// SetlId: order.SetlId,
  1733. //// PsnName: order.PsnName,
  1734. //// Gend: order.Gend,
  1735. //// Brdy: his.Brdy,
  1736. //// Age: his.Age,
  1737. //// Naty: order.Naty,
  1738. //// PatnCertType: order.PsnCertType,
  1739. //// Certno: order.Certno,
  1740. //// Prfs: "90",
  1741. //// ConerName: "",
  1742. //// PatnRlts: "",
  1743. //// ConerAddr: "",
  1744. //// ConerTel: "",
  1745. //// HiType: order.Insutype,
  1746. //// Insuplc: his.InsuplcAdmdvs,
  1747. //// MaindiagFlag: "1",
  1748. //// BillCode: order.SetlId,
  1749. //// BillNo: order.SetlId,
  1750. //// BizSn: order.Number,
  1751. //// PsnSelfPay: order.PsnPartAmt,
  1752. //// PsnOwnPay: order.PsnPartAmt,
  1753. //// AcctPay: order.AcctPay,
  1754. //// PsnCashpay: order.PsnCashPay,
  1755. //// HiPaymtd: "1",
  1756. //// Hsorg: his.InsuplcAdmdvs,
  1757. //// HsorgOpter: his.InsuplcAdmdvs,
  1758. //// MedinsFillPsn: curRoles.UserName,
  1759. //// MedinsFillDept: depart.Name,
  1760. //// IptMedType: "2",
  1761. //// }
  1762. ////
  1763. //// struct4101.SetlBegnDate = order.SetlTime
  1764. //// struct4101.SetlEndDate = order.SetlTime
  1765. ////
  1766. ////
  1767. //// var rf []CustomFundPay
  1768. //// json.Unmarshal([]byte(order.SetlDetail), &rf)
  1769. ////
  1770. //// //var tempFunPays []service.CustomStruct
  1771. //// //var tempFunPay610100 service.CustomStruct
  1772. ////
  1773. //// //for _, item := range rf {
  1774. //// // if item.FundPayType == "610100" {
  1775. //// // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  1776. //// // tempFunPay610100.FundPayType = item.FundPayType
  1777. //// // } else {
  1778. //// // var tempFunPay service.CustomStruct
  1779. //// // tempFunPay.FundPayamt = item.FundPayamt
  1780. //// // tempFunPay.FundPayType = item.FundPayType
  1781. //// // tempFunPays = append(tempFunPays, tempFunPay)
  1782. //// // }
  1783. //// //}
  1784. //// //tempFunPays = append(tempFunPays, tempFunPay610100)
  1785. //// //struct4101.CustomStruct = tempFunPays
  1786. ////
  1787. //// var tempDiaginfos []service.DiaginfoStructTwo
  1788. //// var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  1789. //// var tempOpspdiseinfos []service.OpspdiseinfoStruct
  1790. ////
  1791. //// diagnosis_ids := strings.Split(his.Diagnosis, ",")
  1792. //// var config []*models.HisXtDiagnoseConfig
  1793. //// for _, item := range diagnosis_ids {
  1794. //// id, _ := strconv.ParseInt(item, 10, 64)
  1795. //// diagnosisConfig, _ := service.FindDiagnoseById(id)
  1796. //// config = append(config, &diagnosisConfig)
  1797. //// }
  1798. ////
  1799. //// for index, item := range config {
  1800. //// if index == 0 {
  1801. //// var tempDiaginfo service.DiaginfoStructTwo
  1802. //// tempDiaginfo.DiagCode = item.CountryCode
  1803. //// tempDiaginfo.DiagName = item.CountryContentName
  1804. //// tempDiaginfo.DiagType = "1"
  1805. //// tempDiaginfo.MaindiagFlag = "1"
  1806. //// tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1807. //// } else {
  1808. ////
  1809. //// var tempDiaginfo service.DiaginfoStructTwo
  1810. //// tempDiaginfo.DiagCode = item.CountryCode
  1811. //// tempDiaginfo.DiagName = item.CountryContentName
  1812. //// tempDiaginfo.DiagType = "2"
  1813. //// tempDiaginfo.MaindiagFlag = "0"
  1814. //// tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1815. //// }
  1816. //// }
  1817. //// struct4101.Diseinfo = tempDiaginfos
  1818. ////
  1819. //// sickConfigTwo, _ := service.FindSickById(his.SickType)
  1820. //// tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  1821. //// tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  1822. //// tempOpspdiseinfo2.OprnOprtCode = ""
  1823. //// tempOpspdiseinfo2.OprnOprtName = ""
  1824. //// tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  1825. //// struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  1826. ////
  1827. //// //var iteminfo service.IteminfoStruct
  1828. ////
  1829. //// var bedCostTotal float64 = 0 //床位总费
  1830. //// var bedCostSelfTotal float64 = 0 //床位自费
  1831. //// var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  1832. ////
  1833. //// var examineCostTotal float64 = 0 //诊查总费
  1834. //// var examineCostSelfTotal float64 = 0 //诊查自费
  1835. //// var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  1836. ////
  1837. //// var nursingCostTotal float64 = 0 //护理总费
  1838. //// var nursingCostSelfTotal float64 = 0 //护理自费
  1839. //// var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  1840. ////
  1841. //// var chineseMedicineCostTotal float64 = 0 //中成药
  1842. //// var chineseMedicineCostSelfTotal float64 = 0 //中成药
  1843. //// var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  1844. ////
  1845. //// var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  1846. //// var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  1847. //// var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  1848. ////
  1849. //// var registerCostTotal float64 = 0 //一般诊疗费
  1850. //// var registerCostSelfTotal float64 = 0 //一般诊疗费
  1851. //// var registerPartSelfTotal float64 = 0 //一般诊疗费
  1852. ////
  1853. //// var operationCostTotal float64 = 0 //手术费
  1854. //// var operationCostSelfTotal float64 = 0 //手术费
  1855. //// var operationCostPartSelfTotal float64 = 0 //手术费
  1856. ////
  1857. //// var otherCostTotal float64 = 0 //其他费用
  1858. //// var otherCostSelfTotal float64 = 0 //其他费用
  1859. //// var otherCostPartSelfTotal float64 = 0 //其他费用
  1860. ////
  1861. //// var materialCostTotal float64 = 0 //材料费
  1862. //// var materialCostSelfTotal float64 = 0 //材料费
  1863. //// var materialCostPartSelfTotal float64 = 0 //材料费
  1864. ////
  1865. //// var westernMedicineCostTotal float64 = 0 //西药费
  1866. //// var westernMedicineCostSelfTotal float64 = 0 //西药费
  1867. //// var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  1868. ////
  1869. //// var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  1870. //// var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  1871. //// var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  1872. ////
  1873. //// var checkCostTotal float64 = 0 //检查费
  1874. //// var checkCostSelfTotal float64 = 0 //检查费
  1875. //// var checkCostPartSelfTotal float64 = 0 //检查费
  1876. ////
  1877. //// var laboratoryCostTotal float64 = 0 //化验费
  1878. //// var laboratoryCostSelfTotal float64 = 0 //化验费
  1879. //// var laboratoryCostPartSelfTotal float64 = 0 //化验费
  1880. ////
  1881. //// var treatCostTotal float64 = 0 //治疗费用
  1882. //// var treatCostSelfTotal float64 = 0 //治疗费用
  1883. //// var treatCostPartSelfTotal float64 = 0 //治疗费用
  1884. ////
  1885. //// decimal.DivisionPrecision = 2
  1886. ////
  1887. //// var bed_fulamt_ownpay_amt float64 = 0
  1888. ////
  1889. //// var examine_fulamt_ownpay_amt float64 = 0
  1890. ////
  1891. //// var nursing_fulamt_ownpay_amt float64 = 0
  1892. ////
  1893. //// var chinese_medicine_fulamt_ownpay_amt float64 = 0
  1894. ////
  1895. //// var commonly_treatment_fulamt_ownpay_amt float64 = 0
  1896. ////
  1897. //// var register_fulamt_ownpay_amt float64 = 0
  1898. ////
  1899. //// var operation_fulamt_ownpay_amt float64 = 0
  1900. //// var other_fulamt_ownpay_amt float64 = 0
  1901. //// var westernMedicine_fulamt_ownpay_amt float64 = 0
  1902. //// var chineseTraditional_fulamt_ownpay_amt float64 = 0
  1903. //// var check_fulamt_ownpay_amt float64 = 0
  1904. //// var material_fulamt_ownpay_amt float64 = 0
  1905. //// var laboratory_fulamt_ownpay_amt float64 = 0
  1906. //// var treat_fulamt_ownpay_amt float64 = 0
  1907. ////
  1908. //// var bed_claa_sunmfee float64 = 0
  1909. //// var bed_clab_amt float64 = 0
  1910. //// var bed_other_amt float64 = 0
  1911. ////
  1912. //// var examine_claa_sunmfee float64 = 0
  1913. //// var examine_clab_amt float64 = 0
  1914. //// var examine_other_amt float64 = 0
  1915. ////
  1916. //// var nursing_claa_sunmfee float64 = 0
  1917. //// var nursing_clab_amt float64 = 0
  1918. //// var nursing_other_amt float64 = 0
  1919. ////
  1920. //// var chinese_medicine_claa_sunmfee float64 = 0
  1921. //// var chinese_medicine_clab_amt float64 = 0
  1922. //// var chinese_medicine_other_amt float64 = 0
  1923. ////
  1924. //// var commonly_treatment_claa_sunmfee float64 = 0
  1925. //// var commonly_treatment_clab_amt float64 = 0
  1926. //// var commonly_treatment_other_amt float64 = 0
  1927. ////
  1928. //// var operation_claa_sunmfee float64 = 0
  1929. //// var operation_clab_amt float64 = 0
  1930. //// var operation_other_amt float64 = 0
  1931. ////
  1932. //// var other_claa_sunmfee float64 = 0
  1933. //// var other_clab_amt float64 = 0
  1934. //// var other_other_amt float64 = 0
  1935. ////
  1936. //// var westernMedicine_claa_sunmfee float64 = 0
  1937. //// var westernMedicine_clab_amt float64 = 0
  1938. //// var westernMedicine_other_amt float64 = 0
  1939. ////
  1940. //// var chineseTraditional_claa_sunmfee float64 = 0
  1941. //// var chineseTraditional_clab_amt float64 = 0
  1942. //// var chineseTraditional_other_amt float64 = 0
  1943. ////
  1944. //// var check_claa_sunmfee float64 = 0
  1945. //// var check_clab_amt float64 = 0
  1946. //// var check_other_amt float64 = 0
  1947. ////
  1948. //// var material_claa_sunmfee float64 = 0
  1949. //// var material_clab_amt float64 = 0
  1950. //// var material_other_amt float64 = 0
  1951. ////
  1952. //// var laboratory_claa_sunmfee float64 = 0
  1953. //// var laboratory_clab_amt float64 = 0
  1954. //// var laboratory_other_amt float64 = 0
  1955. ////
  1956. //// var treat_claa_sunmfee float64 = 0
  1957. //// var treat_clab_amt float64 = 0
  1958. //// var treat_other_amt float64 = 0
  1959. ////
  1960. //// var register_claa_sunmfee float64 = 0
  1961. //// var register_clab_amt float64 = 0
  1962. //// var register_other_amt float64 = 0
  1963. ////
  1964. //// for _, item := range order.HisOrderInfo {
  1965. //// if item.MedChrgitmType == "01" { //床位费
  1966. //// bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1967. //// bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1968. //// bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1969. //// bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1970. //// if item.ChrgitmLv == "1" {
  1971. //// bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1972. //// }
  1973. //// if item.ChrgitmLv == "2" {
  1974. //// bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1975. ////
  1976. //// }
  1977. //// if item.ChrgitmLv == "3" {
  1978. //// bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1979. //// }
  1980. ////
  1981. //// }
  1982. ////
  1983. //// if item.MedChrgitmType == "02" { //诊查
  1984. //// examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1985. //// examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1986. //// examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1987. //// examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1988. //// if item.ChrgitmLv == "1" {
  1989. //// examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1990. //// }
  1991. //// if item.ChrgitmLv == "2" {
  1992. //// examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1993. ////
  1994. //// }
  1995. //// if item.ChrgitmLv == "3" {
  1996. //// examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1997. //// }
  1998. ////
  1999. //// }
  2000. ////
  2001. //// if item.MedChrgitmType == "03" { //检查费
  2002. //// checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2003. //// checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2004. //// checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2005. //// check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2006. //// if item.ChrgitmLv == "1" {
  2007. ////
  2008. //// check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2009. ////
  2010. //// }
  2011. //// if item.ChrgitmLv == "2" {
  2012. //// check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2013. ////
  2014. //// }
  2015. //// if item.ChrgitmLv == "3" {
  2016. //// check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2017. //// }
  2018. //// }
  2019. ////
  2020. //// if item.MedChrgitmType == "04" { //化验费
  2021. //// laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2022. //// laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2023. //// laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2024. //// laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2025. //// if item.ChrgitmLv == "1" {
  2026. ////
  2027. //// laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2028. ////
  2029. //// }
  2030. //// if item.ChrgitmLv == "2" {
  2031. //// laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2032. ////
  2033. //// }
  2034. //// if item.ChrgitmLv == "3" {
  2035. //// laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2036. //// }
  2037. //// }
  2038. ////
  2039. //// if item.MedChrgitmType == "05" { //治疗费
  2040. //// treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2041. //// treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2042. //// treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2043. //// treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2044. //// if item.ChrgitmLv == "1" {
  2045. ////
  2046. //// treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2047. ////
  2048. //// }
  2049. //// if item.ChrgitmLv == "2" {
  2050. //// treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2051. ////
  2052. //// }
  2053. //// if item.ChrgitmLv == "3" {
  2054. //// treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2055. //// }
  2056. //// }
  2057. ////
  2058. //// if item.MedChrgitmType == "06" { //手术费
  2059. //// operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2060. //// operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2061. //// operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2062. //// operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2063. ////
  2064. //// if item.ChrgitmLv == "1" {
  2065. ////
  2066. //// operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2067. ////
  2068. //// }
  2069. //// if item.ChrgitmLv == "2" {
  2070. //// operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2071. ////
  2072. //// }
  2073. //// if item.ChrgitmLv == "3" {
  2074. //// operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2075. //// }
  2076. //// }
  2077. ////
  2078. //// if item.MedChrgitmType == "07" { //手术费
  2079. //// nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2080. //// nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2081. //// nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2082. //// nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2083. ////
  2084. //// if item.ChrgitmLv == "1" {
  2085. ////
  2086. //// nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2087. ////
  2088. //// }
  2089. //// if item.ChrgitmLv == "2" {
  2090. //// nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2091. ////
  2092. //// }
  2093. //// if item.ChrgitmLv == "3" {
  2094. //// nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2095. //// }
  2096. //// }
  2097. ////
  2098. //// if item.MedChrgitmType == "08" { //材料费
  2099. //// materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2100. //// materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2101. //// materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2102. //// material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2103. //// if item.ChrgitmLv == "1" {
  2104. ////
  2105. //// material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2106. ////
  2107. //// }
  2108. //// if item.ChrgitmLv == "2" {
  2109. //// material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2110. ////
  2111. //// }
  2112. //// if item.ChrgitmLv == "3" {
  2113. //// material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2114. //// }
  2115. //// }
  2116. //// if item.MedChrgitmType == "09" { //西药费
  2117. //// westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2118. //// westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2119. //// westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2120. //// westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2121. //// if item.ChrgitmLv == "1" {
  2122. //// westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2123. //// }
  2124. //// if item.ChrgitmLv == "2" {
  2125. //// westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2126. //// }
  2127. //// if item.ChrgitmLv == "3" {
  2128. //// westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2129. //// }
  2130. //// }
  2131. //// if item.MedChrgitmType == "10" { //中药饮片
  2132. //// chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2133. //// chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2134. //// chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2135. //// chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2136. //// if item.ChrgitmLv == "1" {
  2137. //// chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2138. //// }
  2139. //// if item.ChrgitmLv == "2" {
  2140. //// chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2141. //// }
  2142. //// if item.ChrgitmLv == "3" {
  2143. //// chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2144. //// }
  2145. //// }
  2146. ////
  2147. //// if item.MedChrgitmType == "11" { //中成费
  2148. //// chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2149. //// chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2150. //// chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2151. //// chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2152. //// if item.ChrgitmLv == "1" {
  2153. ////
  2154. //// chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2155. ////
  2156. //// }
  2157. //// if item.ChrgitmLv == "2" {
  2158. //// chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2159. ////
  2160. //// }
  2161. //// if item.ChrgitmLv == "3" {
  2162. //// chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2163. //// }
  2164. //// }
  2165. ////
  2166. //// if item.MedChrgitmType == "12" { //中成费
  2167. //// commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2168. //// commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2169. //// commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2170. //// commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2171. //// if item.ChrgitmLv == "1" {
  2172. ////
  2173. //// commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2174. ////
  2175. //// }
  2176. //// if item.ChrgitmLv == "2" {
  2177. //// commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2178. ////
  2179. //// }
  2180. //// if item.ChrgitmLv == "3" {
  2181. //// commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2182. //// }
  2183. //// }
  2184. ////
  2185. //// if item.MedChrgitmType == "13" { //中成费
  2186. //// registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2187. //// registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2188. //// registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2189. //// register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2190. //// if item.ChrgitmLv == "1" {
  2191. ////
  2192. //// register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2193. ////
  2194. //// }
  2195. //// if item.ChrgitmLv == "2" {
  2196. //// register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2197. ////
  2198. //// }
  2199. //// if item.ChrgitmLv == "3" {
  2200. //// register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2201. //// }
  2202. //// }
  2203. ////
  2204. //// if item.MedChrgitmType == "14" { //其他费
  2205. //// otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2206. //// otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2207. //// otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2208. //// other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2209. //// if item.ChrgitmLv == "1" {
  2210. //// other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2211. ////
  2212. //// }
  2213. //// if item.ChrgitmLv == "2" {
  2214. //// other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2215. ////
  2216. //// }
  2217. //// if item.ChrgitmLv == "3" {
  2218. //// other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2219. //// }
  2220. //// }
  2221. ////
  2222. //// }
  2223. ////
  2224. //// //var iteminfoStructs []service.IteminfoStruct
  2225. //// //
  2226. //// //if bedCostTotal != 0 {
  2227. //// // iteminfo.MedChrgitm = "01"
  2228. //// // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2229. //// // iteminfo.Amt = bedCostTotal
  2230. //// // iteminfo.ClaaSumfee = bed_claa_sunmfee
  2231. //// // iteminfo.ClabAmt = bed_clab_amt
  2232. //// // iteminfo.OthAmt = bed_other_amt
  2233. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2234. //// //}
  2235. //// //
  2236. //// //if examineCostTotal != 0 {
  2237. //// // iteminfo.MedChrgitm = "02"
  2238. //// // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  2239. //// // iteminfo.Amt = examineCostTotal
  2240. //// // iteminfo.ClaaSumfee = examine_claa_sunmfee
  2241. //// // iteminfo.ClabAmt = examine_clab_amt
  2242. //// // iteminfo.OthAmt = examine_other_amt
  2243. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2244. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2245. //// //}
  2246. //// //
  2247. //// //if checkCostTotal != 0 {
  2248. //// // iteminfo.MedChrgitm = "03"
  2249. //// // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  2250. //// // iteminfo.Amt = checkCostTotal
  2251. //// // iteminfo.ClaaSumfee = check_claa_sunmfee
  2252. //// // iteminfo.ClabAmt = check_clab_amt
  2253. //// // iteminfo.OthAmt = check_other_amt
  2254. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2255. //// //
  2256. //// //}
  2257. //// //
  2258. //// //if laboratoryCostTotal != 0 {
  2259. //// // iteminfo.MedChrgitm = "04"
  2260. //// // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  2261. //// // iteminfo.Amt = laboratoryCostTotal
  2262. //// // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  2263. //// // iteminfo.ClabAmt = laboratory_clab_amt
  2264. //// // iteminfo.OthAmt = laboratory_other_amt
  2265. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2266. //// //
  2267. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2268. //// //
  2269. //// //}
  2270. //// //
  2271. //// //if treatCostTotal != 0 {
  2272. //// // iteminfo.MedChrgitm = "05"
  2273. //// // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  2274. //// // iteminfo.Amt = treatCostTotal
  2275. //// // iteminfo.ClaaSumfee = treat_claa_sunmfee
  2276. //// // iteminfo.ClabAmt = treat_clab_amt
  2277. //// // iteminfo.OthAmt = treat_other_amt
  2278. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2279. //// // //(struct4101.IteminfoStruct, iteminfo)
  2280. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2281. //// //}
  2282. //// //
  2283. //// //if operationCostTotal != 0 {
  2284. //// // iteminfo.MedChrgitm = "06"
  2285. //// // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2286. //// // iteminfo.Amt = operationCostTotal
  2287. //// // iteminfo.ClaaSumfee = operation_claa_sunmfee
  2288. //// // iteminfo.ClabAmt = operation_clab_amt
  2289. //// // iteminfo.OthAmt = operation_other_amt
  2290. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2291. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2292. //// //}
  2293. //// //
  2294. //// //if nursingCostTotal != 0 {
  2295. //// // iteminfo.MedChrgitm = "07"
  2296. //// // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  2297. //// // iteminfo.Amt = nursingCostTotal
  2298. //// // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  2299. //// // iteminfo.ClabAmt = nursing_clab_amt
  2300. //// // iteminfo.OthAmt = nursing_other_amt
  2301. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2302. //// //}
  2303. //// //
  2304. //// //if materialCostTotal != 0 {
  2305. //// // iteminfo.MedChrgitm = "08"
  2306. //// // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  2307. //// // iteminfo.Amt = materialCostTotal
  2308. //// // iteminfo.ClaaSumfee = material_claa_sunmfee
  2309. //// // iteminfo.ClabAmt = material_clab_amt
  2310. //// // iteminfo.OthAmt = material_other_amt
  2311. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2312. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2313. //// //}
  2314. //// //
  2315. //// //if westernMedicineCostTotal != 0 {
  2316. //// // iteminfo.MedChrgitm = "09"
  2317. //// // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2318. //// // iteminfo.Amt = westernMedicineCostTotal
  2319. //// // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2320. //// // iteminfo.ClabAmt = westernMedicine_clab_amt
  2321. //// // iteminfo.OthAmt = westernMedicine_other_amt
  2322. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2323. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2324. //// //
  2325. //// //}
  2326. //// //
  2327. //// //if chineseMedicineCostTotal != 0 {
  2328. //// // iteminfo.MedChrgitm = "10"
  2329. //// // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  2330. //// // iteminfo.Amt = chineseMedicineCostTotal
  2331. //// // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  2332. //// // iteminfo.ClabAmt = chinese_medicine_clab_amt
  2333. //// // iteminfo.OthAmt = chinese_medicine_other_amt
  2334. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2335. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2336. //// //
  2337. //// //}
  2338. //// //
  2339. //// //if chineseTraditionalMedicineCostTotal != 0 {
  2340. //// // iteminfo.MedChrgitm = "11"
  2341. //// // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2342. //// // iteminfo.Amt = westernMedicineCostTotal
  2343. //// // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2344. //// // iteminfo.ClabAmt = westernMedicine_clab_amt
  2345. //// // iteminfo.OthAmt = westernMedicine_other_amt
  2346. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2347. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2348. //// //
  2349. //// //}
  2350. //// //
  2351. //// //if commonlyTreatmentCostTotal != 0 {
  2352. //// // iteminfo.MedChrgitm = "12"
  2353. //// // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  2354. //// // iteminfo.Amt = commonlyTreatmentCostTotal
  2355. //// // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  2356. //// // iteminfo.ClabAmt = commonly_treatment_clab_amt
  2357. //// // iteminfo.OthAmt = commonly_treatment_other_amt
  2358. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2359. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2360. //// //
  2361. //// //}
  2362. //// //
  2363. //// //if registerCostTotal != 0 {
  2364. //// // iteminfo.MedChrgitm = "13"
  2365. //// // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  2366. //// // iteminfo.Amt = registerCostTotal
  2367. //// // iteminfo.ClaaSumfee = register_claa_sunmfee
  2368. //// // iteminfo.ClabAmt = register_clab_amt
  2369. //// // iteminfo.OthAmt = register_other_amt
  2370. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2371. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2372. //// //
  2373. //// //}
  2374. //// //
  2375. //// //if otherCostTotal != 0 {
  2376. //// // iteminfo.MedChrgitm = "14"
  2377. //// // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  2378. //// // iteminfo.Amt = otherCostTotal
  2379. //// // iteminfo.ClaaSumfee = other_claa_sunmfee
  2380. //// // iteminfo.ClabAmt = other_clab_amt
  2381. //// // iteminfo.OthAmt = other_other_amt
  2382. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2383. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2384. //// //
  2385. //// //}
  2386. //// //
  2387. //// //struct4101.IteminfoStruct = iteminfoStructs
  2388. //// time_arr := strings.Split(order.SetlTime, " ")
  2389. //// struct4101.AdmTime = time_arr[0]
  2390. //// struct4101.AdmEndTime = time_arr[0]
  2391. //// struct4101.DoctorName = doctor.UserName
  2392. //// struct4101.DoctorCode = doctor.DoctorNumber
  2393. ////
  2394. //// struct4101.Ntly = "中国"
  2395. //// struct4101.AdmCaty = "A03.06"
  2396. //// var res ResultSeventeen
  2397. //// {
  2398. //// result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  2399. //// fmt.Println(result)
  2400. //// saveLog(result, request, "4101A", "清单上传")
  2401. //// var dat map[string]interface{}
  2402. //// if err := json.Unmarshal([]byte(result), &dat); err == nil {
  2403. //// fmt.Println(dat)
  2404. //// } else {
  2405. //// fmt.Println(err)
  2406. //// }
  2407. //// userJSONBytes, _ := json.Marshal(dat)
  2408. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  2409. //// //utils.ErrorLog("解析失败:%v", err)
  2410. //// //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  2411. //// //adminUser := c.GetAdminUserInfo()
  2412. //// errlog := &models.HisOrderError{
  2413. //// UserOrgId: org_id,
  2414. //// Ctime: time.Now().Unix(),
  2415. //// Mtime: time.Now().Unix(),
  2416. //// ErrMsg: res.ErrMsg + "解析失败",
  2417. //// Status: 1,
  2418. //// PatientId: order_id,
  2419. //// Stage: 10138,
  2420. //// }
  2421. //// service.CreateErrMsgLog(errlog)
  2422. //// continue
  2423. //// }
  2424. //// }
  2425. ////
  2426. //// if res.Infcode != 0 {
  2427. //// //adminUser := c.GetAdminUserInfo()
  2428. //// errlog := &models.HisOrderError{
  2429. //// UserOrgId: org_id,
  2430. //// Ctime: time.Now().Unix(),
  2431. //// Mtime: time.Now().Unix(),
  2432. //// ErrMsg: res.ErrMsg,
  2433. //// Status: 1,
  2434. //// PatientId: order_id,
  2435. //// Stage: 10138,
  2436. //// }
  2437. //// service.CreateErrMsgLog(errlog)
  2438. //// continue
  2439. //// } else {
  2440. //// hisFundSettleListResult := &models.HisFundSettleListResult{
  2441. //// Number: res.Output.SetlListId,
  2442. //// Status: 1,
  2443. //// Ctime: time.Now().Unix(),
  2444. //// Mtime: time.Now().Unix(),
  2445. //// UserOrgId: org_id,
  2446. //// IsUpload: 1,
  2447. //// OrderId: order_id,
  2448. //// }
  2449. //// service.CreateUploadRecord(hisFundSettleListResult)
  2450. //// continue
  2451. //// }
  2452. //// }
  2453. ////}
  2454. //
  2455. //func GetbrBatchSettleList() {
  2456. // org_id, _ := beego.AppConfig.Int64("org_id")
  2457. // var orders []*models.HisOrder
  2458. // //var orders []*models.HisOrderError
  2459. //
  2460. // orders, _ = service.GetAllHisOrder10278()
  2461. // for _, item := range orders {
  2462. // order_id := item.ID
  2463. // order, _ := service.GetHisOrderByIDTwo(order_id)
  2464. // //roles, _ := service.GetDoctorListTwo(org_id)
  2465. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  2466. // var patientPrescription models.HisPrescriptionInfo
  2467. // patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  2468. // doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  2469. // department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  2470. // miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  2471. // var configTwo []*models.HisXtDiagnoseConfig
  2472. // diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  2473. // curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  2474. // for _, item := range diagnosis_idstwo {
  2475. // id, _ := strconv.ParseInt(item, 10, 64)
  2476. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  2477. // configTwo = append(configTwo, &diagnosisConfig)
  2478. // }
  2479. //
  2480. // sickConfig, _ := service.FindSickById(his.SickType)
  2481. // if order.MedType == "1111" || order.MedType == "1112" {
  2482. // order.MedType = "11"
  2483. // }
  2484. // service.Gdyb2203A(his.PsnNo, his.Number, doctor_info.UserName, department.Name, miConfig.OrgName, order.MedType, doctor_info.DoctorNumber, miConfig.Code, his.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, miConfig.SecretKey, sickConfig.ContentCode, sickConfig.ClassName, curRoles.UserName, configTwo, strings.Split(time.Unix(his.RecordDate, 0).Format("2006-01-02 15:04:05"), " ")[0]+" 22:00:00")
  2485. //
  2486. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  2487. // pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  2488. // doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  2489. // if order.ID == 0 {
  2490. // return
  2491. // }
  2492. // if his.BalanceAccountsType == 2 {
  2493. // continue
  2494. // }
  2495. // struct4101 := service.Struct4101{
  2496. // PsnNo: order.PsnNo,
  2497. // MdtrtId: order.MdtrtId,
  2498. // SetlId: order.SetlId,
  2499. // PsnName: order.PsnName,
  2500. // Gend: order.Gend,
  2501. // Brdy: his.Brdy,
  2502. // Age: his.Age,
  2503. // Naty: order.Naty,
  2504. // PatnCertType: order.PsnCertType,
  2505. // Certno: order.Certno,
  2506. // Prfs: "90",
  2507. // ConerName: "",
  2508. // PatnRlts: "",
  2509. // ConerAddr: "",
  2510. // ConerTel: "",
  2511. // HiType: order.Insutype,
  2512. // Insuplc: his.InsuplcAdmdvs,
  2513. // MaindiagFlag: "1",
  2514. // BillCode: order.SetlId,
  2515. // BillNo: order.SetlId,
  2516. // BizSn: order.Number,
  2517. // PsnSelfPay: order.PsnPartAmt,
  2518. // PsnOwnPay: order.PsnPartAmt,
  2519. // AcctPay: order.AcctPay,
  2520. // PsnCashpay: order.PsnCashPay,
  2521. // HiPaymtd: "1",
  2522. // Hsorg: his.InsuplcAdmdvs,
  2523. // HsorgOpter: his.InsuplcAdmdvs,
  2524. // MedinsFillPsn: curRoles.UserName,
  2525. // MedinsFillDept: depart.Name,
  2526. // IptMedType: "2",
  2527. // }
  2528. //
  2529. // struct4101.SetlBegnDate = order.SetlTime
  2530. // struct4101.SetlEndDate = order.SetlTime
  2531. //
  2532. // var rf []CustomFundPay
  2533. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  2534. //
  2535. // //var tempFunPays []service.CustomStruct
  2536. // //var tempFunPay610100 service.CustomStruct
  2537. //
  2538. // //for _, item := range rf {
  2539. // // if item.FundPayType == "610100" {
  2540. // // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  2541. // // tempFunPay610100.FundPayType = item.FundPayType
  2542. // // } else {
  2543. // // var tempFunPay service.CustomStruct
  2544. // // tempFunPay.FundPayamt = item.FundPayamt
  2545. // // tempFunPay.FundPayType = item.FundPayType
  2546. // // tempFunPays = append(tempFunPays, tempFunPay)
  2547. // // }
  2548. // //}
  2549. // //tempFunPays = append(tempFunPays, tempFunPay610100)
  2550. // //struct4101.CustomStruct = tempFunPays
  2551. //
  2552. // var tempDiaginfos []service.DiaginfoStructTwo
  2553. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  2554. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  2555. //
  2556. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  2557. // var config []*models.HisXtDiagnoseConfig
  2558. // for _, item := range diagnosis_ids {
  2559. // id, _ := strconv.ParseInt(item, 10, 64)
  2560. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  2561. // config = append(config, &diagnosisConfig)
  2562. // }
  2563. //
  2564. // for index, item := range config {
  2565. // if index == 0 {
  2566. // var tempDiaginfo service.DiaginfoStructTwo
  2567. // tempDiaginfo.DiagCode = item.CountryCode
  2568. // tempDiaginfo.DiagName = item.CountryContentName
  2569. // tempDiaginfo.DiagType = "1"
  2570. // tempDiaginfo.MaindiagFlag = "1"
  2571. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  2572. // } else {
  2573. //
  2574. // var tempDiaginfo service.DiaginfoStructTwo
  2575. // tempDiaginfo.DiagCode = item.CountryCode
  2576. // tempDiaginfo.DiagName = item.CountryContentName
  2577. // tempDiaginfo.DiagType = "2"
  2578. // tempDiaginfo.MaindiagFlag = "0"
  2579. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  2580. // }
  2581. // }
  2582. // struct4101.Diseinfo = tempDiaginfos
  2583. //
  2584. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  2585. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  2586. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  2587. // tempOpspdiseinfo2.OprnOprtCode = ""
  2588. // tempOpspdiseinfo2.OprnOprtName = ""
  2589. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  2590. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  2591. //
  2592. // //var iteminfo service.IteminfoStruct
  2593. //
  2594. // var bedCostTotal float64 = 0 //床位总费
  2595. // var bedCostSelfTotal float64 = 0 //床位自费
  2596. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  2597. //
  2598. // var examineCostTotal float64 = 0 //诊查总费
  2599. // var examineCostSelfTotal float64 = 0 //诊查自费
  2600. // var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  2601. //
  2602. // var nursingCostTotal float64 = 0 //护理总费
  2603. // var nursingCostSelfTotal float64 = 0 //护理自费
  2604. // var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  2605. //
  2606. // var chineseMedicineCostTotal float64 = 0 //中成药
  2607. // var chineseMedicineCostSelfTotal float64 = 0 //中成药
  2608. // var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  2609. //
  2610. // var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  2611. // var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  2612. // var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  2613. //
  2614. // var registerCostTotal float64 = 0 //一般诊疗费
  2615. // var registerCostSelfTotal float64 = 0 //一般诊疗费
  2616. // var registerPartSelfTotal float64 = 0 //一般诊疗费
  2617. //
  2618. // var operationCostTotal float64 = 0 //手术费
  2619. // var operationCostSelfTotal float64 = 0 //手术费
  2620. // var operationCostPartSelfTotal float64 = 0 //手术费
  2621. //
  2622. // var otherCostTotal float64 = 0 //其他费用
  2623. // var otherCostSelfTotal float64 = 0 //其他费用
  2624. // var otherCostPartSelfTotal float64 = 0 //其他费用
  2625. //
  2626. // var materialCostTotal float64 = 0 //材料费
  2627. // var materialCostSelfTotal float64 = 0 //材料费
  2628. // var materialCostPartSelfTotal float64 = 0 //材料费
  2629. //
  2630. // var westernMedicineCostTotal float64 = 0 //西药费
  2631. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  2632. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  2633. //
  2634. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  2635. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  2636. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  2637. //
  2638. // var checkCostTotal float64 = 0 //检查费
  2639. // var checkCostSelfTotal float64 = 0 //检查费
  2640. // var checkCostPartSelfTotal float64 = 0 //检查费
  2641. //
  2642. // var laboratoryCostTotal float64 = 0 //化验费
  2643. // var laboratoryCostSelfTotal float64 = 0 //化验费
  2644. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  2645. //
  2646. // var treatCostTotal float64 = 0 //治疗费用
  2647. // var treatCostSelfTotal float64 = 0 //治疗费用
  2648. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  2649. //
  2650. // decimal.DivisionPrecision = 2
  2651. //
  2652. // var bed_fulamt_ownpay_amt float64 = 0
  2653. //
  2654. // var examine_fulamt_ownpay_amt float64 = 0
  2655. //
  2656. // var nursing_fulamt_ownpay_amt float64 = 0
  2657. //
  2658. // var chinese_medicine_fulamt_ownpay_amt float64 = 0
  2659. //
  2660. // var commonly_treatment_fulamt_ownpay_amt float64 = 0
  2661. //
  2662. // var register_fulamt_ownpay_amt float64 = 0
  2663. //
  2664. // var operation_fulamt_ownpay_amt float64 = 0
  2665. // var other_fulamt_ownpay_amt float64 = 0
  2666. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  2667. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  2668. // var check_fulamt_ownpay_amt float64 = 0
  2669. // var material_fulamt_ownpay_amt float64 = 0
  2670. // var laboratory_fulamt_ownpay_amt float64 = 0
  2671. // var treat_fulamt_ownpay_amt float64 = 0
  2672. //
  2673. // var bed_claa_sunmfee float64 = 0
  2674. // var bed_clab_amt float64 = 0
  2675. // var bed_other_amt float64 = 0
  2676. //
  2677. // var examine_claa_sunmfee float64 = 0
  2678. // var examine_clab_amt float64 = 0
  2679. // var examine_other_amt float64 = 0
  2680. //
  2681. // var nursing_claa_sunmfee float64 = 0
  2682. // var nursing_clab_amt float64 = 0
  2683. // var nursing_other_amt float64 = 0
  2684. //
  2685. // var chinese_medicine_claa_sunmfee float64 = 0
  2686. // var chinese_medicine_clab_amt float64 = 0
  2687. // var chinese_medicine_other_amt float64 = 0
  2688. //
  2689. // var commonly_treatment_claa_sunmfee float64 = 0
  2690. // var commonly_treatment_clab_amt float64 = 0
  2691. // var commonly_treatment_other_amt float64 = 0
  2692. //
  2693. // var operation_claa_sunmfee float64 = 0
  2694. // var operation_clab_amt float64 = 0
  2695. // var operation_other_amt float64 = 0
  2696. //
  2697. // var other_claa_sunmfee float64 = 0
  2698. // var other_clab_amt float64 = 0
  2699. // var other_other_amt float64 = 0
  2700. //
  2701. // var westernMedicine_claa_sunmfee float64 = 0
  2702. // var westernMedicine_clab_amt float64 = 0
  2703. // var westernMedicine_other_amt float64 = 0
  2704. //
  2705. // var chineseTraditional_claa_sunmfee float64 = 0
  2706. // var chineseTraditional_clab_amt float64 = 0
  2707. // var chineseTraditional_other_amt float64 = 0
  2708. //
  2709. // var check_claa_sunmfee float64 = 0
  2710. // var check_clab_amt float64 = 0
  2711. // var check_other_amt float64 = 0
  2712. //
  2713. // var material_claa_sunmfee float64 = 0
  2714. // var material_clab_amt float64 = 0
  2715. // var material_other_amt float64 = 0
  2716. //
  2717. // var laboratory_claa_sunmfee float64 = 0
  2718. // var laboratory_clab_amt float64 = 0
  2719. // var laboratory_other_amt float64 = 0
  2720. //
  2721. // var treat_claa_sunmfee float64 = 0
  2722. // var treat_clab_amt float64 = 0
  2723. // var treat_other_amt float64 = 0
  2724. //
  2725. // var register_claa_sunmfee float64 = 0
  2726. // var register_clab_amt float64 = 0
  2727. // var register_other_amt float64 = 0
  2728. //
  2729. // for _, item := range order.HisOrderInfo {
  2730. // if item.MedChrgitmType == "01" { //床位费
  2731. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2732. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2733. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2734. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2735. // if item.ChrgitmLv == "1" {
  2736. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2737. // }
  2738. // if item.ChrgitmLv == "2" {
  2739. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2740. //
  2741. // }
  2742. // if item.ChrgitmLv == "3" {
  2743. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2744. // }
  2745. //
  2746. // }
  2747. //
  2748. // if item.MedChrgitmType == "02" { //诊查
  2749. // examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2750. // examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2751. // examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2752. // examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2753. // if item.ChrgitmLv == "1" {
  2754. // examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2755. // }
  2756. // if item.ChrgitmLv == "2" {
  2757. // examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2758. //
  2759. // }
  2760. // if item.ChrgitmLv == "3" {
  2761. // examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2762. // }
  2763. //
  2764. // }
  2765. //
  2766. // if item.MedChrgitmType == "03" { //检查费
  2767. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2768. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2769. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2770. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2771. // if item.ChrgitmLv == "1" {
  2772. //
  2773. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2774. //
  2775. // }
  2776. // if item.ChrgitmLv == "2" {
  2777. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2778. //
  2779. // }
  2780. // if item.ChrgitmLv == "3" {
  2781. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2782. // }
  2783. // }
  2784. //
  2785. // if item.MedChrgitmType == "04" { //化验费
  2786. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2787. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2788. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2789. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2790. // if item.ChrgitmLv == "1" {
  2791. //
  2792. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2793. //
  2794. // }
  2795. // if item.ChrgitmLv == "2" {
  2796. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2797. //
  2798. // }
  2799. // if item.ChrgitmLv == "3" {
  2800. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2801. // }
  2802. // }
  2803. //
  2804. // if item.MedChrgitmType == "05" { //治疗费
  2805. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2806. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2807. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2808. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2809. // if item.ChrgitmLv == "1" {
  2810. //
  2811. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2812. //
  2813. // }
  2814. // if item.ChrgitmLv == "2" {
  2815. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2816. //
  2817. // }
  2818. // if item.ChrgitmLv == "3" {
  2819. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2820. // }
  2821. // }
  2822. //
  2823. // if item.MedChrgitmType == "06" { //手术费
  2824. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2825. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2826. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2827. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2828. //
  2829. // if item.ChrgitmLv == "1" {
  2830. //
  2831. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2832. //
  2833. // }
  2834. // if item.ChrgitmLv == "2" {
  2835. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2836. //
  2837. // }
  2838. // if item.ChrgitmLv == "3" {
  2839. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2840. // }
  2841. // }
  2842. //
  2843. // if item.MedChrgitmType == "07" { //手术费
  2844. // nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2845. // nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2846. // nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2847. // nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2848. //
  2849. // if item.ChrgitmLv == "1" {
  2850. //
  2851. // nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2852. //
  2853. // }
  2854. // if item.ChrgitmLv == "2" {
  2855. // nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2856. //
  2857. // }
  2858. // if item.ChrgitmLv == "3" {
  2859. // nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2860. // }
  2861. // }
  2862. //
  2863. // if item.MedChrgitmType == "08" { //材料费
  2864. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2865. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2866. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2867. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2868. // if item.ChrgitmLv == "1" {
  2869. //
  2870. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2871. //
  2872. // }
  2873. // if item.ChrgitmLv == "2" {
  2874. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2875. //
  2876. // }
  2877. // if item.ChrgitmLv == "3" {
  2878. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2879. // }
  2880. // }
  2881. // if item.MedChrgitmType == "09" { //西药费
  2882. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2883. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2884. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2885. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2886. // if item.ChrgitmLv == "1" {
  2887. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2888. // }
  2889. // if item.ChrgitmLv == "2" {
  2890. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2891. // }
  2892. // if item.ChrgitmLv == "3" {
  2893. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2894. // }
  2895. // }
  2896. // if item.MedChrgitmType == "10" { //中药饮片
  2897. // chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2898. // chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2899. // chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2900. // chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2901. // if item.ChrgitmLv == "1" {
  2902. // chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2903. // }
  2904. // if item.ChrgitmLv == "2" {
  2905. // chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2906. // }
  2907. // if item.ChrgitmLv == "3" {
  2908. // chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2909. // }
  2910. // }
  2911. //
  2912. // if item.MedChrgitmType == "11" { //中成费
  2913. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2914. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2915. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2916. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2917. // if item.ChrgitmLv == "1" {
  2918. //
  2919. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2920. //
  2921. // }
  2922. // if item.ChrgitmLv == "2" {
  2923. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2924. //
  2925. // }
  2926. // if item.ChrgitmLv == "3" {
  2927. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2928. // }
  2929. // }
  2930. //
  2931. // if item.MedChrgitmType == "12" { //中成费
  2932. // commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2933. // commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2934. // commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2935. // commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2936. // if item.ChrgitmLv == "1" {
  2937. //
  2938. // commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2939. //
  2940. // }
  2941. // if item.ChrgitmLv == "2" {
  2942. // commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2943. //
  2944. // }
  2945. // if item.ChrgitmLv == "3" {
  2946. // commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2947. // }
  2948. // }
  2949. //
  2950. // if item.MedChrgitmType == "13" { //中成费
  2951. // registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2952. // registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2953. // registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2954. // register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2955. // if item.ChrgitmLv == "1" {
  2956. //
  2957. // register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2958. //
  2959. // }
  2960. // if item.ChrgitmLv == "2" {
  2961. // register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2962. //
  2963. // }
  2964. // if item.ChrgitmLv == "3" {
  2965. // register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2966. // }
  2967. // }
  2968. //
  2969. // if item.MedChrgitmType == "14" { //其他费
  2970. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2971. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2972. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2973. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2974. // if item.ChrgitmLv == "1" {
  2975. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2976. //
  2977. // }
  2978. // if item.ChrgitmLv == "2" {
  2979. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2980. //
  2981. // }
  2982. // if item.ChrgitmLv == "3" {
  2983. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2984. // }
  2985. // }
  2986. //
  2987. // }
  2988. //
  2989. // //var iteminfoStructs []service.IteminfoStruct
  2990. // //
  2991. // //if bedCostTotal != 0 {
  2992. // // iteminfo.MedChrgitm = "01"
  2993. // // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2994. // // iteminfo.Amt = bedCostTotal
  2995. // // iteminfo.ClaaSumfee = bed_claa_sunmfee
  2996. // // iteminfo.ClabAmt = bed_clab_amt
  2997. // // iteminfo.OthAmt = bed_other_amt
  2998. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2999. // //}
  3000. // //
  3001. // //if examineCostTotal != 0 {
  3002. // // iteminfo.MedChrgitm = "02"
  3003. // // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  3004. // // iteminfo.Amt = examineCostTotal
  3005. // // iteminfo.ClaaSumfee = examine_claa_sunmfee
  3006. // // iteminfo.ClabAmt = examine_clab_amt
  3007. // // iteminfo.OthAmt = examine_other_amt
  3008. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3009. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3010. // //}
  3011. // //
  3012. // //if checkCostTotal != 0 {
  3013. // // iteminfo.MedChrgitm = "03"
  3014. // // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  3015. // // iteminfo.Amt = checkCostTotal
  3016. // // iteminfo.ClaaSumfee = check_claa_sunmfee
  3017. // // iteminfo.ClabAmt = check_clab_amt
  3018. // // iteminfo.OthAmt = check_other_amt
  3019. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3020. // //
  3021. // //}
  3022. // //
  3023. // //if laboratoryCostTotal != 0 {
  3024. // // iteminfo.MedChrgitm = "04"
  3025. // // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  3026. // // iteminfo.Amt = laboratoryCostTotal
  3027. // // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  3028. // // iteminfo.ClabAmt = laboratory_clab_amt
  3029. // // iteminfo.OthAmt = laboratory_other_amt
  3030. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3031. // //
  3032. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3033. // //
  3034. // //}
  3035. // //
  3036. // //if treatCostTotal != 0 {
  3037. // // iteminfo.MedChrgitm = "05"
  3038. // // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  3039. // // iteminfo.Amt = treatCostTotal
  3040. // // iteminfo.ClaaSumfee = treat_claa_sunmfee
  3041. // // iteminfo.ClabAmt = treat_clab_amt
  3042. // // iteminfo.OthAmt = treat_other_amt
  3043. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3044. // // //(struct4101.IteminfoStruct, iteminfo)
  3045. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3046. // //}
  3047. // //
  3048. // //if operationCostTotal != 0 {
  3049. // // iteminfo.MedChrgitm = "06"
  3050. // // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  3051. // // iteminfo.Amt = operationCostTotal
  3052. // // iteminfo.ClaaSumfee = operation_claa_sunmfee
  3053. // // iteminfo.ClabAmt = operation_clab_amt
  3054. // // iteminfo.OthAmt = operation_other_amt
  3055. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3056. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3057. // //}
  3058. // //
  3059. // //if nursingCostTotal != 0 {
  3060. // // iteminfo.MedChrgitm = "07"
  3061. // // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  3062. // // iteminfo.Amt = nursingCostTotal
  3063. // // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  3064. // // iteminfo.ClabAmt = nursing_clab_amt
  3065. // // iteminfo.OthAmt = nursing_other_amt
  3066. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3067. // //}
  3068. // //
  3069. // //if materialCostTotal != 0 {
  3070. // // iteminfo.MedChrgitm = "08"
  3071. // // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  3072. // // iteminfo.Amt = materialCostTotal
  3073. // // iteminfo.ClaaSumfee = material_claa_sunmfee
  3074. // // iteminfo.ClabAmt = material_clab_amt
  3075. // // iteminfo.OthAmt = material_other_amt
  3076. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3077. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3078. // //}
  3079. // //
  3080. // //if westernMedicineCostTotal != 0 {
  3081. // // iteminfo.MedChrgitm = "09"
  3082. // // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  3083. // // iteminfo.Amt = westernMedicineCostTotal
  3084. // // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  3085. // // iteminfo.ClabAmt = westernMedicine_clab_amt
  3086. // // iteminfo.OthAmt = westernMedicine_other_amt
  3087. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3088. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3089. // //
  3090. // //}
  3091. // //
  3092. // //if chineseMedicineCostTotal != 0 {
  3093. // // iteminfo.MedChrgitm = "10"
  3094. // // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  3095. // // iteminfo.Amt = chineseMedicineCostTotal
  3096. // // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  3097. // // iteminfo.ClabAmt = chinese_medicine_clab_amt
  3098. // // iteminfo.OthAmt = chinese_medicine_other_amt
  3099. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3100. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3101. // //
  3102. // //}
  3103. // //
  3104. // //if chineseTraditionalMedicineCostTotal != 0 {
  3105. // // iteminfo.MedChrgitm = "11"
  3106. // // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  3107. // // iteminfo.Amt = westernMedicineCostTotal
  3108. // // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  3109. // // iteminfo.ClabAmt = westernMedicine_clab_amt
  3110. // // iteminfo.OthAmt = westernMedicine_other_amt
  3111. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3112. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3113. // //
  3114. // //}
  3115. // //
  3116. // //if commonlyTreatmentCostTotal != 0 {
  3117. // // iteminfo.MedChrgitm = "12"
  3118. // // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  3119. // // iteminfo.Amt = commonlyTreatmentCostTotal
  3120. // // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  3121. // // iteminfo.ClabAmt = commonly_treatment_clab_amt
  3122. // // iteminfo.OthAmt = commonly_treatment_other_amt
  3123. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3124. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3125. // //
  3126. // //}
  3127. // //
  3128. // //if registerCostTotal != 0 {
  3129. // // iteminfo.MedChrgitm = "13"
  3130. // // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  3131. // // iteminfo.Amt = registerCostTotal
  3132. // // iteminfo.ClaaSumfee = register_claa_sunmfee
  3133. // // iteminfo.ClabAmt = register_clab_amt
  3134. // // iteminfo.OthAmt = register_other_amt
  3135. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3136. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3137. // //
  3138. // //}
  3139. // //
  3140. // //if otherCostTotal != 0 {
  3141. // // iteminfo.MedChrgitm = "14"
  3142. // // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  3143. // // iteminfo.Amt = otherCostTotal
  3144. // // iteminfo.ClaaSumfee = other_claa_sunmfee
  3145. // // iteminfo.ClabAmt = other_clab_amt
  3146. // // iteminfo.OthAmt = other_other_amt
  3147. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3148. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3149. // //
  3150. // //}
  3151. // //
  3152. // //struct4101.IteminfoStruct = iteminfoStructs
  3153. // time_arr := strings.Split(order.SetlTime, " ")
  3154. // struct4101.AdmTime = time_arr[0]
  3155. // struct4101.AdmEndTime = time_arr[0]
  3156. // struct4101.DoctorName = doctor.UserName
  3157. // struct4101.DoctorCode = doctor.DoctorNumber
  3158. //
  3159. // struct4101.Ntly = "中国"
  3160. // struct4101.AdmCaty = "A03.06"
  3161. // var res ResultSeventeen
  3162. // {
  3163. // result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  3164. // fmt.Println(result)
  3165. // saveLog(result, request, "4101A", "清单上传")
  3166. // var dat map[string]interface{}
  3167. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  3168. // fmt.Println(dat)
  3169. // } else {
  3170. // fmt.Println(err)
  3171. // }
  3172. // userJSONBytes, _ := json.Marshal(dat)
  3173. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  3174. // //utils.ErrorLog("解析失败:%v", err)
  3175. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3176. // //adminUser := c.GetAdminUserInfo()
  3177. // errlog := &models.HisOrderError{
  3178. // UserOrgId: org_id,
  3179. // Ctime: time.Now().Unix(),
  3180. // Mtime: time.Now().Unix(),
  3181. // ErrMsg: res.ErrMsg + "解析失败",
  3182. // Status: 1,
  3183. // PatientId: order_id,
  3184. // Stage: 10278000,
  3185. // }
  3186. // service.CreateErrMsgLog(errlog)
  3187. // continue
  3188. // }
  3189. // }
  3190. //
  3191. // if res.Infcode != 0 {
  3192. // //adminUser := c.GetAdminUserInfo()
  3193. // errlog := &models.HisOrderError{
  3194. // UserOrgId: org_id,
  3195. // Ctime: time.Now().Unix(),
  3196. // Mtime: time.Now().Unix(),
  3197. // ErrMsg: res.ErrMsg,
  3198. // Status: 1,
  3199. // PatientId: order_id,
  3200. // Stage: 10278000,
  3201. // }
  3202. // service.CreateErrMsgLog(errlog)
  3203. // continue
  3204. // } else {
  3205. // hisFundSettleListResult := &models.HisFundSettleListResult{
  3206. // Number: res.Output.SetlListId,
  3207. // Status: 1,
  3208. // Ctime: time.Now().Unix(),
  3209. // Mtime: time.Now().Unix(),
  3210. // UserOrgId: org_id,
  3211. // IsUpload: 1,
  3212. // OrderId: order_id,
  3213. // }
  3214. // service.CreateUploadRecord(hisFundSettleListResult)
  3215. // continue
  3216. // }
  3217. // }
  3218. //}
  3219. //
  3220. ////func GetbrBatchSettleList() {
  3221. //// org_id, _ := beego.AppConfig.Int64("org_id")
  3222. //// var orders []*models.HisOrder
  3223. //// orders, _ = service.GetAllHisOrder10278()
  3224. //// for _, item := range orders {
  3225. //// order_id := item.ID
  3226. //// order, _ := service.GetHisOrderByIDTwo(order_id)
  3227. //// roles, _ := service.GetDoctorListTwo(org_id)
  3228. //// his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  3229. //// admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  3230. //// curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  3231. //// depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  3232. //// miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  3233. //// pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  3234. //// doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  3235. //// if order.ID == 0 {
  3236. //// return
  3237. //// }
  3238. //// if his.BalanceAccountsType == 2 {
  3239. //// continue
  3240. //// }
  3241. //// struct4101 := service.Struct4101{
  3242. //// PsnNo: order.PsnNo,
  3243. //// MdtrtId: order.MdtrtId,
  3244. //// SetlId: order.SetlId,
  3245. //// PsnName: order.PsnName,
  3246. //// Gend: order.Gend,
  3247. //// Brdy: his.Brdy,
  3248. //// Age: his.Age,
  3249. //// Naty: order.Naty,
  3250. //// PatnCertType: order.PsnCertType,
  3251. //// Certno: order.Certno,
  3252. //// Prfs: "90",
  3253. //// ConerName: roles[0].UserName,
  3254. //// PatnRlts: "99",
  3255. //// ConerAddr: miConfig.OrgName,
  3256. //// ConerTel: admin.Mobile,
  3257. //// HiType: order.Insutype,
  3258. //// Insuplc: his.InsuplcAdmdvs,
  3259. //// MaindiagFlag: "1",
  3260. //// BillCode: order.SetlId,
  3261. //// BillNo: order.SetlId,
  3262. //// BizSn: order.Number,
  3263. //// PsnSelfPay: order.PsnPartAmt,
  3264. //// PsnOwnPay: order.PsnPartAmt,
  3265. //// AcctPay: order.AcctPay,
  3266. //// PsnCashpay: order.PsnCashPay,
  3267. //// HiPaymtd: "1",
  3268. //// Hsorg: his.InsuplcAdmdvs,
  3269. //// HsorgOpter: his.InsuplcAdmdvs,
  3270. //// MedinsFillPsn: curRoles.UserName,
  3271. //// MedinsFillDept: depart.Name,
  3272. //// IptMedType: "2",
  3273. //// }
  3274. ////
  3275. //// struct4101.SetlBegnDate = order.SetlTime
  3276. //// struct4101.SetlEndDate = order.SetlTime
  3277. ////
  3278. ////
  3279. //// var rf []CustomFundPay
  3280. //// json.Unmarshal([]byte(order.SetlDetail), &rf)
  3281. ////
  3282. //// //var tempFunPays []service.CustomStruct
  3283. //// //var tempFunPay610100 service.CustomStruct
  3284. ////
  3285. //// //for _, item := range rf {
  3286. //// // if item.FundPayType == "610100" {
  3287. //// // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  3288. //// // tempFunPay610100.FundPayType = item.FundPayType
  3289. //// // } else {
  3290. //// // var tempFunPay service.CustomStruct
  3291. //// // tempFunPay.FundPayamt = item.FundPayamt
  3292. //// // tempFunPay.FundPayType = item.FundPayType
  3293. //// // tempFunPays = append(tempFunPays, tempFunPay)
  3294. //// // }
  3295. //// //}
  3296. //// //tempFunPays = append(tempFunPays, tempFunPay610100)
  3297. //// //struct4101.CustomStruct = tempFunPays
  3298. ////
  3299. //// var tempDiaginfos []service.DiaginfoStructTwo
  3300. //// var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  3301. //// var tempOpspdiseinfos []service.OpspdiseinfoStruct
  3302. ////
  3303. //// diagnosis_ids := strings.Split(his.Diagnosis, ",")
  3304. //// var config []*models.HisXtDiagnoseConfig
  3305. //// for _, item := range diagnosis_ids {
  3306. //// id, _ := strconv.ParseInt(item, 10, 64)
  3307. //// diagnosisConfig, _ := service.FindDiagnoseById(id)
  3308. //// config = append(config, &diagnosisConfig)
  3309. //// }
  3310. ////
  3311. //// for index, item := range config {
  3312. //// if index == 0 {
  3313. //// var tempDiaginfo service.DiaginfoStructTwo
  3314. //// tempDiaginfo.DiagCode = item.CountryCode
  3315. //// tempDiaginfo.DiagName = item.CountryContentName
  3316. //// tempDiaginfo.DiagType = "1"
  3317. //// tempDiaginfo.MaindiagFlag = "1"
  3318. //// tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  3319. //// } else {
  3320. ////
  3321. //// var tempDiaginfo service.DiaginfoStructTwo
  3322. //// tempDiaginfo.DiagCode = item.CountryCode
  3323. //// tempDiaginfo.DiagName = item.CountryContentName
  3324. //// tempDiaginfo.DiagType = "2"
  3325. //// tempDiaginfo.MaindiagFlag = "0"
  3326. //// tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  3327. //// }
  3328. //// }
  3329. //// struct4101.Diseinfo = tempDiaginfos
  3330. ////
  3331. //// sickConfigTwo, _ := service.FindSickById(his.SickType)
  3332. //// tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  3333. //// tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  3334. //// tempOpspdiseinfo2.OprnOprtCode = ""
  3335. //// tempOpspdiseinfo2.OprnOprtName = ""
  3336. //// tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  3337. //// struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  3338. ////
  3339. //// //var iteminfo service.IteminfoStruct
  3340. ////
  3341. //// var bedCostTotal float64 = 0 //床位总费
  3342. //// var bedCostSelfTotal float64 = 0 //床位自费
  3343. //// var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  3344. ////
  3345. //// var examineCostTotal float64 = 0 //诊查总费
  3346. //// var examineCostSelfTotal float64 = 0 //诊查自费
  3347. //// var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  3348. ////
  3349. //// var nursingCostTotal float64 = 0 //护理总费
  3350. //// var nursingCostSelfTotal float64 = 0 //护理自费
  3351. //// var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  3352. ////
  3353. //// var chineseMedicineCostTotal float64 = 0 //中成药
  3354. //// var chineseMedicineCostSelfTotal float64 = 0 //中成药
  3355. //// var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  3356. ////
  3357. //// var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  3358. //// var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  3359. //// var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  3360. ////
  3361. //// var registerCostTotal float64 = 0 //一般诊疗费
  3362. //// var registerCostSelfTotal float64 = 0 //一般诊疗费
  3363. //// var registerPartSelfTotal float64 = 0 //一般诊疗费
  3364. ////
  3365. //// var operationCostTotal float64 = 0 //手术费
  3366. //// var operationCostSelfTotal float64 = 0 //手术费
  3367. //// var operationCostPartSelfTotal float64 = 0 //手术费
  3368. ////
  3369. //// var otherCostTotal float64 = 0 //其他费用
  3370. //// var otherCostSelfTotal float64 = 0 //其他费用
  3371. //// var otherCostPartSelfTotal float64 = 0 //其他费用
  3372. ////
  3373. //// var materialCostTotal float64 = 0 //材料费
  3374. //// var materialCostSelfTotal float64 = 0 //材料费
  3375. //// var materialCostPartSelfTotal float64 = 0 //材料费
  3376. ////
  3377. //// var westernMedicineCostTotal float64 = 0 //西药费
  3378. //// var westernMedicineCostSelfTotal float64 = 0 //西药费
  3379. //// var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  3380. ////
  3381. //// var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  3382. //// var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  3383. //// var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  3384. ////
  3385. //// var checkCostTotal float64 = 0 //检查费
  3386. //// var checkCostSelfTotal float64 = 0 //检查费
  3387. //// var checkCostPartSelfTotal float64 = 0 //检查费
  3388. ////
  3389. //// var laboratoryCostTotal float64 = 0 //化验费
  3390. //// var laboratoryCostSelfTotal float64 = 0 //化验费
  3391. //// var laboratoryCostPartSelfTotal float64 = 0 //化验费
  3392. ////
  3393. //// var treatCostTotal float64 = 0 //治疗费用
  3394. //// var treatCostSelfTotal float64 = 0 //治疗费用
  3395. //// var treatCostPartSelfTotal float64 = 0 //治疗费用
  3396. ////
  3397. //// decimal.DivisionPrecision = 2
  3398. ////
  3399. //// var bed_fulamt_ownpay_amt float64 = 0
  3400. ////
  3401. //// var examine_fulamt_ownpay_amt float64 = 0
  3402. ////
  3403. //// var nursing_fulamt_ownpay_amt float64 = 0
  3404. ////
  3405. //// var chinese_medicine_fulamt_ownpay_amt float64 = 0
  3406. ////
  3407. //// var commonly_treatment_fulamt_ownpay_amt float64 = 0
  3408. ////
  3409. //// var register_fulamt_ownpay_amt float64 = 0
  3410. ////
  3411. //// var operation_fulamt_ownpay_amt float64 = 0
  3412. //// var other_fulamt_ownpay_amt float64 = 0
  3413. //// var westernMedicine_fulamt_ownpay_amt float64 = 0
  3414. //// var chineseTraditional_fulamt_ownpay_amt float64 = 0
  3415. //// var check_fulamt_ownpay_amt float64 = 0
  3416. //// var material_fulamt_ownpay_amt float64 = 0
  3417. //// var laboratory_fulamt_ownpay_amt float64 = 0
  3418. //// var treat_fulamt_ownpay_amt float64 = 0
  3419. ////
  3420. //// var bed_claa_sunmfee float64 = 0
  3421. //// var bed_clab_amt float64 = 0
  3422. //// var bed_other_amt float64 = 0
  3423. ////
  3424. //// var examine_claa_sunmfee float64 = 0
  3425. //// var examine_clab_amt float64 = 0
  3426. //// var examine_other_amt float64 = 0
  3427. ////
  3428. //// var nursing_claa_sunmfee float64 = 0
  3429. //// var nursing_clab_amt float64 = 0
  3430. //// var nursing_other_amt float64 = 0
  3431. ////
  3432. //// var chinese_medicine_claa_sunmfee float64 = 0
  3433. //// var chinese_medicine_clab_amt float64 = 0
  3434. //// var chinese_medicine_other_amt float64 = 0
  3435. ////
  3436. //// var commonly_treatment_claa_sunmfee float64 = 0
  3437. //// var commonly_treatment_clab_amt float64 = 0
  3438. //// var commonly_treatment_other_amt float64 = 0
  3439. ////
  3440. //// var operation_claa_sunmfee float64 = 0
  3441. //// var operation_clab_amt float64 = 0
  3442. //// var operation_other_amt float64 = 0
  3443. ////
  3444. //// var other_claa_sunmfee float64 = 0
  3445. //// var other_clab_amt float64 = 0
  3446. //// var other_other_amt float64 = 0
  3447. ////
  3448. //// var westernMedicine_claa_sunmfee float64 = 0
  3449. //// var westernMedicine_clab_amt float64 = 0
  3450. //// var westernMedicine_other_amt float64 = 0
  3451. ////
  3452. //// var chineseTraditional_claa_sunmfee float64 = 0
  3453. //// var chineseTraditional_clab_amt float64 = 0
  3454. //// var chineseTraditional_other_amt float64 = 0
  3455. ////
  3456. //// var check_claa_sunmfee float64 = 0
  3457. //// var check_clab_amt float64 = 0
  3458. //// var check_other_amt float64 = 0
  3459. ////
  3460. //// var material_claa_sunmfee float64 = 0
  3461. //// var material_clab_amt float64 = 0
  3462. //// var material_other_amt float64 = 0
  3463. ////
  3464. //// var laboratory_claa_sunmfee float64 = 0
  3465. //// var laboratory_clab_amt float64 = 0
  3466. //// var laboratory_other_amt float64 = 0
  3467. ////
  3468. //// var treat_claa_sunmfee float64 = 0
  3469. //// var treat_clab_amt float64 = 0
  3470. //// var treat_other_amt float64 = 0
  3471. ////
  3472. //// var register_claa_sunmfee float64 = 0
  3473. //// var register_clab_amt float64 = 0
  3474. //// var register_other_amt float64 = 0
  3475. ////
  3476. //// for _, item := range order.HisOrderInfo {
  3477. //// if item.MedChrgitmType == "01" { //床位费
  3478. //// bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3479. //// bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3480. //// bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3481. //// bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3482. //// if item.ChrgitmLv == "1" {
  3483. //// bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3484. //// }
  3485. //// if item.ChrgitmLv == "2" {
  3486. //// bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3487. ////
  3488. //// }
  3489. //// if item.ChrgitmLv == "3" {
  3490. //// bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3491. //// }
  3492. ////
  3493. //// }
  3494. ////
  3495. //// if item.MedChrgitmType == "02" { //诊查
  3496. //// examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3497. //// examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3498. //// examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3499. //// examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3500. //// if item.ChrgitmLv == "1" {
  3501. //// examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3502. //// }
  3503. //// if item.ChrgitmLv == "2" {
  3504. //// examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3505. ////
  3506. //// }
  3507. //// if item.ChrgitmLv == "3" {
  3508. //// examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3509. //// }
  3510. ////
  3511. //// }
  3512. ////
  3513. //// if item.MedChrgitmType == "03" { //检查费
  3514. //// checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3515. //// checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3516. //// checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3517. //// check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3518. //// if item.ChrgitmLv == "1" {
  3519. ////
  3520. //// check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3521. ////
  3522. //// }
  3523. //// if item.ChrgitmLv == "2" {
  3524. //// check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3525. ////
  3526. //// }
  3527. //// if item.ChrgitmLv == "3" {
  3528. //// check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3529. //// }
  3530. //// }
  3531. ////
  3532. //// if item.MedChrgitmType == "04" { //化验费
  3533. //// laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3534. //// laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3535. //// laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3536. //// laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3537. //// if item.ChrgitmLv == "1" {
  3538. ////
  3539. //// laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3540. ////
  3541. //// }
  3542. //// if item.ChrgitmLv == "2" {
  3543. //// laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3544. ////
  3545. //// }
  3546. //// if item.ChrgitmLv == "3" {
  3547. //// laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3548. //// }
  3549. //// }
  3550. ////
  3551. //// if item.MedChrgitmType == "05" { //治疗费
  3552. //// treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3553. //// treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3554. //// treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3555. //// treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3556. //// if item.ChrgitmLv == "1" {
  3557. ////
  3558. //// treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3559. ////
  3560. //// }
  3561. //// if item.ChrgitmLv == "2" {
  3562. //// treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3563. ////
  3564. //// }
  3565. //// if item.ChrgitmLv == "3" {
  3566. //// treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3567. //// }
  3568. //// }
  3569. ////
  3570. //// if item.MedChrgitmType == "06" { //手术费
  3571. //// operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3572. //// operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3573. //// operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3574. //// operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3575. ////
  3576. //// if item.ChrgitmLv == "1" {
  3577. ////
  3578. //// operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3579. ////
  3580. //// }
  3581. //// if item.ChrgitmLv == "2" {
  3582. //// operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3583. ////
  3584. //// }
  3585. //// if item.ChrgitmLv == "3" {
  3586. //// operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3587. //// }
  3588. //// }
  3589. ////
  3590. //// if item.MedChrgitmType == "07" { //手术费
  3591. //// nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3592. //// nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3593. //// nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3594. //// nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3595. ////
  3596. //// if item.ChrgitmLv == "1" {
  3597. ////
  3598. //// nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3599. ////
  3600. //// }
  3601. //// if item.ChrgitmLv == "2" {
  3602. //// nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3603. ////
  3604. //// }
  3605. //// if item.ChrgitmLv == "3" {
  3606. //// nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3607. //// }
  3608. //// }
  3609. ////
  3610. //// if item.MedChrgitmType == "08" { //材料费
  3611. //// materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3612. //// materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3613. //// materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3614. //// material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3615. //// if item.ChrgitmLv == "1" {
  3616. ////
  3617. //// material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3618. ////
  3619. //// }
  3620. //// if item.ChrgitmLv == "2" {
  3621. //// material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3622. ////
  3623. //// }
  3624. //// if item.ChrgitmLv == "3" {
  3625. //// material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3626. //// }
  3627. //// }
  3628. //// if item.MedChrgitmType == "09" { //西药费
  3629. //// westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3630. //// westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3631. //// westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3632. //// westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3633. //// if item.ChrgitmLv == "1" {
  3634. //// westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3635. //// }
  3636. //// if item.ChrgitmLv == "2" {
  3637. //// westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3638. //// }
  3639. //// if item.ChrgitmLv == "3" {
  3640. //// westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3641. //// }
  3642. //// }
  3643. //// if item.MedChrgitmType == "10" { //中药饮片
  3644. //// chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3645. //// chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3646. //// chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3647. //// chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3648. //// if item.ChrgitmLv == "1" {
  3649. //// chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3650. //// }
  3651. //// if item.ChrgitmLv == "2" {
  3652. //// chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3653. //// }
  3654. //// if item.ChrgitmLv == "3" {
  3655. //// chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3656. //// }
  3657. //// }
  3658. ////
  3659. //// if item.MedChrgitmType == "11" { //中成费
  3660. //// chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3661. //// chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3662. //// chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3663. //// chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3664. //// if item.ChrgitmLv == "1" {
  3665. ////
  3666. //// chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3667. ////
  3668. //// }
  3669. //// if item.ChrgitmLv == "2" {
  3670. //// chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3671. ////
  3672. //// }
  3673. //// if item.ChrgitmLv == "3" {
  3674. //// chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3675. //// }
  3676. //// }
  3677. ////
  3678. //// if item.MedChrgitmType == "12" { //中成费
  3679. //// commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3680. //// commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3681. //// commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3682. //// commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3683. //// if item.ChrgitmLv == "1" {
  3684. ////
  3685. //// commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3686. ////
  3687. //// }
  3688. //// if item.ChrgitmLv == "2" {
  3689. //// commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3690. ////
  3691. //// }
  3692. //// if item.ChrgitmLv == "3" {
  3693. //// commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3694. //// }
  3695. //// }
  3696. ////
  3697. //// if item.MedChrgitmType == "13" { //中成费
  3698. //// registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3699. //// registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3700. //// registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3701. //// register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3702. //// if item.ChrgitmLv == "1" {
  3703. ////
  3704. //// register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3705. ////
  3706. //// }
  3707. //// if item.ChrgitmLv == "2" {
  3708. //// register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3709. ////
  3710. //// }
  3711. //// if item.ChrgitmLv == "3" {
  3712. //// register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3713. //// }
  3714. //// }
  3715. ////
  3716. //// if item.MedChrgitmType == "14" { //其他费
  3717. //// otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3718. //// otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3719. //// otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3720. //// other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3721. //// if item.ChrgitmLv == "1" {
  3722. //// other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3723. ////
  3724. //// }
  3725. //// if item.ChrgitmLv == "2" {
  3726. //// other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3727. ////
  3728. //// }
  3729. //// if item.ChrgitmLv == "3" {
  3730. //// other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3731. //// }
  3732. //// }
  3733. ////
  3734. //// }
  3735. ////
  3736. //// //var iteminfoStructs []service.IteminfoStruct
  3737. //// //
  3738. //// //if bedCostTotal != 0 {
  3739. //// // iteminfo.MedChrgitm = "01"
  3740. //// // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  3741. //// // iteminfo.Amt = bedCostTotal
  3742. //// // iteminfo.ClaaSumfee = bed_claa_sunmfee
  3743. //// // iteminfo.ClabAmt = bed_clab_amt
  3744. //// // iteminfo.OthAmt = bed_other_amt
  3745. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3746. //// //}
  3747. //// //
  3748. //// //if examineCostTotal != 0 {
  3749. //// // iteminfo.MedChrgitm = "02"
  3750. //// // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  3751. //// // iteminfo.Amt = examineCostTotal
  3752. //// // iteminfo.ClaaSumfee = examine_claa_sunmfee
  3753. //// // iteminfo.ClabAmt = examine_clab_amt
  3754. //// // iteminfo.OthAmt = examine_other_amt
  3755. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3756. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3757. //// //}
  3758. //// //
  3759. //// //if checkCostTotal != 0 {
  3760. //// // iteminfo.MedChrgitm = "03"
  3761. //// // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  3762. //// // iteminfo.Amt = checkCostTotal
  3763. //// // iteminfo.ClaaSumfee = check_claa_sunmfee
  3764. //// // iteminfo.ClabAmt = check_clab_amt
  3765. //// // iteminfo.OthAmt = check_other_amt
  3766. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3767. //// //
  3768. //// //}
  3769. //// //
  3770. //// //if laboratoryCostTotal != 0 {
  3771. //// // iteminfo.MedChrgitm = "04"
  3772. //// // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  3773. //// // iteminfo.Amt = laboratoryCostTotal
  3774. //// // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  3775. //// // iteminfo.ClabAmt = laboratory_clab_amt
  3776. //// // iteminfo.OthAmt = laboratory_other_amt
  3777. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3778. //// //
  3779. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3780. //// //
  3781. //// //}
  3782. //// //
  3783. //// //if treatCostTotal != 0 {
  3784. //// // iteminfo.MedChrgitm = "05"
  3785. //// // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  3786. //// // iteminfo.Amt = treatCostTotal
  3787. //// // iteminfo.ClaaSumfee = treat_claa_sunmfee
  3788. //// // iteminfo.ClabAmt = treat_clab_amt
  3789. //// // iteminfo.OthAmt = treat_other_amt
  3790. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3791. //// // //(struct4101.IteminfoStruct, iteminfo)
  3792. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3793. //// //}
  3794. //// //
  3795. //// //if operationCostTotal != 0 {
  3796. //// // iteminfo.MedChrgitm = "06"
  3797. //// // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  3798. //// // iteminfo.Amt = operationCostTotal
  3799. //// // iteminfo.ClaaSumfee = operation_claa_sunmfee
  3800. //// // iteminfo.ClabAmt = operation_clab_amt
  3801. //// // iteminfo.OthAmt = operation_other_amt
  3802. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3803. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3804. //// //}
  3805. //// //
  3806. //// //if nursingCostTotal != 0 {
  3807. //// // iteminfo.MedChrgitm = "07"
  3808. //// // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  3809. //// // iteminfo.Amt = nursingCostTotal
  3810. //// // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  3811. //// // iteminfo.ClabAmt = nursing_clab_amt
  3812. //// // iteminfo.OthAmt = nursing_other_amt
  3813. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3814. //// //}
  3815. //// //
  3816. //// //if materialCostTotal != 0 {
  3817. //// // iteminfo.MedChrgitm = "08"
  3818. //// // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  3819. //// // iteminfo.Amt = materialCostTotal
  3820. //// // iteminfo.ClaaSumfee = material_claa_sunmfee
  3821. //// // iteminfo.ClabAmt = material_clab_amt
  3822. //// // iteminfo.OthAmt = material_other_amt
  3823. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3824. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3825. //// //}
  3826. //// //
  3827. //// //if westernMedicineCostTotal != 0 {
  3828. //// // iteminfo.MedChrgitm = "09"
  3829. //// // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  3830. //// // iteminfo.Amt = westernMedicineCostTotal
  3831. //// // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  3832. //// // iteminfo.ClabAmt = westernMedicine_clab_amt
  3833. //// // iteminfo.OthAmt = westernMedicine_other_amt
  3834. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3835. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3836. //// //
  3837. //// //}
  3838. //// //
  3839. //// //if chineseMedicineCostTotal != 0 {
  3840. //// // iteminfo.MedChrgitm = "10"
  3841. //// // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  3842. //// // iteminfo.Amt = chineseMedicineCostTotal
  3843. //// // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  3844. //// // iteminfo.ClabAmt = chinese_medicine_clab_amt
  3845. //// // iteminfo.OthAmt = chinese_medicine_other_amt
  3846. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3847. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3848. //// //
  3849. //// //}
  3850. //// //
  3851. //// //if chineseTraditionalMedicineCostTotal != 0 {
  3852. //// // iteminfo.MedChrgitm = "11"
  3853. //// // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  3854. //// // iteminfo.Amt = westernMedicineCostTotal
  3855. //// // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  3856. //// // iteminfo.ClabAmt = westernMedicine_clab_amt
  3857. //// // iteminfo.OthAmt = westernMedicine_other_amt
  3858. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3859. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3860. //// //
  3861. //// //}
  3862. //// //
  3863. //// //if commonlyTreatmentCostTotal != 0 {
  3864. //// // iteminfo.MedChrgitm = "12"
  3865. //// // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  3866. //// // iteminfo.Amt = commonlyTreatmentCostTotal
  3867. //// // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  3868. //// // iteminfo.ClabAmt = commonly_treatment_clab_amt
  3869. //// // iteminfo.OthAmt = commonly_treatment_other_amt
  3870. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3871. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3872. //// //
  3873. //// //}
  3874. //// //
  3875. //// //if registerCostTotal != 0 {
  3876. //// // iteminfo.MedChrgitm = "13"
  3877. //// // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  3878. //// // iteminfo.Amt = registerCostTotal
  3879. //// // iteminfo.ClaaSumfee = register_claa_sunmfee
  3880. //// // iteminfo.ClabAmt = register_clab_amt
  3881. //// // iteminfo.OthAmt = register_other_amt
  3882. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3883. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3884. //// //
  3885. //// //}
  3886. //// //
  3887. //// //if otherCostTotal != 0 {
  3888. //// // iteminfo.MedChrgitm = "14"
  3889. //// // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  3890. //// // iteminfo.Amt = otherCostTotal
  3891. //// // iteminfo.ClaaSumfee = other_claa_sunmfee
  3892. //// // iteminfo.ClabAmt = other_clab_amt
  3893. //// // iteminfo.OthAmt = other_other_amt
  3894. //// // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3895. //// // iteminfoStructs = append(iteminfoStructs, iteminfo)
  3896. //// //
  3897. //// //}
  3898. //// //
  3899. //// //struct4101.IteminfoStruct = iteminfoStructs
  3900. //// time_arr := strings.Split(order.SetlTime, " ")
  3901. //// struct4101.AdmTime = time_arr[0]
  3902. //// struct4101.AdmEndTime = time_arr[0]
  3903. //// struct4101.DoctorName = doctor.UserName
  3904. //// struct4101.DoctorCode = doctor.DoctorNumber
  3905. ////
  3906. //// struct4101.Ntly = "中国"
  3907. //// struct4101.AdmCaty = "A03.06"
  3908. //// var res ResultSeventeen
  3909. //// {
  3910. //// result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  3911. //// fmt.Println(result)
  3912. //// saveLog(result, request, "4101A", "清单上传")
  3913. //// var dat map[string]interface{}
  3914. //// if err := json.Unmarshal([]byte(result), &dat); err == nil {
  3915. //// fmt.Println(dat)
  3916. //// } else {
  3917. //// fmt.Println(err)
  3918. //// }
  3919. //// userJSONBytes, _ := json.Marshal(dat)
  3920. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  3921. //// //utils.ErrorLog("解析失败:%v", err)
  3922. //// //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3923. //// //adminUser := c.GetAdminUserInfo()
  3924. //// errlog := &models.HisOrderError{
  3925. //// UserOrgId: org_id,
  3926. //// Ctime: time.Now().Unix(),
  3927. //// Mtime: time.Now().Unix(),
  3928. //// ErrMsg: res.ErrMsg + "解析失败",
  3929. //// Status: 1,
  3930. //// PatientId: order_id,
  3931. //// Stage: 10138,
  3932. //// }
  3933. //// service.CreateErrMsgLog(errlog)
  3934. //// continue
  3935. //// }
  3936. //// }
  3937. ////
  3938. //// if res.Infcode != 0 {
  3939. //// //adminUser := c.GetAdminUserInfo()
  3940. //// errlog := &models.HisOrderError{
  3941. //// UserOrgId: org_id,
  3942. //// Ctime: time.Now().Unix(),
  3943. //// Mtime: time.Now().Unix(),
  3944. //// ErrMsg: res.ErrMsg,
  3945. //// Status: 1,
  3946. //// PatientId: order_id,
  3947. //// Stage: 10138,
  3948. //// }
  3949. //// service.CreateErrMsgLog(errlog)
  3950. //// continue
  3951. //// } else {
  3952. //// hisFundSettleListResult := &models.HisFundSettleListResult{
  3953. //// Number: res.Output.SetlListId,
  3954. //// Status: 1,
  3955. //// Ctime: time.Now().Unix(),
  3956. //// Mtime: time.Now().Unix(),
  3957. //// UserOrgId: org_id,
  3958. //// IsUpload: 1,
  3959. //// OrderId: order_id,
  3960. //// }
  3961. //// service.CreateUploadRecord(hisFundSettleListResult)
  3962. //// continue
  3963. //// }
  3964. //// }
  3965. ////}
  3966. //
  3967. //func GetBatchSettleList() {
  3968. //
  3969. // org_id, _ := beego.AppConfig.Int64("org_id")
  3970. // //list, _ := service.GetLastFundList(org_id)
  3971. // //orders, _ := service.GetOrderError(org_id)
  3972. // //order, _ := service.GetHisOrderByID(list.OrderId)
  3973. // var orders []*models.HisOrder
  3974. // //if order.ID > 0 {
  3975. // //
  3976. // // orders, _ = service.GetAllHisOrderTwo(org_id, order.ID)
  3977. // //
  3978. // //} else {
  3979. // orders, _ = service.GetAllHisOrder10106(org_id)
  3980. // //
  3981. // //}
  3982. //
  3983. // for _, item := range orders {
  3984. // order_id := item.ID
  3985. // order, _ := service.GetHisOrderByIDTwo(order_id)
  3986. // roles, _ := service.GetDoctorListTwo(org_id)
  3987. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  3988. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  3989. // curRoles, _ := service.GetAdminUserInfoByID(org_id, 2495)
  3990. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  3991. // miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  3992. //
  3993. // pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  3994. //
  3995. // doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  3996. //
  3997. // if order.ID == 0 {
  3998. // return
  3999. // }
  4000. // if his.BalanceAccountsType == 2 {
  4001. // continue
  4002. // }
  4003. // struct4101 := service.Struct4101{
  4004. // PsnNo: order.PsnNo,
  4005. // MdtrtId: order.MdtrtId,
  4006. // SetlId: order.SetlId,
  4007. // PsnName: order.PsnName,
  4008. // Gend: order.Gend,
  4009. // Brdy: his.Brdy,
  4010. // Age: his.Age,
  4011. // Naty: order.Naty,
  4012. // PatnCertType: "01",
  4013. // Certno: order.Certno,
  4014. // Prfs: "90",
  4015. // ConerName: roles[0].UserName,
  4016. // PatnRlts: "99",
  4017. // ConerAddr: miConfig.OrgName,
  4018. // ConerTel: admin.Mobile,
  4019. // HiType: order.Insutype,
  4020. // Insuplc: his.InsuplcAdmdvs,
  4021. // MaindiagFlag: "1",
  4022. // BillCode: order.SetlId,
  4023. // BillNo: order.SetlId,
  4024. // BizSn: order.Number,
  4025. // PsnSelfPay: order.PsnPartAmt,
  4026. // PsnOwnPay: order.PsnPartAmt,
  4027. // AcctPay: order.AcctPay,
  4028. // PsnCashpay: order.PsnCashPay,
  4029. // HiPaymtd: "1",
  4030. // Hsorg: his.InsuplcAdmdvs,
  4031. // HsorgOpter: his.InsuplcAdmdvs,
  4032. // MedinsFillPsn: curRoles.UserName,
  4033. // MedinsFillDept: depart.Name,
  4034. // IptMedType: "2",
  4035. // }
  4036. //
  4037. // struct4101.SetlBegnDate = order.SetlTime
  4038. // struct4101.SetlEndDate = order.SetlTime
  4039. //
  4040. // //if order.SettleType == 1 {
  4041. // // t := time.Unix(int64(order.SettleAccountsDate), 0)
  4042. // // dateStr := t.Format("2006-01-02")
  4043. // // struct4101.SetlBegnDate = dateStr
  4044. // // struct4101.SetlEndDate = dateStr
  4045. // //} else {
  4046. // // t := time.Unix(int64(order.SettleStartTime), 0)
  4047. // // t2 := time.Unix(int64(order.SettleEndTime), 0)
  4048. // // dateStartStr := t.Format("2006-01-02")
  4049. // // dateEndStr := t2.Format("2006-01-02")
  4050. // // struct4101.SetlBegnDate = dateStartStr
  4051. // // struct4101.SetlEndDate = dateEndStr
  4052. // //}
  4053. //
  4054. // var rf []CustomFundPay
  4055. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  4056. //
  4057. // var tempFunPays []service.CustomStruct
  4058. // var tempFunPay610100 service.CustomStruct
  4059. //
  4060. // for _, item := range rf {
  4061. // if item.FundPayType == "610100" {
  4062. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  4063. // tempFunPay610100.FundPayType = item.FundPayType
  4064. // } else {
  4065. // var tempFunPay service.CustomStruct
  4066. // tempFunPay.FundPayamt = item.FundPayamt
  4067. // tempFunPay.FundPayType = item.FundPayType
  4068. // tempFunPays = append(tempFunPays, tempFunPay)
  4069. // }
  4070. // }
  4071. // tempFunPays = append(tempFunPays, tempFunPay610100)
  4072. // struct4101.CustomStruct = tempFunPays
  4073. //
  4074. // var tempDiaginfos []service.DiaginfoStructTwo
  4075. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  4076. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  4077. //
  4078. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  4079. // var config []*models.HisXtDiagnoseConfig
  4080. // for _, item := range diagnosis_ids {
  4081. // id, _ := strconv.ParseInt(item, 10, 64)
  4082. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  4083. // config = append(config, &diagnosisConfig)
  4084. // }
  4085. //
  4086. // for index, item := range config {
  4087. // if index == 0 {
  4088. // var tempDiaginfo service.DiaginfoStructTwo
  4089. // tempDiaginfo.DiagCode = item.CountryCode
  4090. // tempDiaginfo.DiagName = item.CountryContentName
  4091. // tempDiaginfo.DiagType = "1"
  4092. // tempDiaginfo.MaindiagFlag = "1"
  4093. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  4094. // } else {
  4095. //
  4096. // var tempDiaginfo service.DiaginfoStructTwo
  4097. // tempDiaginfo.DiagCode = item.CountryCode
  4098. // tempDiaginfo.DiagName = item.CountryContentName
  4099. // tempDiaginfo.DiagType = "2"
  4100. // tempDiaginfo.MaindiagFlag = "0"
  4101. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  4102. // }
  4103. // }
  4104. // struct4101.Diseinfo = tempDiaginfos
  4105. //
  4106. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  4107. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  4108. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  4109. // tempOpspdiseinfo2.OprnOprtCode = ""
  4110. // tempOpspdiseinfo2.OprnOprtName = ""
  4111. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  4112. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  4113. //
  4114. // var iteminfo service.IteminfoStruct
  4115. //
  4116. // var bedCostTotal float64 = 0 //床位总费
  4117. // var bedCostSelfTotal float64 = 0 //床位自费
  4118. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  4119. //
  4120. // var examineCostTotal float64 = 0 //诊查总费
  4121. // var examineCostSelfTotal float64 = 0 //诊查自费
  4122. // var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  4123. //
  4124. // var nursingCostTotal float64 = 0 //护理总费
  4125. // var nursingCostSelfTotal float64 = 0 //护理自费
  4126. // var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  4127. //
  4128. // var chineseMedicineCostTotal float64 = 0 //中成药
  4129. // var chineseMedicineCostSelfTotal float64 = 0 //中成药
  4130. // var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  4131. //
  4132. // var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  4133. // var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  4134. // var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  4135. //
  4136. // var registerCostTotal float64 = 0 //一般诊疗费
  4137. // var registerCostSelfTotal float64 = 0 //一般诊疗费
  4138. // var registerPartSelfTotal float64 = 0 //一般诊疗费
  4139. //
  4140. // var operationCostTotal float64 = 0 //手术费
  4141. // var operationCostSelfTotal float64 = 0 //手术费
  4142. // var operationCostPartSelfTotal float64 = 0 //手术费
  4143. //
  4144. // var otherCostTotal float64 = 0 //其他费用
  4145. // var otherCostSelfTotal float64 = 0 //其他费用
  4146. // var otherCostPartSelfTotal float64 = 0 //其他费用
  4147. //
  4148. // var materialCostTotal float64 = 0 //材料费
  4149. // var materialCostSelfTotal float64 = 0 //材料费
  4150. // var materialCostPartSelfTotal float64 = 0 //材料费
  4151. //
  4152. // var westernMedicineCostTotal float64 = 0 //西药费
  4153. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  4154. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  4155. //
  4156. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  4157. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  4158. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  4159. //
  4160. // var checkCostTotal float64 = 0 //检查费
  4161. // var checkCostSelfTotal float64 = 0 //检查费
  4162. // var checkCostPartSelfTotal float64 = 0 //检查费
  4163. //
  4164. // var laboratoryCostTotal float64 = 0 //化验费
  4165. // var laboratoryCostSelfTotal float64 = 0 //化验费
  4166. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  4167. //
  4168. // var treatCostTotal float64 = 0 //治疗费用
  4169. // var treatCostSelfTotal float64 = 0 //治疗费用
  4170. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  4171. //
  4172. // decimal.DivisionPrecision = 2
  4173. //
  4174. // var bed_fulamt_ownpay_amt float64 = 0
  4175. //
  4176. // var examine_fulamt_ownpay_amt float64 = 0
  4177. //
  4178. // var nursing_fulamt_ownpay_amt float64 = 0
  4179. //
  4180. // var chinese_medicine_fulamt_ownpay_amt float64 = 0
  4181. //
  4182. // var commonly_treatment_fulamt_ownpay_amt float64 = 0
  4183. //
  4184. // var register_fulamt_ownpay_amt float64 = 0
  4185. //
  4186. // var operation_fulamt_ownpay_amt float64 = 0
  4187. // var other_fulamt_ownpay_amt float64 = 0
  4188. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  4189. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  4190. // var check_fulamt_ownpay_amt float64 = 0
  4191. // var material_fulamt_ownpay_amt float64 = 0
  4192. // var laboratory_fulamt_ownpay_amt float64 = 0
  4193. // var treat_fulamt_ownpay_amt float64 = 0
  4194. //
  4195. // var bed_claa_sunmfee float64 = 0
  4196. // var bed_clab_amt float64 = 0
  4197. // var bed_other_amt float64 = 0
  4198. //
  4199. // var examine_claa_sunmfee float64 = 0
  4200. // var examine_clab_amt float64 = 0
  4201. // var examine_other_amt float64 = 0
  4202. //
  4203. // var nursing_claa_sunmfee float64 = 0
  4204. // var nursing_clab_amt float64 = 0
  4205. // var nursing_other_amt float64 = 0
  4206. //
  4207. // var chinese_medicine_claa_sunmfee float64 = 0
  4208. // var chinese_medicine_clab_amt float64 = 0
  4209. // var chinese_medicine_other_amt float64 = 0
  4210. //
  4211. // var commonly_treatment_claa_sunmfee float64 = 0
  4212. // var commonly_treatment_clab_amt float64 = 0
  4213. // var commonly_treatment_other_amt float64 = 0
  4214. //
  4215. // var operation_claa_sunmfee float64 = 0
  4216. // var operation_clab_amt float64 = 0
  4217. // var operation_other_amt float64 = 0
  4218. //
  4219. // var other_claa_sunmfee float64 = 0
  4220. // var other_clab_amt float64 = 0
  4221. // var other_other_amt float64 = 0
  4222. //
  4223. // var westernMedicine_claa_sunmfee float64 = 0
  4224. // var westernMedicine_clab_amt float64 = 0
  4225. // var westernMedicine_other_amt float64 = 0
  4226. //
  4227. // var chineseTraditional_claa_sunmfee float64 = 0
  4228. // var chineseTraditional_clab_amt float64 = 0
  4229. // var chineseTraditional_other_amt float64 = 0
  4230. //
  4231. // var check_claa_sunmfee float64 = 0
  4232. // var check_clab_amt float64 = 0
  4233. // var check_other_amt float64 = 0
  4234. //
  4235. // var material_claa_sunmfee float64 = 0
  4236. // var material_clab_amt float64 = 0
  4237. // var material_other_amt float64 = 0
  4238. //
  4239. // var laboratory_claa_sunmfee float64 = 0
  4240. // var laboratory_clab_amt float64 = 0
  4241. // var laboratory_other_amt float64 = 0
  4242. //
  4243. // var treat_claa_sunmfee float64 = 0
  4244. // var treat_clab_amt float64 = 0
  4245. // var treat_other_amt float64 = 0
  4246. //
  4247. // var register_claa_sunmfee float64 = 0
  4248. // var register_clab_amt float64 = 0
  4249. // var register_other_amt float64 = 0
  4250. //
  4251. // for _, item := range order.HisOrderInfo {
  4252. // if item.MedChrgitmType == "01" { //床位费
  4253. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4254. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4255. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4256. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4257. // if item.ChrgitmLv == "1" {
  4258. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4259. // }
  4260. // if item.ChrgitmLv == "2" {
  4261. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4262. //
  4263. // }
  4264. // if item.ChrgitmLv == "3" {
  4265. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4266. // }
  4267. //
  4268. // }
  4269. //
  4270. // if item.MedChrgitmType == "02" { //诊查
  4271. // examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4272. // examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4273. // examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4274. // examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4275. // if item.ChrgitmLv == "1" {
  4276. // examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4277. // }
  4278. // if item.ChrgitmLv == "2" {
  4279. // examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4280. //
  4281. // }
  4282. // if item.ChrgitmLv == "3" {
  4283. // examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4284. // }
  4285. //
  4286. // }
  4287. //
  4288. // if item.MedChrgitmType == "03" { //检查费
  4289. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4290. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4291. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4292. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4293. // if item.ChrgitmLv == "1" {
  4294. //
  4295. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4296. //
  4297. // }
  4298. // if item.ChrgitmLv == "2" {
  4299. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4300. //
  4301. // }
  4302. // if item.ChrgitmLv == "3" {
  4303. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4304. // }
  4305. // }
  4306. //
  4307. // if item.MedChrgitmType == "04" { //化验费
  4308. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4309. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4310. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4311. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4312. // if item.ChrgitmLv == "1" {
  4313. //
  4314. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4315. //
  4316. // }
  4317. // if item.ChrgitmLv == "2" {
  4318. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4319. //
  4320. // }
  4321. // if item.ChrgitmLv == "3" {
  4322. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4323. // }
  4324. // }
  4325. //
  4326. // if item.MedChrgitmType == "05" { //治疗费
  4327. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4328. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4329. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4330. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4331. // if item.ChrgitmLv == "1" {
  4332. //
  4333. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4334. //
  4335. // }
  4336. // if item.ChrgitmLv == "2" {
  4337. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4338. //
  4339. // }
  4340. // if item.ChrgitmLv == "3" {
  4341. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4342. // }
  4343. // }
  4344. //
  4345. // if item.MedChrgitmType == "06" { //手术费
  4346. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4347. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4348. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4349. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4350. //
  4351. // if item.ChrgitmLv == "1" {
  4352. //
  4353. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4354. //
  4355. // }
  4356. // if item.ChrgitmLv == "2" {
  4357. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4358. //
  4359. // }
  4360. // if item.ChrgitmLv == "3" {
  4361. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4362. // }
  4363. // }
  4364. //
  4365. // if item.MedChrgitmType == "07" { //手术费
  4366. // nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4367. // nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4368. // nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4369. // nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4370. //
  4371. // if item.ChrgitmLv == "1" {
  4372. //
  4373. // nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4374. //
  4375. // }
  4376. // if item.ChrgitmLv == "2" {
  4377. // nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4378. //
  4379. // }
  4380. // if item.ChrgitmLv == "3" {
  4381. // nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4382. // }
  4383. // }
  4384. //
  4385. // if item.MedChrgitmType == "08" { //材料费
  4386. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4387. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4388. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4389. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4390. // if item.ChrgitmLv == "1" {
  4391. //
  4392. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4393. //
  4394. // }
  4395. // if item.ChrgitmLv == "2" {
  4396. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4397. //
  4398. // }
  4399. // if item.ChrgitmLv == "3" {
  4400. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4401. // }
  4402. // }
  4403. // if item.MedChrgitmType == "09" { //西药费
  4404. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4405. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4406. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4407. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4408. // if item.ChrgitmLv == "1" {
  4409. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4410. // }
  4411. // if item.ChrgitmLv == "2" {
  4412. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4413. // }
  4414. // if item.ChrgitmLv == "3" {
  4415. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4416. // }
  4417. // }
  4418. // if item.MedChrgitmType == "10" { //中药饮片
  4419. // chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4420. // chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4421. // chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4422. // chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4423. // if item.ChrgitmLv == "1" {
  4424. // chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4425. // }
  4426. // if item.ChrgitmLv == "2" {
  4427. // chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4428. // }
  4429. // if item.ChrgitmLv == "3" {
  4430. // chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4431. // }
  4432. // }
  4433. //
  4434. // if item.MedChrgitmType == "11" { //中成费
  4435. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4436. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4437. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4438. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4439. // if item.ChrgitmLv == "1" {
  4440. //
  4441. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4442. //
  4443. // }
  4444. // if item.ChrgitmLv == "2" {
  4445. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4446. //
  4447. // }
  4448. // if item.ChrgitmLv == "3" {
  4449. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4450. // }
  4451. // }
  4452. //
  4453. // if item.MedChrgitmType == "12" { //中成费
  4454. // commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4455. // commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4456. // commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4457. // commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4458. // if item.ChrgitmLv == "1" {
  4459. //
  4460. // commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4461. //
  4462. // }
  4463. // if item.ChrgitmLv == "2" {
  4464. // commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4465. //
  4466. // }
  4467. // if item.ChrgitmLv == "3" {
  4468. // commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4469. // }
  4470. // }
  4471. //
  4472. // if item.MedChrgitmType == "13" { //中成费
  4473. // registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4474. // registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4475. // registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4476. // register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4477. // if item.ChrgitmLv == "1" {
  4478. //
  4479. // register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4480. //
  4481. // }
  4482. // if item.ChrgitmLv == "2" {
  4483. // register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4484. //
  4485. // }
  4486. // if item.ChrgitmLv == "3" {
  4487. // register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4488. // }
  4489. // }
  4490. //
  4491. // if item.MedChrgitmType == "14" { //其他费
  4492. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4493. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4494. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4495. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4496. // if item.ChrgitmLv == "1" {
  4497. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4498. //
  4499. // }
  4500. // if item.ChrgitmLv == "2" {
  4501. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4502. //
  4503. // }
  4504. // if item.ChrgitmLv == "3" {
  4505. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4506. // }
  4507. // }
  4508. //
  4509. // }
  4510. //
  4511. // var iteminfoStructs []service.IteminfoStruct
  4512. //
  4513. // if bedCostTotal != 0 {
  4514. // iteminfo.MedChrgitm = "01"
  4515. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  4516. // iteminfo.Amt = bedCostTotal
  4517. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  4518. // iteminfo.ClabAmt = bed_clab_amt
  4519. // iteminfo.OthAmt = bed_other_amt
  4520. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4521. // }
  4522. //
  4523. // if examineCostTotal != 0 {
  4524. // iteminfo.MedChrgitm = "02"
  4525. // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  4526. // iteminfo.Amt = examineCostTotal
  4527. // iteminfo.ClaaSumfee = examine_claa_sunmfee
  4528. // iteminfo.ClabAmt = examine_clab_amt
  4529. // iteminfo.OthAmt = examine_other_amt
  4530. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4531. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4532. // }
  4533. //
  4534. // if checkCostTotal != 0 {
  4535. // iteminfo.MedChrgitm = "03"
  4536. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  4537. // iteminfo.Amt = checkCostTotal
  4538. // iteminfo.ClaaSumfee = check_claa_sunmfee
  4539. // iteminfo.ClabAmt = check_clab_amt
  4540. // iteminfo.OthAmt = check_other_amt
  4541. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4542. //
  4543. // }
  4544. //
  4545. // if laboratoryCostTotal != 0 {
  4546. // iteminfo.MedChrgitm = "04"
  4547. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  4548. // iteminfo.Amt = laboratoryCostTotal
  4549. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  4550. // iteminfo.ClabAmt = laboratory_clab_amt
  4551. // iteminfo.OthAmt = laboratory_other_amt
  4552. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4553. //
  4554. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4555. //
  4556. // }
  4557. //
  4558. // if treatCostTotal != 0 {
  4559. // iteminfo.MedChrgitm = "05"
  4560. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  4561. // iteminfo.Amt = treatCostTotal
  4562. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  4563. // iteminfo.ClabAmt = treat_clab_amt
  4564. // iteminfo.OthAmt = treat_other_amt
  4565. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4566. // //(struct4101.IteminfoStruct, iteminfo)
  4567. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4568. // }
  4569. //
  4570. // if operationCostTotal != 0 {
  4571. // iteminfo.MedChrgitm = "06"
  4572. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  4573. // iteminfo.Amt = operationCostTotal
  4574. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  4575. // iteminfo.ClabAmt = operation_clab_amt
  4576. // iteminfo.OthAmt = operation_other_amt
  4577. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4578. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4579. // }
  4580. //
  4581. // if nursingCostTotal != 0 {
  4582. // iteminfo.MedChrgitm = "07"
  4583. // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  4584. // iteminfo.Amt = nursingCostTotal
  4585. // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  4586. // iteminfo.ClabAmt = nursing_clab_amt
  4587. // iteminfo.OthAmt = nursing_other_amt
  4588. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4589. // }
  4590. //
  4591. // if materialCostTotal != 0 {
  4592. // iteminfo.MedChrgitm = "08"
  4593. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  4594. // iteminfo.Amt = materialCostTotal
  4595. // iteminfo.ClaaSumfee = material_claa_sunmfee
  4596. // iteminfo.ClabAmt = material_clab_amt
  4597. // iteminfo.OthAmt = material_other_amt
  4598. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4599. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4600. // }
  4601. //
  4602. // if westernMedicineCostTotal != 0 {
  4603. // iteminfo.MedChrgitm = "09"
  4604. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  4605. // iteminfo.Amt = westernMedicineCostTotal
  4606. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  4607. // iteminfo.ClabAmt = westernMedicine_clab_amt
  4608. // iteminfo.OthAmt = westernMedicine_other_amt
  4609. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4610. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4611. //
  4612. // }
  4613. //
  4614. // if chineseMedicineCostTotal != 0 {
  4615. // iteminfo.MedChrgitm = "10"
  4616. // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  4617. // iteminfo.Amt = chineseMedicineCostTotal
  4618. // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  4619. // iteminfo.ClabAmt = chinese_medicine_clab_amt
  4620. // iteminfo.OthAmt = chinese_medicine_other_amt
  4621. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4622. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4623. //
  4624. // }
  4625. //
  4626. // if chineseTraditionalMedicineCostTotal != 0 {
  4627. // iteminfo.MedChrgitm = "11"
  4628. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  4629. // iteminfo.Amt = westernMedicineCostTotal
  4630. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  4631. // iteminfo.ClabAmt = westernMedicine_clab_amt
  4632. // iteminfo.OthAmt = westernMedicine_other_amt
  4633. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4634. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4635. //
  4636. // }
  4637. //
  4638. // if commonlyTreatmentCostTotal != 0 {
  4639. // iteminfo.MedChrgitm = "12"
  4640. // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  4641. // iteminfo.Amt = commonlyTreatmentCostTotal
  4642. // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  4643. // iteminfo.ClabAmt = commonly_treatment_clab_amt
  4644. // iteminfo.OthAmt = commonly_treatment_other_amt
  4645. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4646. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4647. //
  4648. // }
  4649. //
  4650. // if registerCostTotal != 0 {
  4651. // iteminfo.MedChrgitm = "13"
  4652. // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  4653. // iteminfo.Amt = registerCostTotal
  4654. // iteminfo.ClaaSumfee = register_claa_sunmfee
  4655. // iteminfo.ClabAmt = register_clab_amt
  4656. // iteminfo.OthAmt = register_other_amt
  4657. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4658. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4659. //
  4660. // }
  4661. //
  4662. // if otherCostTotal != 0 {
  4663. // iteminfo.MedChrgitm = "14"
  4664. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  4665. // iteminfo.Amt = otherCostTotal
  4666. // iteminfo.ClaaSumfee = other_claa_sunmfee
  4667. // iteminfo.ClabAmt = other_clab_amt
  4668. // iteminfo.OthAmt = other_other_amt
  4669. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4670. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4671. //
  4672. // }
  4673. //
  4674. // struct4101.IteminfoStruct = iteminfoStructs
  4675. // time_arr := strings.Split(order.SetlTime, " ")
  4676. // struct4101.AdmTime = time_arr[0]
  4677. // struct4101.AdmEndTime = time_arr[0]
  4678. // struct4101.DoctorName = doctor.UserName
  4679. // struct4101.DoctorCode = doctor.DoctorNumber
  4680. //
  4681. // struct4101.Ntly = "中国"
  4682. // struct4101.AdmCaty = "A03.06"
  4683. // var res ResultSeventeen
  4684. // if miConfig.MdtrtareaAdmvs == "421300" {
  4685. // data := make(map[string]interface{})
  4686. // data["struct4101"] = struct4101
  4687. // data["secret_key"] = miConfig.SecretKey
  4688. // data["org_name"] = miConfig.OrgName
  4689. // data["opera"] = curRoles.UserName
  4690. // data["code"] = miConfig.Code
  4691. // data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
  4692. // data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  4693. //
  4694. // client := &http.Client{}
  4695. // bytesData, _ := json.Marshal(data)
  4696. // req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/4101", bytes.NewReader(bytesData))
  4697. // resp, _ := client.Do(req)
  4698. // defer resp.Body.Close()
  4699. // body, ioErr := ioutil.ReadAll(resp.Body)
  4700. // if ioErr != nil {
  4701. // //utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  4702. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  4703. // return
  4704. // }
  4705. // var respJSON map[string]interface{}
  4706. // if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  4707. // //utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  4708. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  4709. // return
  4710. // }
  4711. //
  4712. // respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  4713. // userJSONBytes, _ := json.Marshal(respJSON)
  4714. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  4715. // //utils.ErrorLog("解析失败:%v", err)
  4716. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  4717. //
  4718. // errlog := &models.HisOrderError{
  4719. // UserOrgId: org_id,
  4720. // Ctime: time.Now().Unix(),
  4721. // Mtime: time.Now().Unix(),
  4722. // ErrMsg: res.ErrMsg + "解析失败",
  4723. // Status: 1,
  4724. // PatientId: order_id,
  4725. // Stage: 10088,
  4726. // }
  4727. // service.CreateErrMsgLog(errlog)
  4728. // continue
  4729. // }
  4730. //
  4731. // } else {
  4732. // result, request := service.Gdyb4101For10106(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  4733. // fmt.Println(result)
  4734. // saveLog(result, request, "4205", "自费就诊和诊断信息上传")
  4735. // var dat map[string]interface{}
  4736. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  4737. // fmt.Println(dat)
  4738. // } else {
  4739. // fmt.Println(err)
  4740. // }
  4741. // userJSONBytes, _ := json.Marshal(dat)
  4742. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  4743. // //utils.ErrorLog("解析失败:%v", err)
  4744. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  4745. // //adminUser := c.GetAdminUserInfo()
  4746. // errlog := &models.HisOrderError{
  4747. // UserOrgId: org_id,
  4748. // Ctime: time.Now().Unix(),
  4749. // Mtime: time.Now().Unix(),
  4750. // ErrMsg: res.ErrMsg + "解析失败",
  4751. // Status: 1,
  4752. // PatientId: order_id,
  4753. // Stage: 50000,
  4754. // }
  4755. // service.CreateErrMsgLog(errlog)
  4756. // continue
  4757. // }
  4758. // }
  4759. //
  4760. // if res.Infcode != 0 {
  4761. // //adminUser := c.GetAdminUserInfo()
  4762. // errlog := &models.HisOrderError{
  4763. // UserOrgId: org_id,
  4764. // Ctime: time.Now().Unix(),
  4765. // Mtime: time.Now().Unix(),
  4766. // ErrMsg: res.ErrMsg,
  4767. // Status: 1,
  4768. // PatientId: order_id,
  4769. // Stage: 50000,
  4770. // }
  4771. // service.CreateErrMsgLog(errlog)
  4772. // continue
  4773. // } else {
  4774. // hisFundSettleListResult := &models.HisFundSettleListResult{
  4775. // Number: res.Output.SetlListId,
  4776. // Status: 1,
  4777. // Ctime: time.Now().Unix(),
  4778. // Mtime: time.Now().Unix(),
  4779. // UserOrgId: org_id,
  4780. // IsUpload: 1,
  4781. // OrderId: order_id,
  4782. // }
  4783. // service.CreateUploadRecord(hisFundSettleListResult)
  4784. // continue
  4785. // }
  4786. // }
  4787. //}
  4788. //
  4789. func saveLog(result string, request string, infno string, desc string) {
  4790. org_id, _ := beego.AppConfig.Int64("org_id")
  4791. miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  4792. dir := miConfig.OrgName + "日志"
  4793. utils.Mkdir(dir)
  4794. month := time.Unix(1557042972, 0).Format("1")
  4795. year := time.Now().Format("2006")
  4796. month = time.Now().Format("01")
  4797. day := time.Now().Format("02")
  4798. hour := time.Now().Format("15")
  4799. min := time.Now().Format("04")
  4800. sec := time.Now().Format("05")
  4801. result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
  4802. file := strconv.FormatInt(org_id, 10) + "_" + year + month + day + "_log"
  4803. file_name := file + ".txt"
  4804. file_path := miConfig.OrgName + "日志" + "/" + file_name
  4805. exist, _ := utils.PathExists(file_path)
  4806. if exist { //存在
  4807. fmt.Println("存在")
  4808. f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  4809. if err != nil {
  4810. fmt.Println("read fail")
  4811. }
  4812. content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
  4813. n, _ := f.Seek(0, 2)
  4814. _, err = f.WriteAt([]byte(content), n)
  4815. } else { //不存在
  4816. fmt.Println("文件不存在,创建文件")
  4817. f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
  4818. defer f.Close()
  4819. if err != nil {
  4820. } else {
  4821. _, err = f.Write([]byte("记录日志"))
  4822. }
  4823. }
  4824. }
  4825. //
  4826. ////func UploadSettleList(org_id int64) {
  4827. //// orders, _ := service.GetAllHisOrder(org_id)
  4828. //// for _, item := range orders {
  4829. //// order_id := item.ID
  4830. //// order, _ := service.GetHisOrderByIDTwo(order_id)
  4831. //// roles, _ := service.GetDoctorListTwo(org_id)
  4832. //// his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  4833. //// admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  4834. //// curRoles, _ := service.GetAdminUserInfo(org_id)
  4835. //// depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  4836. //// miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  4837. ////
  4838. //// result, _ := service.GetHisFundSettleListResult(order_id)
  4839. //// //判断是否已经上传过医保,上传过就跳过该条记录
  4840. //// if result.ID > 0 {
  4841. //// continue
  4842. //// }
  4843. ////
  4844. //// if his.BalanceAccountsType == 2 {
  4845. //// continue
  4846. //// }
  4847. ////
  4848. //// struct4101 := service.Struct4101{
  4849. //// PsnNo: order.PsnNo,
  4850. //// MdtrtId: order.MdtrtId,
  4851. //// SetlId: order.SetlId,
  4852. //// PsnName: order.PsnName,
  4853. //// Gend: order.Gend,
  4854. //// Brdy: his.Brdy,
  4855. //// Age: his.Age,
  4856. //// Naty: order.Naty,
  4857. //// PatnCertType: "01",
  4858. //// Certno: order.Certno,
  4859. //// Prfs: "90",
  4860. //// ConerName: roles[0].UserName,
  4861. //// PatnRlts: "99",
  4862. //// ConerAddr: miConfig.OrgName,
  4863. //// ConerTel: admin.Mobile,
  4864. //// HiType: order.Insutype,
  4865. //// Insuplc: his.InsuplcAdmdvs,
  4866. //// MaindiagFlag: "1",
  4867. //// BillCode: order.FaPiaoCode,
  4868. //// BillNo: order.FaPiaoNumber,
  4869. //// BizSn: order.Number,
  4870. //// PsnSelfPay: order.PsnPartAmt,
  4871. //// PsnOwnPay: order.PsnPartAmt,
  4872. //// AcctPay: order.AcctPay,
  4873. //// PsnCashpay: order.PsnCashPay,
  4874. //// HiPaymtd: "1",
  4875. //// Hsorg: his.InsuplcAdmdvs,
  4876. //// HsorgOpter: his.InsuplcAdmdvs,
  4877. //// MedinsFillPsn: curRoles.UserName,
  4878. //// MedinsFillDept: depart.Name,
  4879. //// IptMedType: "2",
  4880. //// }
  4881. //// struct4101.SetlBegnDate = order.SetlTime
  4882. //// struct4101.SetlEndDate = order.SetlTime
  4883. //// //if order.SettleType == 1 {
  4884. //// // t := time.Unix(int64(order.SettleAccountsDate), 0)
  4885. //// // dateStr := t.Format("2006-01-02")
  4886. //// // struct4101.SetlBegnDate = dateStr
  4887. //// // struct4101.SetlEndDate = dateStr
  4888. //// //} else {
  4889. //// // t := time.Unix(int64(order.SettleStartTime), 0)
  4890. //// // t2 := time.Unix(int64(order.SettleEndTime), 0)
  4891. //// // dateStartStr := t.Format("2006-01-02")
  4892. //// // dateEndStr := t2.Format("2006-01-02")
  4893. //// // struct4101.SetlBegnDate = dateStartStr
  4894. //// // struct4101.SetlEndDate = dateEndStr
  4895. //// //}
  4896. ////
  4897. //// var rf []CustomFundPay
  4898. //// json.Unmarshal([]byte(order.SetlDetail), &rf)
  4899. ////
  4900. //// var tempFunPays []service.CustomStruct
  4901. //// var tempFunPay610100 service.CustomStruct
  4902. ////
  4903. //// for _, item := range rf {
  4904. //// if item.FundPayType == "610100" {
  4905. //// tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  4906. //// tempFunPay610100.FundPayType = item.FundPayType
  4907. //// } else {
  4908. //// var tempFunPay service.CustomStruct
  4909. //// tempFunPay.FundPayamt = item.FundPayamt
  4910. //// tempFunPay.FundPayType = item.FundPayType
  4911. //// tempFunPays = append(tempFunPays, tempFunPay)
  4912. //// }
  4913. //// }
  4914. //// tempFunPays = append(tempFunPays, tempFunPay610100)
  4915. //// struct4101.CustomStruct = tempFunPays
  4916. ////
  4917. //// var tempOpspdiseinfos []service.OpspdiseinfoStruct
  4918. //// var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  4919. //// //sickConfig, _ := service.FindDiagnoseById(his.Diagnosis)
  4920. ////
  4921. //// diagnosis_ids := strings.Split(his.Diagnosis, ",")
  4922. //// var config []*models.HisXtDiagnoseConfig
  4923. //// for _, item := range diagnosis_ids {
  4924. //// id, _ := strconv.ParseInt(item, 10, 64)
  4925. //// diagnosisConfig, _ := service.FindDiagnoseById(id)
  4926. //// config = append(config, &diagnosisConfig)
  4927. //// }
  4928. ////
  4929. //// for _, item := range config {
  4930. //// var tempOpspdiseinfo service.OpspdiseinfoStruct
  4931. //// tempOpspdiseinfo.DiagCode = item.CountryCode
  4932. //// tempOpspdiseinfo.DiagName = item.CountryContentName
  4933. //// tempOpspdiseinfo.MaindiagFlag = "1"
  4934. //// tempOpspdiseinfo.OprnOprtCode = ""
  4935. //// tempOpspdiseinfo.OprnOprtName = ""
  4936. //// tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo)
  4937. //// }
  4938. ////
  4939. //// sickConfigTwo, _ := service.FindSickById(his.SickType)
  4940. //// tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  4941. //// tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  4942. //// tempOpspdiseinfo2.MaindiagFlag = "2"
  4943. //// tempOpspdiseinfo2.OprnOprtCode = ""
  4944. //// tempOpspdiseinfo2.OprnOprtName = ""
  4945. //// tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  4946. //// struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  4947. ////
  4948. //// var iteminfo service.IteminfoStruct
  4949. ////
  4950. //// var bedCostTotal float64 = 0 //床位总费
  4951. //// var bedCostSelfTotal float64 = 0 //床位自费
  4952. //// var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  4953. ////
  4954. //// var examineCostTotal float64 = 0 //诊查总费
  4955. //// var examineCostSelfTotal float64 = 0 //诊查自费
  4956. //// var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  4957. ////
  4958. //// var nursingCostTotal float64 = 0 //护理总费
  4959. //// var nursingCostSelfTotal float64 = 0 //护理自费
  4960. //// var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  4961. ////
  4962. //// var chineseMedicineCostTotal float64 = 0 //中成药
  4963. //// var chineseMedicineCostSelfTotal float64 = 0 //中成药
  4964. //// var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  4965. ////
  4966. //// var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  4967. //// var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  4968. //// var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  4969. ////
  4970. //// var registerCostTotal float64 = 0 //一般诊疗费
  4971. //// var registerCostSelfTotal float64 = 0 //一般诊疗费
  4972. //// var registerPartSelfTotal float64 = 0 //一般诊疗费
  4973. ////
  4974. //// var operationCostTotal float64 = 0 //手术费
  4975. //// var operationCostSelfTotal float64 = 0 //手术费
  4976. //// var operationCostPartSelfTotal float64 = 0 //手术费
  4977. ////
  4978. //// var otherCostTotal float64 = 0 //其他费用
  4979. //// var otherCostSelfTotal float64 = 0 //其他费用
  4980. //// var otherCostPartSelfTotal float64 = 0 //其他费用
  4981. ////
  4982. //// var materialCostTotal float64 = 0 //材料费
  4983. //// var materialCostSelfTotal float64 = 0 //材料费
  4984. //// var materialCostPartSelfTotal float64 = 0 //材料费
  4985. ////
  4986. //// var westernMedicineCostTotal float64 = 0 //西药费
  4987. //// var westernMedicineCostSelfTotal float64 = 0 //西药费
  4988. //// var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  4989. ////
  4990. //// var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  4991. //// var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  4992. //// var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  4993. ////
  4994. //// var checkCostTotal float64 = 0 //检查费
  4995. //// var checkCostSelfTotal float64 = 0 //检查费
  4996. //// var checkCostPartSelfTotal float64 = 0 //检查费
  4997. ////
  4998. //// var laboratoryCostTotal float64 = 0 //化验费
  4999. //// var laboratoryCostSelfTotal float64 = 0 //化验费
  5000. //// var laboratoryCostPartSelfTotal float64 = 0 //化验费
  5001. ////
  5002. //// var treatCostTotal float64 = 0 //治疗费用
  5003. //// var treatCostSelfTotal float64 = 0 //治疗费用
  5004. //// var treatCostPartSelfTotal float64 = 0 //治疗费用
  5005. ////
  5006. //// decimal.DivisionPrecision = 2
  5007. ////
  5008. //// var bed_fulamt_ownpay_amt float64 = 0
  5009. ////
  5010. //// var examine_fulamt_ownpay_amt float64 = 0
  5011. ////
  5012. //// var nursing_fulamt_ownpay_amt float64 = 0
  5013. ////
  5014. //// var chinese_medicine_fulamt_ownpay_amt float64 = 0
  5015. ////
  5016. //// var commonly_treatment_fulamt_ownpay_amt float64 = 0
  5017. ////
  5018. //// var register_fulamt_ownpay_amt float64 = 0
  5019. ////
  5020. //// var operation_fulamt_ownpay_amt float64 = 0
  5021. //// var other_fulamt_ownpay_amt float64 = 0
  5022. //// var westernMedicine_fulamt_ownpay_amt float64 = 0
  5023. //// var chineseTraditional_fulamt_ownpay_amt float64 = 0
  5024. //// var check_fulamt_ownpay_amt float64 = 0
  5025. //// var material_fulamt_ownpay_amt float64 = 0
  5026. //// var laboratory_fulamt_ownpay_amt float64 = 0
  5027. //// var treat_fulamt_ownpay_amt float64 = 0
  5028. ////
  5029. //// var bed_claa_sunmfee float64 = 0
  5030. //// var bed_clab_amt float64 = 0
  5031. //// var bed_other_amt float64 = 0
  5032. ////
  5033. //// var examine_claa_sunmfee float64 = 0
  5034. //// var examine_clab_amt float64 = 0
  5035. //// var examine_other_amt float64 = 0
  5036. ////
  5037. //// var nursing_claa_sunmfee float64 = 0
  5038. //// var nursing_clab_amt float64 = 0
  5039. //// var nursing_other_amt float64 = 0
  5040. ////
  5041. //// var chinese_medicine_claa_sunmfee float64 = 0
  5042. //// var chinese_medicine_clab_amt float64 = 0
  5043. //// var chinese_medicine_other_amt float64 = 0
  5044. ////
  5045. //// var commonly_treatment_claa_sunmfee float64 = 0
  5046. //// var commonly_treatment_clab_amt float64 = 0
  5047. //// var commonly_treatment_other_amt float64 = 0
  5048. ////
  5049. //// var operation_claa_sunmfee float64 = 0
  5050. //// var operation_clab_amt float64 = 0
  5051. //// var operation_other_amt float64 = 0
  5052. ////
  5053. //// var other_claa_sunmfee float64 = 0
  5054. //// var other_clab_amt float64 = 0
  5055. //// var other_other_amt float64 = 0
  5056. ////
  5057. //// var westernMedicine_claa_sunmfee float64 = 0
  5058. //// var westernMedicine_clab_amt float64 = 0
  5059. //// var westernMedicine_other_amt float64 = 0
  5060. ////
  5061. //// var chineseTraditional_claa_sunmfee float64 = 0
  5062. //// var chineseTraditional_clab_amt float64 = 0
  5063. //// var chineseTraditional_other_amt float64 = 0
  5064. ////
  5065. //// var check_claa_sunmfee float64 = 0
  5066. //// var check_clab_amt float64 = 0
  5067. //// var check_other_amt float64 = 0
  5068. ////
  5069. //// var material_claa_sunmfee float64 = 0
  5070. //// var material_clab_amt float64 = 0
  5071. //// var material_other_amt float64 = 0
  5072. ////
  5073. //// var laboratory_claa_sunmfee float64 = 0
  5074. //// var laboratory_clab_amt float64 = 0
  5075. //// var laboratory_other_amt float64 = 0
  5076. ////
  5077. //// var treat_claa_sunmfee float64 = 0
  5078. //// var treat_clab_amt float64 = 0
  5079. //// var treat_other_amt float64 = 0
  5080. ////
  5081. //// var register_claa_sunmfee float64 = 0
  5082. //// var register_clab_amt float64 = 0
  5083. //// var register_other_amt float64 = 0
  5084. ////
  5085. //// for _, item := range order.HisOrderInfo {
  5086. //// if item.MedChrgitmType == "01" { //床位费
  5087. //// bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5088. //// bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5089. //// bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5090. //// bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5091. //// if item.ChrgitmLv == "1" {
  5092. //// bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5093. //// }
  5094. //// if item.ChrgitmLv == "2" {
  5095. //// bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5096. ////
  5097. //// }
  5098. //// if item.ChrgitmLv == "3" {
  5099. //// bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5100. //// }
  5101. ////
  5102. //// }
  5103. ////
  5104. //// if item.MedChrgitmType == "02" { //诊查
  5105. //// examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5106. //// examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5107. //// examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5108. //// examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5109. //// if item.ChrgitmLv == "1" {
  5110. //// examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5111. //// }
  5112. //// if item.ChrgitmLv == "2" {
  5113. //// examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5114. ////
  5115. //// }
  5116. //// if item.ChrgitmLv == "3" {
  5117. //// examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5118. //// }
  5119. ////
  5120. //// }
  5121. ////
  5122. //// if item.MedChrgitmType == "03" { //检查费
  5123. //// checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5124. //// checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5125. //// checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5126. //// check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5127. //// if item.ChrgitmLv == "1" {
  5128. ////
  5129. //// check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5130. ////
  5131. //// }
  5132. //// if item.ChrgitmLv == "2" {
  5133. //// check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5134. ////
  5135. //// }
  5136. //// if item.ChrgitmLv == "3" {
  5137. //// check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5138. //// }
  5139. //// }
  5140. ////
  5141. //// if item.MedChrgitmType == "04" { //化验费
  5142. //// laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5143. //// laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5144. //// laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5145. //// laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5146. //// if item.ChrgitmLv == "1" {
  5147. ////
  5148. //// laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5149. ////
  5150. //// }
  5151. //// if item.ChrgitmLv == "2" {
  5152. //// laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5153. ////
  5154. //// }
  5155. //// if item.ChrgitmLv == "3" {
  5156. //// laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5157. //// }
  5158. //// }
  5159. ////
  5160. //// if item.MedChrgitmType == "05" { //治疗费
  5161. //// treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5162. //// treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5163. //// treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5164. //// treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5165. //// if item.ChrgitmLv == "1" {
  5166. ////
  5167. //// treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5168. ////
  5169. //// }
  5170. //// if item.ChrgitmLv == "2" {
  5171. //// treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5172. ////
  5173. //// }
  5174. //// if item.ChrgitmLv == "3" {
  5175. //// treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5176. //// }
  5177. //// }
  5178. ////
  5179. //// if item.MedChrgitmType == "06" { //手术费
  5180. //// operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5181. //// operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5182. //// operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5183. //// operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5184. ////
  5185. //// if item.ChrgitmLv == "1" {
  5186. ////
  5187. //// operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5188. ////
  5189. //// }
  5190. //// if item.ChrgitmLv == "2" {
  5191. //// operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5192. ////
  5193. //// }
  5194. //// if item.ChrgitmLv == "3" {
  5195. //// operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5196. //// }
  5197. //// }
  5198. ////
  5199. //// if item.MedChrgitmType == "07" { //手术费
  5200. //// nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5201. //// nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5202. //// nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5203. //// nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5204. ////
  5205. //// if item.ChrgitmLv == "1" {
  5206. ////
  5207. //// nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5208. ////
  5209. //// }
  5210. //// if item.ChrgitmLv == "2" {
  5211. //// nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5212. ////
  5213. //// }
  5214. //// if item.ChrgitmLv == "3" {
  5215. //// nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5216. //// }
  5217. //// }
  5218. ////
  5219. //// if item.MedChrgitmType == "08" { //材料费
  5220. //// materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5221. //// materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5222. //// materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5223. //// material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5224. //// if item.ChrgitmLv == "1" {
  5225. ////
  5226. //// material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5227. ////
  5228. //// }
  5229. //// if item.ChrgitmLv == "2" {
  5230. //// material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5231. ////
  5232. //// }
  5233. //// if item.ChrgitmLv == "3" {
  5234. //// material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5235. //// }
  5236. //// }
  5237. //// if item.MedChrgitmType == "09" { //西药费
  5238. //// westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5239. //// westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5240. //// westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5241. //// westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5242. //// if item.ChrgitmLv == "1" {
  5243. //// westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5244. //// }
  5245. //// if item.ChrgitmLv == "2" {
  5246. //// westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5247. //// }
  5248. //// if item.ChrgitmLv == "3" {
  5249. //// westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5250. //// }
  5251. //// }
  5252. //// if item.MedChrgitmType == "10" { //中药饮片
  5253. //// chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5254. //// chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5255. //// chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5256. //// chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5257. //// if item.ChrgitmLv == "1" {
  5258. //// chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5259. //// }
  5260. //// if item.ChrgitmLv == "2" {
  5261. //// chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5262. //// }
  5263. //// if item.ChrgitmLv == "3" {
  5264. //// chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5265. //// }
  5266. //// }
  5267. ////
  5268. //// if item.MedChrgitmType == "11" { //中成费
  5269. //// chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5270. //// chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5271. //// chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5272. //// chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5273. //// if item.ChrgitmLv == "1" {
  5274. ////
  5275. //// chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5276. ////
  5277. //// }
  5278. //// if item.ChrgitmLv == "2" {
  5279. //// chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5280. ////
  5281. //// }
  5282. //// if item.ChrgitmLv == "3" {
  5283. //// chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5284. //// }
  5285. //// }
  5286. ////
  5287. //// if item.MedChrgitmType == "12" { //中成费
  5288. //// commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5289. //// commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5290. //// commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5291. //// commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5292. //// if item.ChrgitmLv == "1" {
  5293. ////
  5294. //// commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5295. ////
  5296. //// }
  5297. //// if item.ChrgitmLv == "2" {
  5298. //// commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5299. ////
  5300. //// }
  5301. //// if item.ChrgitmLv == "3" {
  5302. //// commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5303. //// }
  5304. //// }
  5305. ////
  5306. //// if item.MedChrgitmType == "13" { //中成费
  5307. //// registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5308. //// registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5309. //// registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5310. //// register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5311. //// if item.ChrgitmLv == "1" {
  5312. ////
  5313. //// register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5314. ////
  5315. //// }
  5316. //// if item.ChrgitmLv == "2" {
  5317. //// register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5318. ////
  5319. //// }
  5320. //// if item.ChrgitmLv == "3" {
  5321. //// register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5322. //// }
  5323. //// }
  5324. ////
  5325. //// if item.MedChrgitmType == "14" { //其他费
  5326. //// otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5327. //// otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5328. //// otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5329. //// other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5330. //// if item.ChrgitmLv == "1" {
  5331. //// other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5332. ////
  5333. //// }
  5334. //// if item.ChrgitmLv == "2" {
  5335. //// other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5336. ////
  5337. //// }
  5338. //// if item.ChrgitmLv == "3" {
  5339. //// other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5340. //// }
  5341. //// }
  5342. ////
  5343. //// }
  5344. ////
  5345. //// var iteminfoStructs []service.IteminfoStruct
  5346. ////
  5347. //// if bedCostTotal != 0 {
  5348. //// iteminfo.MedChrgitm = "01"
  5349. //// iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  5350. //// iteminfo.Amt = bedCostTotal
  5351. //// iteminfo.ClaaSumfee = bed_claa_sunmfee
  5352. //// iteminfo.ClabAmt = bed_clab_amt
  5353. //// iteminfo.OthAmt = bed_other_amt
  5354. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5355. //// }
  5356. ////
  5357. //// if examineCostTotal != 0 {
  5358. //// iteminfo.MedChrgitm = "02"
  5359. //// iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  5360. //// iteminfo.Amt = examineCostTotal
  5361. //// iteminfo.ClaaSumfee = examine_claa_sunmfee
  5362. //// iteminfo.ClabAmt = examine_clab_amt
  5363. //// iteminfo.OthAmt = examine_other_amt
  5364. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5365. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5366. //// }
  5367. ////
  5368. //// if checkCostTotal != 0 {
  5369. //// iteminfo.MedChrgitm = "03"
  5370. //// iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  5371. //// iteminfo.Amt = checkCostTotal
  5372. //// iteminfo.ClaaSumfee = check_claa_sunmfee
  5373. //// iteminfo.ClabAmt = check_clab_amt
  5374. //// iteminfo.OthAmt = check_other_amt
  5375. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5376. ////
  5377. //// }
  5378. ////
  5379. //// if laboratoryCostTotal != 0 {
  5380. //// iteminfo.MedChrgitm = "04"
  5381. //// iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  5382. //// iteminfo.Amt = laboratoryCostTotal
  5383. //// iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  5384. //// iteminfo.ClabAmt = laboratory_clab_amt
  5385. //// iteminfo.OthAmt = laboratory_other_amt
  5386. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5387. ////
  5388. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5389. ////
  5390. //// }
  5391. ////
  5392. //// if treatCostTotal != 0 {
  5393. //// iteminfo.MedChrgitm = "05"
  5394. //// iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  5395. //// iteminfo.Amt = treatCostTotal
  5396. //// iteminfo.ClaaSumfee = treat_claa_sunmfee
  5397. //// iteminfo.ClabAmt = treat_clab_amt
  5398. //// iteminfo.OthAmt = treat_other_amt
  5399. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5400. //// //(struct4101.IteminfoStruct, iteminfo)
  5401. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5402. //// }
  5403. ////
  5404. //// if operationCostTotal != 0 {
  5405. //// iteminfo.MedChrgitm = "06"
  5406. //// iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  5407. //// iteminfo.Amt = operationCostTotal
  5408. //// iteminfo.ClaaSumfee = operation_claa_sunmfee
  5409. //// iteminfo.ClabAmt = operation_clab_amt
  5410. //// iteminfo.OthAmt = operation_other_amt
  5411. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5412. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5413. //// }
  5414. ////
  5415. //// if nursingCostTotal != 0 {
  5416. //// iteminfo.MedChrgitm = "07"
  5417. //// iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  5418. //// iteminfo.Amt = nursingCostTotal
  5419. //// iteminfo.ClaaSumfee = nursing_claa_sunmfee
  5420. //// iteminfo.ClabAmt = nursing_clab_amt
  5421. //// iteminfo.OthAmt = nursing_other_amt
  5422. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5423. //// }
  5424. ////
  5425. //// if materialCostTotal != 0 {
  5426. //// iteminfo.MedChrgitm = "08"
  5427. //// iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  5428. //// iteminfo.Amt = materialCostTotal
  5429. //// iteminfo.ClaaSumfee = material_claa_sunmfee
  5430. //// iteminfo.ClabAmt = material_clab_amt
  5431. //// iteminfo.OthAmt = material_other_amt
  5432. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5433. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5434. //// }
  5435. ////
  5436. //// if westernMedicineCostTotal != 0 {
  5437. //// iteminfo.MedChrgitm = "09"
  5438. //// iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  5439. //// iteminfo.Amt = westernMedicineCostTotal
  5440. //// iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  5441. //// iteminfo.ClabAmt = westernMedicine_clab_amt
  5442. //// iteminfo.OthAmt = westernMedicine_other_amt
  5443. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5444. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5445. ////
  5446. //// }
  5447. ////
  5448. //// if chineseMedicineCostTotal != 0 {
  5449. //// iteminfo.MedChrgitm = "10"
  5450. //// iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  5451. //// iteminfo.Amt = chineseMedicineCostTotal
  5452. //// iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  5453. //// iteminfo.ClabAmt = chinese_medicine_clab_amt
  5454. //// iteminfo.OthAmt = chinese_medicine_other_amt
  5455. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5456. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5457. ////
  5458. //// }
  5459. ////
  5460. //// if chineseTraditionalMedicineCostTotal != 0 {
  5461. //// iteminfo.MedChrgitm = "11"
  5462. //// iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  5463. //// iteminfo.Amt = westernMedicineCostTotal
  5464. //// iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  5465. //// iteminfo.ClabAmt = westernMedicine_clab_amt
  5466. //// iteminfo.OthAmt = westernMedicine_other_amt
  5467. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5468. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5469. ////
  5470. //// }
  5471. ////
  5472. //// if commonlyTreatmentCostTotal != 0 {
  5473. //// iteminfo.MedChrgitm = "12"
  5474. //// iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  5475. //// iteminfo.Amt = commonlyTreatmentCostTotal
  5476. //// iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  5477. //// iteminfo.ClabAmt = commonly_treatment_clab_amt
  5478. //// iteminfo.OthAmt = commonly_treatment_other_amt
  5479. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5480. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5481. ////
  5482. //// }
  5483. ////
  5484. //// if registerCostTotal != 0 {
  5485. //// iteminfo.MedChrgitm = "13"
  5486. //// iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  5487. //// iteminfo.Amt = registerCostTotal
  5488. //// iteminfo.ClaaSumfee = register_claa_sunmfee
  5489. //// iteminfo.ClabAmt = register_clab_amt
  5490. //// iteminfo.OthAmt = register_other_amt
  5491. //// //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  5492. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5493. ////
  5494. //// }
  5495. ////
  5496. //// if otherCostTotal != 0 {
  5497. //// iteminfo.MedChrgitm = "14"
  5498. //// iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  5499. //// iteminfo.Amt = otherCostTotal
  5500. //// iteminfo.ClaaSumfee = other_claa_sunmfee
  5501. //// iteminfo.ClabAmt = other_clab_amt
  5502. //// iteminfo.OthAmt = other_other_amt
  5503. //// iteminfoStructs = append(iteminfoStructs, iteminfo)
  5504. ////
  5505. //// }
  5506. //// struct4101.IteminfoStruct = iteminfoStructs
  5507. //// struct4101.Ntly = "中国"
  5508. //// struct4101.AdmCaty = "A03.06"
  5509. //// result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  5510. //// fmt.Println(result)
  5511. ////
  5512. //// var dat map[string]interface{}
  5513. //// if err := json.Unmarshal([]byte(result), &dat); err == nil {
  5514. //// fmt.Println(dat)
  5515. //// } else {
  5516. //// fmt.Println(err)
  5517. //// }
  5518. //// userJSONBytes, _ := json.Marshal(dat)
  5519. //// var res ResultSeventeen
  5520. //// if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  5521. //// utils.ErrorLog("解析失败:%v", err)
  5522. //// //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  5523. //// errlog := &models.HisOrderError{
  5524. //// UserOrgId: org_id,
  5525. //// Ctime: time.Now().Unix(),
  5526. //// Mtime: time.Now().Unix(),
  5527. //// ErrMsg: res.ErrMsg + "解析失败",
  5528. //// Status: 1,
  5529. //// PatientId: order_id,
  5530. //// Stage: 120,
  5531. //// }
  5532. //// service.CreateErrMsgLog(errlog)
  5533. //// continue
  5534. //// }
  5535. ////
  5536. //// if res.Infcode != 0 {
  5537. //// errlog := &models.HisOrderError{
  5538. //// UserOrgId: org_id,
  5539. //// Ctime: time.Now().Unix(),
  5540. //// Mtime: time.Now().Unix(),
  5541. //// ErrMsg: res.ErrMsg,
  5542. //// Status: 1,
  5543. //// PatientId: order_id,
  5544. //// Stage: 200,
  5545. //// }
  5546. //// service.CreateErrMsgLog(errlog)
  5547. //// continue
  5548. //// } else {
  5549. //// hisFundSettleListResult := &models.HisFundSettleListResult{
  5550. //// Number: res.Output.SetlListId,
  5551. //// Status: 1,
  5552. //// Ctime: time.Now().Unix(),
  5553. //// Mtime: time.Now().Unix(),
  5554. //// UserOrgId: org_id,
  5555. //// IsUpload: 1,
  5556. //// OrderId: order_id,
  5557. //// }
  5558. //// service.CreateUploadRecord(hisFundSettleListResult)
  5559. //// continue
  5560. //// }
  5561. //// }
  5562. ////}
  5563. //
  5564. ////func CreateLog(miConfig models.MedicalInsuranceOrgConfig) {
  5565. //// Mkdir(miConfig.OrgName + "日志")
  5566. //// //org_id,_ := beego.AppConfig.Int("org_id")
  5567. //// month := time.Unix(1557042972, 0).Format("1")
  5568. //// year := time.Now().Format("2006")
  5569. //// month = time.Now().Format("01")
  5570. //// day := time.Now().Format("02")
  5571. //// file := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + year + month + day + "_log"
  5572. //// file_name := file + ".txt"
  5573. //// file_path := miConfig.OrgName + "日志" + "/" + file_name
  5574. //// exist, _ := PathExists(file_path)
  5575. //// if exist { //存在
  5576. //// fmt.Println("存在")
  5577. //// f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  5578. //// if err != nil {
  5579. //// fmt.Println("read fail")
  5580. //// }
  5581. //// content := "\r\r\r"
  5582. //// n, _ := f.Seek(0, 2)
  5583. //// _, err = f.WriteAt([]byte(content), n)
  5584. ////
  5585. //// } else { //不存在
  5586. //// fmt.Println("文件不存在,创建文件")
  5587. //// f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
  5588. //// defer f.Close()
  5589. //// if err != nil {
  5590. //// } else {
  5591. //// _, err = f.Write([]byte("记录日志"))
  5592. //// }
  5593. //// }
  5594. ////
  5595. ////}
  5596. //
  5597. ////func UploadLog(miConfig models.MedicalInsuranceOrgConfig) {
  5598. //// //获取七牛云上的文件信息,不存在则表示没上传到七牛云,上传昨天日志信息
  5599. //// nTime := time.Now()
  5600. //// yesTime := nTime.AddDate(0, 0, -1)
  5601. //// file_key := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + yesTime.Format("20060102") + "_log.txt"
  5602. //// mac := qbox.NewMac(beego.AppConfig.String("qiniu_accesskey"), beego.AppConfig.String("qiniu_secretkey"))
  5603. //// cfg := storage.Config{
  5604. //// // 是否使用https域名进行资源管理
  5605. //// UseHTTPS: true,
  5606. //// }
  5607. //// // 指定空间所在的区域,如果不指定将自动探测
  5608. //// // 如果没有特殊需求,默认不需要指定
  5609. //// //cfg.Zone=&storage.ZoneHuabei
  5610. //// bucketManager := storage.NewBucketManager(mac, &cfg)
  5611. //// bucket := beego.AppConfig.String("qiniu_bucket")
  5612. //// key := file_key
  5613. //// file, sErr := bucketManager.Stat(bucket, key)
  5614. //// fmt.Println(file)
  5615. //// fmt.Println(sErr)
  5616. //// fmt.Println(miConfig.OrgName + "日志" + "/" + file_key)
  5617. ////
  5618. //// if sErr != nil {
  5619. //// fmt.Println("七牛云上文件不存在,上传到七牛云")
  5620. //// //判断本地文件是否存在,存在则执行上传操作
  5621. //// exist, _ := PathExists(miConfig.OrgName + "日志" + "/" + file_key)
  5622. //// if exist {
  5623. //// upload_qiniu(miConfig.OrgName+"日志"+"/"+file_key, file_key)
  5624. //// } else {
  5625. //// fmt.Println("本地文件不存在")
  5626. ////
  5627. //// }
  5628. //// } else {
  5629. //// fmt.Println("七牛云文件存在")
  5630. //// }
  5631. ////
  5632. ////}
  5633. ////func Mkdir(dir string) {
  5634. //// // 创建文件夹
  5635. //// exist, err := PathExists(dir)
  5636. //// if err != nil {
  5637. //// fmt.Println(err.Error())
  5638. //// } else {
  5639. //// if exist {
  5640. //// fmt.Println(dir + "文件夹已存在!")
  5641. //// } else {
  5642. //// // 文件夹名称,权限
  5643. //// err := os.Mkdir(dir, os.ModePerm)
  5644. //// if err != nil {
  5645. //// fmt.Println(dir+"文件夹创建失败:", err.Error())
  5646. //// } else {
  5647. //// fmt.Println(dir + "文件夹创建成功!")
  5648. //// }
  5649. //// }
  5650. //// }
  5651. ////}
  5652. ////func PathExists(path string) (bool, error) {
  5653. //// _, err := os.Stat(path)
  5654. //// if err == nil {
  5655. //// return true, nil
  5656. //// }
  5657. //// if os.IsNotExist(err) {
  5658. //// return false, nil
  5659. //// }
  5660. //// return false, err
  5661. ////}
  5662. //
  5663. ////func upload_qiniu(filePath string, keys string) {
  5664. //// key := keys
  5665. //// //上传凭证,关于凭证这块大家可以去看看官方文档
  5666. //// putPolicy := storage.PutPolicy{
  5667. //// Scope: beego.AppConfig.String("qiniu_bucket"),
  5668. //// }
  5669. //// mac := qbox.NewMac(beego.AppConfig.String("qiniu_accesskey"), beego.AppConfig.String("qiniu_secretkey"))
  5670. //// upToken := putPolicy.UploadToken(mac)
  5671. //// cfg := storage.Config{}
  5672. //// //空间对应机房
  5673. //// //其中关于Zone对象和机房的关系如下:
  5674. //// // 机房 Zone对象
  5675. //// // 华东 storage.ZoneHuadong
  5676. //// // 华北 storage.ZoneHuabei
  5677. //// // 华南 storage.ZoneHuanan
  5678. //// // 北美 storage.ZoneBeimei
  5679. //// //七牛云存储空间设置首页有存储区域
  5680. //// cfg.Zone = &storage.ZoneHuadong
  5681. //// //不启用HTTPS域名
  5682. //// cfg.UseHTTPS = false
  5683. //// //不使用CND加速
  5684. //// cfg.UseCdnDomains = false
  5685. //// //构建上传表单对象
  5686. //// formUploader := storage.NewFormUploader(&cfg)
  5687. //// ret := storage.PutRet{}
  5688. //// // 可选
  5689. //// putExtra := storage.PutExtra{
  5690. //// Params: map[string]string{},
  5691. //// }
  5692. //// err := formUploader.PutFile(context.Background(), &ret, upToken, key, filePath, &putExtra)
  5693. //// if err != nil {
  5694. //// fmt.Println(err)
  5695. //// return
  5696. //// }
  5697. //// fmt.Println(ret.Key, ret.Hash)
  5698. ////}
  5699. func GetNMSettleListHospital() {
  5700. admin_user_id := int64(2738)
  5701. var orders []*models.HisOrder
  5702. orders, _ = service.GetAllHisOrder10265()
  5703. for _, item := range orders{
  5704. order_id := item.ID
  5705. order, _ := service.GetHisOrderByIDTwo(order_id)
  5706. roles, _ := service.GetDoctorListTwo(10265)
  5707. his, _ := service.GetInHospitalRecordByNumber(order.MdtrtId)
  5708. admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  5709. curRoles, _ := service.GetAdminUserInfoByID(10265, admin_user_id)
  5710. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  5711. miConfig, _ := service.FindMedicalInsuranceInfo(10265)
  5712. if order.ID == 0 {
  5713. continue
  5714. }
  5715. struct4101 := service.Struct4101{
  5716. PsnNo: order.PsnNo,
  5717. MdtrtId: order.MdtrtId,
  5718. SetlId: order.SetlId,
  5719. PsnName: order.PsnName,
  5720. Gend: order.Gend,
  5721. Brdy: his.Brdy,
  5722. Age: int64(order.Age),
  5723. Naty: order.Naty,
  5724. PatnCertType: "01",
  5725. Certno: order.Certno,
  5726. Prfs: "90",
  5727. ConerName: roles[0].UserName,
  5728. PatnRlts: "99",
  5729. ConerAddr: miConfig.OrgName,
  5730. ConerTel: admin.Mobile,
  5731. HiType: order.Insutype,
  5732. Insuplc: miConfig.InsuplcAdmdvs,
  5733. MaindiagFlag: "1",
  5734. BillCode: order.SetlId,
  5735. BillNo: order.SetlId,
  5736. BizSn: order.Number,
  5737. PsnSelfPay: order.PsnPartAmt,
  5738. PsnOwnPay: order.PsnPartAmt,
  5739. AcctPay: order.AcctPay,
  5740. PsnCashpay: order.PsnCashPay,
  5741. HiPaymtd: "1",
  5742. Hsorg: miConfig.InsuplcAdmdvs,
  5743. HsorgOpter: miConfig.InsuplcAdmdvs,
  5744. MedinsFillPsn: curRoles.UserName,
  5745. MedinsFillDept: depart.Name,
  5746. IptMedType: "2",
  5747. AdmTime: his.InHosptialTime,
  5748. AdmEndTime: his.OutHosptialTime,
  5749. }
  5750. struct4101.SetlBegnDate = order.SetlTime
  5751. struct4101.SetlEndDate = order.SetlTime
  5752. var tempDiaginfos []service.DiaginfoStructTwo
  5753. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  5754. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  5755. diagnosis_ids_arr := strings.Split(his.Diagnosis, ",")
  5756. diagnosis_ids_arr = RemoveRepeatedPurviewElement2(diagnosis_ids_arr)
  5757. var config []*models.HisXtDiagnoseConfig
  5758. for _, item := range diagnosis_ids_arr {
  5759. id, _ := strconv.ParseInt(item, 10, 64)
  5760. diagnosisConfig, _ := service.FindDiagnoseById(id)
  5761. if diagnosisConfig.ID > 0 {
  5762. config = append(config, &diagnosisConfig)
  5763. }
  5764. }
  5765. for index, item := range config {
  5766. if item.ID > 0 {
  5767. if index == 0 {
  5768. var tempDiaginfo service.DiaginfoStructTwo
  5769. tempDiaginfo.DiagCode = item.CountryCode
  5770. tempDiaginfo.DiagName = item.CountryContentName
  5771. tempDiaginfo.DiagType = "1"
  5772. tempDiaginfo.MaindiagFlag = "1"
  5773. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  5774. } else {
  5775. var tempDiaginfo service.DiaginfoStructTwo
  5776. tempDiaginfo.DiagCode = item.CountryCode
  5777. tempDiaginfo.DiagName = item.CountryContentName
  5778. tempDiaginfo.DiagType = "1"
  5779. tempDiaginfo.MaindiagFlag = "0"
  5780. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  5781. }
  5782. }
  5783. }
  5784. struct4101.Diseinfo = tempDiaginfos
  5785. sickConfigTwo, _ := service.FindSickById(his.SickType)
  5786. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  5787. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  5788. tempOpspdiseinfo2.OprnOprtCode = ""
  5789. tempOpspdiseinfo2.OprnOprtName = ""
  5790. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  5791. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  5792. var iteminfo service.IteminfoStruct
  5793. var bedCostTotal float64 = 0 //床位总费
  5794. var bedCostSelfTotal float64 = 0 //床位自费
  5795. var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  5796. var operationCostTotal float64 = 0 //手术费
  5797. var operationCostSelfTotal float64 = 0 //手术费
  5798. var operationCostPartSelfTotal float64 = 0 //手术费
  5799. var otherCostTotal float64 = 0 //其他费用
  5800. var otherCostSelfTotal float64 = 0 //其他费用
  5801. var otherCostPartSelfTotal float64 = 0 //其他费用
  5802. var materialCostTotal float64 = 0 //材料费
  5803. var materialCostSelfTotal float64 = 0 //材料费
  5804. var materialCostPartSelfTotal float64 = 0 //材料费
  5805. var westernMedicineCostTotal float64 = 0 //西药费
  5806. var westernMedicineCostSelfTotal float64 = 0 //西药费
  5807. var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  5808. var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  5809. var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  5810. var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  5811. var checkCostTotal float64 = 0 //检查费
  5812. var checkCostSelfTotal float64 = 0 //检查费
  5813. var checkCostPartSelfTotal float64 = 0 //检查费
  5814. var laboratoryCostTotal float64 = 0 //化验费
  5815. var laboratoryCostSelfTotal float64 = 0 //化验费
  5816. var laboratoryCostPartSelfTotal float64 = 0 //化验费
  5817. var treatCostTotal float64 = 0 //治疗费用
  5818. var treatCostSelfTotal float64 = 0 //治疗费用
  5819. var treatCostPartSelfTotal float64 = 0 //治疗费用
  5820. decimal.DivisionPrecision = 2
  5821. var bed_fulamt_ownpay_amt float64 = 0
  5822. var operation_fulamt_ownpay_amt float64 = 0
  5823. var other_fulamt_ownpay_amt float64 = 0
  5824. var westernMedicine_fulamt_ownpay_amt float64 = 0
  5825. var chineseTraditional_fulamt_ownpay_amt float64 = 0
  5826. var check_fulamt_ownpay_amt float64 = 0
  5827. var material_fulamt_ownpay_amt float64 = 0
  5828. var laboratory_fulamt_ownpay_amt float64 = 0
  5829. var treat_fulamt_ownpay_amt float64 = 0
  5830. var bed_claa_sunmfee float64 = 0
  5831. var bed_clab_amt float64 = 0
  5832. var bed_other_amt float64 = 0
  5833. var operation_claa_sunmfee float64 = 0
  5834. var operation_clab_amt float64 = 0
  5835. var operation_other_amt float64 = 0
  5836. var other_claa_sunmfee float64 = 0
  5837. var other_clab_amt float64 = 0
  5838. var other_other_amt float64 = 0
  5839. var westernMedicine_claa_sunmfee float64 = 0
  5840. var westernMedicine_clab_amt float64 = 0
  5841. var westernMedicine_other_amt float64 = 0
  5842. var chineseTraditional_claa_sunmfee float64 = 0
  5843. var chineseTraditional_clab_amt float64 = 0
  5844. var chineseTraditional_other_amt float64 = 0
  5845. var check_claa_sunmfee float64 = 0
  5846. var check_clab_amt float64 = 0
  5847. var check_other_amt float64 = 0
  5848. var material_claa_sunmfee float64 = 0
  5849. var material_clab_amt float64 = 0
  5850. var material_other_amt float64 = 0
  5851. var laboratory_claa_sunmfee float64 = 0
  5852. var laboratory_clab_amt float64 = 0
  5853. var laboratory_other_amt float64 = 0
  5854. var treat_claa_sunmfee float64 = 0
  5855. var treat_clab_amt float64 = 0
  5856. var treat_other_amt float64 = 0
  5857. for _, item := range order.HisOrderInfo {
  5858. if item.MedChrgitmType == "01" { //床位费
  5859. bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5860. bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5861. bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5862. bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5863. if item.ChrgitmLv == "1" {
  5864. bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5865. }
  5866. if item.ChrgitmLv == "2" {
  5867. bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5868. }
  5869. if item.ChrgitmLv == "3" {
  5870. bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5871. }
  5872. }
  5873. if item.MedChrgitmType == "03" { //检查费
  5874. checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5875. checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5876. checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5877. check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5878. if item.ChrgitmLv == "1" {
  5879. check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5880. }
  5881. if item.ChrgitmLv == "2" {
  5882. check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5883. }
  5884. if item.ChrgitmLv == "3" {
  5885. check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5886. }
  5887. }
  5888. if item.MedChrgitmType == "04" { //化验费
  5889. laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5890. laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5891. laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5892. laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5893. if item.ChrgitmLv == "1" {
  5894. laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5895. }
  5896. if item.ChrgitmLv == "2" {
  5897. laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5898. }
  5899. if item.ChrgitmLv == "3" {
  5900. laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5901. }
  5902. }
  5903. if item.MedChrgitmType == "05" { //治疗费
  5904. treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5905. treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5906. treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5907. treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5908. if item.ChrgitmLv == "1" {
  5909. treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5910. }
  5911. if item.ChrgitmLv == "2" {
  5912. treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5913. }
  5914. if item.ChrgitmLv == "3" {
  5915. treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5916. }
  5917. }
  5918. if item.MedChrgitmType == "06" { //手术费
  5919. operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5920. operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5921. operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5922. operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5923. if item.ChrgitmLv == "1" {
  5924. operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5925. }
  5926. if item.ChrgitmLv == "2" {
  5927. operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5928. }
  5929. if item.ChrgitmLv == "3" {
  5930. operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5931. }
  5932. }
  5933. if item.MedChrgitmType == "08" { //材料费
  5934. materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5935. materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5936. materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5937. material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5938. if item.ChrgitmLv == "1" {
  5939. material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5940. }
  5941. if item.ChrgitmLv == "2" {
  5942. material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5943. }
  5944. if item.ChrgitmLv == "3" {
  5945. material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5946. }
  5947. }
  5948. if item.MedChrgitmType == "09" { //西药费
  5949. westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5950. westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5951. westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5952. westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5953. if item.ChrgitmLv == "1" {
  5954. westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5955. }
  5956. if item.ChrgitmLv == "2" {
  5957. westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5958. }
  5959. if item.ChrgitmLv == "3" {
  5960. westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5961. }
  5962. }
  5963. if item.MedChrgitmType == "11" { //中成费
  5964. chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5965. chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5966. chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5967. chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5968. if item.ChrgitmLv == "1" {
  5969. chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5970. }
  5971. if item.ChrgitmLv == "2" {
  5972. chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5973. }
  5974. if item.ChrgitmLv == "3" {
  5975. chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5976. }
  5977. }
  5978. if item.MedChrgitmType == "14" { //其他费
  5979. otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5980. otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5981. otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5982. other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  5983. if item.ChrgitmLv == "1" {
  5984. other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  5985. }
  5986. if item.ChrgitmLv == "2" {
  5987. other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  5988. }
  5989. if item.ChrgitmLv == "3" {
  5990. other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  5991. }
  5992. }
  5993. }
  5994. var iteminfoStructs []service.IteminfoStruct
  5995. if bedCostTotal != 0 {
  5996. iteminfo.MedChrgitm = "01"
  5997. iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  5998. iteminfo.Amt = bedCostTotal
  5999. iteminfo.ClaaSumfee = bed_claa_sunmfee
  6000. iteminfo.ClabAmt = bed_clab_amt
  6001. iteminfo.OthAmt = bed_other_amt
  6002. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6003. }
  6004. if checkCostTotal != 0 {
  6005. iteminfo.MedChrgitm = "03"
  6006. iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  6007. iteminfo.Amt = checkCostTotal
  6008. iteminfo.ClaaSumfee = check_claa_sunmfee
  6009. iteminfo.ClabAmt = check_clab_amt
  6010. iteminfo.OthAmt = check_other_amt
  6011. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6012. }
  6013. if laboratoryCostTotal != 0 {
  6014. iteminfo.MedChrgitm = "04"
  6015. iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  6016. iteminfo.Amt = laboratoryCostTotal
  6017. iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  6018. iteminfo.ClabAmt = laboratory_clab_amt
  6019. iteminfo.OthAmt = laboratory_other_amt
  6020. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6021. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  6022. }
  6023. if treatCostTotal != 0 {
  6024. iteminfo.MedChrgitm = "05"
  6025. iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  6026. iteminfo.Amt = treatCostTotal
  6027. iteminfo.ClaaSumfee = treat_claa_sunmfee
  6028. iteminfo.ClabAmt = treat_clab_amt
  6029. iteminfo.OthAmt = treat_other_amt
  6030. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6031. //(struct4101.IteminfoStruct, iteminfo)
  6032. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  6033. }
  6034. if operationCostTotal != 0 {
  6035. iteminfo.MedChrgitm = "06"
  6036. iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  6037. iteminfo.Amt = operationCostTotal
  6038. iteminfo.ClaaSumfee = operation_claa_sunmfee
  6039. iteminfo.ClabAmt = operation_clab_amt
  6040. iteminfo.OthAmt = operation_other_amt
  6041. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  6042. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6043. }
  6044. if materialCostTotal != 0 {
  6045. iteminfo.MedChrgitm = "08"
  6046. iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  6047. iteminfo.Amt = materialCostTotal
  6048. iteminfo.ClaaSumfee = material_claa_sunmfee
  6049. iteminfo.ClabAmt = material_clab_amt
  6050. iteminfo.OthAmt = material_other_amt
  6051. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  6052. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6053. }
  6054. if westernMedicineCostTotal != 0 {
  6055. iteminfo.MedChrgitm = "09"
  6056. iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  6057. iteminfo.Amt = westernMedicineCostTotal
  6058. iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  6059. iteminfo.ClabAmt = westernMedicine_clab_amt
  6060. iteminfo.OthAmt = westernMedicine_other_amt
  6061. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  6062. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6063. }
  6064. if chineseTraditionalMedicineCostTotal != 0 {
  6065. iteminfo.MedChrgitm = "11"
  6066. iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  6067. iteminfo.Amt = westernMedicineCostTotal
  6068. iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  6069. iteminfo.ClabAmt = westernMedicine_clab_amt
  6070. iteminfo.OthAmt = westernMedicine_other_amt
  6071. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  6072. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6073. }
  6074. if otherCostTotal != 0 {
  6075. iteminfo.MedChrgitm = "14"
  6076. iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  6077. iteminfo.Amt = otherCostTotal
  6078. iteminfo.ClaaSumfee = other_claa_sunmfee
  6079. iteminfo.ClabAmt = other_clab_amt
  6080. iteminfo.OthAmt = other_other_amt
  6081. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  6082. iteminfoStructs = append(iteminfoStructs, iteminfo)
  6083. }
  6084. struct4101.IteminfoStruct = iteminfoStructs
  6085. struct4101.Ntly = "中国"
  6086. struct4101.AdmCaty = "A03.06"
  6087. var resOther ResultSeventeenOther
  6088. var res ResultSeventeen
  6089. if miConfig.MdtrtareaAdmvs == "150499" {
  6090. var pp models.PublicParams
  6091. pp.InsuplcAdmdvs = miConfig.InsuplcAdmdvs
  6092. pp.MdtrtareaAdmvs = miConfig.MdtrtareaAdmvs
  6093. pp.FixmedinsName = miConfig.OrgName
  6094. pp.FixmedinsCode = miConfig.Code
  6095. pp.RequestUrl = miConfig.Url
  6096. pp.Cainfo = miConfig.Cainfo
  6097. pp.SecretKey = miConfig.SecretKey
  6098. pp.AccessKey = miConfig.AccessKey
  6099. pp.OpterName = curRoles.UserName
  6100. client := &http.Client{}
  6101. var req *http.Request
  6102. data := make(map[string]interface{})
  6103. data["struct4101"] = struct4101
  6104. data["pp"] = pp
  6105. bytesData, _ := json.Marshal(data)
  6106. req, _ = http.NewRequest("POST", "http://172.16.13.254:9532/"+"nmyb/4101", bytes.NewReader(bytesData))
  6107. resp, _ := client.Do(req)
  6108. defer resp.Body.Close()
  6109. body, ioErr := ioutil.ReadAll(resp.Body)
  6110. if ioErr != nil {
  6111. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  6112. }
  6113. var respJSON map[string]interface{}
  6114. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  6115. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  6116. }
  6117. respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  6118. userJSONBytes, _ := json.Marshal(respJSON)
  6119. if err := json.Unmarshal(userJSONBytes, &resOther); err != nil {
  6120. utils.ErrorLog("解析失败:%v", err)
  6121. }
  6122. res.InfRefmsgid = resOther.InfRefmsgid
  6123. res.Output = resOther.Output
  6124. res.ErrMsg = resOther.ErrMsg
  6125. infocode, _ := strconv.ParseInt(resOther.Infcode, 10, 64)
  6126. res.Infcode = infocode
  6127. }
  6128. if res.Infcode != 0 {
  6129. errlog := &models.HisOrderError{
  6130. UserOrgId: 10265,
  6131. Ctime: time.Now().Unix(),
  6132. Mtime: time.Now().Unix(),
  6133. ErrMsg: res.ErrMsg,
  6134. Status: 3000,
  6135. PatientId: order_id,
  6136. Stage: 10265,
  6137. }
  6138. service.CreateErrMsgLog(errlog)
  6139. continue
  6140. } else {
  6141. hisFundSettleListResult := &models.HisFundSettleListResult{
  6142. Number: res.Output.SetlListId,
  6143. Status: 1,
  6144. Ctime: time.Now().Unix(),
  6145. Mtime: time.Now().Unix(),
  6146. UserOrgId: 10265,
  6147. IsUpload: 1,
  6148. OrderId: order_id,
  6149. }
  6150. service.CreateUploadRecord(hisFundSettleListResult)
  6151. continue
  6152. }
  6153. }
  6154. }
  6155. func RemoveRepeatedPurviewElement2(arr []string) (newArr []string) {
  6156. newArr = make([]string, 0)
  6157. for i := 0; i < len(arr); i++ {
  6158. repeat := false
  6159. for j := i + 1; j < len(arr); j++ {
  6160. if arr[i] == arr[j] {
  6161. repeat = true
  6162. break
  6163. }
  6164. }
  6165. if !repeat {
  6166. newArr = append(newArr, arr[i])
  6167. }
  6168. }
  6169. return
  6170. }
  6171. func Get4202(){
  6172. admin_user_id := int64(2738)
  6173. var orders []*models.HisOrder
  6174. orders, _ = service.GetAllHisOrder10265()
  6175. for _,item := range orders{
  6176. order_id := item.ID
  6177. stas_type := "1"
  6178. order, _ := service.GetHisOrderByID(order_id)
  6179. miConfig, _ := service.FindMedicalInsuranceInfo(10265)
  6180. var user_name string
  6181. role, _ := service.GetAdminUserInfoByID(10265, admin_user_id)
  6182. if role.ID == 0 {
  6183. user_name = "管理员"
  6184. } else {
  6185. user_name = role.UserName
  6186. }
  6187. baseParams := models.BaseParams{
  6188. SecretKey: miConfig.SecretKey,
  6189. FixmedinsCode: miConfig.Code,
  6190. InsuplcAdmdvs: miConfig.InsuplcAdmdvs,
  6191. MdtrtareaAdmvs: miConfig.MdtrtareaAdmvs,
  6192. OrgName: miConfig.OrgName,
  6193. Doctor: user_name,
  6194. RequestUrl: miConfig.Url,
  6195. AccessKey: miConfig.AccessKey,
  6196. }
  6197. businessParams := models.BusinessParams{
  6198. PsnNo: order.PsnNo,
  6199. MdtrtId: order.MdtrtId,
  6200. SetlId: order.SetlId,
  6201. StasType: stas_type,
  6202. }
  6203. api := "http://172.16.13.254:9532/" + "nmyb/4102?psn_no=" + businessParams.PsnNo + "&mdtrt_id=" + businessParams.MdtrtId + "&setl_id=" + businessParams.SetlId +
  6204. "&org_name=" + miConfig.OrgName + "&doctor=" + baseParams.Doctor + "&fixmedins_code=" + miConfig.Code +
  6205. "&insuplc_admdvs=" + miConfig.InsuplcAdmdvs + "&mdtrtarea_admvs=" + miConfig.MdtrtareaAdmvs + "&secret_key=" + miConfig.SecretKey + "&stas_type=" + stas_type
  6206. resp, _ := http.Get(api)
  6207. body, ioErr := ioutil.ReadAll(resp.Body)
  6208. if ioErr != nil {
  6209. utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  6210. }
  6211. var respJSON map[string]interface{}
  6212. if err := json.Unmarshal([]byte(string(body)), &respJSON); err != nil {
  6213. utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  6214. }
  6215. respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  6216. result, _ := json.Marshal(respJSON)
  6217. var res2 ResultSix
  6218. var resEmpty10265 ResultEmpty10265
  6219. if err := json.Unmarshal(result, &resEmpty10265); err != nil {
  6220. utils.ErrorLog("解析失败:%v", err)
  6221. }
  6222. Infcode, _ := strconv.ParseInt(resEmpty10265.Infcode, 10, 64)
  6223. res2.Infcode = Infcode
  6224. res2.RespondTime = resEmpty10265.RespondTime
  6225. res2.ErrMsg = resEmpty10265.ErrMsg
  6226. res2.Output = resEmpty10265.Output
  6227. res2.WarnMsg = resEmpty10265.WarnMsg
  6228. if res2.Infcode == 0 {
  6229. continue
  6230. } else {
  6231. errlog := &models.HisOrderError{
  6232. UserOrgId: 10265,
  6233. Ctime: time.Now().Unix(),
  6234. Mtime: time.Now().Unix(),
  6235. ErrMsg: res2.ErrMsg,
  6236. Status: 2000,
  6237. PatientId: order_id,
  6238. Stage: 10265,
  6239. }
  6240. service.CreateErrMsgLog(errlog)
  6241. continue
  6242. }
  6243. }
  6244. }