main.go 38KB

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