main.go 74KB

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