main.go 72KB

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