main.go 209KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850
  1. package main
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. _ "gdyb/routers"
  8. "gdyb/service"
  9. "gdyb/utils"
  10. "github.com/shopspring/decimal"
  11. "io/ioutil"
  12. "net/http"
  13. "os"
  14. "strconv"
  15. "strings"
  16. "time"
  17. "github.com/astaxie/beego"
  18. //"github.com/qiniu/api.v7/auth/qbox"
  19. //"github.com/qiniu/api.v7/storage"
  20. //"github.com/qiniu/roapi.v7/auth/qbox"
  21. //"github.com/qiniu/api.v7/storage"
  22. //"strconv"
  23. //"time"
  24. )
  25. func init() {
  26. service.ConnectDB()
  27. org_id, _ := beego.AppConfig.Int64("org_id")
  28. miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  29. ////CreateLog(miConfig)
  30. ////UploadLog(miConfig)
  31. if org_id == 10191 {
  32. service.GetFjAuthorizationInfo(miConfig.Code)
  33. }
  34. }
  35. func main() {
  36. //service.AutoCreateStock()
  37. //service.AutoGdybCreateStock()
  38. //service.AutoUploadData
  39. //台山百伦清单上传方法
  40. //GetBatchSettleList()
  41. //深圳百霖
  42. //GetblBatchSettleList()
  43. //深圳百霖贝尔
  44. //GetbrBatchSettleList()
  45. beego.Run()
  46. }
  47. type CustomFundPay struct {
  48. FundPayType string `json:"fund_pay_type"`
  49. FundPayamt float64 `json:"fund_payamt"`
  50. }
  51. type ResultSeventeen struct {
  52. ErrMsg string `json:"err_msg"`
  53. InfRefmsgid string `json:"inf_refmsgid"`
  54. Infcode int64 `json:"infcode"`
  55. Output struct {
  56. SetlListId string `json:"setl_list_id"`
  57. } `json:"output"`
  58. RefmsgTime string `json:"refmsg_time"`
  59. RespondTime string `json:"respond_time"`
  60. Signtype string `json:"signtype"`
  61. WarnInfo string `json:"warn_info"`
  62. }
  63. func GetblBatchSettleList() {
  64. org_id, _ := beego.AppConfig.Int64("org_id")
  65. //var orders []*models.HisOrder
  66. var orders []*models.HisOrderError
  67. orders, _ = service.GetOrderError10138(org_id)
  68. for _, item := range orders {
  69. order_id := item.PatientId
  70. order, _ := service.GetHisOrderByIDTwo(order_id)
  71. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  72. var patientPrescription models.HisPrescriptionInfo
  73. patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  74. doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  75. department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  76. miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  77. var configTwo []*models.HisXtDiagnoseConfig
  78. diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  79. curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  80. for _, item := range diagnosis_idstwo {
  81. id, _ := strconv.ParseInt(item, 10, 64)
  82. diagnosisConfig, _ := service.FindDiagnoseById(id)
  83. configTwo = append(configTwo, &diagnosisConfig)
  84. }
  85. sickConfig, _ := service.FindSickById(his.SickType)
  86. if order.MedType == "1111" || order.MedType == "1112" {
  87. order.MedType = "11"
  88. }
  89. 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"))
  90. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  91. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  92. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  93. if order.ID == 0 {
  94. return
  95. }
  96. if his.BalanceAccountsType == 2 {
  97. continue
  98. }
  99. struct4101 := service.Struct4101{
  100. PsnNo: order.PsnNo,
  101. MdtrtId: order.MdtrtId,
  102. SetlId: order.SetlId,
  103. PsnName: order.PsnName,
  104. Gend: order.Gend,
  105. Brdy: his.Brdy,
  106. Age: his.Age,
  107. Naty: order.Naty,
  108. PatnCertType: order.PsnCertType,
  109. Certno: order.Certno,
  110. Prfs: "90",
  111. ConerName: "",
  112. PatnRlts: "",
  113. ConerAddr: "",
  114. ConerTel: "",
  115. HiType: order.Insutype,
  116. Insuplc: his.InsuplcAdmdvs,
  117. MaindiagFlag: "1",
  118. BillCode: order.SetlId,
  119. BillNo: order.SetlId,
  120. BizSn: order.Number,
  121. PsnSelfPay: order.PsnPartAmt,
  122. PsnOwnPay: order.PsnPartAmt,
  123. AcctPay: order.AcctPay,
  124. PsnCashpay: order.PsnCashPay,
  125. HiPaymtd: "1",
  126. Hsorg: his.InsuplcAdmdvs,
  127. HsorgOpter: his.InsuplcAdmdvs,
  128. MedinsFillPsn: curRoles.UserName,
  129. MedinsFillDept: depart.Name,
  130. IptMedType: "2",
  131. }
  132. struct4101.SetlBegnDate = order.SetlTime
  133. struct4101.SetlEndDate = order.SetlTime
  134. var rf []CustomFundPay
  135. json.Unmarshal([]byte(order.SetlDetail), &rf)
  136. //var tempFunPays []service.CustomStruct
  137. //var tempFunPay610100 service.CustomStruct
  138. //for _, item := range rf {
  139. // if item.FundPayType == "610100" {
  140. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  141. // tempFunPay610100.FundPayType = item.FundPayType
  142. // } else {
  143. // var tempFunPay service.CustomStruct
  144. // tempFunPay.FundPayamt = item.FundPayamt
  145. // tempFunPay.FundPayType = item.FundPayType
  146. // tempFunPays = append(tempFunPays, tempFunPay)
  147. // }
  148. //}
  149. //tempFunPays = append(tempFunPays, tempFunPay610100)
  150. //struct4101.CustomStruct = tempFunPays
  151. var tempDiaginfos []service.DiaginfoStructTwo
  152. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  153. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  154. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  155. var config []*models.HisXtDiagnoseConfig
  156. for _, item := range diagnosis_ids {
  157. id, _ := strconv.ParseInt(item, 10, 64)
  158. diagnosisConfig, _ := service.FindDiagnoseById(id)
  159. config = append(config, &diagnosisConfig)
  160. }
  161. for index, item := range config {
  162. if index == 0 {
  163. var tempDiaginfo service.DiaginfoStructTwo
  164. tempDiaginfo.DiagCode = item.CountryCode
  165. tempDiaginfo.DiagName = item.CountryContentName
  166. tempDiaginfo.DiagType = "1"
  167. tempDiaginfo.MaindiagFlag = "1"
  168. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  169. } else {
  170. var tempDiaginfo service.DiaginfoStructTwo
  171. tempDiaginfo.DiagCode = item.CountryCode
  172. tempDiaginfo.DiagName = item.CountryContentName
  173. tempDiaginfo.DiagType = "2"
  174. tempDiaginfo.MaindiagFlag = "0"
  175. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  176. }
  177. }
  178. struct4101.Diseinfo = tempDiaginfos
  179. sickConfigTwo, _ := service.FindSickById(his.SickType)
  180. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  181. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  182. tempOpspdiseinfo2.OprnOprtCode = ""
  183. tempOpspdiseinfo2.OprnOprtName = ""
  184. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  185. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  186. //var iteminfo service.IteminfoStruct
  187. var bedCostTotal float64 = 0 //床位总费
  188. var bedCostSelfTotal float64 = 0 //床位自费
  189. var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  190. var examineCostTotal float64 = 0 //诊查总费
  191. var examineCostSelfTotal float64 = 0 //诊查自费
  192. var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  193. var nursingCostTotal float64 = 0 //护理总费
  194. var nursingCostSelfTotal float64 = 0 //护理自费
  195. var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  196. var chineseMedicineCostTotal float64 = 0 //中成药
  197. var chineseMedicineCostSelfTotal float64 = 0 //中成药
  198. var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  199. var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  200. var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  201. var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  202. var registerCostTotal float64 = 0 //一般诊疗费
  203. var registerCostSelfTotal float64 = 0 //一般诊疗费
  204. var registerPartSelfTotal float64 = 0 //一般诊疗费
  205. var operationCostTotal float64 = 0 //手术费
  206. var operationCostSelfTotal float64 = 0 //手术费
  207. var operationCostPartSelfTotal float64 = 0 //手术费
  208. var otherCostTotal float64 = 0 //其他费用
  209. var otherCostSelfTotal float64 = 0 //其他费用
  210. var otherCostPartSelfTotal float64 = 0 //其他费用
  211. var materialCostTotal float64 = 0 //材料费
  212. var materialCostSelfTotal float64 = 0 //材料费
  213. var materialCostPartSelfTotal float64 = 0 //材料费
  214. var westernMedicineCostTotal float64 = 0 //西药费
  215. var westernMedicineCostSelfTotal float64 = 0 //西药费
  216. var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  217. var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  218. var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  219. var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  220. var checkCostTotal float64 = 0 //检查费
  221. var checkCostSelfTotal float64 = 0 //检查费
  222. var checkCostPartSelfTotal float64 = 0 //检查费
  223. var laboratoryCostTotal float64 = 0 //化验费
  224. var laboratoryCostSelfTotal float64 = 0 //化验费
  225. var laboratoryCostPartSelfTotal float64 = 0 //化验费
  226. var treatCostTotal float64 = 0 //治疗费用
  227. var treatCostSelfTotal float64 = 0 //治疗费用
  228. var treatCostPartSelfTotal float64 = 0 //治疗费用
  229. decimal.DivisionPrecision = 2
  230. var bed_fulamt_ownpay_amt float64 = 0
  231. var examine_fulamt_ownpay_amt float64 = 0
  232. var nursing_fulamt_ownpay_amt float64 = 0
  233. var chinese_medicine_fulamt_ownpay_amt float64 = 0
  234. var commonly_treatment_fulamt_ownpay_amt float64 = 0
  235. var register_fulamt_ownpay_amt float64 = 0
  236. var operation_fulamt_ownpay_amt float64 = 0
  237. var other_fulamt_ownpay_amt float64 = 0
  238. var westernMedicine_fulamt_ownpay_amt float64 = 0
  239. var chineseTraditional_fulamt_ownpay_amt float64 = 0
  240. var check_fulamt_ownpay_amt float64 = 0
  241. var material_fulamt_ownpay_amt float64 = 0
  242. var laboratory_fulamt_ownpay_amt float64 = 0
  243. var treat_fulamt_ownpay_amt float64 = 0
  244. var bed_claa_sunmfee float64 = 0
  245. var bed_clab_amt float64 = 0
  246. var bed_other_amt float64 = 0
  247. var examine_claa_sunmfee float64 = 0
  248. var examine_clab_amt float64 = 0
  249. var examine_other_amt float64 = 0
  250. var nursing_claa_sunmfee float64 = 0
  251. var nursing_clab_amt float64 = 0
  252. var nursing_other_amt float64 = 0
  253. var chinese_medicine_claa_sunmfee float64 = 0
  254. var chinese_medicine_clab_amt float64 = 0
  255. var chinese_medicine_other_amt float64 = 0
  256. var commonly_treatment_claa_sunmfee float64 = 0
  257. var commonly_treatment_clab_amt float64 = 0
  258. var commonly_treatment_other_amt float64 = 0
  259. var operation_claa_sunmfee float64 = 0
  260. var operation_clab_amt float64 = 0
  261. var operation_other_amt float64 = 0
  262. var other_claa_sunmfee float64 = 0
  263. var other_clab_amt float64 = 0
  264. var other_other_amt float64 = 0
  265. var westernMedicine_claa_sunmfee float64 = 0
  266. var westernMedicine_clab_amt float64 = 0
  267. var westernMedicine_other_amt float64 = 0
  268. var chineseTraditional_claa_sunmfee float64 = 0
  269. var chineseTraditional_clab_amt float64 = 0
  270. var chineseTraditional_other_amt float64 = 0
  271. var check_claa_sunmfee float64 = 0
  272. var check_clab_amt float64 = 0
  273. var check_other_amt float64 = 0
  274. var material_claa_sunmfee float64 = 0
  275. var material_clab_amt float64 = 0
  276. var material_other_amt float64 = 0
  277. var laboratory_claa_sunmfee float64 = 0
  278. var laboratory_clab_amt float64 = 0
  279. var laboratory_other_amt float64 = 0
  280. var treat_claa_sunmfee float64 = 0
  281. var treat_clab_amt float64 = 0
  282. var treat_other_amt float64 = 0
  283. var register_claa_sunmfee float64 = 0
  284. var register_clab_amt float64 = 0
  285. var register_other_amt float64 = 0
  286. for _, item := range order.HisOrderInfo {
  287. if item.MedChrgitmType == "01" { //床位费
  288. bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  289. bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  290. bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  291. bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  292. if item.ChrgitmLv == "1" {
  293. bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  294. }
  295. if item.ChrgitmLv == "2" {
  296. bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  297. }
  298. if item.ChrgitmLv == "3" {
  299. bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  300. }
  301. }
  302. if item.MedChrgitmType == "02" { //诊查
  303. examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  304. examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  305. examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  306. examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  307. if item.ChrgitmLv == "1" {
  308. examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  309. }
  310. if item.ChrgitmLv == "2" {
  311. examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  312. }
  313. if item.ChrgitmLv == "3" {
  314. examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  315. }
  316. }
  317. if item.MedChrgitmType == "03" { //检查费
  318. checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  319. checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  320. checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  321. check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  322. if item.ChrgitmLv == "1" {
  323. check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  324. }
  325. if item.ChrgitmLv == "2" {
  326. check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  327. }
  328. if item.ChrgitmLv == "3" {
  329. check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  330. }
  331. }
  332. if item.MedChrgitmType == "04" { //化验费
  333. laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  334. laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  335. laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  336. laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  337. if item.ChrgitmLv == "1" {
  338. laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  339. }
  340. if item.ChrgitmLv == "2" {
  341. laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  342. }
  343. if item.ChrgitmLv == "3" {
  344. laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  345. }
  346. }
  347. if item.MedChrgitmType == "05" { //治疗费
  348. treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  349. treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  350. treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  351. treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  352. if item.ChrgitmLv == "1" {
  353. treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  354. }
  355. if item.ChrgitmLv == "2" {
  356. treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  357. }
  358. if item.ChrgitmLv == "3" {
  359. treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  360. }
  361. }
  362. if item.MedChrgitmType == "06" { //手术费
  363. operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  364. operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  365. operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  366. operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  367. if item.ChrgitmLv == "1" {
  368. operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  369. }
  370. if item.ChrgitmLv == "2" {
  371. operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  372. }
  373. if item.ChrgitmLv == "3" {
  374. operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  375. }
  376. }
  377. if item.MedChrgitmType == "07" { //手术费
  378. nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  379. nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  380. nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  381. nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  382. if item.ChrgitmLv == "1" {
  383. nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  384. }
  385. if item.ChrgitmLv == "2" {
  386. nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  387. }
  388. if item.ChrgitmLv == "3" {
  389. nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  390. }
  391. }
  392. if item.MedChrgitmType == "08" { //材料费
  393. materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  394. materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  395. materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  396. material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  397. if item.ChrgitmLv == "1" {
  398. material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  399. }
  400. if item.ChrgitmLv == "2" {
  401. material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  402. }
  403. if item.ChrgitmLv == "3" {
  404. material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  405. }
  406. }
  407. if item.MedChrgitmType == "09" { //西药费
  408. westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  409. westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  410. westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  411. westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  412. if item.ChrgitmLv == "1" {
  413. westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  414. }
  415. if item.ChrgitmLv == "2" {
  416. westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  417. }
  418. if item.ChrgitmLv == "3" {
  419. westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  420. }
  421. }
  422. if item.MedChrgitmType == "10" { //中药饮片
  423. chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  424. chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  425. chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  426. chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  427. if item.ChrgitmLv == "1" {
  428. chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  429. }
  430. if item.ChrgitmLv == "2" {
  431. chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  432. }
  433. if item.ChrgitmLv == "3" {
  434. chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  435. }
  436. }
  437. if item.MedChrgitmType == "11" { //中成费
  438. chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  439. chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  440. chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  441. chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  442. if item.ChrgitmLv == "1" {
  443. chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  444. }
  445. if item.ChrgitmLv == "2" {
  446. chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  447. }
  448. if item.ChrgitmLv == "3" {
  449. chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  450. }
  451. }
  452. if item.MedChrgitmType == "12" { //中成费
  453. commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  454. commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  455. commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  456. commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  457. if item.ChrgitmLv == "1" {
  458. commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  459. }
  460. if item.ChrgitmLv == "2" {
  461. commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  462. }
  463. if item.ChrgitmLv == "3" {
  464. commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  465. }
  466. }
  467. if item.MedChrgitmType == "13" { //中成费
  468. registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  469. registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  470. registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  471. register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  472. if item.ChrgitmLv == "1" {
  473. register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  474. }
  475. if item.ChrgitmLv == "2" {
  476. register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  477. }
  478. if item.ChrgitmLv == "3" {
  479. register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  480. }
  481. }
  482. if item.MedChrgitmType == "14" { //其他费
  483. otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  484. otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  485. otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  486. other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  487. if item.ChrgitmLv == "1" {
  488. other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  489. }
  490. if item.ChrgitmLv == "2" {
  491. other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  492. }
  493. if item.ChrgitmLv == "3" {
  494. other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  495. }
  496. }
  497. }
  498. //var iteminfoStructs []service.IteminfoStruct
  499. //
  500. //if bedCostTotal != 0 {
  501. // iteminfo.MedChrgitm = "01"
  502. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  503. // iteminfo.Amt = bedCostTotal
  504. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  505. // iteminfo.ClabAmt = bed_clab_amt
  506. // iteminfo.OthAmt = bed_other_amt
  507. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  508. //}
  509. //
  510. //if examineCostTotal != 0 {
  511. // iteminfo.MedChrgitm = "02"
  512. // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  513. // iteminfo.Amt = examineCostTotal
  514. // iteminfo.ClaaSumfee = examine_claa_sunmfee
  515. // iteminfo.ClabAmt = examine_clab_amt
  516. // iteminfo.OthAmt = examine_other_amt
  517. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  518. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  519. //}
  520. //
  521. //if checkCostTotal != 0 {
  522. // iteminfo.MedChrgitm = "03"
  523. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  524. // iteminfo.Amt = checkCostTotal
  525. // iteminfo.ClaaSumfee = check_claa_sunmfee
  526. // iteminfo.ClabAmt = check_clab_amt
  527. // iteminfo.OthAmt = check_other_amt
  528. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  529. //
  530. //}
  531. //
  532. //if laboratoryCostTotal != 0 {
  533. // iteminfo.MedChrgitm = "04"
  534. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  535. // iteminfo.Amt = laboratoryCostTotal
  536. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  537. // iteminfo.ClabAmt = laboratory_clab_amt
  538. // iteminfo.OthAmt = laboratory_other_amt
  539. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  540. //
  541. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  542. //
  543. //}
  544. //
  545. //if treatCostTotal != 0 {
  546. // iteminfo.MedChrgitm = "05"
  547. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  548. // iteminfo.Amt = treatCostTotal
  549. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  550. // iteminfo.ClabAmt = treat_clab_amt
  551. // iteminfo.OthAmt = treat_other_amt
  552. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  553. // //(struct4101.IteminfoStruct, iteminfo)
  554. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  555. //}
  556. //
  557. //if operationCostTotal != 0 {
  558. // iteminfo.MedChrgitm = "06"
  559. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  560. // iteminfo.Amt = operationCostTotal
  561. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  562. // iteminfo.ClabAmt = operation_clab_amt
  563. // iteminfo.OthAmt = operation_other_amt
  564. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  565. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  566. //}
  567. //
  568. //if nursingCostTotal != 0 {
  569. // iteminfo.MedChrgitm = "07"
  570. // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  571. // iteminfo.Amt = nursingCostTotal
  572. // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  573. // iteminfo.ClabAmt = nursing_clab_amt
  574. // iteminfo.OthAmt = nursing_other_amt
  575. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  576. //}
  577. //
  578. //if materialCostTotal != 0 {
  579. // iteminfo.MedChrgitm = "08"
  580. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  581. // iteminfo.Amt = materialCostTotal
  582. // iteminfo.ClaaSumfee = material_claa_sunmfee
  583. // iteminfo.ClabAmt = material_clab_amt
  584. // iteminfo.OthAmt = material_other_amt
  585. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  586. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  587. //}
  588. //
  589. //if westernMedicineCostTotal != 0 {
  590. // iteminfo.MedChrgitm = "09"
  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. //
  601. //if chineseMedicineCostTotal != 0 {
  602. // iteminfo.MedChrgitm = "10"
  603. // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  604. // iteminfo.Amt = chineseMedicineCostTotal
  605. // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  606. // iteminfo.ClabAmt = chinese_medicine_clab_amt
  607. // iteminfo.OthAmt = chinese_medicine_other_amt
  608. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  609. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  610. //
  611. //}
  612. //
  613. //if chineseTraditionalMedicineCostTotal != 0 {
  614. // iteminfo.MedChrgitm = "11"
  615. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  616. // iteminfo.Amt = westernMedicineCostTotal
  617. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  618. // iteminfo.ClabAmt = westernMedicine_clab_amt
  619. // iteminfo.OthAmt = westernMedicine_other_amt
  620. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  621. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  622. //
  623. //}
  624. //
  625. //if commonlyTreatmentCostTotal != 0 {
  626. // iteminfo.MedChrgitm = "12"
  627. // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  628. // iteminfo.Amt = commonlyTreatmentCostTotal
  629. // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  630. // iteminfo.ClabAmt = commonly_treatment_clab_amt
  631. // iteminfo.OthAmt = commonly_treatment_other_amt
  632. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  633. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  634. //
  635. //}
  636. //
  637. //if registerCostTotal != 0 {
  638. // iteminfo.MedChrgitm = "13"
  639. // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  640. // iteminfo.Amt = registerCostTotal
  641. // iteminfo.ClaaSumfee = register_claa_sunmfee
  642. // iteminfo.ClabAmt = register_clab_amt
  643. // iteminfo.OthAmt = register_other_amt
  644. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  645. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  646. //
  647. //}
  648. //
  649. //if otherCostTotal != 0 {
  650. // iteminfo.MedChrgitm = "14"
  651. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  652. // iteminfo.Amt = otherCostTotal
  653. // iteminfo.ClaaSumfee = other_claa_sunmfee
  654. // iteminfo.ClabAmt = other_clab_amt
  655. // iteminfo.OthAmt = other_other_amt
  656. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  657. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  658. //
  659. //}
  660. //
  661. //struct4101.IteminfoStruct = iteminfoStructs
  662. time_arr := strings.Split(order.SetlTime, " ")
  663. struct4101.AdmTime = time_arr[0]
  664. struct4101.AdmEndTime = time_arr[0]
  665. struct4101.DoctorName = doctor.UserName
  666. struct4101.DoctorCode = doctor.DoctorNumber
  667. struct4101.Ntly = "中国"
  668. struct4101.AdmCaty = "A03.06"
  669. var res ResultSeventeen
  670. {
  671. result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  672. fmt.Println(result)
  673. saveLog(result, request, "4101A", "清单上传")
  674. var dat map[string]interface{}
  675. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  676. fmt.Println(dat)
  677. } else {
  678. fmt.Println(err)
  679. }
  680. userJSONBytes, _ := json.Marshal(dat)
  681. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  682. //utils.ErrorLog("解析失败:%v", err)
  683. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  684. //adminUser := c.GetAdminUserInfo()
  685. errlog := &models.HisOrderError{
  686. UserOrgId: org_id,
  687. Ctime: time.Now().Unix(),
  688. Mtime: time.Now().Unix(),
  689. ErrMsg: res.ErrMsg + "解析失败",
  690. Status: 1,
  691. PatientId: order_id,
  692. Stage: 10136000,
  693. }
  694. service.CreateErrMsgLog(errlog)
  695. continue
  696. }
  697. }
  698. if res.Infcode != 0 {
  699. //adminUser := c.GetAdminUserInfo()
  700. errlog := &models.HisOrderError{
  701. UserOrgId: org_id,
  702. Ctime: time.Now().Unix(),
  703. Mtime: time.Now().Unix(),
  704. ErrMsg: res.ErrMsg,
  705. Status: 1,
  706. PatientId: order_id,
  707. Stage: 10136000,
  708. }
  709. service.CreateErrMsgLog(errlog)
  710. continue
  711. } else {
  712. hisFundSettleListResult := &models.HisFundSettleListResult{
  713. Number: res.Output.SetlListId,
  714. Status: 1,
  715. Ctime: time.Now().Unix(),
  716. Mtime: time.Now().Unix(),
  717. UserOrgId: org_id,
  718. IsUpload: 1,
  719. OrderId: order_id,
  720. }
  721. service.CreateUploadRecord(hisFundSettleListResult)
  722. continue
  723. }
  724. }
  725. }
  726. //func GetbrBatchSettleList() {
  727. // org_id, _ := beego.AppConfig.Int64("org_id")
  728. // var orders []*models.HisOrder
  729. // orders, _ = service.GetAllHisOrder10278()
  730. // for _, item := range orders {
  731. // order_id := item.ID
  732. // order, _ := service.GetHisOrderByIDTwo(order_id)
  733. // //roles, _ := service.GetDoctorListTwo(org_id)
  734. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  735. // var patientPrescription models.HisPrescriptionInfo
  736. // patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  737. // doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  738. // department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  739. // miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  740. // var configTwo []*models.HisXtDiagnoseConfig
  741. // diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  742. // curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  743. // for _, item := range diagnosis_idstwo {
  744. // id, _ := strconv.ParseInt(item, 10, 64)
  745. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  746. // configTwo = append(configTwo, &diagnosisConfig)
  747. // }
  748. //
  749. // sickConfig, _ := service.FindSickById(his.SickType)
  750. // 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"))
  751. //
  752. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  753. // pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  754. // doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  755. // if order.ID == 0 {
  756. // return
  757. // }
  758. // if his.BalanceAccountsType == 2 {
  759. // continue
  760. // }
  761. // struct4101 := service.Struct4101{
  762. // PsnNo: order.PsnNo,
  763. // MdtrtId: order.MdtrtId,
  764. // SetlId: order.SetlId,
  765. // PsnName: order.PsnName,
  766. // Gend: order.Gend,
  767. // Brdy: his.Brdy,
  768. // Age: his.Age,
  769. // Naty: order.Naty,
  770. // PatnCertType: order.PsnCertType,
  771. // Certno: order.Certno,
  772. // Prfs: "90",
  773. // ConerName: "",
  774. // PatnRlts: "",
  775. // ConerAddr: "",
  776. // ConerTel: "",
  777. // HiType: order.Insutype,
  778. // Insuplc: his.InsuplcAdmdvs,
  779. // MaindiagFlag: "1",
  780. // BillCode: order.SetlId,
  781. // BillNo: order.SetlId,
  782. // BizSn: order.Number,
  783. // PsnSelfPay: order.PsnPartAmt,
  784. // PsnOwnPay: order.PsnPartAmt,
  785. // AcctPay: order.AcctPay,
  786. // PsnCashpay: order.PsnCashPay,
  787. // HiPaymtd: "1",
  788. // Hsorg: his.InsuplcAdmdvs,
  789. // HsorgOpter: his.InsuplcAdmdvs,
  790. // MedinsFillPsn: curRoles.UserName,
  791. // MedinsFillDept: depart.Name,
  792. // IptMedType: "2",
  793. // }
  794. //
  795. // struct4101.SetlBegnDate = order.SetlTime
  796. // struct4101.SetlEndDate = order.SetlTime
  797. //
  798. //
  799. // var rf []CustomFundPay
  800. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  801. //
  802. // //var tempFunPays []service.CustomStruct
  803. // //var tempFunPay610100 service.CustomStruct
  804. //
  805. // //for _, item := range rf {
  806. // // if item.FundPayType == "610100" {
  807. // // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  808. // // tempFunPay610100.FundPayType = item.FundPayType
  809. // // } else {
  810. // // var tempFunPay service.CustomStruct
  811. // // tempFunPay.FundPayamt = item.FundPayamt
  812. // // tempFunPay.FundPayType = item.FundPayType
  813. // // tempFunPays = append(tempFunPays, tempFunPay)
  814. // // }
  815. // //}
  816. // //tempFunPays = append(tempFunPays, tempFunPay610100)
  817. // //struct4101.CustomStruct = tempFunPays
  818. //
  819. // var tempDiaginfos []service.DiaginfoStructTwo
  820. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  821. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  822. //
  823. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  824. // var config []*models.HisXtDiagnoseConfig
  825. // for _, item := range diagnosis_ids {
  826. // id, _ := strconv.ParseInt(item, 10, 64)
  827. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  828. // config = append(config, &diagnosisConfig)
  829. // }
  830. //
  831. // for index, item := range config {
  832. // if index == 0 {
  833. // var tempDiaginfo service.DiaginfoStructTwo
  834. // tempDiaginfo.DiagCode = item.CountryCode
  835. // tempDiaginfo.DiagName = item.CountryContentName
  836. // tempDiaginfo.DiagType = "1"
  837. // tempDiaginfo.MaindiagFlag = "1"
  838. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  839. // } else {
  840. //
  841. // var tempDiaginfo service.DiaginfoStructTwo
  842. // tempDiaginfo.DiagCode = item.CountryCode
  843. // tempDiaginfo.DiagName = item.CountryContentName
  844. // tempDiaginfo.DiagType = "2"
  845. // tempDiaginfo.MaindiagFlag = "0"
  846. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  847. // }
  848. // }
  849. // struct4101.Diseinfo = tempDiaginfos
  850. //
  851. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  852. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  853. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  854. // tempOpspdiseinfo2.OprnOprtCode = ""
  855. // tempOpspdiseinfo2.OprnOprtName = ""
  856. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  857. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  858. //
  859. // //var iteminfo service.IteminfoStruct
  860. //
  861. // var bedCostTotal float64 = 0 //床位总费
  862. // var bedCostSelfTotal float64 = 0 //床位自费
  863. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  864. //
  865. // var examineCostTotal float64 = 0 //诊查总费
  866. // var examineCostSelfTotal float64 = 0 //诊查自费
  867. // var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  868. //
  869. // var nursingCostTotal float64 = 0 //护理总费
  870. // var nursingCostSelfTotal float64 = 0 //护理自费
  871. // var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  872. //
  873. // var chineseMedicineCostTotal float64 = 0 //中成药
  874. // var chineseMedicineCostSelfTotal float64 = 0 //中成药
  875. // var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  876. //
  877. // var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  878. // var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  879. // var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  880. //
  881. // var registerCostTotal float64 = 0 //一般诊疗费
  882. // var registerCostSelfTotal float64 = 0 //一般诊疗费
  883. // var registerPartSelfTotal float64 = 0 //一般诊疗费
  884. //
  885. // var operationCostTotal float64 = 0 //手术费
  886. // var operationCostSelfTotal float64 = 0 //手术费
  887. // var operationCostPartSelfTotal float64 = 0 //手术费
  888. //
  889. // var otherCostTotal float64 = 0 //其他费用
  890. // var otherCostSelfTotal float64 = 0 //其他费用
  891. // var otherCostPartSelfTotal float64 = 0 //其他费用
  892. //
  893. // var materialCostTotal float64 = 0 //材料费
  894. // var materialCostSelfTotal float64 = 0 //材料费
  895. // var materialCostPartSelfTotal float64 = 0 //材料费
  896. //
  897. // var westernMedicineCostTotal float64 = 0 //西药费
  898. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  899. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  900. //
  901. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  902. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  903. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  904. //
  905. // var checkCostTotal float64 = 0 //检查费
  906. // var checkCostSelfTotal float64 = 0 //检查费
  907. // var checkCostPartSelfTotal float64 = 0 //检查费
  908. //
  909. // var laboratoryCostTotal float64 = 0 //化验费
  910. // var laboratoryCostSelfTotal float64 = 0 //化验费
  911. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  912. //
  913. // var treatCostTotal float64 = 0 //治疗费用
  914. // var treatCostSelfTotal float64 = 0 //治疗费用
  915. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  916. //
  917. // decimal.DivisionPrecision = 2
  918. //
  919. // var bed_fulamt_ownpay_amt float64 = 0
  920. //
  921. // var examine_fulamt_ownpay_amt float64 = 0
  922. //
  923. // var nursing_fulamt_ownpay_amt float64 = 0
  924. //
  925. // var chinese_medicine_fulamt_ownpay_amt float64 = 0
  926. //
  927. // var commonly_treatment_fulamt_ownpay_amt float64 = 0
  928. //
  929. // var register_fulamt_ownpay_amt float64 = 0
  930. //
  931. // var operation_fulamt_ownpay_amt float64 = 0
  932. // var other_fulamt_ownpay_amt float64 = 0
  933. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  934. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  935. // var check_fulamt_ownpay_amt float64 = 0
  936. // var material_fulamt_ownpay_amt float64 = 0
  937. // var laboratory_fulamt_ownpay_amt float64 = 0
  938. // var treat_fulamt_ownpay_amt float64 = 0
  939. //
  940. // var bed_claa_sunmfee float64 = 0
  941. // var bed_clab_amt float64 = 0
  942. // var bed_other_amt float64 = 0
  943. //
  944. // var examine_claa_sunmfee float64 = 0
  945. // var examine_clab_amt float64 = 0
  946. // var examine_other_amt float64 = 0
  947. //
  948. // var nursing_claa_sunmfee float64 = 0
  949. // var nursing_clab_amt float64 = 0
  950. // var nursing_other_amt float64 = 0
  951. //
  952. // var chinese_medicine_claa_sunmfee float64 = 0
  953. // var chinese_medicine_clab_amt float64 = 0
  954. // var chinese_medicine_other_amt float64 = 0
  955. //
  956. // var commonly_treatment_claa_sunmfee float64 = 0
  957. // var commonly_treatment_clab_amt float64 = 0
  958. // var commonly_treatment_other_amt float64 = 0
  959. //
  960. // var operation_claa_sunmfee float64 = 0
  961. // var operation_clab_amt float64 = 0
  962. // var operation_other_amt float64 = 0
  963. //
  964. // var other_claa_sunmfee float64 = 0
  965. // var other_clab_amt float64 = 0
  966. // var other_other_amt float64 = 0
  967. //
  968. // var westernMedicine_claa_sunmfee float64 = 0
  969. // var westernMedicine_clab_amt float64 = 0
  970. // var westernMedicine_other_amt float64 = 0
  971. //
  972. // var chineseTraditional_claa_sunmfee float64 = 0
  973. // var chineseTraditional_clab_amt float64 = 0
  974. // var chineseTraditional_other_amt float64 = 0
  975. //
  976. // var check_claa_sunmfee float64 = 0
  977. // var check_clab_amt float64 = 0
  978. // var check_other_amt float64 = 0
  979. //
  980. // var material_claa_sunmfee float64 = 0
  981. // var material_clab_amt float64 = 0
  982. // var material_other_amt float64 = 0
  983. //
  984. // var laboratory_claa_sunmfee float64 = 0
  985. // var laboratory_clab_amt float64 = 0
  986. // var laboratory_other_amt float64 = 0
  987. //
  988. // var treat_claa_sunmfee float64 = 0
  989. // var treat_clab_amt float64 = 0
  990. // var treat_other_amt float64 = 0
  991. //
  992. // var register_claa_sunmfee float64 = 0
  993. // var register_clab_amt float64 = 0
  994. // var register_other_amt float64 = 0
  995. //
  996. // for _, item := range order.HisOrderInfo {
  997. // if item.MedChrgitmType == "01" { //床位费
  998. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  999. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1000. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1001. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1002. // if item.ChrgitmLv == "1" {
  1003. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1004. // }
  1005. // if item.ChrgitmLv == "2" {
  1006. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1007. //
  1008. // }
  1009. // if item.ChrgitmLv == "3" {
  1010. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1011. // }
  1012. //
  1013. // }
  1014. //
  1015. // if item.MedChrgitmType == "02" { //诊查
  1016. // examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1017. // examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1018. // examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1019. // examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1020. // if item.ChrgitmLv == "1" {
  1021. // examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1022. // }
  1023. // if item.ChrgitmLv == "2" {
  1024. // examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1025. //
  1026. // }
  1027. // if item.ChrgitmLv == "3" {
  1028. // examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1029. // }
  1030. //
  1031. // }
  1032. //
  1033. // if item.MedChrgitmType == "03" { //检查费
  1034. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1035. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1036. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1037. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1038. // if item.ChrgitmLv == "1" {
  1039. //
  1040. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1041. //
  1042. // }
  1043. // if item.ChrgitmLv == "2" {
  1044. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1045. //
  1046. // }
  1047. // if item.ChrgitmLv == "3" {
  1048. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1049. // }
  1050. // }
  1051. //
  1052. // if item.MedChrgitmType == "04" { //化验费
  1053. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1054. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1055. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1056. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1057. // if item.ChrgitmLv == "1" {
  1058. //
  1059. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1060. //
  1061. // }
  1062. // if item.ChrgitmLv == "2" {
  1063. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1064. //
  1065. // }
  1066. // if item.ChrgitmLv == "3" {
  1067. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1068. // }
  1069. // }
  1070. //
  1071. // if item.MedChrgitmType == "05" { //治疗费
  1072. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1073. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1074. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1075. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1076. // if item.ChrgitmLv == "1" {
  1077. //
  1078. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1079. //
  1080. // }
  1081. // if item.ChrgitmLv == "2" {
  1082. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1083. //
  1084. // }
  1085. // if item.ChrgitmLv == "3" {
  1086. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1087. // }
  1088. // }
  1089. //
  1090. // if item.MedChrgitmType == "06" { //手术费
  1091. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1092. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1093. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1094. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1095. //
  1096. // if item.ChrgitmLv == "1" {
  1097. //
  1098. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1099. //
  1100. // }
  1101. // if item.ChrgitmLv == "2" {
  1102. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1103. //
  1104. // }
  1105. // if item.ChrgitmLv == "3" {
  1106. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1107. // }
  1108. // }
  1109. //
  1110. // if item.MedChrgitmType == "07" { //手术费
  1111. // nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1112. // nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1113. // nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1114. // nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1115. //
  1116. // if item.ChrgitmLv == "1" {
  1117. //
  1118. // nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1119. //
  1120. // }
  1121. // if item.ChrgitmLv == "2" {
  1122. // nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1123. //
  1124. // }
  1125. // if item.ChrgitmLv == "3" {
  1126. // nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1127. // }
  1128. // }
  1129. //
  1130. // if item.MedChrgitmType == "08" { //材料费
  1131. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1132. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1133. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1134. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1135. // if item.ChrgitmLv == "1" {
  1136. //
  1137. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1138. //
  1139. // }
  1140. // if item.ChrgitmLv == "2" {
  1141. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1142. //
  1143. // }
  1144. // if item.ChrgitmLv == "3" {
  1145. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1146. // }
  1147. // }
  1148. // if item.MedChrgitmType == "09" { //西药费
  1149. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1150. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1151. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1152. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1153. // if item.ChrgitmLv == "1" {
  1154. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1155. // }
  1156. // if item.ChrgitmLv == "2" {
  1157. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1158. // }
  1159. // if item.ChrgitmLv == "3" {
  1160. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1161. // }
  1162. // }
  1163. // if item.MedChrgitmType == "10" { //中药饮片
  1164. // chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1165. // chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1166. // chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1167. // chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1168. // if item.ChrgitmLv == "1" {
  1169. // chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1170. // }
  1171. // if item.ChrgitmLv == "2" {
  1172. // chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1173. // }
  1174. // if item.ChrgitmLv == "3" {
  1175. // chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1176. // }
  1177. // }
  1178. //
  1179. // if item.MedChrgitmType == "11" { //中成费
  1180. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1181. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1182. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1183. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1184. // if item.ChrgitmLv == "1" {
  1185. //
  1186. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1187. //
  1188. // }
  1189. // if item.ChrgitmLv == "2" {
  1190. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1191. //
  1192. // }
  1193. // if item.ChrgitmLv == "3" {
  1194. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1195. // }
  1196. // }
  1197. //
  1198. // if item.MedChrgitmType == "12" { //中成费
  1199. // commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1200. // commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1201. // commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1202. // commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1203. // if item.ChrgitmLv == "1" {
  1204. //
  1205. // commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1206. //
  1207. // }
  1208. // if item.ChrgitmLv == "2" {
  1209. // commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1210. //
  1211. // }
  1212. // if item.ChrgitmLv == "3" {
  1213. // commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1214. // }
  1215. // }
  1216. //
  1217. // if item.MedChrgitmType == "13" { //中成费
  1218. // registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1219. // registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1220. // registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1221. // register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1222. // if item.ChrgitmLv == "1" {
  1223. //
  1224. // register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1225. //
  1226. // }
  1227. // if item.ChrgitmLv == "2" {
  1228. // register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1229. //
  1230. // }
  1231. // if item.ChrgitmLv == "3" {
  1232. // register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1233. // }
  1234. // }
  1235. //
  1236. // if item.MedChrgitmType == "14" { //其他费
  1237. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1238. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1239. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1240. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1241. // if item.ChrgitmLv == "1" {
  1242. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1243. //
  1244. // }
  1245. // if item.ChrgitmLv == "2" {
  1246. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1247. //
  1248. // }
  1249. // if item.ChrgitmLv == "3" {
  1250. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1251. // }
  1252. // }
  1253. //
  1254. // }
  1255. //
  1256. // //var iteminfoStructs []service.IteminfoStruct
  1257. // //
  1258. // //if bedCostTotal != 0 {
  1259. // // iteminfo.MedChrgitm = "01"
  1260. // // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  1261. // // iteminfo.Amt = bedCostTotal
  1262. // // iteminfo.ClaaSumfee = bed_claa_sunmfee
  1263. // // iteminfo.ClabAmt = bed_clab_amt
  1264. // // iteminfo.OthAmt = bed_other_amt
  1265. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1266. // //}
  1267. // //
  1268. // //if examineCostTotal != 0 {
  1269. // // iteminfo.MedChrgitm = "02"
  1270. // // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  1271. // // iteminfo.Amt = examineCostTotal
  1272. // // iteminfo.ClaaSumfee = examine_claa_sunmfee
  1273. // // iteminfo.ClabAmt = examine_clab_amt
  1274. // // iteminfo.OthAmt = examine_other_amt
  1275. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1276. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1277. // //}
  1278. // //
  1279. // //if checkCostTotal != 0 {
  1280. // // iteminfo.MedChrgitm = "03"
  1281. // // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  1282. // // iteminfo.Amt = checkCostTotal
  1283. // // iteminfo.ClaaSumfee = check_claa_sunmfee
  1284. // // iteminfo.ClabAmt = check_clab_amt
  1285. // // iteminfo.OthAmt = check_other_amt
  1286. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1287. // //
  1288. // //}
  1289. // //
  1290. // //if laboratoryCostTotal != 0 {
  1291. // // iteminfo.MedChrgitm = "04"
  1292. // // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  1293. // // iteminfo.Amt = laboratoryCostTotal
  1294. // // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  1295. // // iteminfo.ClabAmt = laboratory_clab_amt
  1296. // // iteminfo.OthAmt = laboratory_other_amt
  1297. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1298. // //
  1299. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1300. // //
  1301. // //}
  1302. // //
  1303. // //if treatCostTotal != 0 {
  1304. // // iteminfo.MedChrgitm = "05"
  1305. // // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  1306. // // iteminfo.Amt = treatCostTotal
  1307. // // iteminfo.ClaaSumfee = treat_claa_sunmfee
  1308. // // iteminfo.ClabAmt = treat_clab_amt
  1309. // // iteminfo.OthAmt = treat_other_amt
  1310. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1311. // // //(struct4101.IteminfoStruct, iteminfo)
  1312. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1313. // //}
  1314. // //
  1315. // //if operationCostTotal != 0 {
  1316. // // iteminfo.MedChrgitm = "06"
  1317. // // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  1318. // // iteminfo.Amt = operationCostTotal
  1319. // // iteminfo.ClaaSumfee = operation_claa_sunmfee
  1320. // // iteminfo.ClabAmt = operation_clab_amt
  1321. // // iteminfo.OthAmt = operation_other_amt
  1322. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1323. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1324. // //}
  1325. // //
  1326. // //if nursingCostTotal != 0 {
  1327. // // iteminfo.MedChrgitm = "07"
  1328. // // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  1329. // // iteminfo.Amt = nursingCostTotal
  1330. // // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  1331. // // iteminfo.ClabAmt = nursing_clab_amt
  1332. // // iteminfo.OthAmt = nursing_other_amt
  1333. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1334. // //}
  1335. // //
  1336. // //if materialCostTotal != 0 {
  1337. // // iteminfo.MedChrgitm = "08"
  1338. // // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  1339. // // iteminfo.Amt = materialCostTotal
  1340. // // iteminfo.ClaaSumfee = material_claa_sunmfee
  1341. // // iteminfo.ClabAmt = material_clab_amt
  1342. // // iteminfo.OthAmt = material_other_amt
  1343. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1344. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1345. // //}
  1346. // //
  1347. // //if westernMedicineCostTotal != 0 {
  1348. // // iteminfo.MedChrgitm = "09"
  1349. // // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  1350. // // iteminfo.Amt = westernMedicineCostTotal
  1351. // // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  1352. // // iteminfo.ClabAmt = westernMedicine_clab_amt
  1353. // // iteminfo.OthAmt = westernMedicine_other_amt
  1354. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1355. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1356. // //
  1357. // //}
  1358. // //
  1359. // //if chineseMedicineCostTotal != 0 {
  1360. // // iteminfo.MedChrgitm = "10"
  1361. // // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  1362. // // iteminfo.Amt = chineseMedicineCostTotal
  1363. // // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  1364. // // iteminfo.ClabAmt = chinese_medicine_clab_amt
  1365. // // iteminfo.OthAmt = chinese_medicine_other_amt
  1366. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1367. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1368. // //
  1369. // //}
  1370. // //
  1371. // //if chineseTraditionalMedicineCostTotal != 0 {
  1372. // // iteminfo.MedChrgitm = "11"
  1373. // // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  1374. // // iteminfo.Amt = westernMedicineCostTotal
  1375. // // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  1376. // // iteminfo.ClabAmt = westernMedicine_clab_amt
  1377. // // iteminfo.OthAmt = westernMedicine_other_amt
  1378. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1379. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1380. // //
  1381. // //}
  1382. // //
  1383. // //if commonlyTreatmentCostTotal != 0 {
  1384. // // iteminfo.MedChrgitm = "12"
  1385. // // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  1386. // // iteminfo.Amt = commonlyTreatmentCostTotal
  1387. // // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  1388. // // iteminfo.ClabAmt = commonly_treatment_clab_amt
  1389. // // iteminfo.OthAmt = commonly_treatment_other_amt
  1390. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1391. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1392. // //
  1393. // //}
  1394. // //
  1395. // //if registerCostTotal != 0 {
  1396. // // iteminfo.MedChrgitm = "13"
  1397. // // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  1398. // // iteminfo.Amt = registerCostTotal
  1399. // // iteminfo.ClaaSumfee = register_claa_sunmfee
  1400. // // iteminfo.ClabAmt = register_clab_amt
  1401. // // iteminfo.OthAmt = register_other_amt
  1402. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1403. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1404. // //
  1405. // //}
  1406. // //
  1407. // //if otherCostTotal != 0 {
  1408. // // iteminfo.MedChrgitm = "14"
  1409. // // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  1410. // // iteminfo.Amt = otherCostTotal
  1411. // // iteminfo.ClaaSumfee = other_claa_sunmfee
  1412. // // iteminfo.ClabAmt = other_clab_amt
  1413. // // iteminfo.OthAmt = other_other_amt
  1414. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1415. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1416. // //
  1417. // //}
  1418. // //
  1419. // //struct4101.IteminfoStruct = iteminfoStructs
  1420. // time_arr := strings.Split(order.SetlTime, " ")
  1421. // struct4101.AdmTime = time_arr[0]
  1422. // struct4101.AdmEndTime = time_arr[0]
  1423. // struct4101.DoctorName = doctor.UserName
  1424. // struct4101.DoctorCode = doctor.DoctorNumber
  1425. //
  1426. // struct4101.Ntly = "中国"
  1427. // struct4101.AdmCaty = "A03.06"
  1428. // var res ResultSeventeen
  1429. // {
  1430. // result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  1431. // fmt.Println(result)
  1432. // saveLog(result, request, "4101A", "清单上传")
  1433. // var dat map[string]interface{}
  1434. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1435. // fmt.Println(dat)
  1436. // } else {
  1437. // fmt.Println(err)
  1438. // }
  1439. // userJSONBytes, _ := json.Marshal(dat)
  1440. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1441. // //utils.ErrorLog("解析失败:%v", err)
  1442. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1443. // //adminUser := c.GetAdminUserInfo()
  1444. // errlog := &models.HisOrderError{
  1445. // UserOrgId: org_id,
  1446. // Ctime: time.Now().Unix(),
  1447. // Mtime: time.Now().Unix(),
  1448. // ErrMsg: res.ErrMsg + "解析失败",
  1449. // Status: 1,
  1450. // PatientId: order_id,
  1451. // Stage: 10138,
  1452. // }
  1453. // service.CreateErrMsgLog(errlog)
  1454. // continue
  1455. // }
  1456. // }
  1457. //
  1458. // if res.Infcode != 0 {
  1459. // //adminUser := c.GetAdminUserInfo()
  1460. // errlog := &models.HisOrderError{
  1461. // UserOrgId: org_id,
  1462. // Ctime: time.Now().Unix(),
  1463. // Mtime: time.Now().Unix(),
  1464. // ErrMsg: res.ErrMsg,
  1465. // Status: 1,
  1466. // PatientId: order_id,
  1467. // Stage: 10138,
  1468. // }
  1469. // service.CreateErrMsgLog(errlog)
  1470. // continue
  1471. // } else {
  1472. // hisFundSettleListResult := &models.HisFundSettleListResult{
  1473. // Number: res.Output.SetlListId,
  1474. // Status: 1,
  1475. // Ctime: time.Now().Unix(),
  1476. // Mtime: time.Now().Unix(),
  1477. // UserOrgId: org_id,
  1478. // IsUpload: 1,
  1479. // OrderId: order_id,
  1480. // }
  1481. // service.CreateUploadRecord(hisFundSettleListResult)
  1482. // continue
  1483. // }
  1484. // }
  1485. //}
  1486. func GetbrBatchSettleList() {
  1487. org_id, _ := beego.AppConfig.Int64("org_id")
  1488. var orders []*models.HisOrder
  1489. //var orders []*models.HisOrderError
  1490. orders, _ = service.GetAllHisOrder10278()
  1491. for _, item := range orders {
  1492. order_id := item.ID
  1493. order, _ := service.GetHisOrderByIDTwo(order_id)
  1494. //roles, _ := service.GetDoctorListTwo(org_id)
  1495. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  1496. var patientPrescription models.HisPrescriptionInfo
  1497. patientPrescription, _ = service.FindLastPatientPrescriptionInfo(order.UserOrgId, order.PatientId, order.SettleAccountsDate)
  1498. doctor_info, _ := service.GetAdminUserInfoByID(order.UserOrgId, patientPrescription.DoctorId)
  1499. department, _ := service.GetDepartMentDetail(patientPrescription.Departments)
  1500. miConfig, _ := service.FindMedicalInsuranceInfo(order.UserOrgId)
  1501. var configTwo []*models.HisXtDiagnoseConfig
  1502. diagnosis_idstwo := strings.Split(his.Diagnosis, ",")
  1503. curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  1504. for _, item := range diagnosis_idstwo {
  1505. id, _ := strconv.ParseInt(item, 10, 64)
  1506. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1507. configTwo = append(configTwo, &diagnosisConfig)
  1508. }
  1509. sickConfig, _ := service.FindSickById(his.SickType)
  1510. if order.MedType == "1111" || order.MedType == "1112" {
  1511. order.MedType = "11"
  1512. }
  1513. 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")
  1514. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  1515. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  1516. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  1517. if order.ID == 0 {
  1518. return
  1519. }
  1520. if his.BalanceAccountsType == 2 {
  1521. continue
  1522. }
  1523. struct4101 := service.Struct4101{
  1524. PsnNo: order.PsnNo,
  1525. MdtrtId: order.MdtrtId,
  1526. SetlId: order.SetlId,
  1527. PsnName: order.PsnName,
  1528. Gend: order.Gend,
  1529. Brdy: his.Brdy,
  1530. Age: his.Age,
  1531. Naty: order.Naty,
  1532. PatnCertType: order.PsnCertType,
  1533. Certno: order.Certno,
  1534. Prfs: "90",
  1535. ConerName: "",
  1536. PatnRlts: "",
  1537. ConerAddr: "",
  1538. ConerTel: "",
  1539. HiType: order.Insutype,
  1540. Insuplc: his.InsuplcAdmdvs,
  1541. MaindiagFlag: "1",
  1542. BillCode: order.SetlId,
  1543. BillNo: order.SetlId,
  1544. BizSn: order.Number,
  1545. PsnSelfPay: order.PsnPartAmt,
  1546. PsnOwnPay: order.PsnPartAmt,
  1547. AcctPay: order.AcctPay,
  1548. PsnCashpay: order.PsnCashPay,
  1549. HiPaymtd: "1",
  1550. Hsorg: his.InsuplcAdmdvs,
  1551. HsorgOpter: his.InsuplcAdmdvs,
  1552. MedinsFillPsn: curRoles.UserName,
  1553. MedinsFillDept: depart.Name,
  1554. IptMedType: "2",
  1555. }
  1556. struct4101.SetlBegnDate = order.SetlTime
  1557. struct4101.SetlEndDate = order.SetlTime
  1558. var rf []CustomFundPay
  1559. json.Unmarshal([]byte(order.SetlDetail), &rf)
  1560. //var tempFunPays []service.CustomStruct
  1561. //var tempFunPay610100 service.CustomStruct
  1562. //for _, item := range rf {
  1563. // if item.FundPayType == "610100" {
  1564. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  1565. // tempFunPay610100.FundPayType = item.FundPayType
  1566. // } else {
  1567. // var tempFunPay service.CustomStruct
  1568. // tempFunPay.FundPayamt = item.FundPayamt
  1569. // tempFunPay.FundPayType = item.FundPayType
  1570. // tempFunPays = append(tempFunPays, tempFunPay)
  1571. // }
  1572. //}
  1573. //tempFunPays = append(tempFunPays, tempFunPay610100)
  1574. //struct4101.CustomStruct = tempFunPays
  1575. var tempDiaginfos []service.DiaginfoStructTwo
  1576. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  1577. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  1578. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  1579. var config []*models.HisXtDiagnoseConfig
  1580. for _, item := range diagnosis_ids {
  1581. id, _ := strconv.ParseInt(item, 10, 64)
  1582. diagnosisConfig, _ := service.FindDiagnoseById(id)
  1583. config = append(config, &diagnosisConfig)
  1584. }
  1585. for index, item := range config {
  1586. if index == 0 {
  1587. var tempDiaginfo service.DiaginfoStructTwo
  1588. tempDiaginfo.DiagCode = item.CountryCode
  1589. tempDiaginfo.DiagName = item.CountryContentName
  1590. tempDiaginfo.DiagType = "1"
  1591. tempDiaginfo.MaindiagFlag = "1"
  1592. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1593. } else {
  1594. var tempDiaginfo service.DiaginfoStructTwo
  1595. tempDiaginfo.DiagCode = item.CountryCode
  1596. tempDiaginfo.DiagName = item.CountryContentName
  1597. tempDiaginfo.DiagType = "2"
  1598. tempDiaginfo.MaindiagFlag = "0"
  1599. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  1600. }
  1601. }
  1602. struct4101.Diseinfo = tempDiaginfos
  1603. sickConfigTwo, _ := service.FindSickById(his.SickType)
  1604. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  1605. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  1606. tempOpspdiseinfo2.OprnOprtCode = ""
  1607. tempOpspdiseinfo2.OprnOprtName = ""
  1608. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  1609. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  1610. //var iteminfo service.IteminfoStruct
  1611. var bedCostTotal float64 = 0 //床位总费
  1612. var bedCostSelfTotal float64 = 0 //床位自费
  1613. var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  1614. var examineCostTotal float64 = 0 //诊查总费
  1615. var examineCostSelfTotal float64 = 0 //诊查自费
  1616. var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  1617. var nursingCostTotal float64 = 0 //护理总费
  1618. var nursingCostSelfTotal float64 = 0 //护理自费
  1619. var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  1620. var chineseMedicineCostTotal float64 = 0 //中成药
  1621. var chineseMedicineCostSelfTotal float64 = 0 //中成药
  1622. var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  1623. var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  1624. var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  1625. var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  1626. var registerCostTotal float64 = 0 //一般诊疗费
  1627. var registerCostSelfTotal float64 = 0 //一般诊疗费
  1628. var registerPartSelfTotal float64 = 0 //一般诊疗费
  1629. var operationCostTotal float64 = 0 //手术费
  1630. var operationCostSelfTotal float64 = 0 //手术费
  1631. var operationCostPartSelfTotal float64 = 0 //手术费
  1632. var otherCostTotal float64 = 0 //其他费用
  1633. var otherCostSelfTotal float64 = 0 //其他费用
  1634. var otherCostPartSelfTotal float64 = 0 //其他费用
  1635. var materialCostTotal float64 = 0 //材料费
  1636. var materialCostSelfTotal float64 = 0 //材料费
  1637. var materialCostPartSelfTotal float64 = 0 //材料费
  1638. var westernMedicineCostTotal float64 = 0 //西药费
  1639. var westernMedicineCostSelfTotal float64 = 0 //西药费
  1640. var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  1641. var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  1642. var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  1643. var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  1644. var checkCostTotal float64 = 0 //检查费
  1645. var checkCostSelfTotal float64 = 0 //检查费
  1646. var checkCostPartSelfTotal float64 = 0 //检查费
  1647. var laboratoryCostTotal float64 = 0 //化验费
  1648. var laboratoryCostSelfTotal float64 = 0 //化验费
  1649. var laboratoryCostPartSelfTotal float64 = 0 //化验费
  1650. var treatCostTotal float64 = 0 //治疗费用
  1651. var treatCostSelfTotal float64 = 0 //治疗费用
  1652. var treatCostPartSelfTotal float64 = 0 //治疗费用
  1653. decimal.DivisionPrecision = 2
  1654. var bed_fulamt_ownpay_amt float64 = 0
  1655. var examine_fulamt_ownpay_amt float64 = 0
  1656. var nursing_fulamt_ownpay_amt float64 = 0
  1657. var chinese_medicine_fulamt_ownpay_amt float64 = 0
  1658. var commonly_treatment_fulamt_ownpay_amt float64 = 0
  1659. var register_fulamt_ownpay_amt float64 = 0
  1660. var operation_fulamt_ownpay_amt float64 = 0
  1661. var other_fulamt_ownpay_amt float64 = 0
  1662. var westernMedicine_fulamt_ownpay_amt float64 = 0
  1663. var chineseTraditional_fulamt_ownpay_amt float64 = 0
  1664. var check_fulamt_ownpay_amt float64 = 0
  1665. var material_fulamt_ownpay_amt float64 = 0
  1666. var laboratory_fulamt_ownpay_amt float64 = 0
  1667. var treat_fulamt_ownpay_amt float64 = 0
  1668. var bed_claa_sunmfee float64 = 0
  1669. var bed_clab_amt float64 = 0
  1670. var bed_other_amt float64 = 0
  1671. var examine_claa_sunmfee float64 = 0
  1672. var examine_clab_amt float64 = 0
  1673. var examine_other_amt float64 = 0
  1674. var nursing_claa_sunmfee float64 = 0
  1675. var nursing_clab_amt float64 = 0
  1676. var nursing_other_amt float64 = 0
  1677. var chinese_medicine_claa_sunmfee float64 = 0
  1678. var chinese_medicine_clab_amt float64 = 0
  1679. var chinese_medicine_other_amt float64 = 0
  1680. var commonly_treatment_claa_sunmfee float64 = 0
  1681. var commonly_treatment_clab_amt float64 = 0
  1682. var commonly_treatment_other_amt float64 = 0
  1683. var operation_claa_sunmfee float64 = 0
  1684. var operation_clab_amt float64 = 0
  1685. var operation_other_amt float64 = 0
  1686. var other_claa_sunmfee float64 = 0
  1687. var other_clab_amt float64 = 0
  1688. var other_other_amt float64 = 0
  1689. var westernMedicine_claa_sunmfee float64 = 0
  1690. var westernMedicine_clab_amt float64 = 0
  1691. var westernMedicine_other_amt float64 = 0
  1692. var chineseTraditional_claa_sunmfee float64 = 0
  1693. var chineseTraditional_clab_amt float64 = 0
  1694. var chineseTraditional_other_amt float64 = 0
  1695. var check_claa_sunmfee float64 = 0
  1696. var check_clab_amt float64 = 0
  1697. var check_other_amt float64 = 0
  1698. var material_claa_sunmfee float64 = 0
  1699. var material_clab_amt float64 = 0
  1700. var material_other_amt float64 = 0
  1701. var laboratory_claa_sunmfee float64 = 0
  1702. var laboratory_clab_amt float64 = 0
  1703. var laboratory_other_amt float64 = 0
  1704. var treat_claa_sunmfee float64 = 0
  1705. var treat_clab_amt float64 = 0
  1706. var treat_other_amt float64 = 0
  1707. var register_claa_sunmfee float64 = 0
  1708. var register_clab_amt float64 = 0
  1709. var register_other_amt float64 = 0
  1710. for _, item := range order.HisOrderInfo {
  1711. if item.MedChrgitmType == "01" { //床位费
  1712. bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1713. bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1714. bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1715. bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1716. if item.ChrgitmLv == "1" {
  1717. bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1718. }
  1719. if item.ChrgitmLv == "2" {
  1720. bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1721. }
  1722. if item.ChrgitmLv == "3" {
  1723. bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1724. }
  1725. }
  1726. if item.MedChrgitmType == "02" { //诊查
  1727. examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1728. examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1729. examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1730. examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1731. if item.ChrgitmLv == "1" {
  1732. examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1733. }
  1734. if item.ChrgitmLv == "2" {
  1735. examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1736. }
  1737. if item.ChrgitmLv == "3" {
  1738. examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1739. }
  1740. }
  1741. if item.MedChrgitmType == "03" { //检查费
  1742. checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1743. checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1744. checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1745. check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1746. if item.ChrgitmLv == "1" {
  1747. check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1748. }
  1749. if item.ChrgitmLv == "2" {
  1750. check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1751. }
  1752. if item.ChrgitmLv == "3" {
  1753. check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1754. }
  1755. }
  1756. if item.MedChrgitmType == "04" { //化验费
  1757. laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1758. laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1759. laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1760. laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1761. if item.ChrgitmLv == "1" {
  1762. laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1763. }
  1764. if item.ChrgitmLv == "2" {
  1765. laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1766. }
  1767. if item.ChrgitmLv == "3" {
  1768. laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1769. }
  1770. }
  1771. if item.MedChrgitmType == "05" { //治疗费
  1772. treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1773. treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1774. treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1775. treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1776. if item.ChrgitmLv == "1" {
  1777. treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1778. }
  1779. if item.ChrgitmLv == "2" {
  1780. treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1781. }
  1782. if item.ChrgitmLv == "3" {
  1783. treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1784. }
  1785. }
  1786. if item.MedChrgitmType == "06" { //手术费
  1787. operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1788. operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1789. operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1790. operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1791. if item.ChrgitmLv == "1" {
  1792. operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1793. }
  1794. if item.ChrgitmLv == "2" {
  1795. operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1796. }
  1797. if item.ChrgitmLv == "3" {
  1798. operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1799. }
  1800. }
  1801. if item.MedChrgitmType == "07" { //手术费
  1802. nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1803. nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1804. nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1805. nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1806. if item.ChrgitmLv == "1" {
  1807. nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1808. }
  1809. if item.ChrgitmLv == "2" {
  1810. nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1811. }
  1812. if item.ChrgitmLv == "3" {
  1813. nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1814. }
  1815. }
  1816. if item.MedChrgitmType == "08" { //材料费
  1817. materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1818. materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1819. materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1820. material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1821. if item.ChrgitmLv == "1" {
  1822. material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1823. }
  1824. if item.ChrgitmLv == "2" {
  1825. material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1826. }
  1827. if item.ChrgitmLv == "3" {
  1828. material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1829. }
  1830. }
  1831. if item.MedChrgitmType == "09" { //西药费
  1832. westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1833. westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1834. westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1835. westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1836. if item.ChrgitmLv == "1" {
  1837. westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1838. }
  1839. if item.ChrgitmLv == "2" {
  1840. westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1841. }
  1842. if item.ChrgitmLv == "3" {
  1843. westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1844. }
  1845. }
  1846. if item.MedChrgitmType == "10" { //中药饮片
  1847. chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1848. chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1849. chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1850. chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1851. if item.ChrgitmLv == "1" {
  1852. chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1853. }
  1854. if item.ChrgitmLv == "2" {
  1855. chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1856. }
  1857. if item.ChrgitmLv == "3" {
  1858. chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1859. }
  1860. }
  1861. if item.MedChrgitmType == "11" { //中成费
  1862. chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1863. chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1864. chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1865. chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1866. if item.ChrgitmLv == "1" {
  1867. chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1868. }
  1869. if item.ChrgitmLv == "2" {
  1870. chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1871. }
  1872. if item.ChrgitmLv == "3" {
  1873. chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1874. }
  1875. }
  1876. if item.MedChrgitmType == "12" { //中成费
  1877. commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1878. commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1879. commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1880. commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1881. if item.ChrgitmLv == "1" {
  1882. commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1883. }
  1884. if item.ChrgitmLv == "2" {
  1885. commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1886. }
  1887. if item.ChrgitmLv == "3" {
  1888. commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1889. }
  1890. }
  1891. if item.MedChrgitmType == "13" { //中成费
  1892. registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1893. registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1894. registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1895. register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1896. if item.ChrgitmLv == "1" {
  1897. register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1898. }
  1899. if item.ChrgitmLv == "2" {
  1900. register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1901. }
  1902. if item.ChrgitmLv == "3" {
  1903. register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1904. }
  1905. }
  1906. if item.MedChrgitmType == "14" { //其他费
  1907. otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1908. otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1909. otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1910. other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1911. if item.ChrgitmLv == "1" {
  1912. other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1913. }
  1914. if item.ChrgitmLv == "2" {
  1915. other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1916. }
  1917. if item.ChrgitmLv == "3" {
  1918. other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1919. }
  1920. }
  1921. }
  1922. //var iteminfoStructs []service.IteminfoStruct
  1923. //
  1924. //if bedCostTotal != 0 {
  1925. // iteminfo.MedChrgitm = "01"
  1926. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  1927. // iteminfo.Amt = bedCostTotal
  1928. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  1929. // iteminfo.ClabAmt = bed_clab_amt
  1930. // iteminfo.OthAmt = bed_other_amt
  1931. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1932. //}
  1933. //
  1934. //if examineCostTotal != 0 {
  1935. // iteminfo.MedChrgitm = "02"
  1936. // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  1937. // iteminfo.Amt = examineCostTotal
  1938. // iteminfo.ClaaSumfee = examine_claa_sunmfee
  1939. // iteminfo.ClabAmt = examine_clab_amt
  1940. // iteminfo.OthAmt = examine_other_amt
  1941. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1942. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1943. //}
  1944. //
  1945. //if checkCostTotal != 0 {
  1946. // iteminfo.MedChrgitm = "03"
  1947. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  1948. // iteminfo.Amt = checkCostTotal
  1949. // iteminfo.ClaaSumfee = check_claa_sunmfee
  1950. // iteminfo.ClabAmt = check_clab_amt
  1951. // iteminfo.OthAmt = check_other_amt
  1952. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1953. //
  1954. //}
  1955. //
  1956. //if laboratoryCostTotal != 0 {
  1957. // iteminfo.MedChrgitm = "04"
  1958. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  1959. // iteminfo.Amt = laboratoryCostTotal
  1960. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  1961. // iteminfo.ClabAmt = laboratory_clab_amt
  1962. // iteminfo.OthAmt = laboratory_other_amt
  1963. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1964. //
  1965. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1966. //
  1967. //}
  1968. //
  1969. //if treatCostTotal != 0 {
  1970. // iteminfo.MedChrgitm = "05"
  1971. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  1972. // iteminfo.Amt = treatCostTotal
  1973. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  1974. // iteminfo.ClabAmt = treat_clab_amt
  1975. // iteminfo.OthAmt = treat_other_amt
  1976. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1977. // //(struct4101.IteminfoStruct, iteminfo)
  1978. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1979. //}
  1980. //
  1981. //if operationCostTotal != 0 {
  1982. // iteminfo.MedChrgitm = "06"
  1983. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  1984. // iteminfo.Amt = operationCostTotal
  1985. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  1986. // iteminfo.ClabAmt = operation_clab_amt
  1987. // iteminfo.OthAmt = operation_other_amt
  1988. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1989. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1990. //}
  1991. //
  1992. //if nursingCostTotal != 0 {
  1993. // iteminfo.MedChrgitm = "07"
  1994. // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  1995. // iteminfo.Amt = nursingCostTotal
  1996. // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  1997. // iteminfo.ClabAmt = nursing_clab_amt
  1998. // iteminfo.OthAmt = nursing_other_amt
  1999. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2000. //}
  2001. //
  2002. //if materialCostTotal != 0 {
  2003. // iteminfo.MedChrgitm = "08"
  2004. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  2005. // iteminfo.Amt = materialCostTotal
  2006. // iteminfo.ClaaSumfee = material_claa_sunmfee
  2007. // iteminfo.ClabAmt = material_clab_amt
  2008. // iteminfo.OthAmt = material_other_amt
  2009. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2010. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2011. //}
  2012. //
  2013. //if westernMedicineCostTotal != 0 {
  2014. // iteminfo.MedChrgitm = "09"
  2015. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2016. // iteminfo.Amt = westernMedicineCostTotal
  2017. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2018. // iteminfo.ClabAmt = westernMedicine_clab_amt
  2019. // iteminfo.OthAmt = westernMedicine_other_amt
  2020. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2021. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2022. //
  2023. //}
  2024. //
  2025. //if chineseMedicineCostTotal != 0 {
  2026. // iteminfo.MedChrgitm = "10"
  2027. // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  2028. // iteminfo.Amt = chineseMedicineCostTotal
  2029. // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  2030. // iteminfo.ClabAmt = chinese_medicine_clab_amt
  2031. // iteminfo.OthAmt = chinese_medicine_other_amt
  2032. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2033. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2034. //
  2035. //}
  2036. //
  2037. //if chineseTraditionalMedicineCostTotal != 0 {
  2038. // iteminfo.MedChrgitm = "11"
  2039. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2040. // iteminfo.Amt = westernMedicineCostTotal
  2041. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2042. // iteminfo.ClabAmt = westernMedicine_clab_amt
  2043. // iteminfo.OthAmt = westernMedicine_other_amt
  2044. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2045. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2046. //
  2047. //}
  2048. //
  2049. //if commonlyTreatmentCostTotal != 0 {
  2050. // iteminfo.MedChrgitm = "12"
  2051. // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  2052. // iteminfo.Amt = commonlyTreatmentCostTotal
  2053. // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  2054. // iteminfo.ClabAmt = commonly_treatment_clab_amt
  2055. // iteminfo.OthAmt = commonly_treatment_other_amt
  2056. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2057. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2058. //
  2059. //}
  2060. //
  2061. //if registerCostTotal != 0 {
  2062. // iteminfo.MedChrgitm = "13"
  2063. // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  2064. // iteminfo.Amt = registerCostTotal
  2065. // iteminfo.ClaaSumfee = register_claa_sunmfee
  2066. // iteminfo.ClabAmt = register_clab_amt
  2067. // iteminfo.OthAmt = register_other_amt
  2068. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2069. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2070. //
  2071. //}
  2072. //
  2073. //if otherCostTotal != 0 {
  2074. // iteminfo.MedChrgitm = "14"
  2075. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  2076. // iteminfo.Amt = otherCostTotal
  2077. // iteminfo.ClaaSumfee = other_claa_sunmfee
  2078. // iteminfo.ClabAmt = other_clab_amt
  2079. // iteminfo.OthAmt = other_other_amt
  2080. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2081. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2082. //
  2083. //}
  2084. //
  2085. //struct4101.IteminfoStruct = iteminfoStructs
  2086. time_arr := strings.Split(order.SetlTime, " ")
  2087. struct4101.AdmTime = time_arr[0]
  2088. struct4101.AdmEndTime = time_arr[0]
  2089. struct4101.DoctorName = doctor.UserName
  2090. struct4101.DoctorCode = doctor.DoctorNumber
  2091. struct4101.Ntly = "中国"
  2092. struct4101.AdmCaty = "A03.06"
  2093. var res ResultSeventeen
  2094. {
  2095. result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  2096. fmt.Println(result)
  2097. saveLog(result, request, "4101A", "清单上传")
  2098. var dat map[string]interface{}
  2099. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  2100. fmt.Println(dat)
  2101. } else {
  2102. fmt.Println(err)
  2103. }
  2104. userJSONBytes, _ := json.Marshal(dat)
  2105. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  2106. //utils.ErrorLog("解析失败:%v", err)
  2107. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  2108. //adminUser := c.GetAdminUserInfo()
  2109. errlog := &models.HisOrderError{
  2110. UserOrgId: org_id,
  2111. Ctime: time.Now().Unix(),
  2112. Mtime: time.Now().Unix(),
  2113. ErrMsg: res.ErrMsg + "解析失败",
  2114. Status: 1,
  2115. PatientId: order_id,
  2116. Stage: 10278000,
  2117. }
  2118. service.CreateErrMsgLog(errlog)
  2119. continue
  2120. }
  2121. }
  2122. if res.Infcode != 0 {
  2123. //adminUser := c.GetAdminUserInfo()
  2124. errlog := &models.HisOrderError{
  2125. UserOrgId: org_id,
  2126. Ctime: time.Now().Unix(),
  2127. Mtime: time.Now().Unix(),
  2128. ErrMsg: res.ErrMsg,
  2129. Status: 1,
  2130. PatientId: order_id,
  2131. Stage: 10278000,
  2132. }
  2133. service.CreateErrMsgLog(errlog)
  2134. continue
  2135. } else {
  2136. hisFundSettleListResult := &models.HisFundSettleListResult{
  2137. Number: res.Output.SetlListId,
  2138. Status: 1,
  2139. Ctime: time.Now().Unix(),
  2140. Mtime: time.Now().Unix(),
  2141. UserOrgId: org_id,
  2142. IsUpload: 1,
  2143. OrderId: order_id,
  2144. }
  2145. service.CreateUploadRecord(hisFundSettleListResult)
  2146. continue
  2147. }
  2148. }
  2149. }
  2150. //func GetbrBatchSettleList() {
  2151. // org_id, _ := beego.AppConfig.Int64("org_id")
  2152. // var orders []*models.HisOrder
  2153. // orders, _ = service.GetAllHisOrder10278()
  2154. // for _, item := range orders {
  2155. // order_id := item.ID
  2156. // order, _ := service.GetHisOrderByIDTwo(order_id)
  2157. // roles, _ := service.GetDoctorListTwo(org_id)
  2158. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  2159. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  2160. // curRoles, _ := service.GetAdminUserInfoByID(org_id, 2185)
  2161. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  2162. // miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  2163. // pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  2164. // doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  2165. // if order.ID == 0 {
  2166. // return
  2167. // }
  2168. // if his.BalanceAccountsType == 2 {
  2169. // continue
  2170. // }
  2171. // struct4101 := service.Struct4101{
  2172. // PsnNo: order.PsnNo,
  2173. // MdtrtId: order.MdtrtId,
  2174. // SetlId: order.SetlId,
  2175. // PsnName: order.PsnName,
  2176. // Gend: order.Gend,
  2177. // Brdy: his.Brdy,
  2178. // Age: his.Age,
  2179. // Naty: order.Naty,
  2180. // PatnCertType: order.PsnCertType,
  2181. // Certno: order.Certno,
  2182. // Prfs: "90",
  2183. // ConerName: roles[0].UserName,
  2184. // PatnRlts: "99",
  2185. // ConerAddr: miConfig.OrgName,
  2186. // ConerTel: admin.Mobile,
  2187. // HiType: order.Insutype,
  2188. // Insuplc: his.InsuplcAdmdvs,
  2189. // MaindiagFlag: "1",
  2190. // BillCode: order.SetlId,
  2191. // BillNo: order.SetlId,
  2192. // BizSn: order.Number,
  2193. // PsnSelfPay: order.PsnPartAmt,
  2194. // PsnOwnPay: order.PsnPartAmt,
  2195. // AcctPay: order.AcctPay,
  2196. // PsnCashpay: order.PsnCashPay,
  2197. // HiPaymtd: "1",
  2198. // Hsorg: his.InsuplcAdmdvs,
  2199. // HsorgOpter: his.InsuplcAdmdvs,
  2200. // MedinsFillPsn: curRoles.UserName,
  2201. // MedinsFillDept: depart.Name,
  2202. // IptMedType: "2",
  2203. // }
  2204. //
  2205. // struct4101.SetlBegnDate = order.SetlTime
  2206. // struct4101.SetlEndDate = order.SetlTime
  2207. //
  2208. //
  2209. // var rf []CustomFundPay
  2210. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  2211. //
  2212. // //var tempFunPays []service.CustomStruct
  2213. // //var tempFunPay610100 service.CustomStruct
  2214. //
  2215. // //for _, item := range rf {
  2216. // // if item.FundPayType == "610100" {
  2217. // // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  2218. // // tempFunPay610100.FundPayType = item.FundPayType
  2219. // // } else {
  2220. // // var tempFunPay service.CustomStruct
  2221. // // tempFunPay.FundPayamt = item.FundPayamt
  2222. // // tempFunPay.FundPayType = item.FundPayType
  2223. // // tempFunPays = append(tempFunPays, tempFunPay)
  2224. // // }
  2225. // //}
  2226. // //tempFunPays = append(tempFunPays, tempFunPay610100)
  2227. // //struct4101.CustomStruct = tempFunPays
  2228. //
  2229. // var tempDiaginfos []service.DiaginfoStructTwo
  2230. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  2231. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  2232. //
  2233. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  2234. // var config []*models.HisXtDiagnoseConfig
  2235. // for _, item := range diagnosis_ids {
  2236. // id, _ := strconv.ParseInt(item, 10, 64)
  2237. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  2238. // config = append(config, &diagnosisConfig)
  2239. // }
  2240. //
  2241. // for index, item := range config {
  2242. // if index == 0 {
  2243. // var tempDiaginfo service.DiaginfoStructTwo
  2244. // tempDiaginfo.DiagCode = item.CountryCode
  2245. // tempDiaginfo.DiagName = item.CountryContentName
  2246. // tempDiaginfo.DiagType = "1"
  2247. // tempDiaginfo.MaindiagFlag = "1"
  2248. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  2249. // } else {
  2250. //
  2251. // var tempDiaginfo service.DiaginfoStructTwo
  2252. // tempDiaginfo.DiagCode = item.CountryCode
  2253. // tempDiaginfo.DiagName = item.CountryContentName
  2254. // tempDiaginfo.DiagType = "2"
  2255. // tempDiaginfo.MaindiagFlag = "0"
  2256. // tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  2257. // }
  2258. // }
  2259. // struct4101.Diseinfo = tempDiaginfos
  2260. //
  2261. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  2262. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  2263. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  2264. // tempOpspdiseinfo2.OprnOprtCode = ""
  2265. // tempOpspdiseinfo2.OprnOprtName = ""
  2266. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  2267. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  2268. //
  2269. // //var iteminfo service.IteminfoStruct
  2270. //
  2271. // var bedCostTotal float64 = 0 //床位总费
  2272. // var bedCostSelfTotal float64 = 0 //床位自费
  2273. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  2274. //
  2275. // var examineCostTotal float64 = 0 //诊查总费
  2276. // var examineCostSelfTotal float64 = 0 //诊查自费
  2277. // var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  2278. //
  2279. // var nursingCostTotal float64 = 0 //护理总费
  2280. // var nursingCostSelfTotal float64 = 0 //护理自费
  2281. // var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  2282. //
  2283. // var chineseMedicineCostTotal float64 = 0 //中成药
  2284. // var chineseMedicineCostSelfTotal float64 = 0 //中成药
  2285. // var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  2286. //
  2287. // var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  2288. // var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  2289. // var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  2290. //
  2291. // var registerCostTotal float64 = 0 //一般诊疗费
  2292. // var registerCostSelfTotal float64 = 0 //一般诊疗费
  2293. // var registerPartSelfTotal float64 = 0 //一般诊疗费
  2294. //
  2295. // var operationCostTotal float64 = 0 //手术费
  2296. // var operationCostSelfTotal float64 = 0 //手术费
  2297. // var operationCostPartSelfTotal float64 = 0 //手术费
  2298. //
  2299. // var otherCostTotal float64 = 0 //其他费用
  2300. // var otherCostSelfTotal float64 = 0 //其他费用
  2301. // var otherCostPartSelfTotal float64 = 0 //其他费用
  2302. //
  2303. // var materialCostTotal float64 = 0 //材料费
  2304. // var materialCostSelfTotal float64 = 0 //材料费
  2305. // var materialCostPartSelfTotal float64 = 0 //材料费
  2306. //
  2307. // var westernMedicineCostTotal float64 = 0 //西药费
  2308. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  2309. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  2310. //
  2311. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  2312. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  2313. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  2314. //
  2315. // var checkCostTotal float64 = 0 //检查费
  2316. // var checkCostSelfTotal float64 = 0 //检查费
  2317. // var checkCostPartSelfTotal float64 = 0 //检查费
  2318. //
  2319. // var laboratoryCostTotal float64 = 0 //化验费
  2320. // var laboratoryCostSelfTotal float64 = 0 //化验费
  2321. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  2322. //
  2323. // var treatCostTotal float64 = 0 //治疗费用
  2324. // var treatCostSelfTotal float64 = 0 //治疗费用
  2325. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  2326. //
  2327. // decimal.DivisionPrecision = 2
  2328. //
  2329. // var bed_fulamt_ownpay_amt float64 = 0
  2330. //
  2331. // var examine_fulamt_ownpay_amt float64 = 0
  2332. //
  2333. // var nursing_fulamt_ownpay_amt float64 = 0
  2334. //
  2335. // var chinese_medicine_fulamt_ownpay_amt float64 = 0
  2336. //
  2337. // var commonly_treatment_fulamt_ownpay_amt float64 = 0
  2338. //
  2339. // var register_fulamt_ownpay_amt float64 = 0
  2340. //
  2341. // var operation_fulamt_ownpay_amt float64 = 0
  2342. // var other_fulamt_ownpay_amt float64 = 0
  2343. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  2344. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  2345. // var check_fulamt_ownpay_amt float64 = 0
  2346. // var material_fulamt_ownpay_amt float64 = 0
  2347. // var laboratory_fulamt_ownpay_amt float64 = 0
  2348. // var treat_fulamt_ownpay_amt float64 = 0
  2349. //
  2350. // var bed_claa_sunmfee float64 = 0
  2351. // var bed_clab_amt float64 = 0
  2352. // var bed_other_amt float64 = 0
  2353. //
  2354. // var examine_claa_sunmfee float64 = 0
  2355. // var examine_clab_amt float64 = 0
  2356. // var examine_other_amt float64 = 0
  2357. //
  2358. // var nursing_claa_sunmfee float64 = 0
  2359. // var nursing_clab_amt float64 = 0
  2360. // var nursing_other_amt float64 = 0
  2361. //
  2362. // var chinese_medicine_claa_sunmfee float64 = 0
  2363. // var chinese_medicine_clab_amt float64 = 0
  2364. // var chinese_medicine_other_amt float64 = 0
  2365. //
  2366. // var commonly_treatment_claa_sunmfee float64 = 0
  2367. // var commonly_treatment_clab_amt float64 = 0
  2368. // var commonly_treatment_other_amt float64 = 0
  2369. //
  2370. // var operation_claa_sunmfee float64 = 0
  2371. // var operation_clab_amt float64 = 0
  2372. // var operation_other_amt float64 = 0
  2373. //
  2374. // var other_claa_sunmfee float64 = 0
  2375. // var other_clab_amt float64 = 0
  2376. // var other_other_amt float64 = 0
  2377. //
  2378. // var westernMedicine_claa_sunmfee float64 = 0
  2379. // var westernMedicine_clab_amt float64 = 0
  2380. // var westernMedicine_other_amt float64 = 0
  2381. //
  2382. // var chineseTraditional_claa_sunmfee float64 = 0
  2383. // var chineseTraditional_clab_amt float64 = 0
  2384. // var chineseTraditional_other_amt float64 = 0
  2385. //
  2386. // var check_claa_sunmfee float64 = 0
  2387. // var check_clab_amt float64 = 0
  2388. // var check_other_amt float64 = 0
  2389. //
  2390. // var material_claa_sunmfee float64 = 0
  2391. // var material_clab_amt float64 = 0
  2392. // var material_other_amt float64 = 0
  2393. //
  2394. // var laboratory_claa_sunmfee float64 = 0
  2395. // var laboratory_clab_amt float64 = 0
  2396. // var laboratory_other_amt float64 = 0
  2397. //
  2398. // var treat_claa_sunmfee float64 = 0
  2399. // var treat_clab_amt float64 = 0
  2400. // var treat_other_amt float64 = 0
  2401. //
  2402. // var register_claa_sunmfee float64 = 0
  2403. // var register_clab_amt float64 = 0
  2404. // var register_other_amt float64 = 0
  2405. //
  2406. // for _, item := range order.HisOrderInfo {
  2407. // if item.MedChrgitmType == "01" { //床位费
  2408. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2409. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2410. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2411. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2412. // if item.ChrgitmLv == "1" {
  2413. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2414. // }
  2415. // if item.ChrgitmLv == "2" {
  2416. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2417. //
  2418. // }
  2419. // if item.ChrgitmLv == "3" {
  2420. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2421. // }
  2422. //
  2423. // }
  2424. //
  2425. // if item.MedChrgitmType == "02" { //诊查
  2426. // examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2427. // examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2428. // examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2429. // examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2430. // if item.ChrgitmLv == "1" {
  2431. // examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2432. // }
  2433. // if item.ChrgitmLv == "2" {
  2434. // examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2435. //
  2436. // }
  2437. // if item.ChrgitmLv == "3" {
  2438. // examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2439. // }
  2440. //
  2441. // }
  2442. //
  2443. // if item.MedChrgitmType == "03" { //检查费
  2444. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2445. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2446. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2447. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2448. // if item.ChrgitmLv == "1" {
  2449. //
  2450. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2451. //
  2452. // }
  2453. // if item.ChrgitmLv == "2" {
  2454. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2455. //
  2456. // }
  2457. // if item.ChrgitmLv == "3" {
  2458. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2459. // }
  2460. // }
  2461. //
  2462. // if item.MedChrgitmType == "04" { //化验费
  2463. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2464. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2465. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2466. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2467. // if item.ChrgitmLv == "1" {
  2468. //
  2469. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2470. //
  2471. // }
  2472. // if item.ChrgitmLv == "2" {
  2473. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2474. //
  2475. // }
  2476. // if item.ChrgitmLv == "3" {
  2477. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2478. // }
  2479. // }
  2480. //
  2481. // if item.MedChrgitmType == "05" { //治疗费
  2482. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2483. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2484. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2485. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2486. // if item.ChrgitmLv == "1" {
  2487. //
  2488. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2489. //
  2490. // }
  2491. // if item.ChrgitmLv == "2" {
  2492. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2493. //
  2494. // }
  2495. // if item.ChrgitmLv == "3" {
  2496. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2497. // }
  2498. // }
  2499. //
  2500. // if item.MedChrgitmType == "06" { //手术费
  2501. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2502. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2503. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2504. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2505. //
  2506. // if item.ChrgitmLv == "1" {
  2507. //
  2508. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2509. //
  2510. // }
  2511. // if item.ChrgitmLv == "2" {
  2512. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2513. //
  2514. // }
  2515. // if item.ChrgitmLv == "3" {
  2516. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2517. // }
  2518. // }
  2519. //
  2520. // if item.MedChrgitmType == "07" { //手术费
  2521. // nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2522. // nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2523. // nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2524. // nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2525. //
  2526. // if item.ChrgitmLv == "1" {
  2527. //
  2528. // nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2529. //
  2530. // }
  2531. // if item.ChrgitmLv == "2" {
  2532. // nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2533. //
  2534. // }
  2535. // if item.ChrgitmLv == "3" {
  2536. // nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2537. // }
  2538. // }
  2539. //
  2540. // if item.MedChrgitmType == "08" { //材料费
  2541. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2542. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2543. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2544. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2545. // if item.ChrgitmLv == "1" {
  2546. //
  2547. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2548. //
  2549. // }
  2550. // if item.ChrgitmLv == "2" {
  2551. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2552. //
  2553. // }
  2554. // if item.ChrgitmLv == "3" {
  2555. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2556. // }
  2557. // }
  2558. // if item.MedChrgitmType == "09" { //西药费
  2559. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2560. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2561. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2562. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2563. // if item.ChrgitmLv == "1" {
  2564. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2565. // }
  2566. // if item.ChrgitmLv == "2" {
  2567. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2568. // }
  2569. // if item.ChrgitmLv == "3" {
  2570. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2571. // }
  2572. // }
  2573. // if item.MedChrgitmType == "10" { //中药饮片
  2574. // chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2575. // chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2576. // chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2577. // chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2578. // if item.ChrgitmLv == "1" {
  2579. // chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2580. // }
  2581. // if item.ChrgitmLv == "2" {
  2582. // chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2583. // }
  2584. // if item.ChrgitmLv == "3" {
  2585. // chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2586. // }
  2587. // }
  2588. //
  2589. // if item.MedChrgitmType == "11" { //中成费
  2590. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2591. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2592. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2593. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2594. // if item.ChrgitmLv == "1" {
  2595. //
  2596. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2597. //
  2598. // }
  2599. // if item.ChrgitmLv == "2" {
  2600. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2601. //
  2602. // }
  2603. // if item.ChrgitmLv == "3" {
  2604. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2605. // }
  2606. // }
  2607. //
  2608. // if item.MedChrgitmType == "12" { //中成费
  2609. // commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2610. // commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2611. // commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2612. // commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2613. // if item.ChrgitmLv == "1" {
  2614. //
  2615. // commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2616. //
  2617. // }
  2618. // if item.ChrgitmLv == "2" {
  2619. // commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2620. //
  2621. // }
  2622. // if item.ChrgitmLv == "3" {
  2623. // commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2624. // }
  2625. // }
  2626. //
  2627. // if item.MedChrgitmType == "13" { //中成费
  2628. // registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2629. // registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2630. // registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2631. // register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2632. // if item.ChrgitmLv == "1" {
  2633. //
  2634. // register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2635. //
  2636. // }
  2637. // if item.ChrgitmLv == "2" {
  2638. // register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2639. //
  2640. // }
  2641. // if item.ChrgitmLv == "3" {
  2642. // register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2643. // }
  2644. // }
  2645. //
  2646. // if item.MedChrgitmType == "14" { //其他费
  2647. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2648. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2649. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2650. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  2651. // if item.ChrgitmLv == "1" {
  2652. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  2653. //
  2654. // }
  2655. // if item.ChrgitmLv == "2" {
  2656. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  2657. //
  2658. // }
  2659. // if item.ChrgitmLv == "3" {
  2660. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  2661. // }
  2662. // }
  2663. //
  2664. // }
  2665. //
  2666. // //var iteminfoStructs []service.IteminfoStruct
  2667. // //
  2668. // //if bedCostTotal != 0 {
  2669. // // iteminfo.MedChrgitm = "01"
  2670. // // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2671. // // iteminfo.Amt = bedCostTotal
  2672. // // iteminfo.ClaaSumfee = bed_claa_sunmfee
  2673. // // iteminfo.ClabAmt = bed_clab_amt
  2674. // // iteminfo.OthAmt = bed_other_amt
  2675. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2676. // //}
  2677. // //
  2678. // //if examineCostTotal != 0 {
  2679. // // iteminfo.MedChrgitm = "02"
  2680. // // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  2681. // // iteminfo.Amt = examineCostTotal
  2682. // // iteminfo.ClaaSumfee = examine_claa_sunmfee
  2683. // // iteminfo.ClabAmt = examine_clab_amt
  2684. // // iteminfo.OthAmt = examine_other_amt
  2685. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2686. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2687. // //}
  2688. // //
  2689. // //if checkCostTotal != 0 {
  2690. // // iteminfo.MedChrgitm = "03"
  2691. // // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  2692. // // iteminfo.Amt = checkCostTotal
  2693. // // iteminfo.ClaaSumfee = check_claa_sunmfee
  2694. // // iteminfo.ClabAmt = check_clab_amt
  2695. // // iteminfo.OthAmt = check_other_amt
  2696. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2697. // //
  2698. // //}
  2699. // //
  2700. // //if laboratoryCostTotal != 0 {
  2701. // // iteminfo.MedChrgitm = "04"
  2702. // // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  2703. // // iteminfo.Amt = laboratoryCostTotal
  2704. // // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  2705. // // iteminfo.ClabAmt = laboratory_clab_amt
  2706. // // iteminfo.OthAmt = laboratory_other_amt
  2707. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2708. // //
  2709. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2710. // //
  2711. // //}
  2712. // //
  2713. // //if treatCostTotal != 0 {
  2714. // // iteminfo.MedChrgitm = "05"
  2715. // // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  2716. // // iteminfo.Amt = treatCostTotal
  2717. // // iteminfo.ClaaSumfee = treat_claa_sunmfee
  2718. // // iteminfo.ClabAmt = treat_clab_amt
  2719. // // iteminfo.OthAmt = treat_other_amt
  2720. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2721. // // //(struct4101.IteminfoStruct, iteminfo)
  2722. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2723. // //}
  2724. // //
  2725. // //if operationCostTotal != 0 {
  2726. // // iteminfo.MedChrgitm = "06"
  2727. // // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  2728. // // iteminfo.Amt = operationCostTotal
  2729. // // iteminfo.ClaaSumfee = operation_claa_sunmfee
  2730. // // iteminfo.ClabAmt = operation_clab_amt
  2731. // // iteminfo.OthAmt = operation_other_amt
  2732. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2733. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2734. // //}
  2735. // //
  2736. // //if nursingCostTotal != 0 {
  2737. // // iteminfo.MedChrgitm = "07"
  2738. // // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  2739. // // iteminfo.Amt = nursingCostTotal
  2740. // // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  2741. // // iteminfo.ClabAmt = nursing_clab_amt
  2742. // // iteminfo.OthAmt = nursing_other_amt
  2743. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2744. // //}
  2745. // //
  2746. // //if materialCostTotal != 0 {
  2747. // // iteminfo.MedChrgitm = "08"
  2748. // // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  2749. // // iteminfo.Amt = materialCostTotal
  2750. // // iteminfo.ClaaSumfee = material_claa_sunmfee
  2751. // // iteminfo.ClabAmt = material_clab_amt
  2752. // // iteminfo.OthAmt = material_other_amt
  2753. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2754. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2755. // //}
  2756. // //
  2757. // //if westernMedicineCostTotal != 0 {
  2758. // // iteminfo.MedChrgitm = "09"
  2759. // // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2760. // // iteminfo.Amt = westernMedicineCostTotal
  2761. // // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2762. // // iteminfo.ClabAmt = westernMedicine_clab_amt
  2763. // // iteminfo.OthAmt = westernMedicine_other_amt
  2764. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2765. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2766. // //
  2767. // //}
  2768. // //
  2769. // //if chineseMedicineCostTotal != 0 {
  2770. // // iteminfo.MedChrgitm = "10"
  2771. // // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  2772. // // iteminfo.Amt = chineseMedicineCostTotal
  2773. // // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  2774. // // iteminfo.ClabAmt = chinese_medicine_clab_amt
  2775. // // iteminfo.OthAmt = chinese_medicine_other_amt
  2776. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2777. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2778. // //
  2779. // //}
  2780. // //
  2781. // //if chineseTraditionalMedicineCostTotal != 0 {
  2782. // // iteminfo.MedChrgitm = "11"
  2783. // // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  2784. // // iteminfo.Amt = westernMedicineCostTotal
  2785. // // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  2786. // // iteminfo.ClabAmt = westernMedicine_clab_amt
  2787. // // iteminfo.OthAmt = westernMedicine_other_amt
  2788. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2789. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2790. // //
  2791. // //}
  2792. // //
  2793. // //if commonlyTreatmentCostTotal != 0 {
  2794. // // iteminfo.MedChrgitm = "12"
  2795. // // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  2796. // // iteminfo.Amt = commonlyTreatmentCostTotal
  2797. // // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  2798. // // iteminfo.ClabAmt = commonly_treatment_clab_amt
  2799. // // iteminfo.OthAmt = commonly_treatment_other_amt
  2800. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2801. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2802. // //
  2803. // //}
  2804. // //
  2805. // //if registerCostTotal != 0 {
  2806. // // iteminfo.MedChrgitm = "13"
  2807. // // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  2808. // // iteminfo.Amt = registerCostTotal
  2809. // // iteminfo.ClaaSumfee = register_claa_sunmfee
  2810. // // iteminfo.ClabAmt = register_clab_amt
  2811. // // iteminfo.OthAmt = register_other_amt
  2812. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2813. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2814. // //
  2815. // //}
  2816. // //
  2817. // //if otherCostTotal != 0 {
  2818. // // iteminfo.MedChrgitm = "14"
  2819. // // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  2820. // // iteminfo.Amt = otherCostTotal
  2821. // // iteminfo.ClaaSumfee = other_claa_sunmfee
  2822. // // iteminfo.ClabAmt = other_clab_amt
  2823. // // iteminfo.OthAmt = other_other_amt
  2824. // // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  2825. // // iteminfoStructs = append(iteminfoStructs, iteminfo)
  2826. // //
  2827. // //}
  2828. // //
  2829. // //struct4101.IteminfoStruct = iteminfoStructs
  2830. // time_arr := strings.Split(order.SetlTime, " ")
  2831. // struct4101.AdmTime = time_arr[0]
  2832. // struct4101.AdmEndTime = time_arr[0]
  2833. // struct4101.DoctorName = doctor.UserName
  2834. // struct4101.DoctorCode = doctor.DoctorNumber
  2835. //
  2836. // struct4101.Ntly = "中国"
  2837. // struct4101.AdmCaty = "A03.06"
  2838. // var res ResultSeventeen
  2839. // {
  2840. // result, request := service.Gdyb4101For10138(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  2841. // fmt.Println(result)
  2842. // saveLog(result, request, "4101A", "清单上传")
  2843. // var dat map[string]interface{}
  2844. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  2845. // fmt.Println(dat)
  2846. // } else {
  2847. // fmt.Println(err)
  2848. // }
  2849. // userJSONBytes, _ := json.Marshal(dat)
  2850. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  2851. // //utils.ErrorLog("解析失败:%v", err)
  2852. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  2853. // //adminUser := c.GetAdminUserInfo()
  2854. // errlog := &models.HisOrderError{
  2855. // UserOrgId: org_id,
  2856. // Ctime: time.Now().Unix(),
  2857. // Mtime: time.Now().Unix(),
  2858. // ErrMsg: res.ErrMsg + "解析失败",
  2859. // Status: 1,
  2860. // PatientId: order_id,
  2861. // Stage: 10138,
  2862. // }
  2863. // service.CreateErrMsgLog(errlog)
  2864. // continue
  2865. // }
  2866. // }
  2867. //
  2868. // if res.Infcode != 0 {
  2869. // //adminUser := c.GetAdminUserInfo()
  2870. // errlog := &models.HisOrderError{
  2871. // UserOrgId: org_id,
  2872. // Ctime: time.Now().Unix(),
  2873. // Mtime: time.Now().Unix(),
  2874. // ErrMsg: res.ErrMsg,
  2875. // Status: 1,
  2876. // PatientId: order_id,
  2877. // Stage: 10138,
  2878. // }
  2879. // service.CreateErrMsgLog(errlog)
  2880. // continue
  2881. // } else {
  2882. // hisFundSettleListResult := &models.HisFundSettleListResult{
  2883. // Number: res.Output.SetlListId,
  2884. // Status: 1,
  2885. // Ctime: time.Now().Unix(),
  2886. // Mtime: time.Now().Unix(),
  2887. // UserOrgId: org_id,
  2888. // IsUpload: 1,
  2889. // OrderId: order_id,
  2890. // }
  2891. // service.CreateUploadRecord(hisFundSettleListResult)
  2892. // continue
  2893. // }
  2894. // }
  2895. //}
  2896. func GetBatchSettleList() {
  2897. org_id, _ := beego.AppConfig.Int64("org_id")
  2898. //list, _ := service.GetLastFundList(org_id)
  2899. //orders, _ := service.GetOrderError(org_id)
  2900. //order, _ := service.GetHisOrderByID(list.OrderId)
  2901. var orders []*models.HisOrder
  2902. //if order.ID > 0 {
  2903. //
  2904. // orders, _ = service.GetAllHisOrderTwo(org_id, order.ID)
  2905. //
  2906. //} else {
  2907. orders, _ = service.GetAllHisOrder10106(org_id)
  2908. //
  2909. //}
  2910. for _, item := range orders {
  2911. order_id := item.ID
  2912. order, _ := service.GetHisOrderByIDTwo(order_id)
  2913. roles, _ := service.GetDoctorListTwo(org_id)
  2914. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  2915. admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  2916. curRoles, _ := service.GetAdminUserInfoByID(org_id, 2495)
  2917. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  2918. miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  2919. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  2920. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  2921. if order.ID == 0 {
  2922. return
  2923. }
  2924. if his.BalanceAccountsType == 2 {
  2925. continue
  2926. }
  2927. struct4101 := service.Struct4101{
  2928. PsnNo: order.PsnNo,
  2929. MdtrtId: order.MdtrtId,
  2930. SetlId: order.SetlId,
  2931. PsnName: order.PsnName,
  2932. Gend: order.Gend,
  2933. Brdy: his.Brdy,
  2934. Age: his.Age,
  2935. Naty: order.Naty,
  2936. PatnCertType: "01",
  2937. Certno: order.Certno,
  2938. Prfs: "90",
  2939. ConerName: roles[0].UserName,
  2940. PatnRlts: "99",
  2941. ConerAddr: miConfig.OrgName,
  2942. ConerTel: admin.Mobile,
  2943. HiType: order.Insutype,
  2944. Insuplc: his.InsuplcAdmdvs,
  2945. MaindiagFlag: "1",
  2946. BillCode: order.SetlId,
  2947. BillNo: order.SetlId,
  2948. BizSn: order.Number,
  2949. PsnSelfPay: order.PsnPartAmt,
  2950. PsnOwnPay: order.PsnPartAmt,
  2951. AcctPay: order.AcctPay,
  2952. PsnCashpay: order.PsnCashPay,
  2953. HiPaymtd: "1",
  2954. Hsorg: his.InsuplcAdmdvs,
  2955. HsorgOpter: his.InsuplcAdmdvs,
  2956. MedinsFillPsn: curRoles.UserName,
  2957. MedinsFillDept: depart.Name,
  2958. IptMedType: "2",
  2959. }
  2960. struct4101.SetlBegnDate = order.SetlTime
  2961. struct4101.SetlEndDate = order.SetlTime
  2962. //if order.SettleType == 1 {
  2963. // t := time.Unix(int64(order.SettleAccountsDate), 0)
  2964. // dateStr := t.Format("2006-01-02")
  2965. // struct4101.SetlBegnDate = dateStr
  2966. // struct4101.SetlEndDate = dateStr
  2967. //} else {
  2968. // t := time.Unix(int64(order.SettleStartTime), 0)
  2969. // t2 := time.Unix(int64(order.SettleEndTime), 0)
  2970. // dateStartStr := t.Format("2006-01-02")
  2971. // dateEndStr := t2.Format("2006-01-02")
  2972. // struct4101.SetlBegnDate = dateStartStr
  2973. // struct4101.SetlEndDate = dateEndStr
  2974. //}
  2975. var rf []CustomFundPay
  2976. json.Unmarshal([]byte(order.SetlDetail), &rf)
  2977. var tempFunPays []service.CustomStruct
  2978. var tempFunPay610100 service.CustomStruct
  2979. for _, item := range rf {
  2980. if item.FundPayType == "610100" {
  2981. tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  2982. tempFunPay610100.FundPayType = item.FundPayType
  2983. } else {
  2984. var tempFunPay service.CustomStruct
  2985. tempFunPay.FundPayamt = item.FundPayamt
  2986. tempFunPay.FundPayType = item.FundPayType
  2987. tempFunPays = append(tempFunPays, tempFunPay)
  2988. }
  2989. }
  2990. tempFunPays = append(tempFunPays, tempFunPay610100)
  2991. struct4101.CustomStruct = tempFunPays
  2992. var tempDiaginfos []service.DiaginfoStructTwo
  2993. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  2994. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  2995. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  2996. var config []*models.HisXtDiagnoseConfig
  2997. for _, item := range diagnosis_ids {
  2998. id, _ := strconv.ParseInt(item, 10, 64)
  2999. diagnosisConfig, _ := service.FindDiagnoseById(id)
  3000. config = append(config, &diagnosisConfig)
  3001. }
  3002. for index, item := range config {
  3003. if index == 0 {
  3004. var tempDiaginfo service.DiaginfoStructTwo
  3005. tempDiaginfo.DiagCode = item.CountryCode
  3006. tempDiaginfo.DiagName = item.CountryContentName
  3007. tempDiaginfo.DiagType = "1"
  3008. tempDiaginfo.MaindiagFlag = "1"
  3009. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  3010. } else {
  3011. var tempDiaginfo service.DiaginfoStructTwo
  3012. tempDiaginfo.DiagCode = item.CountryCode
  3013. tempDiaginfo.DiagName = item.CountryContentName
  3014. tempDiaginfo.DiagType = "2"
  3015. tempDiaginfo.MaindiagFlag = "0"
  3016. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  3017. }
  3018. }
  3019. struct4101.Diseinfo = tempDiaginfos
  3020. sickConfigTwo, _ := service.FindSickById(his.SickType)
  3021. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  3022. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  3023. tempOpspdiseinfo2.OprnOprtCode = ""
  3024. tempOpspdiseinfo2.OprnOprtName = ""
  3025. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  3026. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  3027. var iteminfo service.IteminfoStruct
  3028. var bedCostTotal float64 = 0 //床位总费
  3029. var bedCostSelfTotal float64 = 0 //床位自费
  3030. var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  3031. var examineCostTotal float64 = 0 //诊查总费
  3032. var examineCostSelfTotal float64 = 0 //诊查自费
  3033. var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  3034. var nursingCostTotal float64 = 0 //护理总费
  3035. var nursingCostSelfTotal float64 = 0 //护理自费
  3036. var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  3037. var chineseMedicineCostTotal float64 = 0 //中成药
  3038. var chineseMedicineCostSelfTotal float64 = 0 //中成药
  3039. var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  3040. var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  3041. var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  3042. var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  3043. var registerCostTotal float64 = 0 //一般诊疗费
  3044. var registerCostSelfTotal float64 = 0 //一般诊疗费
  3045. var registerPartSelfTotal float64 = 0 //一般诊疗费
  3046. var operationCostTotal float64 = 0 //手术费
  3047. var operationCostSelfTotal float64 = 0 //手术费
  3048. var operationCostPartSelfTotal float64 = 0 //手术费
  3049. var otherCostTotal float64 = 0 //其他费用
  3050. var otherCostSelfTotal float64 = 0 //其他费用
  3051. var otherCostPartSelfTotal float64 = 0 //其他费用
  3052. var materialCostTotal float64 = 0 //材料费
  3053. var materialCostSelfTotal float64 = 0 //材料费
  3054. var materialCostPartSelfTotal float64 = 0 //材料费
  3055. var westernMedicineCostTotal float64 = 0 //西药费
  3056. var westernMedicineCostSelfTotal float64 = 0 //西药费
  3057. var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  3058. var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  3059. var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  3060. var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  3061. var checkCostTotal float64 = 0 //检查费
  3062. var checkCostSelfTotal float64 = 0 //检查费
  3063. var checkCostPartSelfTotal float64 = 0 //检查费
  3064. var laboratoryCostTotal float64 = 0 //化验费
  3065. var laboratoryCostSelfTotal float64 = 0 //化验费
  3066. var laboratoryCostPartSelfTotal float64 = 0 //化验费
  3067. var treatCostTotal float64 = 0 //治疗费用
  3068. var treatCostSelfTotal float64 = 0 //治疗费用
  3069. var treatCostPartSelfTotal float64 = 0 //治疗费用
  3070. decimal.DivisionPrecision = 2
  3071. var bed_fulamt_ownpay_amt float64 = 0
  3072. var examine_fulamt_ownpay_amt float64 = 0
  3073. var nursing_fulamt_ownpay_amt float64 = 0
  3074. var chinese_medicine_fulamt_ownpay_amt float64 = 0
  3075. var commonly_treatment_fulamt_ownpay_amt float64 = 0
  3076. var register_fulamt_ownpay_amt float64 = 0
  3077. var operation_fulamt_ownpay_amt float64 = 0
  3078. var other_fulamt_ownpay_amt float64 = 0
  3079. var westernMedicine_fulamt_ownpay_amt float64 = 0
  3080. var chineseTraditional_fulamt_ownpay_amt float64 = 0
  3081. var check_fulamt_ownpay_amt float64 = 0
  3082. var material_fulamt_ownpay_amt float64 = 0
  3083. var laboratory_fulamt_ownpay_amt float64 = 0
  3084. var treat_fulamt_ownpay_amt float64 = 0
  3085. var bed_claa_sunmfee float64 = 0
  3086. var bed_clab_amt float64 = 0
  3087. var bed_other_amt float64 = 0
  3088. var examine_claa_sunmfee float64 = 0
  3089. var examine_clab_amt float64 = 0
  3090. var examine_other_amt float64 = 0
  3091. var nursing_claa_sunmfee float64 = 0
  3092. var nursing_clab_amt float64 = 0
  3093. var nursing_other_amt float64 = 0
  3094. var chinese_medicine_claa_sunmfee float64 = 0
  3095. var chinese_medicine_clab_amt float64 = 0
  3096. var chinese_medicine_other_amt float64 = 0
  3097. var commonly_treatment_claa_sunmfee float64 = 0
  3098. var commonly_treatment_clab_amt float64 = 0
  3099. var commonly_treatment_other_amt float64 = 0
  3100. var operation_claa_sunmfee float64 = 0
  3101. var operation_clab_amt float64 = 0
  3102. var operation_other_amt float64 = 0
  3103. var other_claa_sunmfee float64 = 0
  3104. var other_clab_amt float64 = 0
  3105. var other_other_amt float64 = 0
  3106. var westernMedicine_claa_sunmfee float64 = 0
  3107. var westernMedicine_clab_amt float64 = 0
  3108. var westernMedicine_other_amt float64 = 0
  3109. var chineseTraditional_claa_sunmfee float64 = 0
  3110. var chineseTraditional_clab_amt float64 = 0
  3111. var chineseTraditional_other_amt float64 = 0
  3112. var check_claa_sunmfee float64 = 0
  3113. var check_clab_amt float64 = 0
  3114. var check_other_amt float64 = 0
  3115. var material_claa_sunmfee float64 = 0
  3116. var material_clab_amt float64 = 0
  3117. var material_other_amt float64 = 0
  3118. var laboratory_claa_sunmfee float64 = 0
  3119. var laboratory_clab_amt float64 = 0
  3120. var laboratory_other_amt float64 = 0
  3121. var treat_claa_sunmfee float64 = 0
  3122. var treat_clab_amt float64 = 0
  3123. var treat_other_amt float64 = 0
  3124. var register_claa_sunmfee float64 = 0
  3125. var register_clab_amt float64 = 0
  3126. var register_other_amt float64 = 0
  3127. for _, item := range order.HisOrderInfo {
  3128. if item.MedChrgitmType == "01" { //床位费
  3129. bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3130. bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3131. bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3132. bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3133. if item.ChrgitmLv == "1" {
  3134. bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3135. }
  3136. if item.ChrgitmLv == "2" {
  3137. bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3138. }
  3139. if item.ChrgitmLv == "3" {
  3140. bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3141. }
  3142. }
  3143. if item.MedChrgitmType == "02" { //诊查
  3144. examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3145. examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3146. examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3147. examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3148. if item.ChrgitmLv == "1" {
  3149. examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3150. }
  3151. if item.ChrgitmLv == "2" {
  3152. examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3153. }
  3154. if item.ChrgitmLv == "3" {
  3155. examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3156. }
  3157. }
  3158. if item.MedChrgitmType == "03" { //检查费
  3159. checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3160. checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3161. checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3162. check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3163. if item.ChrgitmLv == "1" {
  3164. check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3165. }
  3166. if item.ChrgitmLv == "2" {
  3167. check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3168. }
  3169. if item.ChrgitmLv == "3" {
  3170. check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3171. }
  3172. }
  3173. if item.MedChrgitmType == "04" { //化验费
  3174. laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3175. laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3176. laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3177. laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3178. if item.ChrgitmLv == "1" {
  3179. laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3180. }
  3181. if item.ChrgitmLv == "2" {
  3182. laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3183. }
  3184. if item.ChrgitmLv == "3" {
  3185. laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3186. }
  3187. }
  3188. if item.MedChrgitmType == "05" { //治疗费
  3189. treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3190. treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3191. treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3192. treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3193. if item.ChrgitmLv == "1" {
  3194. treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3195. }
  3196. if item.ChrgitmLv == "2" {
  3197. treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3198. }
  3199. if item.ChrgitmLv == "3" {
  3200. treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3201. }
  3202. }
  3203. if item.MedChrgitmType == "06" { //手术费
  3204. operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3205. operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3206. operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3207. operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3208. if item.ChrgitmLv == "1" {
  3209. operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3210. }
  3211. if item.ChrgitmLv == "2" {
  3212. operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3213. }
  3214. if item.ChrgitmLv == "3" {
  3215. operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3216. }
  3217. }
  3218. if item.MedChrgitmType == "07" { //手术费
  3219. nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3220. nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3221. nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3222. nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3223. if item.ChrgitmLv == "1" {
  3224. nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3225. }
  3226. if item.ChrgitmLv == "2" {
  3227. nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3228. }
  3229. if item.ChrgitmLv == "3" {
  3230. nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3231. }
  3232. }
  3233. if item.MedChrgitmType == "08" { //材料费
  3234. materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3235. materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3236. materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3237. material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3238. if item.ChrgitmLv == "1" {
  3239. material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3240. }
  3241. if item.ChrgitmLv == "2" {
  3242. material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3243. }
  3244. if item.ChrgitmLv == "3" {
  3245. material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3246. }
  3247. }
  3248. if item.MedChrgitmType == "09" { //西药费
  3249. westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3250. westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3251. westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3252. westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3253. if item.ChrgitmLv == "1" {
  3254. westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3255. }
  3256. if item.ChrgitmLv == "2" {
  3257. westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3258. }
  3259. if item.ChrgitmLv == "3" {
  3260. westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3261. }
  3262. }
  3263. if item.MedChrgitmType == "10" { //中药饮片
  3264. chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3265. chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3266. chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3267. chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3268. if item.ChrgitmLv == "1" {
  3269. chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3270. }
  3271. if item.ChrgitmLv == "2" {
  3272. chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3273. }
  3274. if item.ChrgitmLv == "3" {
  3275. chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3276. }
  3277. }
  3278. if item.MedChrgitmType == "11" { //中成费
  3279. chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3280. chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3281. chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3282. chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3283. if item.ChrgitmLv == "1" {
  3284. chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3285. }
  3286. if item.ChrgitmLv == "2" {
  3287. chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3288. }
  3289. if item.ChrgitmLv == "3" {
  3290. chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3291. }
  3292. }
  3293. if item.MedChrgitmType == "12" { //中成费
  3294. commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3295. commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3296. commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3297. commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3298. if item.ChrgitmLv == "1" {
  3299. commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3300. }
  3301. if item.ChrgitmLv == "2" {
  3302. commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3303. }
  3304. if item.ChrgitmLv == "3" {
  3305. commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3306. }
  3307. }
  3308. if item.MedChrgitmType == "13" { //中成费
  3309. registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3310. registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3311. registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3312. register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3313. if item.ChrgitmLv == "1" {
  3314. register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3315. }
  3316. if item.ChrgitmLv == "2" {
  3317. register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3318. }
  3319. if item.ChrgitmLv == "3" {
  3320. register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3321. }
  3322. }
  3323. if item.MedChrgitmType == "14" { //其他费
  3324. otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3325. otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3326. otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3327. other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3328. if item.ChrgitmLv == "1" {
  3329. other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3330. }
  3331. if item.ChrgitmLv == "2" {
  3332. other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3333. }
  3334. if item.ChrgitmLv == "3" {
  3335. other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3336. }
  3337. }
  3338. }
  3339. var iteminfoStructs []service.IteminfoStruct
  3340. if bedCostTotal != 0 {
  3341. iteminfo.MedChrgitm = "01"
  3342. iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  3343. iteminfo.Amt = bedCostTotal
  3344. iteminfo.ClaaSumfee = bed_claa_sunmfee
  3345. iteminfo.ClabAmt = bed_clab_amt
  3346. iteminfo.OthAmt = bed_other_amt
  3347. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3348. }
  3349. if examineCostTotal != 0 {
  3350. iteminfo.MedChrgitm = "02"
  3351. iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  3352. iteminfo.Amt = examineCostTotal
  3353. iteminfo.ClaaSumfee = examine_claa_sunmfee
  3354. iteminfo.ClabAmt = examine_clab_amt
  3355. iteminfo.OthAmt = examine_other_amt
  3356. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3357. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3358. }
  3359. if checkCostTotal != 0 {
  3360. iteminfo.MedChrgitm = "03"
  3361. iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  3362. iteminfo.Amt = checkCostTotal
  3363. iteminfo.ClaaSumfee = check_claa_sunmfee
  3364. iteminfo.ClabAmt = check_clab_amt
  3365. iteminfo.OthAmt = check_other_amt
  3366. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3367. }
  3368. if laboratoryCostTotal != 0 {
  3369. iteminfo.MedChrgitm = "04"
  3370. iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  3371. iteminfo.Amt = laboratoryCostTotal
  3372. iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  3373. iteminfo.ClabAmt = laboratory_clab_amt
  3374. iteminfo.OthAmt = laboratory_other_amt
  3375. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3376. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3377. }
  3378. if treatCostTotal != 0 {
  3379. iteminfo.MedChrgitm = "05"
  3380. iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  3381. iteminfo.Amt = treatCostTotal
  3382. iteminfo.ClaaSumfee = treat_claa_sunmfee
  3383. iteminfo.ClabAmt = treat_clab_amt
  3384. iteminfo.OthAmt = treat_other_amt
  3385. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3386. //(struct4101.IteminfoStruct, iteminfo)
  3387. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3388. }
  3389. if operationCostTotal != 0 {
  3390. iteminfo.MedChrgitm = "06"
  3391. iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  3392. iteminfo.Amt = operationCostTotal
  3393. iteminfo.ClaaSumfee = operation_claa_sunmfee
  3394. iteminfo.ClabAmt = operation_clab_amt
  3395. iteminfo.OthAmt = operation_other_amt
  3396. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3397. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3398. }
  3399. if nursingCostTotal != 0 {
  3400. iteminfo.MedChrgitm = "07"
  3401. iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  3402. iteminfo.Amt = nursingCostTotal
  3403. iteminfo.ClaaSumfee = nursing_claa_sunmfee
  3404. iteminfo.ClabAmt = nursing_clab_amt
  3405. iteminfo.OthAmt = nursing_other_amt
  3406. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3407. }
  3408. if materialCostTotal != 0 {
  3409. iteminfo.MedChrgitm = "08"
  3410. iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  3411. iteminfo.Amt = materialCostTotal
  3412. iteminfo.ClaaSumfee = material_claa_sunmfee
  3413. iteminfo.ClabAmt = material_clab_amt
  3414. iteminfo.OthAmt = material_other_amt
  3415. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3416. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3417. }
  3418. if westernMedicineCostTotal != 0 {
  3419. iteminfo.MedChrgitm = "09"
  3420. iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  3421. iteminfo.Amt = westernMedicineCostTotal
  3422. iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  3423. iteminfo.ClabAmt = westernMedicine_clab_amt
  3424. iteminfo.OthAmt = westernMedicine_other_amt
  3425. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3426. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3427. }
  3428. if chineseMedicineCostTotal != 0 {
  3429. iteminfo.MedChrgitm = "10"
  3430. iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  3431. iteminfo.Amt = chineseMedicineCostTotal
  3432. iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  3433. iteminfo.ClabAmt = chinese_medicine_clab_amt
  3434. iteminfo.OthAmt = chinese_medicine_other_amt
  3435. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3436. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3437. }
  3438. if chineseTraditionalMedicineCostTotal != 0 {
  3439. iteminfo.MedChrgitm = "11"
  3440. iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  3441. iteminfo.Amt = westernMedicineCostTotal
  3442. iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  3443. iteminfo.ClabAmt = westernMedicine_clab_amt
  3444. iteminfo.OthAmt = westernMedicine_other_amt
  3445. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3446. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3447. }
  3448. if commonlyTreatmentCostTotal != 0 {
  3449. iteminfo.MedChrgitm = "12"
  3450. iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  3451. iteminfo.Amt = commonlyTreatmentCostTotal
  3452. iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  3453. iteminfo.ClabAmt = commonly_treatment_clab_amt
  3454. iteminfo.OthAmt = commonly_treatment_other_amt
  3455. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3456. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3457. }
  3458. if registerCostTotal != 0 {
  3459. iteminfo.MedChrgitm = "13"
  3460. iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  3461. iteminfo.Amt = registerCostTotal
  3462. iteminfo.ClaaSumfee = register_claa_sunmfee
  3463. iteminfo.ClabAmt = register_clab_amt
  3464. iteminfo.OthAmt = register_other_amt
  3465. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3466. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3467. }
  3468. if otherCostTotal != 0 {
  3469. iteminfo.MedChrgitm = "14"
  3470. iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  3471. iteminfo.Amt = otherCostTotal
  3472. iteminfo.ClaaSumfee = other_claa_sunmfee
  3473. iteminfo.ClabAmt = other_clab_amt
  3474. iteminfo.OthAmt = other_other_amt
  3475. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  3476. iteminfoStructs = append(iteminfoStructs, iteminfo)
  3477. }
  3478. struct4101.IteminfoStruct = iteminfoStructs
  3479. time_arr := strings.Split(order.SetlTime, " ")
  3480. struct4101.AdmTime = time_arr[0]
  3481. struct4101.AdmEndTime = time_arr[0]
  3482. struct4101.DoctorName = doctor.UserName
  3483. struct4101.DoctorCode = doctor.DoctorNumber
  3484. struct4101.Ntly = "中国"
  3485. struct4101.AdmCaty = "A03.06"
  3486. var res ResultSeventeen
  3487. if miConfig.MdtrtareaAdmvs == "421300" {
  3488. data := make(map[string]interface{})
  3489. data["struct4101"] = struct4101
  3490. data["secret_key"] = miConfig.SecretKey
  3491. data["org_name"] = miConfig.OrgName
  3492. data["opera"] = curRoles.UserName
  3493. data["code"] = miConfig.Code
  3494. data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
  3495. data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  3496. client := &http.Client{}
  3497. bytesData, _ := json.Marshal(data)
  3498. req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/4101", bytes.NewReader(bytesData))
  3499. resp, _ := client.Do(req)
  3500. defer resp.Body.Close()
  3501. body, ioErr := ioutil.ReadAll(resp.Body)
  3502. if ioErr != nil {
  3503. //utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  3504. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3505. return
  3506. }
  3507. var respJSON map[string]interface{}
  3508. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  3509. //utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  3510. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3511. return
  3512. }
  3513. respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  3514. userJSONBytes, _ := json.Marshal(respJSON)
  3515. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  3516. //utils.ErrorLog("解析失败:%v", err)
  3517. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3518. errlog := &models.HisOrderError{
  3519. UserOrgId: org_id,
  3520. Ctime: time.Now().Unix(),
  3521. Mtime: time.Now().Unix(),
  3522. ErrMsg: res.ErrMsg + "解析失败",
  3523. Status: 1,
  3524. PatientId: order_id,
  3525. Stage: 10088,
  3526. }
  3527. service.CreateErrMsgLog(errlog)
  3528. continue
  3529. }
  3530. } else {
  3531. result, request := service.Gdyb4101For10106(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  3532. fmt.Println(result)
  3533. saveLog(result, request, "4205", "自费就诊和诊断信息上传")
  3534. var dat map[string]interface{}
  3535. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  3536. fmt.Println(dat)
  3537. } else {
  3538. fmt.Println(err)
  3539. }
  3540. userJSONBytes, _ := json.Marshal(dat)
  3541. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  3542. //utils.ErrorLog("解析失败:%v", err)
  3543. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  3544. //adminUser := c.GetAdminUserInfo()
  3545. errlog := &models.HisOrderError{
  3546. UserOrgId: org_id,
  3547. Ctime: time.Now().Unix(),
  3548. Mtime: time.Now().Unix(),
  3549. ErrMsg: res.ErrMsg + "解析失败",
  3550. Status: 1,
  3551. PatientId: order_id,
  3552. Stage: 50000,
  3553. }
  3554. service.CreateErrMsgLog(errlog)
  3555. continue
  3556. }
  3557. }
  3558. if res.Infcode != 0 {
  3559. //adminUser := c.GetAdminUserInfo()
  3560. errlog := &models.HisOrderError{
  3561. UserOrgId: org_id,
  3562. Ctime: time.Now().Unix(),
  3563. Mtime: time.Now().Unix(),
  3564. ErrMsg: res.ErrMsg,
  3565. Status: 1,
  3566. PatientId: order_id,
  3567. Stage: 50000,
  3568. }
  3569. service.CreateErrMsgLog(errlog)
  3570. continue
  3571. } else {
  3572. hisFundSettleListResult := &models.HisFundSettleListResult{
  3573. Number: res.Output.SetlListId,
  3574. Status: 1,
  3575. Ctime: time.Now().Unix(),
  3576. Mtime: time.Now().Unix(),
  3577. UserOrgId: org_id,
  3578. IsUpload: 1,
  3579. OrderId: order_id,
  3580. }
  3581. service.CreateUploadRecord(hisFundSettleListResult)
  3582. continue
  3583. }
  3584. }
  3585. }
  3586. func saveLog(result string, request string, infno string, desc string) {
  3587. org_id, _ := beego.AppConfig.Int64("org_id")
  3588. miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  3589. dir := miConfig.OrgName + "日志"
  3590. utils.Mkdir(dir)
  3591. month := time.Unix(1557042972, 0).Format("1")
  3592. year := time.Now().Format("2006")
  3593. month = time.Now().Format("01")
  3594. day := time.Now().Format("02")
  3595. hour := time.Now().Format("15")
  3596. min := time.Now().Format("04")
  3597. sec := time.Now().Format("05")
  3598. result_time := year + "-" + month + "-" + day + " " + hour + ":" + min + ":" + sec
  3599. file := strconv.FormatInt(org_id, 10) + "_" + year + month + day + "_log"
  3600. file_name := file + ".txt"
  3601. file_path := miConfig.OrgName + "日志" + "/" + file_name
  3602. exist, _ := utils.PathExists(file_path)
  3603. if exist { //存在
  3604. fmt.Println("存在")
  3605. f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  3606. if err != nil {
  3607. fmt.Println("read fail")
  3608. }
  3609. content := "\r\n" + "\r\n" + "\r\n" + result_time + " " + "【 " + desc + infno + "入参" + " 】:" + "\r\n" + request + "\r\n" + result_time + " " + "【 " + desc + infno + "出参" + " 】:" + "\r\n" + result
  3610. n, _ := f.Seek(0, 2)
  3611. _, err = f.WriteAt([]byte(content), n)
  3612. } else { //不存在
  3613. fmt.Println("文件不存在,创建文件")
  3614. f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
  3615. defer f.Close()
  3616. if err != nil {
  3617. } else {
  3618. _, err = f.Write([]byte("记录日志"))
  3619. }
  3620. }
  3621. }
  3622. //func UploadSettleList(org_id int64) {
  3623. // orders, _ := service.GetAllHisOrder(org_id)
  3624. // for _, item := range orders {
  3625. // order_id := item.ID
  3626. // order, _ := service.GetHisOrderByIDTwo(order_id)
  3627. // roles, _ := service.GetDoctorListTwo(org_id)
  3628. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  3629. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  3630. // curRoles, _ := service.GetAdminUserInfo(org_id)
  3631. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  3632. // miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  3633. //
  3634. // result, _ := service.GetHisFundSettleListResult(order_id)
  3635. // //判断是否已经上传过医保,上传过就跳过该条记录
  3636. // if result.ID > 0 {
  3637. // continue
  3638. // }
  3639. //
  3640. // if his.BalanceAccountsType == 2 {
  3641. // continue
  3642. // }
  3643. //
  3644. // struct4101 := service.Struct4101{
  3645. // PsnNo: order.PsnNo,
  3646. // MdtrtId: order.MdtrtId,
  3647. // SetlId: order.SetlId,
  3648. // PsnName: order.PsnName,
  3649. // Gend: order.Gend,
  3650. // Brdy: his.Brdy,
  3651. // Age: his.Age,
  3652. // Naty: order.Naty,
  3653. // PatnCertType: "01",
  3654. // Certno: order.Certno,
  3655. // Prfs: "90",
  3656. // ConerName: roles[0].UserName,
  3657. // PatnRlts: "99",
  3658. // ConerAddr: miConfig.OrgName,
  3659. // ConerTel: admin.Mobile,
  3660. // HiType: order.Insutype,
  3661. // Insuplc: his.InsuplcAdmdvs,
  3662. // MaindiagFlag: "1",
  3663. // BillCode: order.FaPiaoCode,
  3664. // BillNo: order.FaPiaoNumber,
  3665. // BizSn: order.Number,
  3666. // PsnSelfPay: order.PsnPartAmt,
  3667. // PsnOwnPay: order.PsnPartAmt,
  3668. // AcctPay: order.AcctPay,
  3669. // PsnCashpay: order.PsnCashPay,
  3670. // HiPaymtd: "1",
  3671. // Hsorg: his.InsuplcAdmdvs,
  3672. // HsorgOpter: his.InsuplcAdmdvs,
  3673. // MedinsFillPsn: curRoles.UserName,
  3674. // MedinsFillDept: depart.Name,
  3675. // IptMedType: "2",
  3676. // }
  3677. // struct4101.SetlBegnDate = order.SetlTime
  3678. // struct4101.SetlEndDate = order.SetlTime
  3679. // //if order.SettleType == 1 {
  3680. // // t := time.Unix(int64(order.SettleAccountsDate), 0)
  3681. // // dateStr := t.Format("2006-01-02")
  3682. // // struct4101.SetlBegnDate = dateStr
  3683. // // struct4101.SetlEndDate = dateStr
  3684. // //} else {
  3685. // // t := time.Unix(int64(order.SettleStartTime), 0)
  3686. // // t2 := time.Unix(int64(order.SettleEndTime), 0)
  3687. // // dateStartStr := t.Format("2006-01-02")
  3688. // // dateEndStr := t2.Format("2006-01-02")
  3689. // // struct4101.SetlBegnDate = dateStartStr
  3690. // // struct4101.SetlEndDate = dateEndStr
  3691. // //}
  3692. //
  3693. // var rf []CustomFundPay
  3694. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  3695. //
  3696. // var tempFunPays []service.CustomStruct
  3697. // var tempFunPay610100 service.CustomStruct
  3698. //
  3699. // for _, item := range rf {
  3700. // if item.FundPayType == "610100" {
  3701. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  3702. // tempFunPay610100.FundPayType = item.FundPayType
  3703. // } else {
  3704. // var tempFunPay service.CustomStruct
  3705. // tempFunPay.FundPayamt = item.FundPayamt
  3706. // tempFunPay.FundPayType = item.FundPayType
  3707. // tempFunPays = append(tempFunPays, tempFunPay)
  3708. // }
  3709. // }
  3710. // tempFunPays = append(tempFunPays, tempFunPay610100)
  3711. // struct4101.CustomStruct = tempFunPays
  3712. //
  3713. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  3714. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  3715. // //sickConfig, _ := service.FindDiagnoseById(his.Diagnosis)
  3716. //
  3717. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  3718. // var config []*models.HisXtDiagnoseConfig
  3719. // for _, item := range diagnosis_ids {
  3720. // id, _ := strconv.ParseInt(item, 10, 64)
  3721. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  3722. // config = append(config, &diagnosisConfig)
  3723. // }
  3724. //
  3725. // for _, item := range config {
  3726. // var tempOpspdiseinfo service.OpspdiseinfoStruct
  3727. // tempOpspdiseinfo.DiagCode = item.CountryCode
  3728. // tempOpspdiseinfo.DiagName = item.CountryContentName
  3729. // tempOpspdiseinfo.MaindiagFlag = "1"
  3730. // tempOpspdiseinfo.OprnOprtCode = ""
  3731. // tempOpspdiseinfo.OprnOprtName = ""
  3732. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo)
  3733. // }
  3734. //
  3735. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  3736. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  3737. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  3738. // tempOpspdiseinfo2.MaindiagFlag = "2"
  3739. // tempOpspdiseinfo2.OprnOprtCode = ""
  3740. // tempOpspdiseinfo2.OprnOprtName = ""
  3741. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  3742. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  3743. //
  3744. // var iteminfo service.IteminfoStruct
  3745. //
  3746. // var bedCostTotal float64 = 0 //床位总费
  3747. // var bedCostSelfTotal float64 = 0 //床位自费
  3748. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  3749. //
  3750. // var examineCostTotal float64 = 0 //诊查总费
  3751. // var examineCostSelfTotal float64 = 0 //诊查自费
  3752. // var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  3753. //
  3754. // var nursingCostTotal float64 = 0 //护理总费
  3755. // var nursingCostSelfTotal float64 = 0 //护理自费
  3756. // var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  3757. //
  3758. // var chineseMedicineCostTotal float64 = 0 //中成药
  3759. // var chineseMedicineCostSelfTotal float64 = 0 //中成药
  3760. // var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  3761. //
  3762. // var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  3763. // var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  3764. // var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  3765. //
  3766. // var registerCostTotal float64 = 0 //一般诊疗费
  3767. // var registerCostSelfTotal float64 = 0 //一般诊疗费
  3768. // var registerPartSelfTotal float64 = 0 //一般诊疗费
  3769. //
  3770. // var operationCostTotal float64 = 0 //手术费
  3771. // var operationCostSelfTotal float64 = 0 //手术费
  3772. // var operationCostPartSelfTotal float64 = 0 //手术费
  3773. //
  3774. // var otherCostTotal float64 = 0 //其他费用
  3775. // var otherCostSelfTotal float64 = 0 //其他费用
  3776. // var otherCostPartSelfTotal float64 = 0 //其他费用
  3777. //
  3778. // var materialCostTotal float64 = 0 //材料费
  3779. // var materialCostSelfTotal float64 = 0 //材料费
  3780. // var materialCostPartSelfTotal float64 = 0 //材料费
  3781. //
  3782. // var westernMedicineCostTotal float64 = 0 //西药费
  3783. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  3784. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  3785. //
  3786. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  3787. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  3788. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  3789. //
  3790. // var checkCostTotal float64 = 0 //检查费
  3791. // var checkCostSelfTotal float64 = 0 //检查费
  3792. // var checkCostPartSelfTotal float64 = 0 //检查费
  3793. //
  3794. // var laboratoryCostTotal float64 = 0 //化验费
  3795. // var laboratoryCostSelfTotal float64 = 0 //化验费
  3796. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  3797. //
  3798. // var treatCostTotal float64 = 0 //治疗费用
  3799. // var treatCostSelfTotal float64 = 0 //治疗费用
  3800. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  3801. //
  3802. // decimal.DivisionPrecision = 2
  3803. //
  3804. // var bed_fulamt_ownpay_amt float64 = 0
  3805. //
  3806. // var examine_fulamt_ownpay_amt float64 = 0
  3807. //
  3808. // var nursing_fulamt_ownpay_amt float64 = 0
  3809. //
  3810. // var chinese_medicine_fulamt_ownpay_amt float64 = 0
  3811. //
  3812. // var commonly_treatment_fulamt_ownpay_amt float64 = 0
  3813. //
  3814. // var register_fulamt_ownpay_amt float64 = 0
  3815. //
  3816. // var operation_fulamt_ownpay_amt float64 = 0
  3817. // var other_fulamt_ownpay_amt float64 = 0
  3818. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  3819. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  3820. // var check_fulamt_ownpay_amt float64 = 0
  3821. // var material_fulamt_ownpay_amt float64 = 0
  3822. // var laboratory_fulamt_ownpay_amt float64 = 0
  3823. // var treat_fulamt_ownpay_amt float64 = 0
  3824. //
  3825. // var bed_claa_sunmfee float64 = 0
  3826. // var bed_clab_amt float64 = 0
  3827. // var bed_other_amt float64 = 0
  3828. //
  3829. // var examine_claa_sunmfee float64 = 0
  3830. // var examine_clab_amt float64 = 0
  3831. // var examine_other_amt float64 = 0
  3832. //
  3833. // var nursing_claa_sunmfee float64 = 0
  3834. // var nursing_clab_amt float64 = 0
  3835. // var nursing_other_amt float64 = 0
  3836. //
  3837. // var chinese_medicine_claa_sunmfee float64 = 0
  3838. // var chinese_medicine_clab_amt float64 = 0
  3839. // var chinese_medicine_other_amt float64 = 0
  3840. //
  3841. // var commonly_treatment_claa_sunmfee float64 = 0
  3842. // var commonly_treatment_clab_amt float64 = 0
  3843. // var commonly_treatment_other_amt float64 = 0
  3844. //
  3845. // var operation_claa_sunmfee float64 = 0
  3846. // var operation_clab_amt float64 = 0
  3847. // var operation_other_amt float64 = 0
  3848. //
  3849. // var other_claa_sunmfee float64 = 0
  3850. // var other_clab_amt float64 = 0
  3851. // var other_other_amt float64 = 0
  3852. //
  3853. // var westernMedicine_claa_sunmfee float64 = 0
  3854. // var westernMedicine_clab_amt float64 = 0
  3855. // var westernMedicine_other_amt float64 = 0
  3856. //
  3857. // var chineseTraditional_claa_sunmfee float64 = 0
  3858. // var chineseTraditional_clab_amt float64 = 0
  3859. // var chineseTraditional_other_amt float64 = 0
  3860. //
  3861. // var check_claa_sunmfee float64 = 0
  3862. // var check_clab_amt float64 = 0
  3863. // var check_other_amt float64 = 0
  3864. //
  3865. // var material_claa_sunmfee float64 = 0
  3866. // var material_clab_amt float64 = 0
  3867. // var material_other_amt float64 = 0
  3868. //
  3869. // var laboratory_claa_sunmfee float64 = 0
  3870. // var laboratory_clab_amt float64 = 0
  3871. // var laboratory_other_amt float64 = 0
  3872. //
  3873. // var treat_claa_sunmfee float64 = 0
  3874. // var treat_clab_amt float64 = 0
  3875. // var treat_other_amt float64 = 0
  3876. //
  3877. // var register_claa_sunmfee float64 = 0
  3878. // var register_clab_amt float64 = 0
  3879. // var register_other_amt float64 = 0
  3880. //
  3881. // for _, item := range order.HisOrderInfo {
  3882. // if item.MedChrgitmType == "01" { //床位费
  3883. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3884. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3885. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3886. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3887. // if item.ChrgitmLv == "1" {
  3888. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3889. // }
  3890. // if item.ChrgitmLv == "2" {
  3891. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3892. //
  3893. // }
  3894. // if item.ChrgitmLv == "3" {
  3895. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3896. // }
  3897. //
  3898. // }
  3899. //
  3900. // if item.MedChrgitmType == "02" { //诊查
  3901. // examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3902. // examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3903. // examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3904. // examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3905. // if item.ChrgitmLv == "1" {
  3906. // examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3907. // }
  3908. // if item.ChrgitmLv == "2" {
  3909. // examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3910. //
  3911. // }
  3912. // if item.ChrgitmLv == "3" {
  3913. // examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3914. // }
  3915. //
  3916. // }
  3917. //
  3918. // if item.MedChrgitmType == "03" { //检查费
  3919. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3920. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3921. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3922. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3923. // if item.ChrgitmLv == "1" {
  3924. //
  3925. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3926. //
  3927. // }
  3928. // if item.ChrgitmLv == "2" {
  3929. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3930. //
  3931. // }
  3932. // if item.ChrgitmLv == "3" {
  3933. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3934. // }
  3935. // }
  3936. //
  3937. // if item.MedChrgitmType == "04" { //化验费
  3938. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3939. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3940. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3941. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3942. // if item.ChrgitmLv == "1" {
  3943. //
  3944. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3945. //
  3946. // }
  3947. // if item.ChrgitmLv == "2" {
  3948. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3949. //
  3950. // }
  3951. // if item.ChrgitmLv == "3" {
  3952. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3953. // }
  3954. // }
  3955. //
  3956. // if item.MedChrgitmType == "05" { //治疗费
  3957. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3958. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3959. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3960. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3961. // if item.ChrgitmLv == "1" {
  3962. //
  3963. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3964. //
  3965. // }
  3966. // if item.ChrgitmLv == "2" {
  3967. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3968. //
  3969. // }
  3970. // if item.ChrgitmLv == "3" {
  3971. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3972. // }
  3973. // }
  3974. //
  3975. // if item.MedChrgitmType == "06" { //手术费
  3976. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3977. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3978. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3979. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  3980. //
  3981. // if item.ChrgitmLv == "1" {
  3982. //
  3983. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3984. //
  3985. // }
  3986. // if item.ChrgitmLv == "2" {
  3987. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3988. //
  3989. // }
  3990. // if item.ChrgitmLv == "3" {
  3991. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3992. // }
  3993. // }
  3994. //
  3995. // if item.MedChrgitmType == "07" { //手术费
  3996. // nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  3997. // nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  3998. // nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  3999. // nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4000. //
  4001. // if item.ChrgitmLv == "1" {
  4002. //
  4003. // nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4004. //
  4005. // }
  4006. // if item.ChrgitmLv == "2" {
  4007. // nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4008. //
  4009. // }
  4010. // if item.ChrgitmLv == "3" {
  4011. // nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4012. // }
  4013. // }
  4014. //
  4015. // if item.MedChrgitmType == "08" { //材料费
  4016. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4017. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4018. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4019. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4020. // if item.ChrgitmLv == "1" {
  4021. //
  4022. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4023. //
  4024. // }
  4025. // if item.ChrgitmLv == "2" {
  4026. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4027. //
  4028. // }
  4029. // if item.ChrgitmLv == "3" {
  4030. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4031. // }
  4032. // }
  4033. // if item.MedChrgitmType == "09" { //西药费
  4034. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4035. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4036. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4037. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4038. // if item.ChrgitmLv == "1" {
  4039. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4040. // }
  4041. // if item.ChrgitmLv == "2" {
  4042. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4043. // }
  4044. // if item.ChrgitmLv == "3" {
  4045. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4046. // }
  4047. // }
  4048. // if item.MedChrgitmType == "10" { //中药饮片
  4049. // chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4050. // chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4051. // chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4052. // chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4053. // if item.ChrgitmLv == "1" {
  4054. // chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4055. // }
  4056. // if item.ChrgitmLv == "2" {
  4057. // chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4058. // }
  4059. // if item.ChrgitmLv == "3" {
  4060. // chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4061. // }
  4062. // }
  4063. //
  4064. // if item.MedChrgitmType == "11" { //中成费
  4065. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4066. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4067. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4068. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4069. // if item.ChrgitmLv == "1" {
  4070. //
  4071. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4072. //
  4073. // }
  4074. // if item.ChrgitmLv == "2" {
  4075. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4076. //
  4077. // }
  4078. // if item.ChrgitmLv == "3" {
  4079. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4080. // }
  4081. // }
  4082. //
  4083. // if item.MedChrgitmType == "12" { //中成费
  4084. // commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4085. // commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4086. // commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4087. // commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4088. // if item.ChrgitmLv == "1" {
  4089. //
  4090. // commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4091. //
  4092. // }
  4093. // if item.ChrgitmLv == "2" {
  4094. // commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4095. //
  4096. // }
  4097. // if item.ChrgitmLv == "3" {
  4098. // commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4099. // }
  4100. // }
  4101. //
  4102. // if item.MedChrgitmType == "13" { //中成费
  4103. // registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4104. // registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4105. // registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4106. // register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4107. // if item.ChrgitmLv == "1" {
  4108. //
  4109. // register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4110. //
  4111. // }
  4112. // if item.ChrgitmLv == "2" {
  4113. // register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4114. //
  4115. // }
  4116. // if item.ChrgitmLv == "3" {
  4117. // register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4118. // }
  4119. // }
  4120. //
  4121. // if item.MedChrgitmType == "14" { //其他费
  4122. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4123. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4124. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4125. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  4126. // if item.ChrgitmLv == "1" {
  4127. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  4128. //
  4129. // }
  4130. // if item.ChrgitmLv == "2" {
  4131. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  4132. //
  4133. // }
  4134. // if item.ChrgitmLv == "3" {
  4135. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  4136. // }
  4137. // }
  4138. //
  4139. // }
  4140. //
  4141. // var iteminfoStructs []service.IteminfoStruct
  4142. //
  4143. // if bedCostTotal != 0 {
  4144. // iteminfo.MedChrgitm = "01"
  4145. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  4146. // iteminfo.Amt = bedCostTotal
  4147. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  4148. // iteminfo.ClabAmt = bed_clab_amt
  4149. // iteminfo.OthAmt = bed_other_amt
  4150. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4151. // }
  4152. //
  4153. // if examineCostTotal != 0 {
  4154. // iteminfo.MedChrgitm = "02"
  4155. // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  4156. // iteminfo.Amt = examineCostTotal
  4157. // iteminfo.ClaaSumfee = examine_claa_sunmfee
  4158. // iteminfo.ClabAmt = examine_clab_amt
  4159. // iteminfo.OthAmt = examine_other_amt
  4160. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4161. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4162. // }
  4163. //
  4164. // if checkCostTotal != 0 {
  4165. // iteminfo.MedChrgitm = "03"
  4166. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  4167. // iteminfo.Amt = checkCostTotal
  4168. // iteminfo.ClaaSumfee = check_claa_sunmfee
  4169. // iteminfo.ClabAmt = check_clab_amt
  4170. // iteminfo.OthAmt = check_other_amt
  4171. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4172. //
  4173. // }
  4174. //
  4175. // if laboratoryCostTotal != 0 {
  4176. // iteminfo.MedChrgitm = "04"
  4177. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  4178. // iteminfo.Amt = laboratoryCostTotal
  4179. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  4180. // iteminfo.ClabAmt = laboratory_clab_amt
  4181. // iteminfo.OthAmt = laboratory_other_amt
  4182. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4183. //
  4184. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4185. //
  4186. // }
  4187. //
  4188. // if treatCostTotal != 0 {
  4189. // iteminfo.MedChrgitm = "05"
  4190. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  4191. // iteminfo.Amt = treatCostTotal
  4192. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  4193. // iteminfo.ClabAmt = treat_clab_amt
  4194. // iteminfo.OthAmt = treat_other_amt
  4195. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4196. // //(struct4101.IteminfoStruct, iteminfo)
  4197. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4198. // }
  4199. //
  4200. // if operationCostTotal != 0 {
  4201. // iteminfo.MedChrgitm = "06"
  4202. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  4203. // iteminfo.Amt = operationCostTotal
  4204. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  4205. // iteminfo.ClabAmt = operation_clab_amt
  4206. // iteminfo.OthAmt = operation_other_amt
  4207. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4208. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4209. // }
  4210. //
  4211. // if nursingCostTotal != 0 {
  4212. // iteminfo.MedChrgitm = "07"
  4213. // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  4214. // iteminfo.Amt = nursingCostTotal
  4215. // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  4216. // iteminfo.ClabAmt = nursing_clab_amt
  4217. // iteminfo.OthAmt = nursing_other_amt
  4218. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4219. // }
  4220. //
  4221. // if materialCostTotal != 0 {
  4222. // iteminfo.MedChrgitm = "08"
  4223. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  4224. // iteminfo.Amt = materialCostTotal
  4225. // iteminfo.ClaaSumfee = material_claa_sunmfee
  4226. // iteminfo.ClabAmt = material_clab_amt
  4227. // iteminfo.OthAmt = material_other_amt
  4228. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4229. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4230. // }
  4231. //
  4232. // if westernMedicineCostTotal != 0 {
  4233. // iteminfo.MedChrgitm = "09"
  4234. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  4235. // iteminfo.Amt = westernMedicineCostTotal
  4236. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  4237. // iteminfo.ClabAmt = westernMedicine_clab_amt
  4238. // iteminfo.OthAmt = westernMedicine_other_amt
  4239. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4240. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4241. //
  4242. // }
  4243. //
  4244. // if chineseMedicineCostTotal != 0 {
  4245. // iteminfo.MedChrgitm = "10"
  4246. // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  4247. // iteminfo.Amt = chineseMedicineCostTotal
  4248. // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  4249. // iteminfo.ClabAmt = chinese_medicine_clab_amt
  4250. // iteminfo.OthAmt = chinese_medicine_other_amt
  4251. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4252. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4253. //
  4254. // }
  4255. //
  4256. // if chineseTraditionalMedicineCostTotal != 0 {
  4257. // iteminfo.MedChrgitm = "11"
  4258. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  4259. // iteminfo.Amt = westernMedicineCostTotal
  4260. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  4261. // iteminfo.ClabAmt = westernMedicine_clab_amt
  4262. // iteminfo.OthAmt = westernMedicine_other_amt
  4263. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4264. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4265. //
  4266. // }
  4267. //
  4268. // if commonlyTreatmentCostTotal != 0 {
  4269. // iteminfo.MedChrgitm = "12"
  4270. // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  4271. // iteminfo.Amt = commonlyTreatmentCostTotal
  4272. // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  4273. // iteminfo.ClabAmt = commonly_treatment_clab_amt
  4274. // iteminfo.OthAmt = commonly_treatment_other_amt
  4275. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4276. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4277. //
  4278. // }
  4279. //
  4280. // if registerCostTotal != 0 {
  4281. // iteminfo.MedChrgitm = "13"
  4282. // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  4283. // iteminfo.Amt = registerCostTotal
  4284. // iteminfo.ClaaSumfee = register_claa_sunmfee
  4285. // iteminfo.ClabAmt = register_clab_amt
  4286. // iteminfo.OthAmt = register_other_amt
  4287. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  4288. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4289. //
  4290. // }
  4291. //
  4292. // if otherCostTotal != 0 {
  4293. // iteminfo.MedChrgitm = "14"
  4294. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  4295. // iteminfo.Amt = otherCostTotal
  4296. // iteminfo.ClaaSumfee = other_claa_sunmfee
  4297. // iteminfo.ClabAmt = other_clab_amt
  4298. // iteminfo.OthAmt = other_other_amt
  4299. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  4300. //
  4301. // }
  4302. // struct4101.IteminfoStruct = iteminfoStructs
  4303. // struct4101.Ntly = "中国"
  4304. // struct4101.AdmCaty = "A03.06"
  4305. // result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  4306. // fmt.Println(result)
  4307. //
  4308. // var dat map[string]interface{}
  4309. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  4310. // fmt.Println(dat)
  4311. // } else {
  4312. // fmt.Println(err)
  4313. // }
  4314. // userJSONBytes, _ := json.Marshal(dat)
  4315. // var res ResultSeventeen
  4316. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  4317. // utils.ErrorLog("解析失败:%v", err)
  4318. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  4319. // errlog := &models.HisOrderError{
  4320. // UserOrgId: org_id,
  4321. // Ctime: time.Now().Unix(),
  4322. // Mtime: time.Now().Unix(),
  4323. // ErrMsg: res.ErrMsg + "解析失败",
  4324. // Status: 1,
  4325. // PatientId: order_id,
  4326. // Stage: 120,
  4327. // }
  4328. // service.CreateErrMsgLog(errlog)
  4329. // continue
  4330. // }
  4331. //
  4332. // if res.Infcode != 0 {
  4333. // errlog := &models.HisOrderError{
  4334. // UserOrgId: org_id,
  4335. // Ctime: time.Now().Unix(),
  4336. // Mtime: time.Now().Unix(),
  4337. // ErrMsg: res.ErrMsg,
  4338. // Status: 1,
  4339. // PatientId: order_id,
  4340. // Stage: 200,
  4341. // }
  4342. // service.CreateErrMsgLog(errlog)
  4343. // continue
  4344. // } else {
  4345. // hisFundSettleListResult := &models.HisFundSettleListResult{
  4346. // Number: res.Output.SetlListId,
  4347. // Status: 1,
  4348. // Ctime: time.Now().Unix(),
  4349. // Mtime: time.Now().Unix(),
  4350. // UserOrgId: org_id,
  4351. // IsUpload: 1,
  4352. // OrderId: order_id,
  4353. // }
  4354. // service.CreateUploadRecord(hisFundSettleListResult)
  4355. // continue
  4356. // }
  4357. // }
  4358. //}
  4359. //func CreateLog(miConfig models.MedicalInsuranceOrgConfig) {
  4360. // Mkdir(miConfig.OrgName + "日志")
  4361. // //org_id,_ := beego.AppConfig.Int("org_id")
  4362. // month := time.Unix(1557042972, 0).Format("1")
  4363. // year := time.Now().Format("2006")
  4364. // month = time.Now().Format("01")
  4365. // day := time.Now().Format("02")
  4366. // file := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + year + month + day + "_log"
  4367. // file_name := file + ".txt"
  4368. // file_path := miConfig.OrgName + "日志" + "/" + file_name
  4369. // exist, _ := PathExists(file_path)
  4370. // if exist { //存在
  4371. // fmt.Println("存在")
  4372. // f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  4373. // if err != nil {
  4374. // fmt.Println("read fail")
  4375. // }
  4376. // content := "\r\r\r"
  4377. // n, _ := f.Seek(0, 2)
  4378. // _, err = f.WriteAt([]byte(content), n)
  4379. //
  4380. // } else { //不存在
  4381. // fmt.Println("文件不存在,创建文件")
  4382. // f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
  4383. // defer f.Close()
  4384. // if err != nil {
  4385. // } else {
  4386. // _, err = f.Write([]byte("记录日志"))
  4387. // }
  4388. // }
  4389. //
  4390. //}
  4391. //func UploadLog(miConfig models.MedicalInsuranceOrgConfig) {
  4392. // //获取七牛云上的文件信息,不存在则表示没上传到七牛云,上传昨天日志信息
  4393. // nTime := time.Now()
  4394. // yesTime := nTime.AddDate(0, 0, -1)
  4395. // file_key := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + yesTime.Format("20060102") + "_log.txt"
  4396. // mac := qbox.NewMac(beego.AppConfig.String("qiniu_accesskey"), beego.AppConfig.String("qiniu_secretkey"))
  4397. // cfg := storage.Config{
  4398. // // 是否使用https域名进行资源管理
  4399. // UseHTTPS: true,
  4400. // }
  4401. // // 指定空间所在的区域,如果不指定将自动探测
  4402. // // 如果没有特殊需求,默认不需要指定
  4403. // //cfg.Zone=&storage.ZoneHuabei
  4404. // bucketManager := storage.NewBucketManager(mac, &cfg)
  4405. // bucket := beego.AppConfig.String("qiniu_bucket")
  4406. // key := file_key
  4407. // file, sErr := bucketManager.Stat(bucket, key)
  4408. // fmt.Println(file)
  4409. // fmt.Println(sErr)
  4410. // fmt.Println(miConfig.OrgName + "日志" + "/" + file_key)
  4411. //
  4412. // if sErr != nil {
  4413. // fmt.Println("七牛云上文件不存在,上传到七牛云")
  4414. // //判断本地文件是否存在,存在则执行上传操作
  4415. // exist, _ := PathExists(miConfig.OrgName + "日志" + "/" + file_key)
  4416. // if exist {
  4417. // upload_qiniu(miConfig.OrgName+"日志"+"/"+file_key, file_key)
  4418. // } else {
  4419. // fmt.Println("本地文件不存在")
  4420. //
  4421. // }
  4422. // } else {
  4423. // fmt.Println("七牛云文件存在")
  4424. // }
  4425. //
  4426. //}
  4427. //func Mkdir(dir string) {
  4428. // // 创建文件夹
  4429. // exist, err := PathExists(dir)
  4430. // if err != nil {
  4431. // fmt.Println(err.Error())
  4432. // } else {
  4433. // if exist {
  4434. // fmt.Println(dir + "文件夹已存在!")
  4435. // } else {
  4436. // // 文件夹名称,权限
  4437. // err := os.Mkdir(dir, os.ModePerm)
  4438. // if err != nil {
  4439. // fmt.Println(dir+"文件夹创建失败:", err.Error())
  4440. // } else {
  4441. // fmt.Println(dir + "文件夹创建成功!")
  4442. // }
  4443. // }
  4444. // }
  4445. //}
  4446. //func PathExists(path string) (bool, error) {
  4447. // _, err := os.Stat(path)
  4448. // if err == nil {
  4449. // return true, nil
  4450. // }
  4451. // if os.IsNotExist(err) {
  4452. // return false, nil
  4453. // }
  4454. // return false, err
  4455. //}
  4456. //func upload_qiniu(filePath string, keys string) {
  4457. // key := keys
  4458. // //上传凭证,关于凭证这块大家可以去看看官方文档
  4459. // putPolicy := storage.PutPolicy{
  4460. // Scope: beego.AppConfig.String("qiniu_bucket"),
  4461. // }
  4462. // mac := qbox.NewMac(beego.AppConfig.String("qiniu_accesskey"), beego.AppConfig.String("qiniu_secretkey"))
  4463. // upToken := putPolicy.UploadToken(mac)
  4464. // cfg := storage.Config{}
  4465. // //空间对应机房
  4466. // //其中关于Zone对象和机房的关系如下:
  4467. // // 机房 Zone对象
  4468. // // 华东 storage.ZoneHuadong
  4469. // // 华北 storage.ZoneHuabei
  4470. // // 华南 storage.ZoneHuanan
  4471. // // 北美 storage.ZoneBeimei
  4472. // //七牛云存储空间设置首页有存储区域
  4473. // cfg.Zone = &storage.ZoneHuadong
  4474. // //不启用HTTPS域名
  4475. // cfg.UseHTTPS = false
  4476. // //不使用CND加速
  4477. // cfg.UseCdnDomains = false
  4478. // //构建上传表单对象
  4479. // formUploader := storage.NewFormUploader(&cfg)
  4480. // ret := storage.PutRet{}
  4481. // // 可选
  4482. // putExtra := storage.PutExtra{
  4483. // Params: map[string]string{},
  4484. // }
  4485. // err := formUploader.PutFile(context.Background(), &ret, upToken, key, filePath, &putExtra)
  4486. // if err != nil {
  4487. // fmt.Println(err)
  4488. // return
  4489. // }
  4490. // fmt.Println(ret.Key, ret.Hash)
  4491. //}