main.go 72KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755
  1. package main
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. _ "gdyb/routers"
  8. "gdyb/service"
  9. "github.com/shopspring/decimal"
  10. "io/ioutil"
  11. "net/http"
  12. "strconv"
  13. "strings"
  14. "time"
  15. "github.com/astaxie/beego"
  16. //"github.com/qiniu/api.v7/auth/qbox"
  17. //"github.com/qiniu/api.v7/storage"
  18. //"github.com/qiniu/roapi.v7/auth/qbox"
  19. //"github.com/qiniu/api.v7/storage"
  20. //"strconv"
  21. //"time"
  22. )
  23. func init() {
  24. service.ConnectDB()
  25. org_id, _ := beego.AppConfig.Int64("org_id")
  26. miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  27. //CreateLog(miConfig)
  28. //UploadLog(miConfig)
  29. if org_id == 10191 {
  30. service.GetFjAuthorizationInfo(miConfig.Code)
  31. }
  32. }
  33. func main() {
  34. //service.AutoCreateStock()
  35. //service.AutoUploadData
  36. //GetBatchSettleList()
  37. beego.Run()
  38. }
  39. type CustomFundPay struct {
  40. FundPayType string `json:"fund_pay_type"`
  41. FundPayamt float64 `json:"fund_payamt"`
  42. }
  43. type ResultSeventeen struct {
  44. ErrMsg string `json:"err_msg"`
  45. InfRefmsgid string `json:"inf_refmsgid"`
  46. Infcode int64 `json:"infcode"`
  47. Output struct {
  48. SetlListId string `json:"setl_list_id"`
  49. } `json:"output"`
  50. RefmsgTime string `json:"refmsg_time"`
  51. RespondTime string `json:"respond_time"`
  52. Signtype string `json:"signtype"`
  53. WarnInfo string `json:"warn_info"`
  54. }
  55. func GetBatchSettleList() {
  56. org_id, _ := beego.AppConfig.Int64("org_id")
  57. list, _ := service.GetLastFundList(org_id)
  58. order, _ := service.GetHisOrderByID(list.OrderId)
  59. var orders []*models.HisOrder
  60. if order.ID > 0 {
  61. orders, _ = service.GetAllHisOrderTwo(org_id, order.ID)
  62. } else {
  63. orders, _ = service.GetAllHisOrder(org_id)
  64. }
  65. for _, item := range orders {
  66. order_id := item.ID
  67. order, _ := service.GetHisOrderByIDTwo(order_id)
  68. roles, _ := service.GetDoctorListTwo(org_id)
  69. his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  70. admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  71. curRoles, _ := service.GetAdminUserInfoByID(org_id, 2495)
  72. depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  73. miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  74. pre, _ := service.GetNewHisPrescriptionByNumber(order.Number)
  75. doctor, _ := service.GetAdminUserInfoByID(org_id, pre.Creator)
  76. if order.ID == 0 {
  77. return
  78. }
  79. if his.BalanceAccountsType == 2 {
  80. continue
  81. }
  82. struct4101 := service.Struct4101{
  83. PsnNo: order.PsnNo,
  84. MdtrtId: order.MdtrtId,
  85. SetlId: order.SetlId,
  86. PsnName: order.PsnName,
  87. Gend: order.Gend,
  88. Brdy: his.Brdy,
  89. Age: his.Age,
  90. Naty: order.Naty,
  91. PatnCertType: "01",
  92. Certno: order.Certno,
  93. Prfs: "90",
  94. ConerName: roles[0].UserName,
  95. PatnRlts: "99",
  96. ConerAddr: miConfig.OrgName,
  97. ConerTel: admin.Mobile,
  98. HiType: order.Insutype,
  99. Insuplc: his.InsuplcAdmdvs,
  100. MaindiagFlag: "1",
  101. BillCode: order.SetlId,
  102. BillNo: order.SetlId,
  103. BizSn: order.Number,
  104. PsnSelfPay: order.PsnPartAmt,
  105. PsnOwnPay: order.PsnPartAmt,
  106. AcctPay: order.AcctPay,
  107. PsnCashpay: order.PsnCashPay,
  108. HiPaymtd: "1",
  109. Hsorg: his.InsuplcAdmdvs,
  110. HsorgOpter: his.InsuplcAdmdvs,
  111. MedinsFillPsn: curRoles.UserName,
  112. MedinsFillDept: depart.Name,
  113. IptMedType: "2",
  114. }
  115. struct4101.SetlBegnDate = order.SetlTime
  116. struct4101.SetlEndDate = order.SetlTime
  117. //if order.SettleType == 1 {
  118. // t := time.Unix(int64(order.SettleAccountsDate), 0)
  119. // dateStr := t.Format("2006-01-02")
  120. // struct4101.SetlBegnDate = dateStr
  121. // struct4101.SetlEndDate = dateStr
  122. //} else {
  123. // t := time.Unix(int64(order.SettleStartTime), 0)
  124. // t2 := time.Unix(int64(order.SettleEndTime), 0)
  125. // dateStartStr := t.Format("2006-01-02")
  126. // dateEndStr := t2.Format("2006-01-02")
  127. // struct4101.SetlBegnDate = dateStartStr
  128. // struct4101.SetlEndDate = dateEndStr
  129. //}
  130. var rf []CustomFundPay
  131. json.Unmarshal([]byte(order.SetlDetail), &rf)
  132. var tempFunPays []service.CustomStruct
  133. var tempFunPay610100 service.CustomStruct
  134. for _, item := range rf {
  135. if item.FundPayType == "610100" {
  136. tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  137. tempFunPay610100.FundPayType = item.FundPayType
  138. } else {
  139. var tempFunPay service.CustomStruct
  140. tempFunPay.FundPayamt = item.FundPayamt
  141. tempFunPay.FundPayType = item.FundPayType
  142. tempFunPays = append(tempFunPays, tempFunPay)
  143. }
  144. }
  145. tempFunPays = append(tempFunPays, tempFunPay610100)
  146. struct4101.CustomStruct = tempFunPays
  147. var tempDiaginfos []service.DiaginfoStructTwo
  148. var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  149. var tempOpspdiseinfos []service.OpspdiseinfoStruct
  150. diagnosis_ids := strings.Split(his.Diagnosis, ",")
  151. var config []*models.HisXtDiagnoseConfig
  152. for _, item := range diagnosis_ids {
  153. id, _ := strconv.ParseInt(item, 10, 64)
  154. diagnosisConfig, _ := service.FindDiagnoseById(id)
  155. config = append(config, &diagnosisConfig)
  156. }
  157. for index, item := range config {
  158. if index == 0 {
  159. var tempDiaginfo service.DiaginfoStructTwo
  160. tempDiaginfo.DiagCode = item.CountryCode
  161. tempDiaginfo.DiagName = item.CountryContentName
  162. tempDiaginfo.DiagType = "1"
  163. tempDiaginfo.MaindiagFlag = "1"
  164. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  165. } else {
  166. var tempDiaginfo service.DiaginfoStructTwo
  167. tempDiaginfo.DiagCode = item.CountryCode
  168. tempDiaginfo.DiagName = item.CountryContentName
  169. tempDiaginfo.DiagType = "2"
  170. tempDiaginfo.MaindiagFlag = "0"
  171. tempDiaginfos = append(tempDiaginfos, tempDiaginfo)
  172. }
  173. }
  174. struct4101.Diseinfo = tempDiaginfos
  175. sickConfigTwo, _ := service.FindSickById(his.SickType)
  176. tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  177. tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  178. tempOpspdiseinfo2.OprnOprtCode = ""
  179. tempOpspdiseinfo2.OprnOprtName = ""
  180. tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  181. struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  182. var iteminfo service.IteminfoStruct
  183. var bedCostTotal float64 = 0 //床位总费
  184. var bedCostSelfTotal float64 = 0 //床位自费
  185. var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  186. var examineCostTotal float64 = 0 //诊查总费
  187. var examineCostSelfTotal float64 = 0 //诊查自费
  188. var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  189. var nursingCostTotal float64 = 0 //护理总费
  190. var nursingCostSelfTotal float64 = 0 //护理自费
  191. var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  192. var chineseMedicineCostTotal float64 = 0 //中成药
  193. var chineseMedicineCostSelfTotal float64 = 0 //中成药
  194. var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  195. var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  196. var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  197. var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  198. var registerCostTotal float64 = 0 //一般诊疗费
  199. var registerCostSelfTotal float64 = 0 //一般诊疗费
  200. var registerPartSelfTotal float64 = 0 //一般诊疗费
  201. var operationCostTotal float64 = 0 //手术费
  202. var operationCostSelfTotal float64 = 0 //手术费
  203. var operationCostPartSelfTotal float64 = 0 //手术费
  204. var otherCostTotal float64 = 0 //其他费用
  205. var otherCostSelfTotal float64 = 0 //其他费用
  206. var otherCostPartSelfTotal float64 = 0 //其他费用
  207. var materialCostTotal float64 = 0 //材料费
  208. var materialCostSelfTotal float64 = 0 //材料费
  209. var materialCostPartSelfTotal float64 = 0 //材料费
  210. var westernMedicineCostTotal float64 = 0 //西药费
  211. var westernMedicineCostSelfTotal float64 = 0 //西药费
  212. var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  213. var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  214. var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  215. var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  216. var checkCostTotal float64 = 0 //检查费
  217. var checkCostSelfTotal float64 = 0 //检查费
  218. var checkCostPartSelfTotal float64 = 0 //检查费
  219. var laboratoryCostTotal float64 = 0 //化验费
  220. var laboratoryCostSelfTotal float64 = 0 //化验费
  221. var laboratoryCostPartSelfTotal float64 = 0 //化验费
  222. var treatCostTotal float64 = 0 //治疗费用
  223. var treatCostSelfTotal float64 = 0 //治疗费用
  224. var treatCostPartSelfTotal float64 = 0 //治疗费用
  225. decimal.DivisionPrecision = 2
  226. var bed_fulamt_ownpay_amt float64 = 0
  227. var examine_fulamt_ownpay_amt float64 = 0
  228. var nursing_fulamt_ownpay_amt float64 = 0
  229. var chinese_medicine_fulamt_ownpay_amt float64 = 0
  230. var commonly_treatment_fulamt_ownpay_amt float64 = 0
  231. var register_fulamt_ownpay_amt float64 = 0
  232. var operation_fulamt_ownpay_amt float64 = 0
  233. var other_fulamt_ownpay_amt float64 = 0
  234. var westernMedicine_fulamt_ownpay_amt float64 = 0
  235. var chineseTraditional_fulamt_ownpay_amt float64 = 0
  236. var check_fulamt_ownpay_amt float64 = 0
  237. var material_fulamt_ownpay_amt float64 = 0
  238. var laboratory_fulamt_ownpay_amt float64 = 0
  239. var treat_fulamt_ownpay_amt float64 = 0
  240. var bed_claa_sunmfee float64 = 0
  241. var bed_clab_amt float64 = 0
  242. var bed_other_amt float64 = 0
  243. var examine_claa_sunmfee float64 = 0
  244. var examine_clab_amt float64 = 0
  245. var examine_other_amt float64 = 0
  246. var nursing_claa_sunmfee float64 = 0
  247. var nursing_clab_amt float64 = 0
  248. var nursing_other_amt float64 = 0
  249. var chinese_medicine_claa_sunmfee float64 = 0
  250. var chinese_medicine_clab_amt float64 = 0
  251. var chinese_medicine_other_amt float64 = 0
  252. var commonly_treatment_claa_sunmfee float64 = 0
  253. var commonly_treatment_clab_amt float64 = 0
  254. var commonly_treatment_other_amt float64 = 0
  255. var operation_claa_sunmfee float64 = 0
  256. var operation_clab_amt float64 = 0
  257. var operation_other_amt float64 = 0
  258. var other_claa_sunmfee float64 = 0
  259. var other_clab_amt float64 = 0
  260. var other_other_amt float64 = 0
  261. var westernMedicine_claa_sunmfee float64 = 0
  262. var westernMedicine_clab_amt float64 = 0
  263. var westernMedicine_other_amt float64 = 0
  264. var chineseTraditional_claa_sunmfee float64 = 0
  265. var chineseTraditional_clab_amt float64 = 0
  266. var chineseTraditional_other_amt float64 = 0
  267. var check_claa_sunmfee float64 = 0
  268. var check_clab_amt float64 = 0
  269. var check_other_amt float64 = 0
  270. var material_claa_sunmfee float64 = 0
  271. var material_clab_amt float64 = 0
  272. var material_other_amt float64 = 0
  273. var laboratory_claa_sunmfee float64 = 0
  274. var laboratory_clab_amt float64 = 0
  275. var laboratory_other_amt float64 = 0
  276. var treat_claa_sunmfee float64 = 0
  277. var treat_clab_amt float64 = 0
  278. var treat_other_amt float64 = 0
  279. var register_claa_sunmfee float64 = 0
  280. var register_clab_amt float64 = 0
  281. var register_other_amt float64 = 0
  282. for _, item := range order.HisOrderInfo {
  283. if item.MedChrgitmType == "01" { //床位费
  284. bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  285. bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  286. bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  287. bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  288. if item.ChrgitmLv == "1" {
  289. bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  290. }
  291. if item.ChrgitmLv == "2" {
  292. bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  293. }
  294. if item.ChrgitmLv == "3" {
  295. bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  296. }
  297. }
  298. if item.MedChrgitmType == "02" { //诊查
  299. examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  300. examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  301. examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  302. examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  303. if item.ChrgitmLv == "1" {
  304. examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  305. }
  306. if item.ChrgitmLv == "2" {
  307. examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  308. }
  309. if item.ChrgitmLv == "3" {
  310. examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  311. }
  312. }
  313. if item.MedChrgitmType == "03" { //检查费
  314. checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  315. checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  316. checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  317. check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  318. if item.ChrgitmLv == "1" {
  319. check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  320. }
  321. if item.ChrgitmLv == "2" {
  322. check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  323. }
  324. if item.ChrgitmLv == "3" {
  325. check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  326. }
  327. }
  328. if item.MedChrgitmType == "04" { //化验费
  329. laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  330. laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  331. laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  332. laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  333. if item.ChrgitmLv == "1" {
  334. laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  335. }
  336. if item.ChrgitmLv == "2" {
  337. laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  338. }
  339. if item.ChrgitmLv == "3" {
  340. laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  341. }
  342. }
  343. if item.MedChrgitmType == "05" { //治疗费
  344. treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  345. treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  346. treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  347. treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  348. if item.ChrgitmLv == "1" {
  349. treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  350. }
  351. if item.ChrgitmLv == "2" {
  352. treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  353. }
  354. if item.ChrgitmLv == "3" {
  355. treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  356. }
  357. }
  358. if item.MedChrgitmType == "06" { //手术费
  359. operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  360. operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  361. operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  362. operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  363. if item.ChrgitmLv == "1" {
  364. operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  365. }
  366. if item.ChrgitmLv == "2" {
  367. operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  368. }
  369. if item.ChrgitmLv == "3" {
  370. operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  371. }
  372. }
  373. if item.MedChrgitmType == "07" { //手术费
  374. nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  375. nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  376. nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  377. nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  378. if item.ChrgitmLv == "1" {
  379. nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  380. }
  381. if item.ChrgitmLv == "2" {
  382. nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  383. }
  384. if item.ChrgitmLv == "3" {
  385. nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  386. }
  387. }
  388. if item.MedChrgitmType == "08" { //材料费
  389. materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  390. materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  391. materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  392. material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  393. if item.ChrgitmLv == "1" {
  394. material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  395. }
  396. if item.ChrgitmLv == "2" {
  397. material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  398. }
  399. if item.ChrgitmLv == "3" {
  400. material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  401. }
  402. }
  403. if item.MedChrgitmType == "09" { //西药费
  404. westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  405. westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  406. westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  407. westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  408. if item.ChrgitmLv == "1" {
  409. westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  410. }
  411. if item.ChrgitmLv == "2" {
  412. westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  413. }
  414. if item.ChrgitmLv == "3" {
  415. westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  416. }
  417. }
  418. if item.MedChrgitmType == "10" { //中药饮片
  419. chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  420. chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  421. chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  422. chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  423. if item.ChrgitmLv == "1" {
  424. chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  425. }
  426. if item.ChrgitmLv == "2" {
  427. chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  428. }
  429. if item.ChrgitmLv == "3" {
  430. chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  431. }
  432. }
  433. if item.MedChrgitmType == "11" { //中成费
  434. chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  435. chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  436. chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  437. chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  438. if item.ChrgitmLv == "1" {
  439. chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  440. }
  441. if item.ChrgitmLv == "2" {
  442. chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  443. }
  444. if item.ChrgitmLv == "3" {
  445. chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  446. }
  447. }
  448. if item.MedChrgitmType == "12" { //中成费
  449. commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  450. commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  451. commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  452. commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  453. if item.ChrgitmLv == "1" {
  454. commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  455. }
  456. if item.ChrgitmLv == "2" {
  457. commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  458. }
  459. if item.ChrgitmLv == "3" {
  460. commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  461. }
  462. }
  463. if item.MedChrgitmType == "13" { //中成费
  464. registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  465. registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  466. registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  467. register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  468. if item.ChrgitmLv == "1" {
  469. register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  470. }
  471. if item.ChrgitmLv == "2" {
  472. register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  473. }
  474. if item.ChrgitmLv == "3" {
  475. register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  476. }
  477. }
  478. if item.MedChrgitmType == "14" { //其他费
  479. otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  480. otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  481. otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  482. other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  483. if item.ChrgitmLv == "1" {
  484. other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  485. }
  486. if item.ChrgitmLv == "2" {
  487. other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  488. }
  489. if item.ChrgitmLv == "3" {
  490. other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  491. }
  492. }
  493. }
  494. var iteminfoStructs []service.IteminfoStruct
  495. if bedCostTotal != 0 {
  496. iteminfo.MedChrgitm = "01"
  497. iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  498. iteminfo.Amt = bedCostTotal
  499. iteminfo.ClaaSumfee = bed_claa_sunmfee
  500. iteminfo.ClabAmt = bed_clab_amt
  501. iteminfo.OthAmt = bed_other_amt
  502. iteminfoStructs = append(iteminfoStructs, iteminfo)
  503. }
  504. if examineCostTotal != 0 {
  505. iteminfo.MedChrgitm = "02"
  506. iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  507. iteminfo.Amt = examineCostTotal
  508. iteminfo.ClaaSumfee = examine_claa_sunmfee
  509. iteminfo.ClabAmt = examine_clab_amt
  510. iteminfo.OthAmt = examine_other_amt
  511. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  512. iteminfoStructs = append(iteminfoStructs, iteminfo)
  513. }
  514. if checkCostTotal != 0 {
  515. iteminfo.MedChrgitm = "03"
  516. iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  517. iteminfo.Amt = checkCostTotal
  518. iteminfo.ClaaSumfee = check_claa_sunmfee
  519. iteminfo.ClabAmt = check_clab_amt
  520. iteminfo.OthAmt = check_other_amt
  521. iteminfoStructs = append(iteminfoStructs, iteminfo)
  522. }
  523. if laboratoryCostTotal != 0 {
  524. iteminfo.MedChrgitm = "04"
  525. iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  526. iteminfo.Amt = laboratoryCostTotal
  527. iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  528. iteminfo.ClabAmt = laboratory_clab_amt
  529. iteminfo.OthAmt = laboratory_other_amt
  530. iteminfoStructs = append(iteminfoStructs, iteminfo)
  531. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  532. }
  533. if treatCostTotal != 0 {
  534. iteminfo.MedChrgitm = "05"
  535. iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  536. iteminfo.Amt = treatCostTotal
  537. iteminfo.ClaaSumfee = treat_claa_sunmfee
  538. iteminfo.ClabAmt = treat_clab_amt
  539. iteminfo.OthAmt = treat_other_amt
  540. iteminfoStructs = append(iteminfoStructs, iteminfo)
  541. //(struct4101.IteminfoStruct, iteminfo)
  542. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  543. }
  544. if operationCostTotal != 0 {
  545. iteminfo.MedChrgitm = "06"
  546. iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  547. iteminfo.Amt = operationCostTotal
  548. iteminfo.ClaaSumfee = operation_claa_sunmfee
  549. iteminfo.ClabAmt = operation_clab_amt
  550. iteminfo.OthAmt = operation_other_amt
  551. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  552. iteminfoStructs = append(iteminfoStructs, iteminfo)
  553. }
  554. if nursingCostTotal != 0 {
  555. iteminfo.MedChrgitm = "07"
  556. iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  557. iteminfo.Amt = nursingCostTotal
  558. iteminfo.ClaaSumfee = nursing_claa_sunmfee
  559. iteminfo.ClabAmt = nursing_clab_amt
  560. iteminfo.OthAmt = nursing_other_amt
  561. iteminfoStructs = append(iteminfoStructs, iteminfo)
  562. }
  563. if materialCostTotal != 0 {
  564. iteminfo.MedChrgitm = "08"
  565. iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  566. iteminfo.Amt = materialCostTotal
  567. iteminfo.ClaaSumfee = material_claa_sunmfee
  568. iteminfo.ClabAmt = material_clab_amt
  569. iteminfo.OthAmt = material_other_amt
  570. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  571. iteminfoStructs = append(iteminfoStructs, iteminfo)
  572. }
  573. if westernMedicineCostTotal != 0 {
  574. iteminfo.MedChrgitm = "09"
  575. iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  576. iteminfo.Amt = westernMedicineCostTotal
  577. iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  578. iteminfo.ClabAmt = westernMedicine_clab_amt
  579. iteminfo.OthAmt = westernMedicine_other_amt
  580. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  581. iteminfoStructs = append(iteminfoStructs, iteminfo)
  582. }
  583. if chineseMedicineCostTotal != 0 {
  584. iteminfo.MedChrgitm = "10"
  585. iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  586. iteminfo.Amt = chineseMedicineCostTotal
  587. iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  588. iteminfo.ClabAmt = chinese_medicine_clab_amt
  589. iteminfo.OthAmt = chinese_medicine_other_amt
  590. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  591. iteminfoStructs = append(iteminfoStructs, iteminfo)
  592. }
  593. if chineseTraditionalMedicineCostTotal != 0 {
  594. iteminfo.MedChrgitm = "11"
  595. iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  596. iteminfo.Amt = westernMedicineCostTotal
  597. iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  598. iteminfo.ClabAmt = westernMedicine_clab_amt
  599. iteminfo.OthAmt = westernMedicine_other_amt
  600. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  601. iteminfoStructs = append(iteminfoStructs, iteminfo)
  602. }
  603. if commonlyTreatmentCostTotal != 0 {
  604. iteminfo.MedChrgitm = "12"
  605. iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  606. iteminfo.Amt = commonlyTreatmentCostTotal
  607. iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  608. iteminfo.ClabAmt = commonly_treatment_clab_amt
  609. iteminfo.OthAmt = commonly_treatment_other_amt
  610. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  611. iteminfoStructs = append(iteminfoStructs, iteminfo)
  612. }
  613. if registerCostTotal != 0 {
  614. iteminfo.MedChrgitm = "13"
  615. iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  616. iteminfo.Amt = registerCostTotal
  617. iteminfo.ClaaSumfee = register_claa_sunmfee
  618. iteminfo.ClabAmt = register_clab_amt
  619. iteminfo.OthAmt = register_other_amt
  620. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  621. iteminfoStructs = append(iteminfoStructs, iteminfo)
  622. }
  623. if otherCostTotal != 0 {
  624. iteminfo.MedChrgitm = "14"
  625. iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  626. iteminfo.Amt = otherCostTotal
  627. iteminfo.ClaaSumfee = other_claa_sunmfee
  628. iteminfo.ClabAmt = other_clab_amt
  629. iteminfo.OthAmt = other_other_amt
  630. //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  631. iteminfoStructs = append(iteminfoStructs, iteminfo)
  632. }
  633. struct4101.IteminfoStruct = iteminfoStructs
  634. time_arr := strings.Split(order.SetlTime, " ")
  635. struct4101.AdmTime = time_arr[0]
  636. struct4101.AdmEndTime = time_arr[0]
  637. struct4101.DoctorName = doctor.UserName
  638. struct4101.DoctorCode = doctor.DoctorNumber
  639. struct4101.Ntly = "中国"
  640. struct4101.AdmCaty = "A03.06"
  641. var res ResultSeventeen
  642. if miConfig.MdtrtareaAdmvs == "421300" {
  643. data := make(map[string]interface{})
  644. data["struct4101"] = struct4101
  645. data["secret_key"] = miConfig.SecretKey
  646. data["org_name"] = miConfig.OrgName
  647. data["opera"] = curRoles.UserName
  648. data["code"] = miConfig.Code
  649. data["insuplc_admdvs"] = miConfig.InsuplcAdmdvs
  650. data["mdtrtarea_admvs"] = miConfig.MdtrtareaAdmvs
  651. client := &http.Client{}
  652. bytesData, _ := json.Marshal(data)
  653. req, _ := http.NewRequest("POST", "http://192.168.124.4:9532/"+"hbyb/4101", bytes.NewReader(bytesData))
  654. resp, _ := client.Do(req)
  655. defer resp.Body.Close()
  656. body, ioErr := ioutil.ReadAll(resp.Body)
  657. if ioErr != nil {
  658. //utils.ErrorLog("接口返回数据读取失败: %v", ioErr)
  659. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  660. return
  661. }
  662. var respJSON map[string]interface{}
  663. if err := json.Unmarshal([]byte(body), &respJSON); err != nil {
  664. //utils.ErrorLog("接口返回数据解析JSON失败: %v", err)
  665. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  666. return
  667. }
  668. respJSON = respJSON["data"].(map[string]interface{})["pre"].(map[string]interface{})
  669. userJSONBytes, _ := json.Marshal(respJSON)
  670. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  671. //utils.ErrorLog("解析失败:%v", err)
  672. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  673. errlog := &models.HisOrderError{
  674. UserOrgId: org_id,
  675. Ctime: time.Now().Unix(),
  676. Mtime: time.Now().Unix(),
  677. ErrMsg: res.ErrMsg + "解析失败",
  678. Status: 1,
  679. PatientId: order_id,
  680. Stage: 10088,
  681. }
  682. service.CreateErrMsgLog(errlog)
  683. continue
  684. }
  685. } else {
  686. result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  687. fmt.Println(result)
  688. var dat map[string]interface{}
  689. if err := json.Unmarshal([]byte(result), &dat); err == nil {
  690. fmt.Println(dat)
  691. } else {
  692. fmt.Println(err)
  693. }
  694. userJSONBytes, _ := json.Marshal(dat)
  695. if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  696. //utils.ErrorLog("解析失败:%v", err)
  697. //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  698. //adminUser := c.GetAdminUserInfo()
  699. errlog := &models.HisOrderError{
  700. UserOrgId: org_id,
  701. Ctime: time.Now().Unix(),
  702. Mtime: time.Now().Unix(),
  703. ErrMsg: res.ErrMsg + "解析失败",
  704. Status: 1,
  705. PatientId: order_id,
  706. Stage: 10106,
  707. }
  708. service.CreateErrMsgLog(errlog)
  709. continue
  710. }
  711. }
  712. if res.Infcode != 0 {
  713. //adminUser := c.GetAdminUserInfo()
  714. errlog := &models.HisOrderError{
  715. UserOrgId: org_id,
  716. Ctime: time.Now().Unix(),
  717. Mtime: time.Now().Unix(),
  718. ErrMsg: res.ErrMsg,
  719. Status: 1,
  720. PatientId: order_id,
  721. Stage: 10106,
  722. }
  723. service.CreateErrMsgLog(errlog)
  724. continue
  725. } else {
  726. hisFundSettleListResult := &models.HisFundSettleListResult{
  727. Number: res.Output.SetlListId,
  728. Status: 1,
  729. Ctime: time.Now().Unix(),
  730. Mtime: time.Now().Unix(),
  731. UserOrgId: org_id,
  732. IsUpload: 1,
  733. OrderId: order_id,
  734. }
  735. service.CreateUploadRecord(hisFundSettleListResult)
  736. continue
  737. }
  738. }
  739. }
  740. //func UploadSettleList(org_id int64) {
  741. // orders, _ := service.GetAllHisOrder(org_id)
  742. // for _, item := range orders {
  743. // order_id := item.ID
  744. // order, _ := service.GetHisOrderByIDTwo(order_id)
  745. // roles, _ := service.GetDoctorListTwo(org_id)
  746. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  747. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  748. // curRoles, _ := service.GetAdminUserInfo(org_id)
  749. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  750. // miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  751. //
  752. // result, _ := service.GetHisFundSettleListResult(order_id)
  753. // //判断是否已经上传过医保,上传过就跳过该条记录
  754. // if result.ID > 0 {
  755. // continue
  756. // }
  757. //
  758. // if his.BalanceAccountsType == 2 {
  759. // continue
  760. // }
  761. //
  762. // struct4101 := service.Struct4101{
  763. // PsnNo: order.PsnNo,
  764. // MdtrtId: order.MdtrtId,
  765. // SetlId: order.SetlId,
  766. // PsnName: order.PsnName,
  767. // Gend: order.Gend,
  768. // Brdy: his.Brdy,
  769. // Age: his.Age,
  770. // Naty: order.Naty,
  771. // PatnCertType: "01",
  772. // Certno: order.Certno,
  773. // Prfs: "90",
  774. // ConerName: roles[0].UserName,
  775. // PatnRlts: "99",
  776. // ConerAddr: miConfig.OrgName,
  777. // ConerTel: admin.Mobile,
  778. // HiType: order.Insutype,
  779. // Insuplc: his.InsuplcAdmdvs,
  780. // MaindiagFlag: "1",
  781. // BillCode: order.FaPiaoCode,
  782. // BillNo: order.FaPiaoNumber,
  783. // BizSn: order.Number,
  784. // PsnSelfPay: order.PsnPartAmt,
  785. // PsnOwnPay: order.PsnPartAmt,
  786. // AcctPay: order.AcctPay,
  787. // PsnCashpay: order.PsnCashPay,
  788. // HiPaymtd: "1",
  789. // Hsorg: his.InsuplcAdmdvs,
  790. // HsorgOpter: his.InsuplcAdmdvs,
  791. // MedinsFillPsn: curRoles.UserName,
  792. // MedinsFillDept: depart.Name,
  793. // IptMedType: "2",
  794. // }
  795. // struct4101.SetlBegnDate = order.SetlTime
  796. // struct4101.SetlEndDate = order.SetlTime
  797. // //if order.SettleType == 1 {
  798. // // t := time.Unix(int64(order.SettleAccountsDate), 0)
  799. // // dateStr := t.Format("2006-01-02")
  800. // // struct4101.SetlBegnDate = dateStr
  801. // // struct4101.SetlEndDate = dateStr
  802. // //} else {
  803. // // t := time.Unix(int64(order.SettleStartTime), 0)
  804. // // t2 := time.Unix(int64(order.SettleEndTime), 0)
  805. // // dateStartStr := t.Format("2006-01-02")
  806. // // dateEndStr := t2.Format("2006-01-02")
  807. // // struct4101.SetlBegnDate = dateStartStr
  808. // // struct4101.SetlEndDate = dateEndStr
  809. // //}
  810. //
  811. // var rf []CustomFundPay
  812. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  813. //
  814. // var tempFunPays []service.CustomStruct
  815. // var tempFunPay610100 service.CustomStruct
  816. //
  817. // for _, item := range rf {
  818. // if item.FundPayType == "610100" {
  819. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  820. // tempFunPay610100.FundPayType = item.FundPayType
  821. // } else {
  822. // var tempFunPay service.CustomStruct
  823. // tempFunPay.FundPayamt = item.FundPayamt
  824. // tempFunPay.FundPayType = item.FundPayType
  825. // tempFunPays = append(tempFunPays, tempFunPay)
  826. // }
  827. // }
  828. // tempFunPays = append(tempFunPays, tempFunPay610100)
  829. // struct4101.CustomStruct = tempFunPays
  830. //
  831. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  832. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  833. // //sickConfig, _ := service.FindDiagnoseById(his.Diagnosis)
  834. //
  835. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  836. // var config []*models.HisXtDiagnoseConfig
  837. // for _, item := range diagnosis_ids {
  838. // id, _ := strconv.ParseInt(item, 10, 64)
  839. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  840. // config = append(config, &diagnosisConfig)
  841. // }
  842. //
  843. // for _, item := range config {
  844. // var tempOpspdiseinfo service.OpspdiseinfoStruct
  845. // tempOpspdiseinfo.DiagCode = item.CountryCode
  846. // tempOpspdiseinfo.DiagName = item.CountryContentName
  847. // tempOpspdiseinfo.MaindiagFlag = "1"
  848. // tempOpspdiseinfo.OprnOprtCode = ""
  849. // tempOpspdiseinfo.OprnOprtName = ""
  850. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo)
  851. // }
  852. //
  853. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  854. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  855. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  856. // tempOpspdiseinfo2.MaindiagFlag = "2"
  857. // tempOpspdiseinfo2.OprnOprtCode = ""
  858. // tempOpspdiseinfo2.OprnOprtName = ""
  859. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  860. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  861. //
  862. // var iteminfo service.IteminfoStruct
  863. //
  864. // var bedCostTotal float64 = 0 //床位总费
  865. // var bedCostSelfTotal float64 = 0 //床位自费
  866. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  867. //
  868. // var examineCostTotal float64 = 0 //诊查总费
  869. // var examineCostSelfTotal float64 = 0 //诊查自费
  870. // var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  871. //
  872. // var nursingCostTotal float64 = 0 //护理总费
  873. // var nursingCostSelfTotal float64 = 0 //护理自费
  874. // var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  875. //
  876. // var chineseMedicineCostTotal float64 = 0 //中成药
  877. // var chineseMedicineCostSelfTotal float64 = 0 //中成药
  878. // var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  879. //
  880. // var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  881. // var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  882. // var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  883. //
  884. // var registerCostTotal float64 = 0 //一般诊疗费
  885. // var registerCostSelfTotal float64 = 0 //一般诊疗费
  886. // var registerPartSelfTotal float64 = 0 //一般诊疗费
  887. //
  888. // var operationCostTotal float64 = 0 //手术费
  889. // var operationCostSelfTotal float64 = 0 //手术费
  890. // var operationCostPartSelfTotal float64 = 0 //手术费
  891. //
  892. // var otherCostTotal float64 = 0 //其他费用
  893. // var otherCostSelfTotal float64 = 0 //其他费用
  894. // var otherCostPartSelfTotal float64 = 0 //其他费用
  895. //
  896. // var materialCostTotal float64 = 0 //材料费
  897. // var materialCostSelfTotal float64 = 0 //材料费
  898. // var materialCostPartSelfTotal float64 = 0 //材料费
  899. //
  900. // var westernMedicineCostTotal float64 = 0 //西药费
  901. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  902. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  903. //
  904. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  905. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  906. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  907. //
  908. // var checkCostTotal float64 = 0 //检查费
  909. // var checkCostSelfTotal float64 = 0 //检查费
  910. // var checkCostPartSelfTotal float64 = 0 //检查费
  911. //
  912. // var laboratoryCostTotal float64 = 0 //化验费
  913. // var laboratoryCostSelfTotal float64 = 0 //化验费
  914. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  915. //
  916. // var treatCostTotal float64 = 0 //治疗费用
  917. // var treatCostSelfTotal float64 = 0 //治疗费用
  918. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  919. //
  920. // decimal.DivisionPrecision = 2
  921. //
  922. // var bed_fulamt_ownpay_amt float64 = 0
  923. //
  924. // var examine_fulamt_ownpay_amt float64 = 0
  925. //
  926. // var nursing_fulamt_ownpay_amt float64 = 0
  927. //
  928. // var chinese_medicine_fulamt_ownpay_amt float64 = 0
  929. //
  930. // var commonly_treatment_fulamt_ownpay_amt float64 = 0
  931. //
  932. // var register_fulamt_ownpay_amt float64 = 0
  933. //
  934. // var operation_fulamt_ownpay_amt float64 = 0
  935. // var other_fulamt_ownpay_amt float64 = 0
  936. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  937. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  938. // var check_fulamt_ownpay_amt float64 = 0
  939. // var material_fulamt_ownpay_amt float64 = 0
  940. // var laboratory_fulamt_ownpay_amt float64 = 0
  941. // var treat_fulamt_ownpay_amt float64 = 0
  942. //
  943. // var bed_claa_sunmfee float64 = 0
  944. // var bed_clab_amt float64 = 0
  945. // var bed_other_amt float64 = 0
  946. //
  947. // var examine_claa_sunmfee float64 = 0
  948. // var examine_clab_amt float64 = 0
  949. // var examine_other_amt float64 = 0
  950. //
  951. // var nursing_claa_sunmfee float64 = 0
  952. // var nursing_clab_amt float64 = 0
  953. // var nursing_other_amt float64 = 0
  954. //
  955. // var chinese_medicine_claa_sunmfee float64 = 0
  956. // var chinese_medicine_clab_amt float64 = 0
  957. // var chinese_medicine_other_amt float64 = 0
  958. //
  959. // var commonly_treatment_claa_sunmfee float64 = 0
  960. // var commonly_treatment_clab_amt float64 = 0
  961. // var commonly_treatment_other_amt float64 = 0
  962. //
  963. // var operation_claa_sunmfee float64 = 0
  964. // var operation_clab_amt float64 = 0
  965. // var operation_other_amt float64 = 0
  966. //
  967. // var other_claa_sunmfee float64 = 0
  968. // var other_clab_amt float64 = 0
  969. // var other_other_amt float64 = 0
  970. //
  971. // var westernMedicine_claa_sunmfee float64 = 0
  972. // var westernMedicine_clab_amt float64 = 0
  973. // var westernMedicine_other_amt float64 = 0
  974. //
  975. // var chineseTraditional_claa_sunmfee float64 = 0
  976. // var chineseTraditional_clab_amt float64 = 0
  977. // var chineseTraditional_other_amt float64 = 0
  978. //
  979. // var check_claa_sunmfee float64 = 0
  980. // var check_clab_amt float64 = 0
  981. // var check_other_amt float64 = 0
  982. //
  983. // var material_claa_sunmfee float64 = 0
  984. // var material_clab_amt float64 = 0
  985. // var material_other_amt float64 = 0
  986. //
  987. // var laboratory_claa_sunmfee float64 = 0
  988. // var laboratory_clab_amt float64 = 0
  989. // var laboratory_other_amt float64 = 0
  990. //
  991. // var treat_claa_sunmfee float64 = 0
  992. // var treat_clab_amt float64 = 0
  993. // var treat_other_amt float64 = 0
  994. //
  995. // var register_claa_sunmfee float64 = 0
  996. // var register_clab_amt float64 = 0
  997. // var register_other_amt float64 = 0
  998. //
  999. // for _, item := range order.HisOrderInfo {
  1000. // if item.MedChrgitmType == "01" { //床位费
  1001. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1002. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1003. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1004. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1005. // if item.ChrgitmLv == "1" {
  1006. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1007. // }
  1008. // if item.ChrgitmLv == "2" {
  1009. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1010. //
  1011. // }
  1012. // if item.ChrgitmLv == "3" {
  1013. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1014. // }
  1015. //
  1016. // }
  1017. //
  1018. // if item.MedChrgitmType == "02" { //诊查
  1019. // examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1020. // examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1021. // examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1022. // examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1023. // if item.ChrgitmLv == "1" {
  1024. // examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1025. // }
  1026. // if item.ChrgitmLv == "2" {
  1027. // examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1028. //
  1029. // }
  1030. // if item.ChrgitmLv == "3" {
  1031. // examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1032. // }
  1033. //
  1034. // }
  1035. //
  1036. // if item.MedChrgitmType == "03" { //检查费
  1037. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1038. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1039. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1040. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1041. // if item.ChrgitmLv == "1" {
  1042. //
  1043. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1044. //
  1045. // }
  1046. // if item.ChrgitmLv == "2" {
  1047. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1048. //
  1049. // }
  1050. // if item.ChrgitmLv == "3" {
  1051. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1052. // }
  1053. // }
  1054. //
  1055. // if item.MedChrgitmType == "04" { //化验费
  1056. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1057. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1058. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1059. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1060. // if item.ChrgitmLv == "1" {
  1061. //
  1062. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1063. //
  1064. // }
  1065. // if item.ChrgitmLv == "2" {
  1066. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1067. //
  1068. // }
  1069. // if item.ChrgitmLv == "3" {
  1070. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1071. // }
  1072. // }
  1073. //
  1074. // if item.MedChrgitmType == "05" { //治疗费
  1075. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1076. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1077. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1078. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1079. // if item.ChrgitmLv == "1" {
  1080. //
  1081. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1082. //
  1083. // }
  1084. // if item.ChrgitmLv == "2" {
  1085. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1086. //
  1087. // }
  1088. // if item.ChrgitmLv == "3" {
  1089. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1090. // }
  1091. // }
  1092. //
  1093. // if item.MedChrgitmType == "06" { //手术费
  1094. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1095. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1096. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1097. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1098. //
  1099. // if item.ChrgitmLv == "1" {
  1100. //
  1101. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1102. //
  1103. // }
  1104. // if item.ChrgitmLv == "2" {
  1105. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1106. //
  1107. // }
  1108. // if item.ChrgitmLv == "3" {
  1109. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1110. // }
  1111. // }
  1112. //
  1113. // if item.MedChrgitmType == "07" { //手术费
  1114. // nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1115. // nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1116. // nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1117. // nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1118. //
  1119. // if item.ChrgitmLv == "1" {
  1120. //
  1121. // nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1122. //
  1123. // }
  1124. // if item.ChrgitmLv == "2" {
  1125. // nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1126. //
  1127. // }
  1128. // if item.ChrgitmLv == "3" {
  1129. // nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1130. // }
  1131. // }
  1132. //
  1133. // if item.MedChrgitmType == "08" { //材料费
  1134. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1135. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1136. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1137. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1138. // if item.ChrgitmLv == "1" {
  1139. //
  1140. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1141. //
  1142. // }
  1143. // if item.ChrgitmLv == "2" {
  1144. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1145. //
  1146. // }
  1147. // if item.ChrgitmLv == "3" {
  1148. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1149. // }
  1150. // }
  1151. // if item.MedChrgitmType == "09" { //西药费
  1152. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1153. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1154. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1155. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1156. // if item.ChrgitmLv == "1" {
  1157. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1158. // }
  1159. // if item.ChrgitmLv == "2" {
  1160. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1161. // }
  1162. // if item.ChrgitmLv == "3" {
  1163. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1164. // }
  1165. // }
  1166. // if item.MedChrgitmType == "10" { //中药饮片
  1167. // chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1168. // chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1169. // chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1170. // chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1171. // if item.ChrgitmLv == "1" {
  1172. // chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1173. // }
  1174. // if item.ChrgitmLv == "2" {
  1175. // chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1176. // }
  1177. // if item.ChrgitmLv == "3" {
  1178. // chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1179. // }
  1180. // }
  1181. //
  1182. // if item.MedChrgitmType == "11" { //中成费
  1183. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1184. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1185. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1186. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1187. // if item.ChrgitmLv == "1" {
  1188. //
  1189. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1190. //
  1191. // }
  1192. // if item.ChrgitmLv == "2" {
  1193. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1194. //
  1195. // }
  1196. // if item.ChrgitmLv == "3" {
  1197. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1198. // }
  1199. // }
  1200. //
  1201. // if item.MedChrgitmType == "12" { //中成费
  1202. // commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1203. // commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1204. // commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1205. // commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1206. // if item.ChrgitmLv == "1" {
  1207. //
  1208. // commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1209. //
  1210. // }
  1211. // if item.ChrgitmLv == "2" {
  1212. // commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1213. //
  1214. // }
  1215. // if item.ChrgitmLv == "3" {
  1216. // commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1217. // }
  1218. // }
  1219. //
  1220. // if item.MedChrgitmType == "13" { //中成费
  1221. // registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1222. // registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1223. // registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1224. // register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1225. // if item.ChrgitmLv == "1" {
  1226. //
  1227. // register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1228. //
  1229. // }
  1230. // if item.ChrgitmLv == "2" {
  1231. // register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1232. //
  1233. // }
  1234. // if item.ChrgitmLv == "3" {
  1235. // register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1236. // }
  1237. // }
  1238. //
  1239. // if item.MedChrgitmType == "14" { //其他费
  1240. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1241. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1242. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1243. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  1244. // if item.ChrgitmLv == "1" {
  1245. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  1246. //
  1247. // }
  1248. // if item.ChrgitmLv == "2" {
  1249. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  1250. //
  1251. // }
  1252. // if item.ChrgitmLv == "3" {
  1253. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  1254. // }
  1255. // }
  1256. //
  1257. // }
  1258. //
  1259. // var iteminfoStructs []service.IteminfoStruct
  1260. //
  1261. // if bedCostTotal != 0 {
  1262. // iteminfo.MedChrgitm = "01"
  1263. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  1264. // iteminfo.Amt = bedCostTotal
  1265. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  1266. // iteminfo.ClabAmt = bed_clab_amt
  1267. // iteminfo.OthAmt = bed_other_amt
  1268. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1269. // }
  1270. //
  1271. // if examineCostTotal != 0 {
  1272. // iteminfo.MedChrgitm = "02"
  1273. // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  1274. // iteminfo.Amt = examineCostTotal
  1275. // iteminfo.ClaaSumfee = examine_claa_sunmfee
  1276. // iteminfo.ClabAmt = examine_clab_amt
  1277. // iteminfo.OthAmt = examine_other_amt
  1278. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1279. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1280. // }
  1281. //
  1282. // if checkCostTotal != 0 {
  1283. // iteminfo.MedChrgitm = "03"
  1284. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  1285. // iteminfo.Amt = checkCostTotal
  1286. // iteminfo.ClaaSumfee = check_claa_sunmfee
  1287. // iteminfo.ClabAmt = check_clab_amt
  1288. // iteminfo.OthAmt = check_other_amt
  1289. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1290. //
  1291. // }
  1292. //
  1293. // if laboratoryCostTotal != 0 {
  1294. // iteminfo.MedChrgitm = "04"
  1295. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  1296. // iteminfo.Amt = laboratoryCostTotal
  1297. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  1298. // iteminfo.ClabAmt = laboratory_clab_amt
  1299. // iteminfo.OthAmt = laboratory_other_amt
  1300. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1301. //
  1302. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1303. //
  1304. // }
  1305. //
  1306. // if treatCostTotal != 0 {
  1307. // iteminfo.MedChrgitm = "05"
  1308. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  1309. // iteminfo.Amt = treatCostTotal
  1310. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  1311. // iteminfo.ClabAmt = treat_clab_amt
  1312. // iteminfo.OthAmt = treat_other_amt
  1313. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1314. // //(struct4101.IteminfoStruct, iteminfo)
  1315. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1316. // }
  1317. //
  1318. // if operationCostTotal != 0 {
  1319. // iteminfo.MedChrgitm = "06"
  1320. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  1321. // iteminfo.Amt = operationCostTotal
  1322. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  1323. // iteminfo.ClabAmt = operation_clab_amt
  1324. // iteminfo.OthAmt = operation_other_amt
  1325. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1326. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1327. // }
  1328. //
  1329. // if nursingCostTotal != 0 {
  1330. // iteminfo.MedChrgitm = "07"
  1331. // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  1332. // iteminfo.Amt = nursingCostTotal
  1333. // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  1334. // iteminfo.ClabAmt = nursing_clab_amt
  1335. // iteminfo.OthAmt = nursing_other_amt
  1336. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1337. // }
  1338. //
  1339. // if materialCostTotal != 0 {
  1340. // iteminfo.MedChrgitm = "08"
  1341. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  1342. // iteminfo.Amt = materialCostTotal
  1343. // iteminfo.ClaaSumfee = material_claa_sunmfee
  1344. // iteminfo.ClabAmt = material_clab_amt
  1345. // iteminfo.OthAmt = material_other_amt
  1346. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1347. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1348. // }
  1349. //
  1350. // if westernMedicineCostTotal != 0 {
  1351. // iteminfo.MedChrgitm = "09"
  1352. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  1353. // iteminfo.Amt = westernMedicineCostTotal
  1354. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  1355. // iteminfo.ClabAmt = westernMedicine_clab_amt
  1356. // iteminfo.OthAmt = westernMedicine_other_amt
  1357. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1358. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1359. //
  1360. // }
  1361. //
  1362. // if chineseMedicineCostTotal != 0 {
  1363. // iteminfo.MedChrgitm = "10"
  1364. // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  1365. // iteminfo.Amt = chineseMedicineCostTotal
  1366. // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  1367. // iteminfo.ClabAmt = chinese_medicine_clab_amt
  1368. // iteminfo.OthAmt = chinese_medicine_other_amt
  1369. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1370. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1371. //
  1372. // }
  1373. //
  1374. // if chineseTraditionalMedicineCostTotal != 0 {
  1375. // iteminfo.MedChrgitm = "11"
  1376. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  1377. // iteminfo.Amt = westernMedicineCostTotal
  1378. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  1379. // iteminfo.ClabAmt = westernMedicine_clab_amt
  1380. // iteminfo.OthAmt = westernMedicine_other_amt
  1381. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1382. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1383. //
  1384. // }
  1385. //
  1386. // if commonlyTreatmentCostTotal != 0 {
  1387. // iteminfo.MedChrgitm = "12"
  1388. // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  1389. // iteminfo.Amt = commonlyTreatmentCostTotal
  1390. // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  1391. // iteminfo.ClabAmt = commonly_treatment_clab_amt
  1392. // iteminfo.OthAmt = commonly_treatment_other_amt
  1393. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1394. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1395. //
  1396. // }
  1397. //
  1398. // if registerCostTotal != 0 {
  1399. // iteminfo.MedChrgitm = "13"
  1400. // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  1401. // iteminfo.Amt = registerCostTotal
  1402. // iteminfo.ClaaSumfee = register_claa_sunmfee
  1403. // iteminfo.ClabAmt = register_clab_amt
  1404. // iteminfo.OthAmt = register_other_amt
  1405. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  1406. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1407. //
  1408. // }
  1409. //
  1410. // if otherCostTotal != 0 {
  1411. // iteminfo.MedChrgitm = "14"
  1412. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  1413. // iteminfo.Amt = otherCostTotal
  1414. // iteminfo.ClaaSumfee = other_claa_sunmfee
  1415. // iteminfo.ClabAmt = other_clab_amt
  1416. // iteminfo.OthAmt = other_other_amt
  1417. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  1418. //
  1419. // }
  1420. // struct4101.IteminfoStruct = iteminfoStructs
  1421. // struct4101.Ntly = "中国"
  1422. // struct4101.AdmCaty = "A03.06"
  1423. // result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  1424. // fmt.Println(result)
  1425. //
  1426. // var dat map[string]interface{}
  1427. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  1428. // fmt.Println(dat)
  1429. // } else {
  1430. // fmt.Println(err)
  1431. // }
  1432. // userJSONBytes, _ := json.Marshal(dat)
  1433. // var res ResultSeventeen
  1434. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  1435. // utils.ErrorLog("解析失败:%v", err)
  1436. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  1437. // errlog := &models.HisOrderError{
  1438. // UserOrgId: org_id,
  1439. // Ctime: time.Now().Unix(),
  1440. // Mtime: time.Now().Unix(),
  1441. // ErrMsg: res.ErrMsg + "解析失败",
  1442. // Status: 1,
  1443. // PatientId: order_id,
  1444. // Stage: 120,
  1445. // }
  1446. // service.CreateErrMsgLog(errlog)
  1447. // continue
  1448. // }
  1449. //
  1450. // if res.Infcode != 0 {
  1451. // errlog := &models.HisOrderError{
  1452. // UserOrgId: org_id,
  1453. // Ctime: time.Now().Unix(),
  1454. // Mtime: time.Now().Unix(),
  1455. // ErrMsg: res.ErrMsg,
  1456. // Status: 1,
  1457. // PatientId: order_id,
  1458. // Stage: 200,
  1459. // }
  1460. // service.CreateErrMsgLog(errlog)
  1461. // continue
  1462. // } else {
  1463. // hisFundSettleListResult := &models.HisFundSettleListResult{
  1464. // Number: res.Output.SetlListId,
  1465. // Status: 1,
  1466. // Ctime: time.Now().Unix(),
  1467. // Mtime: time.Now().Unix(),
  1468. // UserOrgId: org_id,
  1469. // IsUpload: 1,
  1470. // OrderId: order_id,
  1471. // }
  1472. // service.CreateUploadRecord(hisFundSettleListResult)
  1473. // continue
  1474. // }
  1475. // }
  1476. //}
  1477. //func CreateLog(miConfig models.MedicalInsuranceOrgConfig) {
  1478. // Mkdir(miConfig.OrgName + "日志")
  1479. // //org_id,_ := beego.AppConfig.Int("org_id")
  1480. // month := time.Unix(1557042972, 0).Format("1")
  1481. // year := time.Now().Format("2006")
  1482. // month = time.Now().Format("01")
  1483. // day := time.Now().Format("02")
  1484. // file := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + year + month + day + "_log"
  1485. // file_name := file + ".txt"
  1486. // file_path := miConfig.OrgName + "日志" + "/" + file_name
  1487. // exist, _ := PathExists(file_path)
  1488. // if exist { //存在
  1489. // fmt.Println("存在")
  1490. // f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  1491. // if err != nil {
  1492. // fmt.Println("read fail")
  1493. // }
  1494. // content := "\r\r\r"
  1495. // n, _ := f.Seek(0, 2)
  1496. // _, err = f.WriteAt([]byte(content), n)
  1497. //
  1498. // } else { //不存在
  1499. // fmt.Println("文件不存在,创建文件")
  1500. // f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
  1501. // defer f.Close()
  1502. // if err != nil {
  1503. // } else {
  1504. // _, err = f.Write([]byte("记录日志"))
  1505. // }
  1506. // }
  1507. //
  1508. //}
  1509. //func UploadLog(miConfig models.MedicalInsuranceOrgConfig) {
  1510. // //获取七牛云上的文件信息,不存在则表示没上传到七牛云,上传昨天日志信息
  1511. // nTime := time.Now()
  1512. // yesTime := nTime.AddDate(0, 0, -1)
  1513. // file_key := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + yesTime.Format("20060102") + "_log.txt"
  1514. // mac := qbox.NewMac(beego.AppConfig.String("qiniu_accesskey"), beego.AppConfig.String("qiniu_secretkey"))
  1515. // cfg := storage.Config{
  1516. // // 是否使用https域名进行资源管理
  1517. // UseHTTPS: true,
  1518. // }
  1519. // // 指定空间所在的区域,如果不指定将自动探测
  1520. // // 如果没有特殊需求,默认不需要指定
  1521. // //cfg.Zone=&storage.ZoneHuabei
  1522. // bucketManager := storage.NewBucketManager(mac, &cfg)
  1523. // bucket := beego.AppConfig.String("qiniu_bucket")
  1524. // key := file_key
  1525. // file, sErr := bucketManager.Stat(bucket, key)
  1526. // fmt.Println(file)
  1527. // fmt.Println(sErr)
  1528. // fmt.Println(miConfig.OrgName + "日志" + "/" + file_key)
  1529. //
  1530. // if sErr != nil {
  1531. // fmt.Println("七牛云上文件不存在,上传到七牛云")
  1532. // //判断本地文件是否存在,存在则执行上传操作
  1533. // exist, _ := PathExists(miConfig.OrgName + "日志" + "/" + file_key)
  1534. // if exist {
  1535. // upload_qiniu(miConfig.OrgName+"日志"+"/"+file_key, file_key)
  1536. // } else {
  1537. // fmt.Println("本地文件不存在")
  1538. //
  1539. // }
  1540. // } else {
  1541. // fmt.Println("七牛云文件存在")
  1542. // }
  1543. //
  1544. //}
  1545. //func Mkdir(dir string) {
  1546. // // 创建文件夹
  1547. // exist, err := PathExists(dir)
  1548. // if err != nil {
  1549. // fmt.Println(err.Error())
  1550. // } else {
  1551. // if exist {
  1552. // fmt.Println(dir + "文件夹已存在!")
  1553. // } else {
  1554. // // 文件夹名称,权限
  1555. // err := os.Mkdir(dir, os.ModePerm)
  1556. // if err != nil {
  1557. // fmt.Println(dir+"文件夹创建失败:", err.Error())
  1558. // } else {
  1559. // fmt.Println(dir + "文件夹创建成功!")
  1560. // }
  1561. // }
  1562. // }
  1563. //}
  1564. //func PathExists(path string) (bool, error) {
  1565. // _, err := os.Stat(path)
  1566. // if err == nil {
  1567. // return true, nil
  1568. // }
  1569. // if os.IsNotExist(err) {
  1570. // return false, nil
  1571. // }
  1572. // return false, err
  1573. //}
  1574. //func upload_qiniu(filePath string, keys string) {
  1575. // key := keys
  1576. // //上传凭证,关于凭证这块大家可以去看看官方文档
  1577. // putPolicy := storage.PutPolicy{
  1578. // Scope: beego.AppConfig.String("qiniu_bucket"),
  1579. // }
  1580. // mac := qbox.NewMac(beego.AppConfig.String("qiniu_accesskey"), beego.AppConfig.String("qiniu_secretkey"))
  1581. // upToken := putPolicy.UploadToken(mac)
  1582. // cfg := storage.Config{}
  1583. // //空间对应机房
  1584. // //其中关于Zone对象和机房的关系如下:
  1585. // // 机房 Zone对象
  1586. // // 华东 storage.ZoneHuadong
  1587. // // 华北 storage.ZoneHuabei
  1588. // // 华南 storage.ZoneHuanan
  1589. // // 北美 storage.ZoneBeimei
  1590. // //七牛云存储空间设置首页有存储区域
  1591. // cfg.Zone = &storage.ZoneHuadong
  1592. // //不启用HTTPS域名
  1593. // cfg.UseHTTPS = false
  1594. // //不使用CND加速
  1595. // cfg.UseCdnDomains = false
  1596. // //构建上传表单对象
  1597. // formUploader := storage.NewFormUploader(&cfg)
  1598. // ret := storage.PutRet{}
  1599. // // 可选
  1600. // putExtra := storage.PutExtra{
  1601. // Params: map[string]string{},
  1602. // }
  1603. // err := formUploader.PutFile(context.Background(), &ret, upToken, key, filePath, &putExtra)
  1604. // if err != nil {
  1605. // fmt.Println(err)
  1606. // return
  1607. // }
  1608. // fmt.Println(ret.Key, ret.Hash)
  1609. //}