main.go 38KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928
  1. package main
  2. import (
  3. //"github.com/qiniu/api.v7/auth/qbox"
  4. //"github.com/qiniu/api.v7/storage"
  5. //"gdyb/models"
  6. _ "gdyb/routers"
  7. "gdyb/service"
  8. //"github.com/qiniu/api.v7/auth/qbox"
  9. //"github.com/qiniu/api.v7/storage"
  10. //"github.com/qiniu/roapi.v7/auth/qbox"
  11. //"github.com/qiniu/api.v7/storage"
  12. //"gdyb/service"
  13. "github.com/astaxie/beego"
  14. //"strconv"
  15. //"time"
  16. )
  17. func init() {
  18. service.ConnectDB()
  19. org_id, _ := beego.AppConfig.Int64("org_id")
  20. miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  21. //CreateLog(miConfig)
  22. //UploadLog(miConfig)
  23. if org_id == 10191 {
  24. service.GetFjAuthorizationInfo(miConfig.Code)
  25. }
  26. }
  27. func main() {
  28. beego.Run()
  29. }
  30. type CustomFundPay struct {
  31. FundPayType string `json:"fund_pay_type"`
  32. FundPayamt float64 `json:"fund_payamt"`
  33. }
  34. type ResultSeventeen struct {
  35. ErrMsg string `json:"err_msg"`
  36. InfRefmsgid string `json:"inf_refmsgid"`
  37. Infcode int64 `json:"infcode"`
  38. Output struct {
  39. SetlListId string `json:"setl_list_id"`
  40. } `json:"output"`
  41. RefmsgTime string `json:"refmsg_time"`
  42. RespondTime string `json:"respond_time"`
  43. Signtype string `json:"signtype"`
  44. WarnInfo string `json:"warn_info"`
  45. }
  46. //func UploadSettleList(org_id int64) {
  47. // orders, _ := service.GetAllHisOrder(org_id)
  48. // for _, item := range orders {
  49. // order_id := item.ID
  50. // order, _ := service.GetHisOrderByIDTwo(order_id)
  51. // roles, _ := service.GetDoctorListTwo(org_id)
  52. // his, _ := service.GetHisPatientByNumber(order.MdtrtId)
  53. // admin, _ := service.GetAdminUserByUserID(roles[0].AdminUserId)
  54. // curRoles, _ := service.GetAdminUserInfo(org_id)
  55. // depart, _ := service.GetDepartMentDetail(curRoles.DepartmentId)
  56. // miConfig, _ := service.FindMedicalInsuranceInfo(org_id)
  57. //
  58. // result, _ := service.GetHisFundSettleListResult(order_id)
  59. // //判断是否已经上传过医保,上传过就跳过该条记录
  60. // if result.ID > 0 {
  61. // continue
  62. // }
  63. //
  64. // if his.BalanceAccountsType == 2 {
  65. // continue
  66. // }
  67. //
  68. // struct4101 := service.Struct4101{
  69. // PsnNo: order.PsnNo,
  70. // MdtrtId: order.MdtrtId,
  71. // SetlId: order.SetlId,
  72. // PsnName: order.PsnName,
  73. // Gend: order.Gend,
  74. // Brdy: his.Brdy,
  75. // Age: his.Age,
  76. // Naty: order.Naty,
  77. // PatnCertType: "01",
  78. // Certno: order.Certno,
  79. // Prfs: "90",
  80. // ConerName: roles[0].UserName,
  81. // PatnRlts: "99",
  82. // ConerAddr: miConfig.OrgName,
  83. // ConerTel: admin.Mobile,
  84. // HiType: order.Insutype,
  85. // Insuplc: his.InsuplcAdmdvs,
  86. // MaindiagFlag: "1",
  87. // BillCode: order.FaPiaoCode,
  88. // BillNo: order.FaPiaoNumber,
  89. // BizSn: order.Number,
  90. // PsnSelfPay: order.PsnPartAmt,
  91. // PsnOwnPay: order.PsnPartAmt,
  92. // AcctPay: order.AcctPay,
  93. // PsnCashpay: order.PsnCashPay,
  94. // HiPaymtd: "1",
  95. // Hsorg: his.InsuplcAdmdvs,
  96. // HsorgOpter: his.InsuplcAdmdvs,
  97. // MedinsFillPsn: curRoles.UserName,
  98. // MedinsFillDept: depart.Name,
  99. // IptMedType: "2",
  100. // }
  101. // struct4101.SetlBegnDate = order.SetlTime
  102. // struct4101.SetlEndDate = order.SetlTime
  103. // //if order.SettleType == 1 {
  104. // // t := time.Unix(int64(order.SettleAccountsDate), 0)
  105. // // dateStr := t.Format("2006-01-02")
  106. // // struct4101.SetlBegnDate = dateStr
  107. // // struct4101.SetlEndDate = dateStr
  108. // //} else {
  109. // // t := time.Unix(int64(order.SettleStartTime), 0)
  110. // // t2 := time.Unix(int64(order.SettleEndTime), 0)
  111. // // dateStartStr := t.Format("2006-01-02")
  112. // // dateEndStr := t2.Format("2006-01-02")
  113. // // struct4101.SetlBegnDate = dateStartStr
  114. // // struct4101.SetlEndDate = dateEndStr
  115. // //}
  116. //
  117. // var rf []CustomFundPay
  118. // json.Unmarshal([]byte(order.SetlDetail), &rf)
  119. //
  120. // var tempFunPays []service.CustomStruct
  121. // var tempFunPay610100 service.CustomStruct
  122. //
  123. // for _, item := range rf {
  124. // if item.FundPayType == "610100" {
  125. // tempFunPay610100.FundPayamt, _ = decimal.NewFromFloat(tempFunPay610100.FundPayamt).Add(decimal.NewFromFloat(item.FundPayamt)).Float64()
  126. // tempFunPay610100.FundPayType = item.FundPayType
  127. // } else {
  128. // var tempFunPay service.CustomStruct
  129. // tempFunPay.FundPayamt = item.FundPayamt
  130. // tempFunPay.FundPayType = item.FundPayType
  131. // tempFunPays = append(tempFunPays, tempFunPay)
  132. // }
  133. // }
  134. // tempFunPays = append(tempFunPays, tempFunPay610100)
  135. // struct4101.CustomStruct = tempFunPays
  136. //
  137. // var tempOpspdiseinfos []service.OpspdiseinfoStruct
  138. // var tempOpspdiseinfo2 service.OpspdiseinfoStruct
  139. // //sickConfig, _ := service.FindDiagnoseById(his.Diagnosis)
  140. //
  141. // diagnosis_ids := strings.Split(his.Diagnosis, ",")
  142. // var config []*models.HisXtDiagnoseConfig
  143. // for _, item := range diagnosis_ids {
  144. // id, _ := strconv.ParseInt(item, 10, 64)
  145. // diagnosisConfig, _ := service.FindDiagnoseById(id)
  146. // config = append(config, &diagnosisConfig)
  147. // }
  148. //
  149. // for _, item := range config {
  150. // var tempOpspdiseinfo service.OpspdiseinfoStruct
  151. // tempOpspdiseinfo.DiagCode = item.CountryCode
  152. // tempOpspdiseinfo.DiagName = item.CountryContentName
  153. // tempOpspdiseinfo.MaindiagFlag = "1"
  154. // tempOpspdiseinfo.OprnOprtCode = ""
  155. // tempOpspdiseinfo.OprnOprtName = ""
  156. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo)
  157. // }
  158. //
  159. // sickConfigTwo, _ := service.FindSickById(his.SickType)
  160. // tempOpspdiseinfo2.DiagCode = sickConfigTwo.ContentCode
  161. // tempOpspdiseinfo2.DiagName = sickConfigTwo.CountryContentName
  162. // tempOpspdiseinfo2.MaindiagFlag = "2"
  163. // tempOpspdiseinfo2.OprnOprtCode = ""
  164. // tempOpspdiseinfo2.OprnOprtName = ""
  165. // tempOpspdiseinfos = append(tempOpspdiseinfos, tempOpspdiseinfo2)
  166. // struct4101.OpspdiseinfoStruct = tempOpspdiseinfos
  167. //
  168. // var iteminfo service.IteminfoStruct
  169. //
  170. // var bedCostTotal float64 = 0 //床位总费
  171. // var bedCostSelfTotal float64 = 0 //床位自费
  172. // var bedCostPartSelfTotal float64 = 0 //床位部分项目自费
  173. //
  174. // var examineCostTotal float64 = 0 //诊查总费
  175. // var examineCostSelfTotal float64 = 0 //诊查自费
  176. // var examineCostPartSelfTotal float64 = 0 //诊查部分项目自费
  177. //
  178. // var nursingCostTotal float64 = 0 //护理总费
  179. // var nursingCostSelfTotal float64 = 0 //护理自费
  180. // var nursingCostPartSelfTotal float64 = 0 //护理部分项目自费
  181. //
  182. // var chineseMedicineCostTotal float64 = 0 //中成药
  183. // var chineseMedicineCostSelfTotal float64 = 0 //中成药
  184. // var chineseMedicineCostPartSelfTotal float64 = 0 //中成药
  185. //
  186. // var commonlyTreatmentCostTotal float64 = 0 //一般诊疗费
  187. // var commonlyTreatmentCostSelfTotal float64 = 0 //一般诊疗费
  188. // var commonlyTreatmentCostPartSelfTotal float64 = 0 //一般诊疗费
  189. //
  190. // var registerCostTotal float64 = 0 //一般诊疗费
  191. // var registerCostSelfTotal float64 = 0 //一般诊疗费
  192. // var registerPartSelfTotal float64 = 0 //一般诊疗费
  193. //
  194. // var operationCostTotal float64 = 0 //手术费
  195. // var operationCostSelfTotal float64 = 0 //手术费
  196. // var operationCostPartSelfTotal float64 = 0 //手术费
  197. //
  198. // var otherCostTotal float64 = 0 //其他费用
  199. // var otherCostSelfTotal float64 = 0 //其他费用
  200. // var otherCostPartSelfTotal float64 = 0 //其他费用
  201. //
  202. // var materialCostTotal float64 = 0 //材料费
  203. // var materialCostSelfTotal float64 = 0 //材料费
  204. // var materialCostPartSelfTotal float64 = 0 //材料费
  205. //
  206. // var westernMedicineCostTotal float64 = 0 //西药费
  207. // var westernMedicineCostSelfTotal float64 = 0 //西药费
  208. // var westernMedicineCostPartSelfTotal float64 = 0 //西药费
  209. //
  210. // var chineseTraditionalMedicineCostTotal float64 = 0 //中成药
  211. // var chineseTraditionalMedicineCostSelfTotal float64 = 0 //中成药
  212. // var chineseTraditionalMedicineCostPartSelfTotal float64 = 0 //中成药
  213. //
  214. // var checkCostTotal float64 = 0 //检查费
  215. // var checkCostSelfTotal float64 = 0 //检查费
  216. // var checkCostPartSelfTotal float64 = 0 //检查费
  217. //
  218. // var laboratoryCostTotal float64 = 0 //化验费
  219. // var laboratoryCostSelfTotal float64 = 0 //化验费
  220. // var laboratoryCostPartSelfTotal float64 = 0 //化验费
  221. //
  222. // var treatCostTotal float64 = 0 //治疗费用
  223. // var treatCostSelfTotal float64 = 0 //治疗费用
  224. // var treatCostPartSelfTotal float64 = 0 //治疗费用
  225. //
  226. // decimal.DivisionPrecision = 2
  227. //
  228. // var bed_fulamt_ownpay_amt float64 = 0
  229. //
  230. // var examine_fulamt_ownpay_amt float64 = 0
  231. //
  232. // var nursing_fulamt_ownpay_amt float64 = 0
  233. //
  234. // var chinese_medicine_fulamt_ownpay_amt float64 = 0
  235. //
  236. // var commonly_treatment_fulamt_ownpay_amt float64 = 0
  237. //
  238. // var register_fulamt_ownpay_amt float64 = 0
  239. //
  240. // var operation_fulamt_ownpay_amt float64 = 0
  241. // var other_fulamt_ownpay_amt float64 = 0
  242. // var westernMedicine_fulamt_ownpay_amt float64 = 0
  243. // var chineseTraditional_fulamt_ownpay_amt float64 = 0
  244. // var check_fulamt_ownpay_amt float64 = 0
  245. // var material_fulamt_ownpay_amt float64 = 0
  246. // var laboratory_fulamt_ownpay_amt float64 = 0
  247. // var treat_fulamt_ownpay_amt float64 = 0
  248. //
  249. // var bed_claa_sunmfee float64 = 0
  250. // var bed_clab_amt float64 = 0
  251. // var bed_other_amt float64 = 0
  252. //
  253. // var examine_claa_sunmfee float64 = 0
  254. // var examine_clab_amt float64 = 0
  255. // var examine_other_amt float64 = 0
  256. //
  257. // var nursing_claa_sunmfee float64 = 0
  258. // var nursing_clab_amt float64 = 0
  259. // var nursing_other_amt float64 = 0
  260. //
  261. // var chinese_medicine_claa_sunmfee float64 = 0
  262. // var chinese_medicine_clab_amt float64 = 0
  263. // var chinese_medicine_other_amt float64 = 0
  264. //
  265. // var commonly_treatment_claa_sunmfee float64 = 0
  266. // var commonly_treatment_clab_amt float64 = 0
  267. // var commonly_treatment_other_amt float64 = 0
  268. //
  269. // var operation_claa_sunmfee float64 = 0
  270. // var operation_clab_amt float64 = 0
  271. // var operation_other_amt float64 = 0
  272. //
  273. // var other_claa_sunmfee float64 = 0
  274. // var other_clab_amt float64 = 0
  275. // var other_other_amt float64 = 0
  276. //
  277. // var westernMedicine_claa_sunmfee float64 = 0
  278. // var westernMedicine_clab_amt float64 = 0
  279. // var westernMedicine_other_amt float64 = 0
  280. //
  281. // var chineseTraditional_claa_sunmfee float64 = 0
  282. // var chineseTraditional_clab_amt float64 = 0
  283. // var chineseTraditional_other_amt float64 = 0
  284. //
  285. // var check_claa_sunmfee float64 = 0
  286. // var check_clab_amt float64 = 0
  287. // var check_other_amt float64 = 0
  288. //
  289. // var material_claa_sunmfee float64 = 0
  290. // var material_clab_amt float64 = 0
  291. // var material_other_amt float64 = 0
  292. //
  293. // var laboratory_claa_sunmfee float64 = 0
  294. // var laboratory_clab_amt float64 = 0
  295. // var laboratory_other_amt float64 = 0
  296. //
  297. // var treat_claa_sunmfee float64 = 0
  298. // var treat_clab_amt float64 = 0
  299. // var treat_other_amt float64 = 0
  300. //
  301. // var register_claa_sunmfee float64 = 0
  302. // var register_clab_amt float64 = 0
  303. // var register_other_amt float64 = 0
  304. //
  305. // for _, item := range order.HisOrderInfo {
  306. // if item.MedChrgitmType == "01" { //床位费
  307. // bedCostTotal, _ = decimal.NewFromFloat(bedCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  308. // bedCostSelfTotal, _ = decimal.NewFromFloat(bedCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  309. // bedCostPartSelfTotal, _ = decimal.NewFromFloat(bedCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  310. // bed_fulamt_ownpay_amt, _ = decimal.NewFromFloat(bed_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  311. // if item.ChrgitmLv == "1" {
  312. // bed_claa_sunmfee, _ = decimal.NewFromFloat(bed_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  313. // }
  314. // if item.ChrgitmLv == "2" {
  315. // bed_clab_amt, _ = decimal.NewFromFloat(bed_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  316. //
  317. // }
  318. // if item.ChrgitmLv == "3" {
  319. // bed_other_amt, _ = decimal.NewFromFloat(bed_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  320. // }
  321. //
  322. // }
  323. //
  324. // if item.MedChrgitmType == "02" { //诊查
  325. // examineCostTotal, _ = decimal.NewFromFloat(examineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  326. // examineCostSelfTotal, _ = decimal.NewFromFloat(examineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  327. // examineCostPartSelfTotal, _ = decimal.NewFromFloat(examineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  328. // examine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(examine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  329. // if item.ChrgitmLv == "1" {
  330. // examine_claa_sunmfee, _ = decimal.NewFromFloat(examine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  331. // }
  332. // if item.ChrgitmLv == "2" {
  333. // examine_clab_amt, _ = decimal.NewFromFloat(examine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  334. //
  335. // }
  336. // if item.ChrgitmLv == "3" {
  337. // examine_other_amt, _ = decimal.NewFromFloat(examine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  338. // }
  339. //
  340. // }
  341. //
  342. // if item.MedChrgitmType == "03" { //检查费
  343. // checkCostTotal, _ = decimal.NewFromFloat(checkCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  344. // checkCostSelfTotal, _ = decimal.NewFromFloat(checkCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  345. // checkCostPartSelfTotal, _ = decimal.NewFromFloat(checkCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  346. // check_fulamt_ownpay_amt, _ = decimal.NewFromFloat(check_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  347. // if item.ChrgitmLv == "1" {
  348. //
  349. // check_claa_sunmfee, _ = decimal.NewFromFloat(check_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  350. //
  351. // }
  352. // if item.ChrgitmLv == "2" {
  353. // check_clab_amt, _ = decimal.NewFromFloat(check_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  354. //
  355. // }
  356. // if item.ChrgitmLv == "3" {
  357. // check_other_amt, _ = decimal.NewFromFloat(check_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  358. // }
  359. // }
  360. //
  361. // if item.MedChrgitmType == "04" { //化验费
  362. // laboratoryCostTotal, _ = decimal.NewFromFloat(laboratoryCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  363. // laboratoryCostSelfTotal, _ = decimal.NewFromFloat(laboratoryCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  364. // laboratoryCostPartSelfTotal, _ = decimal.NewFromFloat(laboratoryCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  365. // laboratory_fulamt_ownpay_amt, _ = decimal.NewFromFloat(laboratory_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  366. // if item.ChrgitmLv == "1" {
  367. //
  368. // laboratory_claa_sunmfee, _ = decimal.NewFromFloat(laboratory_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  369. //
  370. // }
  371. // if item.ChrgitmLv == "2" {
  372. // laboratory_clab_amt, _ = decimal.NewFromFloat(laboratory_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  373. //
  374. // }
  375. // if item.ChrgitmLv == "3" {
  376. // laboratory_other_amt, _ = decimal.NewFromFloat(laboratory_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  377. // }
  378. // }
  379. //
  380. // if item.MedChrgitmType == "05" { //治疗费
  381. // treatCostTotal, _ = decimal.NewFromFloat(treatCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  382. // treatCostSelfTotal, _ = decimal.NewFromFloat(treatCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  383. // treatCostPartSelfTotal, _ = decimal.NewFromFloat(treatCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  384. // treat_fulamt_ownpay_amt, _ = decimal.NewFromFloat(treat_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  385. // if item.ChrgitmLv == "1" {
  386. //
  387. // treat_claa_sunmfee, _ = decimal.NewFromFloat(treat_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  388. //
  389. // }
  390. // if item.ChrgitmLv == "2" {
  391. // treat_clab_amt, _ = decimal.NewFromFloat(treat_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  392. //
  393. // }
  394. // if item.ChrgitmLv == "3" {
  395. // treat_other_amt, _ = decimal.NewFromFloat(treat_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  396. // }
  397. // }
  398. //
  399. // if item.MedChrgitmType == "06" { //手术费
  400. // operationCostTotal, _ = decimal.NewFromFloat(operationCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  401. // operationCostSelfTotal, _ = decimal.NewFromFloat(operationCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  402. // operationCostPartSelfTotal, _ = decimal.NewFromFloat(operationCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  403. // operation_fulamt_ownpay_amt, _ = decimal.NewFromFloat(operation_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  404. //
  405. // if item.ChrgitmLv == "1" {
  406. //
  407. // operation_claa_sunmfee, _ = decimal.NewFromFloat(operation_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  408. //
  409. // }
  410. // if item.ChrgitmLv == "2" {
  411. // operation_clab_amt, _ = decimal.NewFromFloat(operation_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  412. //
  413. // }
  414. // if item.ChrgitmLv == "3" {
  415. // operation_other_amt, _ = decimal.NewFromFloat(operation_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  416. // }
  417. // }
  418. //
  419. // if item.MedChrgitmType == "07" { //手术费
  420. // nursingCostTotal, _ = decimal.NewFromFloat(nursingCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  421. // nursingCostSelfTotal, _ = decimal.NewFromFloat(nursingCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  422. // nursingCostPartSelfTotal, _ = decimal.NewFromFloat(nursingCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  423. // nursing_fulamt_ownpay_amt, _ = decimal.NewFromFloat(nursing_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  424. //
  425. // if item.ChrgitmLv == "1" {
  426. //
  427. // nursing_claa_sunmfee, _ = decimal.NewFromFloat(nursing_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  428. //
  429. // }
  430. // if item.ChrgitmLv == "2" {
  431. // nursing_clab_amt, _ = decimal.NewFromFloat(nursing_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  432. //
  433. // }
  434. // if item.ChrgitmLv == "3" {
  435. // nursing_other_amt, _ = decimal.NewFromFloat(nursing_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  436. // }
  437. // }
  438. //
  439. // if item.MedChrgitmType == "08" { //材料费
  440. // materialCostTotal, _ = decimal.NewFromFloat(materialCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  441. // materialCostSelfTotal, _ = decimal.NewFromFloat(materialCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  442. // materialCostPartSelfTotal, _ = decimal.NewFromFloat(materialCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  443. // material_fulamt_ownpay_amt, _ = decimal.NewFromFloat(material_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  444. // if item.ChrgitmLv == "1" {
  445. //
  446. // material_claa_sunmfee, _ = decimal.NewFromFloat(material_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  447. //
  448. // }
  449. // if item.ChrgitmLv == "2" {
  450. // material_clab_amt, _ = decimal.NewFromFloat(material_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  451. //
  452. // }
  453. // if item.ChrgitmLv == "3" {
  454. // material_other_amt, _ = decimal.NewFromFloat(material_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  455. // }
  456. // }
  457. // if item.MedChrgitmType == "09" { //西药费
  458. // westernMedicineCostTotal, _ = decimal.NewFromFloat(westernMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  459. // westernMedicineCostSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  460. // westernMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(westernMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  461. // westernMedicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(westernMedicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  462. // if item.ChrgitmLv == "1" {
  463. // westernMedicine_claa_sunmfee, _ = decimal.NewFromFloat(westernMedicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  464. // }
  465. // if item.ChrgitmLv == "2" {
  466. // westernMedicine_clab_amt, _ = decimal.NewFromFloat(westernMedicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  467. // }
  468. // if item.ChrgitmLv == "3" {
  469. // westernMedicine_other_amt, _ = decimal.NewFromFloat(westernMedicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  470. // }
  471. // }
  472. // if item.MedChrgitmType == "10" { //中药饮片
  473. // chineseMedicineCostTotal, _ = decimal.NewFromFloat(chineseMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  474. // chineseMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  475. // chineseMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  476. // chinese_medicine_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chinese_medicine_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  477. // if item.ChrgitmLv == "1" {
  478. // chinese_medicine_claa_sunmfee, _ = decimal.NewFromFloat(chinese_medicine_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  479. // }
  480. // if item.ChrgitmLv == "2" {
  481. // chinese_medicine_clab_amt, _ = decimal.NewFromFloat(chinese_medicine_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  482. // }
  483. // if item.ChrgitmLv == "3" {
  484. // chinese_medicine_other_amt, _ = decimal.NewFromFloat(chinese_medicine_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  485. // }
  486. // }
  487. //
  488. // if item.MedChrgitmType == "11" { //中成费
  489. // chineseTraditionalMedicineCostTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  490. // chineseTraditionalMedicineCostSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  491. // chineseTraditionalMedicineCostPartSelfTotal, _ = decimal.NewFromFloat(chineseTraditionalMedicineCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  492. // chineseTraditional_fulamt_ownpay_amt, _ = decimal.NewFromFloat(chineseTraditional_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  493. // if item.ChrgitmLv == "1" {
  494. //
  495. // chineseTraditional_claa_sunmfee, _ = decimal.NewFromFloat(chineseTraditional_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  496. //
  497. // }
  498. // if item.ChrgitmLv == "2" {
  499. // chineseTraditional_clab_amt, _ = decimal.NewFromFloat(chineseTraditional_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  500. //
  501. // }
  502. // if item.ChrgitmLv == "3" {
  503. // chineseTraditional_other_amt, _ = decimal.NewFromFloat(chineseTraditional_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  504. // }
  505. // }
  506. //
  507. // if item.MedChrgitmType == "12" { //中成费
  508. // commonlyTreatmentCostTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  509. // commonlyTreatmentCostSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  510. // commonlyTreatmentCostPartSelfTotal, _ = decimal.NewFromFloat(commonlyTreatmentCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  511. // commonly_treatment_fulamt_ownpay_amt, _ = decimal.NewFromFloat(commonly_treatment_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  512. // if item.ChrgitmLv == "1" {
  513. //
  514. // commonly_treatment_claa_sunmfee, _ = decimal.NewFromFloat(commonly_treatment_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  515. //
  516. // }
  517. // if item.ChrgitmLv == "2" {
  518. // commonly_treatment_clab_amt, _ = decimal.NewFromFloat(commonly_treatment_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  519. //
  520. // }
  521. // if item.ChrgitmLv == "3" {
  522. // commonly_treatment_other_amt, _ = decimal.NewFromFloat(commonly_treatment_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  523. // }
  524. // }
  525. //
  526. // if item.MedChrgitmType == "13" { //中成费
  527. // registerCostTotal, _ = decimal.NewFromFloat(registerCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  528. // registerCostSelfTotal, _ = decimal.NewFromFloat(registerCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  529. // registerPartSelfTotal, _ = decimal.NewFromFloat(registerPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  530. // register_fulamt_ownpay_amt, _ = decimal.NewFromFloat(register_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  531. // if item.ChrgitmLv == "1" {
  532. //
  533. // register_claa_sunmfee, _ = decimal.NewFromFloat(register_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  534. //
  535. // }
  536. // if item.ChrgitmLv == "2" {
  537. // register_clab_amt, _ = decimal.NewFromFloat(register_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  538. //
  539. // }
  540. // if item.ChrgitmLv == "3" {
  541. // register_other_amt, _ = decimal.NewFromFloat(register_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  542. // }
  543. // }
  544. //
  545. // if item.MedChrgitmType == "14" { //其他费
  546. // otherCostTotal, _ = decimal.NewFromFloat(otherCostTotal).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  547. // otherCostSelfTotal, _ = decimal.NewFromFloat(otherCostSelfTotal).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  548. // otherCostPartSelfTotal, _ = decimal.NewFromFloat(otherCostPartSelfTotal).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  549. // other_fulamt_ownpay_amt, _ = decimal.NewFromFloat(other_fulamt_ownpay_amt).Add(decimal.NewFromFloat(item.FulamtOwnpayAmt)).Float64()
  550. // if item.ChrgitmLv == "1" {
  551. // other_claa_sunmfee, _ = decimal.NewFromFloat(other_claa_sunmfee).Add(decimal.NewFromFloat(item.DetItemFeeSumamt)).Float64()
  552. //
  553. // }
  554. // if item.ChrgitmLv == "2" {
  555. // other_clab_amt, _ = decimal.NewFromFloat(other_clab_amt).Add(decimal.NewFromFloat(item.PreselfpayAmt)).Float64()
  556. //
  557. // }
  558. // if item.ChrgitmLv == "3" {
  559. // other_other_amt, _ = decimal.NewFromFloat(other_other_amt).Add(decimal.NewFromFloat(item.OverlmtAmt)).Float64()
  560. // }
  561. // }
  562. //
  563. // }
  564. //
  565. // var iteminfoStructs []service.IteminfoStruct
  566. //
  567. // if bedCostTotal != 0 {
  568. // iteminfo.MedChrgitm = "01"
  569. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  570. // iteminfo.Amt = bedCostTotal
  571. // iteminfo.ClaaSumfee = bed_claa_sunmfee
  572. // iteminfo.ClabAmt = bed_clab_amt
  573. // iteminfo.OthAmt = bed_other_amt
  574. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  575. // }
  576. //
  577. // if examineCostTotal != 0 {
  578. // iteminfo.MedChrgitm = "02"
  579. // iteminfo.FulamtOwnpayAmt = examine_fulamt_ownpay_amt
  580. // iteminfo.Amt = examineCostTotal
  581. // iteminfo.ClaaSumfee = examine_claa_sunmfee
  582. // iteminfo.ClabAmt = examine_clab_amt
  583. // iteminfo.OthAmt = examine_other_amt
  584. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  585. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  586. // }
  587. //
  588. // if checkCostTotal != 0 {
  589. // iteminfo.MedChrgitm = "03"
  590. // iteminfo.FulamtOwnpayAmt = check_fulamt_ownpay_amt
  591. // iteminfo.Amt = checkCostTotal
  592. // iteminfo.ClaaSumfee = check_claa_sunmfee
  593. // iteminfo.ClabAmt = check_clab_amt
  594. // iteminfo.OthAmt = check_other_amt
  595. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  596. //
  597. // }
  598. //
  599. // if laboratoryCostTotal != 0 {
  600. // iteminfo.MedChrgitm = "04"
  601. // iteminfo.FulamtOwnpayAmt = laboratory_fulamt_ownpay_amt
  602. // iteminfo.Amt = laboratoryCostTotal
  603. // iteminfo.ClaaSumfee = laboratory_claa_sunmfee
  604. // iteminfo.ClabAmt = laboratory_clab_amt
  605. // iteminfo.OthAmt = laboratory_other_amt
  606. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  607. //
  608. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  609. //
  610. // }
  611. //
  612. // if treatCostTotal != 0 {
  613. // iteminfo.MedChrgitm = "05"
  614. // iteminfo.FulamtOwnpayAmt = treat_fulamt_ownpay_amt
  615. // iteminfo.Amt = treatCostTotal
  616. // iteminfo.ClaaSumfee = treat_claa_sunmfee
  617. // iteminfo.ClabAmt = treat_clab_amt
  618. // iteminfo.OthAmt = treat_other_amt
  619. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  620. // //(struct4101.IteminfoStruct, iteminfo)
  621. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  622. // }
  623. //
  624. // if operationCostTotal != 0 {
  625. // iteminfo.MedChrgitm = "06"
  626. // iteminfo.FulamtOwnpayAmt = bed_fulamt_ownpay_amt
  627. // iteminfo.Amt = operationCostTotal
  628. // iteminfo.ClaaSumfee = operation_claa_sunmfee
  629. // iteminfo.ClabAmt = operation_clab_amt
  630. // iteminfo.OthAmt = operation_other_amt
  631. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  632. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  633. // }
  634. //
  635. // if nursingCostTotal != 0 {
  636. // iteminfo.MedChrgitm = "07"
  637. // iteminfo.FulamtOwnpayAmt = nursing_fulamt_ownpay_amt
  638. // iteminfo.Amt = nursingCostTotal
  639. // iteminfo.ClaaSumfee = nursing_claa_sunmfee
  640. // iteminfo.ClabAmt = nursing_clab_amt
  641. // iteminfo.OthAmt = nursing_other_amt
  642. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  643. // }
  644. //
  645. // if materialCostTotal != 0 {
  646. // iteminfo.MedChrgitm = "08"
  647. // iteminfo.FulamtOwnpayAmt = material_fulamt_ownpay_amt
  648. // iteminfo.Amt = materialCostTotal
  649. // iteminfo.ClaaSumfee = material_claa_sunmfee
  650. // iteminfo.ClabAmt = material_clab_amt
  651. // iteminfo.OthAmt = material_other_amt
  652. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  653. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  654. // }
  655. //
  656. // if westernMedicineCostTotal != 0 {
  657. // iteminfo.MedChrgitm = "09"
  658. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  659. // iteminfo.Amt = westernMedicineCostTotal
  660. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  661. // iteminfo.ClabAmt = westernMedicine_clab_amt
  662. // iteminfo.OthAmt = westernMedicine_other_amt
  663. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  664. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  665. //
  666. // }
  667. //
  668. // if chineseMedicineCostTotal != 0 {
  669. // iteminfo.MedChrgitm = "10"
  670. // iteminfo.FulamtOwnpayAmt = chinese_medicine_fulamt_ownpay_amt
  671. // iteminfo.Amt = chineseMedicineCostTotal
  672. // iteminfo.ClaaSumfee = chinese_medicine_claa_sunmfee
  673. // iteminfo.ClabAmt = chinese_medicine_clab_amt
  674. // iteminfo.OthAmt = chinese_medicine_other_amt
  675. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  676. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  677. //
  678. // }
  679. //
  680. // if chineseTraditionalMedicineCostTotal != 0 {
  681. // iteminfo.MedChrgitm = "11"
  682. // iteminfo.FulamtOwnpayAmt = westernMedicine_fulamt_ownpay_amt
  683. // iteminfo.Amt = westernMedicineCostTotal
  684. // iteminfo.ClaaSumfee = westernMedicine_claa_sunmfee
  685. // iteminfo.ClabAmt = westernMedicine_clab_amt
  686. // iteminfo.OthAmt = westernMedicine_other_amt
  687. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  688. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  689. //
  690. // }
  691. //
  692. // if commonlyTreatmentCostTotal != 0 {
  693. // iteminfo.MedChrgitm = "12"
  694. // iteminfo.FulamtOwnpayAmt = commonly_treatment_fulamt_ownpay_amt
  695. // iteminfo.Amt = commonlyTreatmentCostTotal
  696. // iteminfo.ClaaSumfee = commonly_treatment_claa_sunmfee
  697. // iteminfo.ClabAmt = commonly_treatment_clab_amt
  698. // iteminfo.OthAmt = commonly_treatment_other_amt
  699. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  700. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  701. //
  702. // }
  703. //
  704. // if registerCostTotal != 0 {
  705. // iteminfo.MedChrgitm = "13"
  706. // iteminfo.FulamtOwnpayAmt = register_fulamt_ownpay_amt
  707. // iteminfo.Amt = registerCostTotal
  708. // iteminfo.ClaaSumfee = register_claa_sunmfee
  709. // iteminfo.ClabAmt = register_clab_amt
  710. // iteminfo.OthAmt = register_other_amt
  711. // //struct4101.IteminfoStruct = append(struct4101.IteminfoStruct, iteminfo)
  712. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  713. //
  714. // }
  715. //
  716. // if otherCostTotal != 0 {
  717. // iteminfo.MedChrgitm = "14"
  718. // iteminfo.FulamtOwnpayAmt = other_fulamt_ownpay_amt
  719. // iteminfo.Amt = otherCostTotal
  720. // iteminfo.ClaaSumfee = other_claa_sunmfee
  721. // iteminfo.ClabAmt = other_clab_amt
  722. // iteminfo.OthAmt = other_other_amt
  723. // iteminfoStructs = append(iteminfoStructs, iteminfo)
  724. //
  725. // }
  726. // struct4101.IteminfoStruct = iteminfoStructs
  727. // struct4101.Ntly = "中国"
  728. // struct4101.AdmCaty = "A03.06"
  729. // result := service.Gdyb4101(struct4101, miConfig.SecretKey, miConfig.OrgName, curRoles.UserName, miConfig.Code, miConfig.InsuplcAdmdvs, miConfig.MdtrtareaAdmvs, org_id)
  730. // fmt.Println(result)
  731. //
  732. // var dat map[string]interface{}
  733. // if err := json.Unmarshal([]byte(result), &dat); err == nil {
  734. // fmt.Println(dat)
  735. // } else {
  736. // fmt.Println(err)
  737. // }
  738. // userJSONBytes, _ := json.Marshal(dat)
  739. // var res ResultSeventeen
  740. // if err := json.Unmarshal(userJSONBytes, &res); err != nil {
  741. // utils.ErrorLog("解析失败:%v", err)
  742. // //c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeDataException)
  743. // errlog := &models.HisOrderError{
  744. // UserOrgId: org_id,
  745. // Ctime: time.Now().Unix(),
  746. // Mtime: time.Now().Unix(),
  747. // ErrMsg: res.ErrMsg + "解析失败",
  748. // Status: 1,
  749. // PatientId: order_id,
  750. // Stage: 120,
  751. // }
  752. // service.CreateErrMsgLog(errlog)
  753. // continue
  754. // }
  755. //
  756. // if res.Infcode != 0 {
  757. // errlog := &models.HisOrderError{
  758. // UserOrgId: org_id,
  759. // Ctime: time.Now().Unix(),
  760. // Mtime: time.Now().Unix(),
  761. // ErrMsg: res.ErrMsg,
  762. // Status: 1,
  763. // PatientId: order_id,
  764. // Stage: 200,
  765. // }
  766. // service.CreateErrMsgLog(errlog)
  767. // continue
  768. // } else {
  769. // hisFundSettleListResult := &models.HisFundSettleListResult{
  770. // Number: res.Output.SetlListId,
  771. // Status: 1,
  772. // Ctime: time.Now().Unix(),
  773. // Mtime: time.Now().Unix(),
  774. // UserOrgId: org_id,
  775. // IsUpload: 1,
  776. // OrderId: order_id,
  777. // }
  778. // service.CreateUploadRecord(hisFundSettleListResult)
  779. // continue
  780. // }
  781. // }
  782. //}
  783. //func CreateLog(miConfig models.MedicalInsuranceOrgConfig) {
  784. // Mkdir(miConfig.OrgName + "日志")
  785. // //org_id,_ := beego.AppConfig.Int("org_id")
  786. // month := time.Unix(1557042972, 0).Format("1")
  787. // year := time.Now().Format("2006")
  788. // month = time.Now().Format("01")
  789. // day := time.Now().Format("02")
  790. // file := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + year + month + day + "_log"
  791. // file_name := file + ".txt"
  792. // file_path := miConfig.OrgName + "日志" + "/" + file_name
  793. // exist, _ := PathExists(file_path)
  794. // if exist { //存在
  795. // fmt.Println("存在")
  796. // f, err := os.OpenFile(file_path, os.O_WRONLY, 0644)
  797. // if err != nil {
  798. // fmt.Println("read fail")
  799. // }
  800. // content := "\r\r\r"
  801. // n, _ := f.Seek(0, 2)
  802. // _, err = f.WriteAt([]byte(content), n)
  803. //
  804. // } else { //不存在
  805. // fmt.Println("文件不存在,创建文件")
  806. // f, err := os.Create(miConfig.OrgName + "日志" + "/" + file_name)
  807. // defer f.Close()
  808. // if err != nil {
  809. // } else {
  810. // _, err = f.Write([]byte("记录日志"))
  811. // }
  812. // }
  813. //
  814. //}
  815. //func UploadLog(miConfig models.MedicalInsuranceOrgConfig) {
  816. // //获取七牛云上的文件信息,不存在则表示没上传到七牛云,上传昨天日志信息
  817. // nTime := time.Now()
  818. // yesTime := nTime.AddDate(0, 0, -1)
  819. // file_key := strconv.FormatInt(miConfig.UserOrgId, 10) + "_" + yesTime.Format("20060102") + "_log.txt"
  820. // mac := qbox.NewMac(beego.AppConfig.String("qiniu_accesskey"), beego.AppConfig.String("qiniu_secretkey"))
  821. // cfg := storage.Config{
  822. // // 是否使用https域名进行资源管理
  823. // UseHTTPS: true,
  824. // }
  825. // // 指定空间所在的区域,如果不指定将自动探测
  826. // // 如果没有特殊需求,默认不需要指定
  827. // //cfg.Zone=&storage.ZoneHuabei
  828. // bucketManager := storage.NewBucketManager(mac, &cfg)
  829. // bucket := beego.AppConfig.String("qiniu_bucket")
  830. // key := file_key
  831. // file, sErr := bucketManager.Stat(bucket, key)
  832. // fmt.Println(file)
  833. // fmt.Println(sErr)
  834. // fmt.Println(miConfig.OrgName + "日志" + "/" + file_key)
  835. //
  836. // if sErr != nil {
  837. // fmt.Println("七牛云上文件不存在,上传到七牛云")
  838. // //判断本地文件是否存在,存在则执行上传操作
  839. // exist, _ := PathExists(miConfig.OrgName + "日志" + "/" + file_key)
  840. // if exist {
  841. // upload_qiniu(miConfig.OrgName+"日志"+"/"+file_key, file_key)
  842. // } else {
  843. // fmt.Println("本地文件不存在")
  844. //
  845. // }
  846. // } else {
  847. // fmt.Println("七牛云文件存在")
  848. // }
  849. //
  850. //}
  851. //func Mkdir(dir string) {
  852. // // 创建文件夹
  853. // exist, err := PathExists(dir)
  854. // if err != nil {
  855. // fmt.Println(err.Error())
  856. // } else {
  857. // if exist {
  858. // fmt.Println(dir + "文件夹已存在!")
  859. // } else {
  860. // // 文件夹名称,权限
  861. // err := os.Mkdir(dir, os.ModePerm)
  862. // if err != nil {
  863. // fmt.Println(dir+"文件夹创建失败:", err.Error())
  864. // } else {
  865. // fmt.Println(dir + "文件夹创建成功!")
  866. // }
  867. // }
  868. // }
  869. //}
  870. //func PathExists(path string) (bool, error) {
  871. // _, err := os.Stat(path)
  872. // if err == nil {
  873. // return true, nil
  874. // }
  875. // if os.IsNotExist(err) {
  876. // return false, nil
  877. // }
  878. // return false, err
  879. //}
  880. //func upload_qiniu(filePath string, keys string) {
  881. // key := keys
  882. // //上传凭证,关于凭证这块大家可以去看看官方文档
  883. // putPolicy := storage.PutPolicy{
  884. // Scope: beego.AppConfig.String("qiniu_bucket"),
  885. // }
  886. // mac := qbox.NewMac(beego.AppConfig.String("qiniu_accesskey"), beego.AppConfig.String("qiniu_secretkey"))
  887. // upToken := putPolicy.UploadToken(mac)
  888. // cfg := storage.Config{}
  889. // //空间对应机房
  890. // //其中关于Zone对象和机房的关系如下:
  891. // // 机房 Zone对象
  892. // // 华东 storage.ZoneHuadong
  893. // // 华北 storage.ZoneHuabei
  894. // // 华南 storage.ZoneHuanan
  895. // // 北美 storage.ZoneBeimei
  896. // //七牛云存储空间设置首页有存储区域
  897. // cfg.Zone = &storage.ZoneHuadong
  898. // //不启用HTTPS域名
  899. // cfg.UseHTTPS = false
  900. // //不使用CND加速
  901. // cfg.UseCdnDomains = false
  902. // //构建上传表单对象
  903. // formUploader := storage.NewFormUploader(&cfg)
  904. // ret := storage.PutRet{}
  905. // // 可选
  906. // putExtra := storage.PutExtra{
  907. // Params: map[string]string{},
  908. // }
  909. // err := formUploader.PutFile(context.Background(), &ret, upToken, key, filePath, &putExtra)
  910. // if err != nil {
  911. // fmt.Println(err)
  912. // return
  913. // }
  914. // fmt.Println(ret.Key, ret.Hash)
  915. //}