main.go 209KB

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