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