main.go 73KB

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