hbyb_service.go 90KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335
  1. package service
  2. import (
  3. "bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. "github.com/astaxie/beego"
  8. "github.com/axgle/mahonia"
  9. "io/ioutil"
  10. "net/http"
  11. "os/exec"
  12. "strconv"
  13. "strings"
  14. "time"
  15. )
  16. type Charset string
  17. const (
  18. UTF8 = Charset("UTF-8")
  19. GB18030 = Charset("GB18030")
  20. )
  21. func ConvertToString(src string, srcCode string, tagCode string) string {
  22. srcCoder := mahonia.NewDecoder(srcCode)
  23. srcResult := srcCoder.ConvertString(src)
  24. tagCoder := mahonia.NewDecoder(tagCode)
  25. _, cdata, _ := tagCoder.Translate([]byte(srcResult), true)
  26. result := string(cdata)
  27. return result
  28. }
  29. // 人员基本信息
  30. func Hbyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string) (string, string) {
  31. //生成签名
  32. nonce := GetRandomString(32)
  33. timestamp := time.Now().Unix()
  34. //生成输入报文
  35. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  36. input := make(map[string]interface{})
  37. inputData := make(map[string]interface{})
  38. inputMessage["infno"] = "1101" // 交易编码
  39. if certificates == "3" {
  40. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  41. inputData["certno"] = certNo // 证件号码
  42. inputData["psn_cert_type"] = "99" // 人员证件类型
  43. } else {
  44. if id_card_type == 1 {
  45. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  46. inputData["card_sn"] = "" // 卡识别码
  47. inputData["certno"] = "" // 证件号码
  48. inputData["psn_cert_type"] = "" // 人员证件类型
  49. } else if id_card_type == 4 {
  50. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  51. inputData["card_sn"] = "" // 卡识别码
  52. inputData["certno"] = "" // 证件号码
  53. inputData["psn_cert_type"] = "" // 人员证件类型
  54. } else {
  55. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  56. inputData["card_sn"] = "" // 卡识别码
  57. inputData["certno"] = certNo // 证件号码
  58. inputData["psn_cert_type"] = "01" // 人员证件类型
  59. }
  60. }
  61. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  62. inputData["begntime"] = "" // 开始时间
  63. inputData["psn_name"] = "" // 人员姓名
  64. input["data"] = inputData
  65. inputMessage["input"] = input //交易输入
  66. var inputLog string
  67. bytesData, err := json.Marshal(inputMessage)
  68. inputLog = string(bytesData)
  69. fmt.Println(string(bytesData))
  70. if err != nil {
  71. fmt.Println(err.Error())
  72. return err.Error(), ""
  73. }
  74. var json2 string
  75. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
  76. out, err := cmd.Output()
  77. if err != nil {
  78. fmt.Println("error:", err.Error())
  79. }
  80. fmt.Println(string(out))
  81. return ConvertToString(string(out), "gbk", "utf-8"), inputLog
  82. }
  83. // 门诊挂号
  84. func Hbyb2201(psnNo string, insutype string, certNo string, org_name string, doctor string, ipt_otp_no string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, opter string, doctor_name string) (string, string) {
  85. // 生成签名
  86. nonce := GetRandomString(32)
  87. timestamp := time.Now().Unix()
  88. tempTime := time.Unix(timestamp, 0)
  89. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  90. // 生成输入报文
  91. inputMessage := SetInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  92. input := make(map[string]interface{})
  93. inputData := make(map[string]interface{})
  94. inputMessage["infno"] = "2201" // 交易编码
  95. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  96. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  97. inputData["begntime"] = timeFormatOne // 开始时间
  98. if id_card_type == 1 {
  99. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  100. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  101. } else if id_card_type == 4 {
  102. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  103. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  104. } else {
  105. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  106. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  107. }
  108. inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
  109. inputData["atddr_no"] = doctor_id // 医师编码
  110. inputData["dr_name"] = doctor_name // 医师姓名
  111. inputData["dept_code"] = dept_code // 科室编码
  112. inputData["dept_name"] = dept // 科室名称
  113. inputData["caty"] = "A03.06" // 科别
  114. input["data"] = inputData
  115. inputMessage["input"] = input //交易输入
  116. var requestLog string
  117. bytesData, err := json.Marshal(inputMessage)
  118. requestLog = string(bytesData)
  119. fmt.Println(string(bytesData))
  120. if err != nil {
  121. fmt.Println(err.Error())
  122. return err.Error(), ""
  123. }
  124. var json2 string
  125. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2201", string(bytesData), json2)
  126. out, err := cmd.Output()
  127. if err != nil {
  128. fmt.Println("error:", err.Error())
  129. }
  130. fmt.Println(string(out))
  131. return ConvertToString(string(out), "gbk", "utf-8"), requestLog
  132. }
  133. // 门诊挂号撤销
  134. func Hbyb2202(psnNo string, mdtrtId string, ipt_otp_no string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string) (string, string) {
  135. // 生成签名
  136. nonce := GetRandomString(32)
  137. timestamp := time.Now().Unix()
  138. // 生成输入报文
  139. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  140. input := make(map[string]interface{})
  141. inputData := make(map[string]interface{})
  142. inputMessage["infno"] = "2202" // 交易编码
  143. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  144. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  145. inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
  146. input["data"] = inputData
  147. inputMessage["input"] = input //交易输入
  148. var requestLog string
  149. bytesData, err := json.Marshal(inputMessage)
  150. fmt.Println(string(bytesData))
  151. requestLog = string(bytesData)
  152. if err != nil {
  153. fmt.Println(err.Error())
  154. return err.Error(), ""
  155. }
  156. var json2 string
  157. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2202", string(bytesData), json2)
  158. out, err := cmd.Output()
  159. if err != nil {
  160. fmt.Println("error:", err.Error())
  161. }
  162. fmt.Println(string(out))
  163. return ConvertToString(string(out), "gbk", "utf-8"), requestLog
  164. }
  165. // 门诊就诊信息上传
  166. func Hbyb2203(psnNo string, mdtrtId string, doctor string, department string, org_name string, med_type string, doctor_id string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string, dept string, config []*models.HisXtDiagnoseConfig, begin_time string, doctor_name string, opter string) (string, string) {
  167. // 生成签名
  168. nonce := GetRandomString(32)
  169. timestamp := time.Now().Unix()
  170. tempTime := time.Unix(timestamp, 0)
  171. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  172. // 生成输入报文
  173. inputMessage := SetInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  174. input := make(map[string]interface{})
  175. inputData := make(map[string]interface{})
  176. diseinfo := make([]map[string]interface{}, 0)
  177. inputMessage["infno"] = "2203" // 交易编码
  178. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  179. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  180. //inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  181. inputData["begntime"] = begin_time // 开始时间
  182. //inputData["begntime"] = // 开始时间
  183. inputData["main_cond_dscr"] = "" // 主要病情描述
  184. inputData["dise_codg"] = sick_code // 病种编码
  185. inputData["dise_name"] = sick_name // 病种名称
  186. inputData["birctrl_type"] = "" // 计划生育手术类别
  187. inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  188. if insuplc_admdvs == "421300" {
  189. if med_type == "11" || med_type == "1111" || med_type == "1112" {
  190. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  191. } else if med_type == "14" {
  192. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  193. }
  194. } else {
  195. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  196. }
  197. for index, item := range config {
  198. diseinfo_sun := make(map[string]interface{})
  199. diseinfo_sun["diag_type"] = "1" // 诊断类别
  200. diseinfo_sun["diag_srt_no"] = index // 诊断排序号
  201. diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
  202. diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
  203. diseinfo_sun["diag_dept"] = department // 诊断科室
  204. diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  205. diseinfo_sun["dise_dor_name"] = doctor_name // 诊断医生姓名
  206. diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  207. diseinfo_sun["vali_flag"] = "1" // 有效标志
  208. diseinfo = append(diseinfo, diseinfo_sun)
  209. }
  210. input["diseinfo"] = diseinfo
  211. input["mdtrtinfo"] = inputData
  212. inputMessage["input"] = input //交易输入
  213. var requestLog string
  214. bytesData, err := json.Marshal(inputMessage)
  215. fmt.Println(string(bytesData))
  216. requestLog = string(bytesData)
  217. if err != nil {
  218. fmt.Println(err.Error())
  219. return err.Error(), ""
  220. }
  221. var json2 string
  222. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2203", string(bytesData), json2)
  223. out, err := cmd.Output()
  224. if err != nil {
  225. fmt.Println("error:", err.Error())
  226. }
  227. fmt.Println(string(out))
  228. return ConvertToString(string(out), "gbk", "utf-8"), requestLog
  229. }
  230. // 门诊费用明细信息上传
  231. func Hbyb2204(psnNo string, mdtrtId string, hisPrescription []*models.HisPrescription, chrg_bchno string, org_name string, doctor string, dept string, fixmedins_code string, dept_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, balance_accounts_type string, opter string) (string, string) {
  232. // 生成签名
  233. nonce := GetRandomString(32)
  234. timestamp := time.Now().Unix()
  235. //tempTime := time.Unix(timestamp, 0)
  236. //timeFormat := tempTime.Format("20060102150405")
  237. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  238. //chrgBchno := rand.Intn(100000) + 10000
  239. var customs []*Custom
  240. for _, item := range hisPrescription {
  241. tm := time.Unix(item.PreTime, 0)
  242. if item.Type == 1 { //药品
  243. for _, subItem := range item.HisDoctorAdviceInfo {
  244. if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
  245. //var randNum int
  246. //randNum = rand.Intn(10000) + 1000
  247. cus := &Custom{
  248. DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
  249. Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
  250. FeedetlSn: subItem.FeedetlSn,
  251. Price: fmt.Sprintf("%.2f", subItem.Price),
  252. MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber,
  253. HospApprFlag: subItem.BaseDrugLib.HospApprFlag,
  254. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  255. }
  256. customs = append(customs, cus)
  257. }
  258. }
  259. }
  260. if item.Type == 2 { //项目
  261. for _, subItem := range item.HisPrescriptionProject {
  262. //var randNum int
  263. //randNum = rand.Intn(10000) + 1000
  264. if subItem.Type == 2 {
  265. if len(subItem.HisProject.MedicalCode) > 0 {
  266. cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  267. cus := &Custom{
  268. DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
  269. Cut: fmt.Sprintf("%.2f", cnt),
  270. FeedetlSn: subItem.FeedetlSn,
  271. Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
  272. MedListCodg: subItem.HisProject.MedicalCode,
  273. HospApprFlag: -1,
  274. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  275. }
  276. customs = append(customs, cus)
  277. }
  278. } else if subItem.Type == 3 {
  279. if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
  280. cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  281. cus := &Custom{
  282. DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
  283. Cut: fmt.Sprintf("%.2f", cnt),
  284. FeedetlSn: subItem.FeedetlSn,
  285. Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
  286. MedListCodg: subItem.GoodInfo.MedicalInsuranceNumber,
  287. HospApprFlag: -1,
  288. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  289. }
  290. customs = append(customs, cus)
  291. }
  292. }
  293. }
  294. }
  295. for _, subItem := range item.HisAdditionalCharge {
  296. if len(subItem.XtHisAddtionConfig.Code) > 0 {
  297. cus := &Custom{
  298. DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
  299. Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
  300. FeedetlSn: subItem.FeedetlSn,
  301. Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
  302. MedListCodg: subItem.XtHisAddtionConfig.Code,
  303. HospApprFlag: -1,
  304. }
  305. customs = append(customs, cus)
  306. }
  307. }
  308. }
  309. // 生成输入报文
  310. inputMessage := SetInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  311. input := make(map[string]interface{})
  312. feedetail := make([]map[string]interface{}, 0)
  313. inputMessage["infno"] = "2204" // 交易编码
  314. //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
  315. for _, item := range customs {
  316. feedetailInfo := make(map[string]interface{})
  317. feedetailInfo["feedetl_sn"] = item.FeedetlSn
  318. feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  319. feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  320. feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
  321. feedetailInfo["dise_codg"] = "" // 病种编码
  322. feedetailInfo["rxno"] = "" // 处方号
  323. feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
  324. feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间
  325. feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
  326. feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码
  327. feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
  328. feedetailInfo["cnt"] = item.Cut // 数量
  329. feedetailInfo["pric"] = item.Price // 单价
  330. feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
  331. feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
  332. feedetailInfo["prd_days"] = "0" // 周期天数
  333. feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
  334. feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
  335. feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
  336. feedetailInfo["bilg_dr_codg"] = doctor_id // 开单医生编码
  337. feedetailInfo["bilg_dr_name"] = doctor // 开单医师姓名
  338. feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
  339. feedetailInfo["acord_dept_name"] = "" // 受单科室名称
  340. feedetailInfo["orders_dr_code"] = "" // 受单医生编码
  341. feedetailInfo["orders_dr_name"] = "" // 受单医生姓名
  342. if balance_accounts_type == "8" {
  343. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  344. } else {
  345. if item.HospApprFlag != -1 {
  346. if item.HospApprFlag == 1 {
  347. feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
  348. } else if item.HospApprFlag == 2 {
  349. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  350. } else if item.HospApprFlag == 3 {
  351. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  352. } else {
  353. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  354. }
  355. } else {
  356. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  357. }
  358. }
  359. feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
  360. feedetailInfo["etip_flag"] = "" // 外检标志
  361. feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
  362. feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
  363. feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
  364. feedetail = append(feedetail, feedetailInfo)
  365. }
  366. input["feedetail"] = feedetail
  367. inputMessage["input"] = input //交易输入
  368. var requestLog string
  369. bytesData, err := json.Marshal(inputMessage)
  370. fmt.Println("----------")
  371. fmt.Println(string(bytesData))
  372. fmt.Println("----------")
  373. requestLog = string(bytesData)
  374. if err != nil {
  375. fmt.Println(err.Error())
  376. return "", ""
  377. }
  378. var json2 string
  379. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2204", string(bytesData), json2)
  380. out, err := cmd.Output()
  381. if err != nil {
  382. fmt.Println("error:", err.Error())
  383. }
  384. fmt.Println(string(out))
  385. return ConvertToString(string(out), "gbk", "utf-8"), requestLog
  386. }
  387. // 门诊费用明细信息撤销
  388. func Hbyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string) (string, string) {
  389. // 生成签名
  390. nonce := GetRandomString(32)
  391. timestamp := time.Now().Unix()
  392. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  393. input := make(map[string]interface{})
  394. inputData := make(map[string]interface{})
  395. inputMessage["infno"] = "2205" // 交易编码
  396. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  397. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  398. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  399. input["data"] = inputData
  400. inputMessage["input"] = input //交易输入
  401. bytesData, err := json.Marshal(inputMessage)
  402. fmt.Println(string(bytesData))
  403. var requestLog string
  404. requestLog = string(bytesData)
  405. if err != nil {
  406. fmt.Println(err.Error())
  407. return err.Error(), ""
  408. }
  409. var json2 string
  410. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2205", string(bytesData), json2)
  411. out, err := cmd.Output()
  412. if err != nil {
  413. fmt.Println("error:", err.Error())
  414. }
  415. fmt.Println(string(out))
  416. return ConvertToString(string(out), "gbk", "utf-8"), requestLog
  417. }
  418. // 门诊预结算
  419. //func Hbyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, secret_key string) string {
  420. func Hbyb2206(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64) (string, string) {
  421. // 生成签名
  422. nonce := GetRandomString(32)
  423. timestamp := time.Now().Unix()
  424. // 生成输入报文
  425. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  426. input := make(map[string]interface{})
  427. inputData := make(map[string]interface{})
  428. inputMessage["infno"] = "2206" // 交易编码
  429. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  430. if certificates == 3 {
  431. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  432. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  433. } else {
  434. if id_card_type == 1 {
  435. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  436. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  437. } else {
  438. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  439. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  440. }
  441. }
  442. if med_type == "1111" || med_type == "1112" {
  443. med_type = "11"
  444. }
  445. if insuplc_admdvs == "421300" {
  446. if med_type == "11" || med_type == "1111" || med_type == "1112" {
  447. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  448. } else if med_type == "14" {
  449. inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
  450. }
  451. } else {
  452. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  453. }
  454. inputData["medfee_sumamt"] = total // 医疗费总额
  455. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  456. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  457. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  458. inputData["acct_used_flag"] = "0" // 个人账户使用标志 0否 1是
  459. inputData["insutype"] = insutype // 险种类型
  460. inputData["invono"] = "" // 发票号
  461. input["data"] = inputData
  462. inputMessage["input"] = input //交易输入
  463. var requestLog string
  464. bytesData, err := json.Marshal(inputMessage)
  465. requestLog = string(bytesData)
  466. fmt.Println(string(bytesData))
  467. if err != nil {
  468. fmt.Println(err.Error())
  469. return err.Error(), ""
  470. }
  471. var json2 string
  472. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2206", string(bytesData), json2)
  473. out, err := cmd.Output()
  474. if err != nil {
  475. fmt.Println("error:", err.Error())
  476. }
  477. fmt.Println(string(out))
  478. return ConvertToString(string(out), "gbk", "utf-8"), requestLog
  479. }
  480. // 门诊结算
  481. func Hbyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag int64) (string, string) {
  482. // 生成签名
  483. nonce := GetRandomString(32)
  484. timestamp := time.Now().Unix()
  485. // 生成输入报文
  486. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  487. input := make(map[string]interface{})
  488. inputData := make(map[string]interface{})
  489. inputMessage["infno"] = "2207" // 交易编码
  490. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  491. if certificates == 3 {
  492. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  493. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  494. } else {
  495. if id_card_type == 1 {
  496. inputData["mdtrt_cert_type"] = "" // 就诊凭证类型
  497. inputData["mdtrt_cert_no"] = "" // 就诊凭证编号
  498. } else {
  499. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  500. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  501. }
  502. }
  503. if med_type == "1111" || med_type == "1112" {
  504. med_type = "11"
  505. }
  506. if insuplc_admdvs == "421300" {
  507. if med_type == "11" || med_type == "1111" || med_type == "1112" {
  508. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  509. } else if med_type == "14" {
  510. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  511. }
  512. } else {
  513. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  514. }
  515. inputData["medfee_sumamt"] = total // 医疗费总额
  516. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  517. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  518. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  519. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  520. inputData["insutype"] = insutype // 险种类型
  521. inputData["invono"] = "" // 发票号
  522. inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
  523. inputData["overlmt_selfpay"] = overlmt_selfpay //
  524. inputData["preselfpay_amt"] = preselfpay_amt //
  525. inputData["inscp_scp_amt"] = inscp_scp_amt //
  526. input["data"] = inputData
  527. inputMessage["input"] = input //交易输入
  528. bytesData, err := json.Marshal(inputMessage)
  529. fmt.Println(string(bytesData))
  530. if err != nil {
  531. fmt.Println(err.Error())
  532. return err.Error(), ""
  533. }
  534. var json2 string
  535. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2207", string(bytesData), json2)
  536. out, err := cmd.Output()
  537. if err != nil {
  538. fmt.Println("error:", err.Error())
  539. }
  540. mjson, _ := json.Marshal(inputMessage)
  541. str2 := string(mjson)
  542. fmt.Println(string(out))
  543. return ConvertToString(string(out), "gbk", "utf-8"), str2
  544. }
  545. // 门诊结算撤销
  546. func Hbyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
  547. // 生成签名
  548. nonce := GetRandomString(32)
  549. timestamp := time.Now().Unix()
  550. // 生成输入报文
  551. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  552. input := make(map[string]interface{})
  553. inputData := make(map[string]interface{})
  554. inputMessage["infno"] = "2208" // 交易编码
  555. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  556. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  557. inputData["setl_id"] = setlId // 结算 ID
  558. input["data"] = inputData
  559. inputMessage["input"] = input //交易输入
  560. bytesData, err := json.Marshal(inputMessage)
  561. fmt.Println(string(bytesData))
  562. if err != nil {
  563. fmt.Println(err.Error())
  564. return err.Error(), ""
  565. }
  566. var json2 string
  567. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2208", string(bytesData), json2)
  568. out, err := cmd.Output()
  569. if err != nil {
  570. fmt.Println("error:", err.Error())
  571. }
  572. mjson, _ := json.Marshal(inputMessage)
  573. str2 := string(mjson)
  574. fmt.Println(string(out))
  575. return ConvertToString(string(out), "gbk", "utf-8"), str2
  576. }
  577. func Hbyb5203(baseParams models.BaseParams, businessParams models.BusinessParams, med_type string) string {
  578. // 生成签名
  579. nonce := GetRandomString(32)
  580. timestamp := time.Now().Unix()
  581. // 生成输入报文
  582. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  583. input := make(map[string]interface{})
  584. inputData := make(map[string]interface{})
  585. inputMessage["infno"] = "5203" // 交易编码
  586. inputData["psn_no"] = businessParams.PsnNo
  587. inputData["setl_id"] = businessParams.SetlId
  588. inputData["mdtrt_id"] = businessParams.MdtrtId
  589. //inputData["med_type"] = med_type
  590. fmt.Println(med_type)
  591. input["data"] = inputData
  592. inputMessage["input"] = input //交易输入
  593. bytesData, err := json.Marshal(inputMessage)
  594. fmt.Println(string(bytesData))
  595. if err != nil {
  596. fmt.Println(err.Error())
  597. return err.Error()
  598. }
  599. var json2 string
  600. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "2208", string(bytesData), json2)
  601. out, err := cmd.Output()
  602. if err != nil {
  603. fmt.Println("error:", err.Error())
  604. }
  605. //mjson, _ := json.Marshal(inputMessage)
  606. //str2 := string(mjson)
  607. fmt.Println(string(out))
  608. return ConvertToString(string(out), "gbk", "utf-8")
  609. }
  610. //确认订单
  611. func Hbyb6201(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, order models.HisOrder) string {
  612. // 生成签名
  613. nonce := GetRandomString(32)
  614. timestamp := time.Now().Unix()
  615. signature := setSignature(timestamp, nonce, secret_key)
  616. // 生成输入报文
  617. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  618. input := make(map[string]interface{})
  619. inputData := make(map[string]interface{})
  620. inputMessage["infno"] = "6201" // 交易编码
  621. inputData["mdtrt_id"] = order.MdtrtId
  622. inputData["chrg_bchno"] = order.Number
  623. inputData["psn_no"] = order.PsnNo
  624. inputData["psn_name"] = order.PsnName
  625. inputData["psn_cert_type"] = order.PsnCertType
  626. inputData["certno"] = order.Certno
  627. inputData["insutype"] = order.Insutype
  628. inputData["med_type"] = order.MedType
  629. inputData["medfee_sumamt"] = order.MedfeeSumamt
  630. inputData["fulamt_ownpay_amt"] = order.FulamtOwnpayAmt
  631. inputData["overlmt_selfpay"] = order.OverlmtSelfPay
  632. inputData["preselfpay_amt"] = order.PreselfpayAmt
  633. inputData["inscp_scp_amt"] = order.InscpScpAmt
  634. inputData["act_pay_dedc"] = order.ActPayDedc
  635. inputData["hifp_pay"] = order.HifpPay
  636. inputData["pool_prop_selfpay"] = order.PoolPropSelfpay
  637. inputData["cvlserv_pay"] = order.CvlservPay
  638. inputData["hifes_pay"] = order.HifesPay
  639. inputData["hifmi_pay"] = order.HifmiPay
  640. inputData["hifob_pay"] = order.HifobPay
  641. inputData["maf_pay"] = order.MafPay
  642. inputData["oth_pay"] = order.OthPay
  643. inputData["fund_pay_sumamt"] = order.FundPaySumamt
  644. inputData["psn_part_amt"] = order.PsnPartAmt
  645. inputData["acct_pay"] = order.AcctPay
  646. inputData["psn_cash_pay"] = order.PsnCashPay
  647. inputData["hosp_part_amt"] = order.HospPartAmt
  648. inputData["acct_mulaid_pay"] = order.AcctMulaidPay
  649. input["data"] = inputData
  650. inputMessage["input"] = input //交易输入
  651. bytesData, err := json.Marshal(inputMessage)
  652. fmt.Println(string(bytesData))
  653. if err != nil {
  654. fmt.Println(err.Error())
  655. return err.Error()
  656. }
  657. reader := bytes.NewReader(bytesData)
  658. gdyb_url := beego.AppConfig.String("gdyb_url")
  659. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  660. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  661. url := gdyb_url + "6201"
  662. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/6201"
  663. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/6201"
  664. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
  665. request, err := http.NewRequest("POST", url, reader)
  666. if err != nil {
  667. fmt.Println(err.Error())
  668. return err.Error()
  669. }
  670. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  671. request.Header.Set("x-tif-paasid", gdyb_paasid)
  672. request.Header.Set("x-tif-signature", signature)
  673. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  674. request.Header.Set("x-tif-nonce", nonce)
  675. client := http.Client{}
  676. resp, err := client.Do(request)
  677. if err != nil {
  678. fmt.Println(err.Error())
  679. return err.Error()
  680. }
  681. respBytes, err := ioutil.ReadAll(resp.Body)
  682. if err != nil {
  683. fmt.Println(err.Error())
  684. return err.Error()
  685. }
  686. str := string(respBytes)
  687. fmt.Println(str)
  688. return str
  689. }
  690. // 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
  691. func Hbyb3201(baseParams models.BaseParams, businessParams models.BusinessParams) string {
  692. fmt.Println("11222333-----")
  693. fmt.Println(baseParams)
  694. fmt.Println(businessParams)
  695. // 生成签名
  696. nonce := GetRandomString(32)
  697. timestamp := time.Now().Unix()
  698. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  699. // 生成输入报文
  700. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  701. input := make(map[string]interface{})
  702. inputData := make(map[string]interface{})
  703. inputMessage["infno"] = "3201" // 交易编码
  704. inputData["insutype"] = businessParams.Insutype // 险种
  705. inputData["clr_type"] = businessParams.ClrType // 就诊 ID(来自2201接口返回)
  706. inputData["setl_optins"] = baseParams.InsuplcAdmdvs // 结算经办机构
  707. inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
  708. inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
  709. inputData["medfee_sumamt"] = businessParams.MedfeeSumamt //医疗费总额
  710. inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
  711. inputData["acct_pay"] = businessParams.AcctPay //个人账户支付金额
  712. inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
  713. inputData["refd_setl_flag"] = 0 // 就诊 ID(来自2201接口返回)
  714. input["data"] = inputData
  715. inputMessage["input"] = input //交易输入
  716. bytesData, err := json.Marshal(inputMessage)
  717. fmt.Println(string(bytesData))
  718. if err != nil {
  719. fmt.Println(err.Error())
  720. return err.Error()
  721. }
  722. reader := bytes.NewReader(bytesData)
  723. gdyb_url := beego.AppConfig.String("gdyb_url")
  724. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  725. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  726. url := gdyb_url + "3201"
  727. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3201"
  728. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
  729. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3201"
  730. request, err := http.NewRequest("POST", url, reader)
  731. if err != nil {
  732. fmt.Println(err.Error())
  733. return err.Error()
  734. }
  735. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  736. request.Header.Set("x-tif-paasid", gdyb_paasid)
  737. request.Header.Set("x-tif-signature", signature)
  738. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  739. request.Header.Set("x-tif-nonce", nonce)
  740. client := http.Client{}
  741. resp, err := client.Do(request)
  742. if err != nil {
  743. fmt.Println(err.Error())
  744. return err.Error()
  745. }
  746. respBytes, err := ioutil.ReadAll(resp.Body)
  747. if err != nil {
  748. fmt.Println(err.Error())
  749. return err.Error()
  750. }
  751. str := string(respBytes)
  752. fmt.Println(str)
  753. return str
  754. }
  755. func Hbyb3202a(baseParams models.BaseParams, businessParams models.BusinessParams) string {
  756. fmt.Println("11222333-----")
  757. fmt.Println(baseParams)
  758. fmt.Println(businessParams)
  759. // 生成签名
  760. nonce := GetRandomString(32)
  761. timestamp := time.Now().Unix()
  762. // 生成输入报文
  763. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  764. input := make(map[string]interface{})
  765. inputData := make(map[string]interface{})
  766. inputMessage["infno"] = "3202a" // 交易编码
  767. inputData["insutype"] = businessParams.Insutype // 险种
  768. inputData["clr_type"] = businessParams.ClrType // 就诊 ID(来自2201接口返回)
  769. inputData["setl_optins"] = businessParams.SetlOptins // 结算经办机构
  770. inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
  771. inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
  772. inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
  773. inputData["acct_pay"] = businessParams.AcctPay //个人账户支付金额
  774. input["clrdata"] = inputData
  775. inputMessage["input"] = input //交易输入
  776. bytesData, err := json.Marshal(inputMessage)
  777. fmt.Println(string(bytesData))
  778. if err != nil {
  779. fmt.Println(err.Error())
  780. return err.Error()
  781. }
  782. var json2 string
  783. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "3202a", string(bytesData), json2)
  784. out, err := cmd.Output()
  785. if err != nil {
  786. fmt.Println("error:", err.Error())
  787. }
  788. fmt.Println(string(out))
  789. return ConvertToString(string(out), "gbk", "utf-8")
  790. }
  791. //文件上传
  792. //文件上传
  793. func Hbyb9101(baseParams models.BaseParams, file_name string, file_byte []byte) string {
  794. // 生成签名
  795. nonce := GetRandomString(32)
  796. timestamp := time.Now().Unix()
  797. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  798. buf := new(bytes.Buffer)
  799. buf.ReadFrom(strings.NewReader(string(file_byte)))
  800. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  801. input := make(map[string]interface{})
  802. inputData := make(map[string]interface{})
  803. inputMessage["infno"] = "9101" // 交易编码
  804. inputData["file_name"] = file_name //文件名
  805. inputData["in"] = file_byte //文件数据
  806. inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
  807. input["fsUploadIn"] = inputData
  808. inputMessage["input"] = input //交易输入
  809. bytesData, err := json.Marshal(inputMessage)
  810. fmt.Println(string(bytesData))
  811. if err != nil {
  812. fmt.Println(err.Error())
  813. return err.Error()
  814. }
  815. reader := bytes.NewReader(bytesData)
  816. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9101"
  817. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
  818. gdyb_url := beego.AppConfig.String("gdyb_url")
  819. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  820. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  821. url := gdyb_url + "9101"
  822. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
  823. request, err := http.NewRequest("POST", url, reader)
  824. if err != nil {
  825. fmt.Println(err.Error())
  826. return err.Error()
  827. }
  828. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  829. request.Header.Set("x-tif-paasid", gdyb_paasid)
  830. request.Header.Set("x-tif-signature", signature)
  831. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  832. request.Header.Set("x-tif-nonce", nonce)
  833. client := http.Client{}
  834. resp, err := client.Do(request)
  835. if err != nil {
  836. fmt.Println(err.Error())
  837. return err.Error()
  838. }
  839. respBytes, err := ioutil.ReadAll(resp.Body)
  840. if err != nil {
  841. fmt.Println(err.Error())
  842. return err.Error()
  843. }
  844. str := string(respBytes)
  845. fmt.Println(str)
  846. return str
  847. }
  848. func Hbyb9102(baseParams models.BaseParams, file_name string, file_qury_no string) string {
  849. // 生成签名
  850. nonce := GetRandomString(32)
  851. timestamp := time.Now().Unix()
  852. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  853. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  854. input := make(map[string]interface{})
  855. inputData := make(map[string]interface{})
  856. inputMessage["infno"] = "9102" // 交易编码
  857. inputData["file_name"] = file_name //文件名
  858. inputData["file_qury_no"] = file_qury_no //文件数据
  859. inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
  860. input["fsDownloadIn"] = inputData
  861. inputMessage["input"] = input //交易输入
  862. bytesData, err := json.Marshal(inputMessage)
  863. fmt.Println(string(bytesData))
  864. if err != nil {
  865. fmt.Println(err.Error())
  866. return err.Error()
  867. }
  868. reader := bytes.NewReader(bytesData)
  869. gdyb_url := beego.AppConfig.String("gdyb_url")
  870. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  871. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  872. url := gdyb_url + "9102"
  873. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9102"
  874. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
  875. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
  876. request, err := http.NewRequest("POST", url, reader)
  877. if err != nil {
  878. fmt.Println(err.Error())
  879. return err.Error()
  880. }
  881. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  882. request.Header.Set("x-tif-paasid", gdyb_paasid)
  883. request.Header.Set("x-tif-signature", signature)
  884. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  885. request.Header.Set("x-tif-nonce", nonce)
  886. client := http.Client{}
  887. resp, err := client.Do(request)
  888. if err != nil {
  889. fmt.Println(err.Error())
  890. return err.Error()
  891. }
  892. respBytes, err := ioutil.ReadAll(resp.Body)
  893. if err != nil {
  894. fmt.Println(err.Error())
  895. return err.Error()
  896. }
  897. str := string(respBytes)
  898. fmt.Println(str)
  899. return str
  900. }
  901. func Hbyb3202(baseParams models.BaseParams, businessParams models.BusinessParams) string {
  902. // 生成签名
  903. nonce := GetRandomString(32)
  904. timestamp := time.Now().Unix()
  905. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  906. // 生成输入报文
  907. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  908. input := make(map[string]interface{})
  909. inputData := make(map[string]interface{})
  910. inputMessage["infno"] = "3202" // 交易编码
  911. inputData["file_qury_no"] = businessParams.FileQuryNo // 险种
  912. inputData["setl_optins"] = baseParams.InsuplcAdmdvs // 结算经办机构
  913. inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
  914. inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
  915. inputData["medfee_sumamt"] = businessParams.MedfeeSumamt //医疗费总额
  916. inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
  917. inputData["cash_payamt"] = businessParams.CashPayamt //现金支付金额
  918. inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
  919. inputData["clr_type"] = "11" // 就诊 ID(来自2201接口返回)
  920. inputData["refd_setl_flag"] = 1 // 就诊 ID(来自2201接口返回)
  921. input["data"] = inputData
  922. inputMessage["input"] = input //交易输入
  923. bytesData, err := json.Marshal(inputMessage)
  924. fmt.Println(string(bytesData))
  925. if err != nil {
  926. fmt.Println(err.Error())
  927. return err.Error()
  928. }
  929. reader := bytes.NewReader(bytesData)
  930. gdyb_url := beego.AppConfig.String("gdyb_url")
  931. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  932. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  933. url := gdyb_url + "3202"
  934. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3202"
  935. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
  936. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
  937. request, err := http.NewRequest("POST", url, reader)
  938. if err != nil {
  939. fmt.Println(err.Error())
  940. return err.Error()
  941. }
  942. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  943. request.Header.Set("x-tif-paasid", gdyb_paasid)
  944. request.Header.Set("x-tif-signature", signature)
  945. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  946. request.Header.Set("x-tif-nonce", nonce)
  947. client := http.Client{}
  948. resp, err := client.Do(request)
  949. if err != nil {
  950. fmt.Println(err.Error())
  951. return err.Error()
  952. }
  953. respBytes, err := ioutil.ReadAll(resp.Body)
  954. if err != nil {
  955. fmt.Println(err.Error())
  956. return err.Error()
  957. }
  958. str := string(respBytes)
  959. fmt.Println(str)
  960. return str
  961. }
  962. //func Hbyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
  963. // // 生成签名
  964. // nonce := GetRandomString(32)
  965. // timestamp := time.Now().Unix()
  966. // signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  967. //
  968. // // 生成输入报文
  969. // inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  970. // input := make(map[string]interface{})
  971. // inputData := make(map[string]interface{})
  972. // inputMessage["infno"] = "2001" // 交易编码
  973. // inputData["psn_no"] = psn_no
  974. // inputData["insutype"] = insutype
  975. // inputData["med_type"] = med_type
  976. // inputData["begntime"] = "2021-01-01 00:00:00"
  977. // input["data"] = inputData
  978. // inputMessage["input"] = input //交易输入
  979. // bytesData, err := json.Marshal(inputMessage)
  980. // fmt.Println(string(bytesData))
  981. // if err != nil {
  982. // fmt.Println(err.Error())
  983. // return err.Error()
  984. // }
  985. // reader := bytes.NewReader(bytesData)
  986. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
  987. //
  988. // gdyb_url := beego.AppConfig.String("gdyb_url")
  989. // gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  990. //
  991. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  992. // url := gdyb_url + "2001"
  993. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
  994. // request, err := http.NewRequest("POST", url, reader)
  995. // if err != nil {
  996. // fmt.Println(err.Error())
  997. // return err.Error()
  998. // }
  999. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1000. // request.Header.Set("x-tif-paasid", gdyb_paasid)
  1001. // request.Header.Set("x-tif-signature", signature)
  1002. // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1003. // request.Header.Set("x-tif-nonce", nonce)
  1004. // client := http.Client{}
  1005. // resp, err := client.Do(request)
  1006. // if err != nil {
  1007. // fmt.Println(err.Error())
  1008. // return err.Error()
  1009. // }
  1010. // respBytes, err := ioutil.ReadAll(resp.Body)
  1011. // if err != nil {
  1012. // fmt.Println(err.Error())
  1013. // return err.Error()
  1014. // }
  1015. // str := string(respBytes)
  1016. // fmt.Println(str)
  1017. // return str
  1018. //}
  1019. func Hbyb3301(baseParams *models.BaseParams, name string, codg string, list_type_code string, start_time string, ent_time string, list_type string) string {
  1020. // 生成签名
  1021. nonce := GetRandomString(32)
  1022. timestamp := time.Now().Unix()
  1023. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  1024. // 生成输入报文
  1025. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  1026. input := make(map[string]interface{})
  1027. inputData := make(map[string]interface{})
  1028. inputMessage["infno"] = "3301" // 交易编码
  1029. inputData["fixmedins_hilist_id"] = codg
  1030. inputData["fixmedins_hilist_name"] = name
  1031. inputData["list_type"] = list_type
  1032. inputData["med_list_codg"] = codg
  1033. inputData["begndate"] = start_time
  1034. inputData["enddate"] = ent_time
  1035. inputData["aprvno"] = ""
  1036. inputData["dosform"] = ""
  1037. inputData["exct_cont"] = ""
  1038. inputData["item_cont"] = ""
  1039. inputData["prcunt"] = ""
  1040. inputData["spec"] = ""
  1041. inputData["pacspec"] = ""
  1042. inputData["memo"] = ""
  1043. input["data"] = inputData
  1044. inputMessage["input"] = input //交易输入
  1045. bytesData, err := json.Marshal(inputMessage)
  1046. fmt.Println(string(bytesData))
  1047. if err != nil {
  1048. fmt.Println(err.Error())
  1049. return err.Error()
  1050. }
  1051. reader := bytes.NewReader(bytesData)
  1052. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
  1053. //
  1054. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
  1055. gdyb_url := beego.AppConfig.String("gdyb_url")
  1056. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1057. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1058. url := gdyb_url + "3301"
  1059. request, err := http.NewRequest("POST", url, reader)
  1060. if err != nil {
  1061. fmt.Println(err.Error())
  1062. return err.Error()
  1063. }
  1064. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1065. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1066. request.Header.Set("x-tif-signature", signature)
  1067. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1068. request.Header.Set("x-tif-nonce", nonce)
  1069. client := http.Client{}
  1070. resp, err := client.Do(request)
  1071. if err != nil {
  1072. fmt.Println(err.Error())
  1073. return err.Error()
  1074. }
  1075. respBytes, err := ioutil.ReadAll(resp.Body)
  1076. if err != nil {
  1077. fmt.Println(err.Error())
  1078. return err.Error()
  1079. }
  1080. str := string(respBytes)
  1081. fmt.Println(str)
  1082. return str
  1083. }
  1084. func Hbyb3302(baseParams *models.BaseParams, name string, codg string, list_type_code string) string {
  1085. // 生成签名
  1086. nonce := GetRandomString(32)
  1087. timestamp := time.Now().Unix()
  1088. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  1089. // 生成输入报文
  1090. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  1091. input := make(map[string]interface{})
  1092. inputData := make(map[string]interface{})
  1093. inputMessage["infno"] = "3302" // 交易编码
  1094. inputData["fixmedins_code"] = baseParams.FixmedinsCode
  1095. inputData["fixmedins_hilist_id"] = codg
  1096. inputData["list_type"] = list_type_code
  1097. inputData["med_list_codg"] = codg
  1098. input["data"] = inputData
  1099. inputMessage["input"] = input //交易输入
  1100. bytesData, err := json.Marshal(inputMessage)
  1101. fmt.Println(string(bytesData))
  1102. if err != nil {
  1103. fmt.Println(err.Error())
  1104. return err.Error()
  1105. }
  1106. reader := bytes.NewReader(bytesData)
  1107. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3302"
  1108. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3302"
  1109. gdyb_url := beego.AppConfig.String("gdyb_url")
  1110. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1111. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1112. url := gdyb_url + "3302"
  1113. request, err := http.NewRequest("POST", url, reader)
  1114. if err != nil {
  1115. fmt.Println(err.Error())
  1116. return err.Error()
  1117. }
  1118. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1119. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1120. request.Header.Set("x-tif-signature", signature)
  1121. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1122. request.Header.Set("x-tif-nonce", nonce)
  1123. client := http.Client{}
  1124. resp, err := client.Do(request)
  1125. if err != nil {
  1126. fmt.Println(err.Error())
  1127. return err.Error()
  1128. }
  1129. respBytes, err := ioutil.ReadAll(resp.Body)
  1130. if err != nil {
  1131. fmt.Println(err.Error())
  1132. return err.Error()
  1133. }
  1134. str := string(respBytes)
  1135. fmt.Println(str)
  1136. return str
  1137. }
  1138. func Hbyb2505(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, start_time string, end_time string) string {
  1139. // 生成签名
  1140. nonce := GetRandomString(32)
  1141. timestamp := time.Now().Unix()
  1142. signature := setSignature(timestamp, nonce, secret_key)
  1143. // 生成输入报文
  1144. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1145. input := make(map[string]interface{})
  1146. inputData := make(map[string]interface{})
  1147. inputMessage["infno"] = "2505"
  1148. inputData["psn_no"] = psnNo
  1149. inputData["biz_appy_type"] = "03"
  1150. inputData["begndate"] = start_time
  1151. inputData["enddate"] = end_time
  1152. inputData["fixmedins_code"] = fixmedins_code
  1153. inputData["fixmedins_name"] = org_name
  1154. inputData["tel"] = ""
  1155. inputData["addr"] = ""
  1156. inputData["agnter_name"] = ""
  1157. inputData["agnter_cert_type"] = ""
  1158. inputData["agnter_certno"] = ""
  1159. inputData["agnter_tel"] = ""
  1160. inputData["agnter_addr"] = ""
  1161. inputData["agnter_rlts"] = ""
  1162. inputData["fix_srt_no"] = ""
  1163. inputData["memo"] = ""
  1164. input["data"] = inputData
  1165. inputMessage["input"] = input //交易输入
  1166. bytesData, err := json.Marshal(inputMessage)
  1167. if err != nil {
  1168. fmt.Println(err.Error())
  1169. return err.Error()
  1170. }
  1171. reader := bytes.NewReader(bytesData)
  1172. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
  1173. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2505"
  1174. gdyb_url := beego.AppConfig.String("gdyb_url")
  1175. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1176. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1177. url := gdyb_url + "2505"
  1178. request, err := http.NewRequest("POST", url, reader)
  1179. if err != nil {
  1180. fmt.Println(err.Error())
  1181. return err.Error()
  1182. }
  1183. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1184. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1185. request.Header.Set("x-tif-signature", signature)
  1186. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1187. request.Header.Set("x-tif-nonce", nonce)
  1188. client := http.Client{}
  1189. resp, err := client.Do(request)
  1190. if err != nil {
  1191. fmt.Println(err.Error())
  1192. return err.Error()
  1193. }
  1194. respBytes, err := ioutil.ReadAll(resp.Body)
  1195. if err != nil {
  1196. fmt.Println(err.Error())
  1197. return err.Error()
  1198. }
  1199. str := string(respBytes)
  1200. fmt.Println(str)
  1201. return str
  1202. }
  1203. func Hbyb2506(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn string) string {
  1204. // 生成签名
  1205. nonce := GetRandomString(32)
  1206. timestamp := time.Now().Unix()
  1207. signature := setSignature(timestamp, nonce, secret_key)
  1208. // 生成输入报文
  1209. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1210. input := make(map[string]interface{})
  1211. inputData := make(map[string]interface{})
  1212. inputMessage["infno"] = "2506"
  1213. inputData["psn_no"] = psnNo
  1214. inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn
  1215. inputData["memo"] = ""
  1216. input["data"] = inputData
  1217. inputMessage["input"] = input //交易输入
  1218. bytesData, err := json.Marshal(inputMessage)
  1219. fmt.Println(string(bytesData))
  1220. if err != nil {
  1221. fmt.Println(err.Error())
  1222. return err.Error()
  1223. }
  1224. reader := bytes.NewReader(bytesData)
  1225. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2506"
  1226. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2506"
  1227. gdyb_url := beego.AppConfig.String("gdyb_url")
  1228. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1229. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1230. url := gdyb_url + "2506"
  1231. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
  1232. request, err := http.NewRequest("POST", url, reader)
  1233. if err != nil {
  1234. fmt.Println(err.Error())
  1235. return err.Error()
  1236. }
  1237. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1238. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1239. request.Header.Set("x-tif-signature", signature)
  1240. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1241. request.Header.Set("x-tif-nonce", nonce)
  1242. client := http.Client{}
  1243. resp, err := client.Do(request)
  1244. if err != nil {
  1245. fmt.Println(err.Error())
  1246. return err.Error()
  1247. }
  1248. respBytes, err := ioutil.ReadAll(resp.Body)
  1249. if err != nil {
  1250. fmt.Println(err.Error())
  1251. return err.Error()
  1252. }
  1253. str := string(respBytes)
  1254. fmt.Println(str)
  1255. return str
  1256. }
  1257. func Hbyb2503(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string) string {
  1258. // 生成签名
  1259. nonce := GetRandomString(32)
  1260. timestamp := time.Now().Unix()
  1261. signature := setSignature(timestamp, nonce, secret_key)
  1262. tempTime := time.Unix(timestamp, 0)
  1263. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1264. timeFormatTwo := tempTime.Format("2006-01-02")
  1265. t := time.Now()
  1266. last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC)
  1267. tm := time.Unix(last.Unix(), 0)
  1268. // 生成输入报文
  1269. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1270. input := make(map[string]interface{})
  1271. inputData := make(map[string]interface{})
  1272. inputMessage["infno"] = "2503" // 交易编码
  1273. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1274. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  1275. inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
  1276. inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
  1277. inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
  1278. inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
  1279. inputData["ide_fixmedins_name"] = org_name // 险种类型(来自1101接口返回)
  1280. inputData["hosp_ide_date"] = timeFormatTwo // 险种类型(来自1101接口返回)
  1281. inputData["diag_dr_codg"] = doctor_id // 开始时间
  1282. inputData["diag_dr_name"] = doctor // 开始时间
  1283. inputData["begndate"] = timeFormatTwo // 医师编码
  1284. inputData["tel"] = "" // 医师编码
  1285. inputData["addr"] = "" // 医师编码
  1286. inputData["enddate"] = tm.Format("2006-01-02") // 医师编码
  1287. input["data"] = inputData
  1288. inputMessage["input"] = input //交易输入
  1289. bytesData, err := json.Marshal(inputMessage)
  1290. fmt.Println(string(bytesData))
  1291. if err != nil {
  1292. fmt.Println(err.Error())
  1293. return err.Error()
  1294. }
  1295. reader := bytes.NewReader(bytesData)
  1296. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
  1297. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
  1298. gdyb_url := beego.AppConfig.String("gdyb_url")
  1299. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1300. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1301. url := gdyb_url + "2503"
  1302. request, err := http.NewRequest("POST", url, reader)
  1303. if err != nil {
  1304. fmt.Println(err.Error())
  1305. return err.Error()
  1306. }
  1307. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1308. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1309. request.Header.Set("x-tif-signature", signature)
  1310. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1311. request.Header.Set("x-tif-nonce", nonce)
  1312. client := http.Client{}
  1313. resp, err := client.Do(request)
  1314. if err != nil {
  1315. fmt.Println(err.Error())
  1316. return err.Error()
  1317. }
  1318. respBytes, err := ioutil.ReadAll(resp.Body)
  1319. if err != nil {
  1320. fmt.Println(err.Error())
  1321. return err.Error()
  1322. }
  1323. str := string(respBytes)
  1324. fmt.Println(str)
  1325. return str
  1326. }
  1327. func Hbyb2504(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn string) string {
  1328. // 生成签名
  1329. nonce := GetRandomString(32)
  1330. timestamp := time.Now().Unix()
  1331. signature := setSignature(timestamp, nonce, secret_key)
  1332. // 生成输入报文
  1333. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1334. input := make(map[string]interface{})
  1335. inputData := make(map[string]interface{})
  1336. inputMessage["infno"] = "2504" // 交易编码
  1337. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1338. inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn // 人员编号 (来自1101接口返回)
  1339. inputData["memo"] = "撤销备案" // 人员编号 (来自1101接口返回)
  1340. input["data"] = inputData
  1341. inputMessage["input"] = input //交易输入
  1342. bytesData, err := json.Marshal(inputMessage)
  1343. fmt.Println(string(bytesData))
  1344. if err != nil {
  1345. fmt.Println(err.Error())
  1346. return err.Error()
  1347. }
  1348. reader := bytes.NewReader(bytesData)
  1349. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2504"
  1350. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2504"
  1351. gdyb_url := beego.AppConfig.String("gdyb_url")
  1352. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1353. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1354. url := gdyb_url + "2504"
  1355. request, err := http.NewRequest("POST", url, reader)
  1356. if err != nil {
  1357. fmt.Println(err.Error())
  1358. return err.Error()
  1359. }
  1360. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1361. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1362. request.Header.Set("x-tif-signature", signature)
  1363. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1364. request.Header.Set("x-tif-nonce", nonce)
  1365. client := http.Client{}
  1366. resp, err := client.Do(request)
  1367. if err != nil {
  1368. fmt.Println(err.Error())
  1369. return err.Error()
  1370. }
  1371. respBytes, err := ioutil.ReadAll(resp.Body)
  1372. if err != nil {
  1373. fmt.Println(err.Error())
  1374. return err.Error()
  1375. }
  1376. str := string(respBytes)
  1377. fmt.Println(str)
  1378. return str
  1379. }
  1380. //func Gdyb2503(psnNo string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string) string {
  1381. // // 生成签名
  1382. // nonce := GetRandomString(32)
  1383. // timestamp := time.Now().Unix()
  1384. // signature := setSignature(timestamp, nonce, secret_key)
  1385. // tempTime := time.Unix(timestamp, 0)
  1386. // timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1387. //
  1388. // // 生成输入报文
  1389. // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1390. // input := make(map[string]interface{})
  1391. // inputData := make(map[string]interface{})
  1392. // diseinfo := make([]map[string]interface{}, 0)
  1393. //
  1394. // inputMessage["infno"] = "2203" // 交易编码
  1395. // inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1396. // inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1397. // inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  1398. // inputData["begntime"] = timeFormatOne // 开始时间
  1399. // inputData["main_cond_dscr"] = "" // 主要病情描述
  1400. // inputData["dise_codg"] = sick_code // 病种编码
  1401. // inputData["dise_name"] = sick_name // 病种名称
  1402. // inputData["birctrl_type"] = "" // 计划生育手术类别
  1403. // inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  1404. //
  1405. // diseinfo_sun := make(map[string]interface{})
  1406. // diseinfo_sun["diag_type"] = "1" // 诊断类别
  1407. // diseinfo_sun["diag_srt_no"] = "1" // 诊断排序号
  1408. // diseinfo_sun["diag_code"] = diag_code // 诊断代码
  1409. // diseinfo_sun["diag_name"] = diag // 诊断名称
  1410. // diseinfo_sun["diag_dept"] = department // 诊断科室
  1411. // diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  1412. // diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
  1413. // diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  1414. // diseinfo_sun["vali_flag"] = "1" // 有效标志
  1415. //
  1416. // diseinfo = append(diseinfo, diseinfo_sun)
  1417. // input["diseinfo"] = diseinfo
  1418. // input["mdtrtinfo"] = inputData
  1419. // inputMessage["input"] = input //交易输入
  1420. //
  1421. // bytesData, err := json.Marshal(inputMessage)
  1422. // fmt.Println(string(bytesData))
  1423. // if err != nil {
  1424. // fmt.Println(err.Error())
  1425. // return err.Error()
  1426. // }
  1427. // reader := bytes.NewReader(bytesData)
  1428. //
  1429. // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203"
  1430. //
  1431. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
  1432. // request, err := http.NewRequest("POST", url, reader)
  1433. // if err != nil {
  1434. // fmt.Println(err.Error())
  1435. // return err.Error()
  1436. // }
  1437. //
  1438. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1439. // request.Header.Set("x-tif-paasid", "sg03_prd")
  1440. // request.Header.Set("x-tif-signature", signature)
  1441. // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1442. // request.Header.Set("x-tif-nonce", nonce)
  1443. //
  1444. // client := http.Client{}
  1445. // resp, err := client.Do(request)
  1446. // if err != nil {
  1447. // fmt.Println(err.Error())
  1448. // return err.Error()
  1449. // }
  1450. // respBytes, err := ioutil.ReadAll(resp.Body)
  1451. // if err != nil {
  1452. // fmt.Println(err.Error())
  1453. // return err.Error()
  1454. // }
  1455. // str := string(respBytes)
  1456. // fmt.Println(str)
  1457. // return str
  1458. //}
  1459. func Hbyb5301(psnNo string, insutype string, org_name string, doctor string, fixmedins_code string, doctor_id string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_name string, sick_code string) string {
  1460. // 生成签名
  1461. nonce := GetRandomString(32)
  1462. timestamp := time.Now().Unix()
  1463. signature := setSignature(timestamp, nonce, secret_key)
  1464. //tempTime := time.Unix(timestamp, 0)
  1465. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1466. //timeFormatTwo := tempTime.Format("2006-01-02")
  1467. // 生成输入报文
  1468. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1469. input := make(map[string]interface{})
  1470. inputData := make(map[string]interface{})
  1471. inputMessage["infno"] = "5301" // 交易编码
  1472. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1473. input["data"] = inputData
  1474. inputMessage["input"] = input //交易输入
  1475. bytesData, err := json.Marshal(inputMessage)
  1476. fmt.Println(string(bytesData))
  1477. if err != nil {
  1478. fmt.Println(err.Error())
  1479. return err.Error()
  1480. }
  1481. reader := bytes.NewReader(bytesData)
  1482. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
  1483. gdyb_url := beego.AppConfig.String("gdyb_url")
  1484. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1485. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1486. url := gdyb_url + "5301"
  1487. request, err := http.NewRequest("POST", url, reader)
  1488. if err != nil {
  1489. fmt.Println(err.Error())
  1490. return err.Error()
  1491. }
  1492. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1493. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1494. request.Header.Set("x-tif-signature", signature)
  1495. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1496. request.Header.Set("x-tif-nonce", nonce)
  1497. client := http.Client{}
  1498. resp, err := client.Do(request)
  1499. if err != nil {
  1500. fmt.Println(err.Error())
  1501. return err.Error()
  1502. }
  1503. respBytes, err := ioutil.ReadAll(resp.Body)
  1504. if err != nil {
  1505. fmt.Println(err.Error())
  1506. return err.Error()
  1507. }
  1508. str := string(respBytes)
  1509. fmt.Println(str)
  1510. return str
  1511. }
  1512. //
  1513. func Hbyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
  1514. // 生成签名
  1515. nonce := GetRandomString(32)
  1516. timestamp := time.Now().Unix()
  1517. // 生成输入报文
  1518. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1519. input := make(map[string]interface{})
  1520. inputData := make(map[string]interface{})
  1521. inputMessage["infno"] = "4101" // 交易编码
  1522. year := time.Now().Format("2006")
  1523. month := time.Now().Format("01")
  1524. day := time.Now().Format("02")
  1525. inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
  1526. inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
  1527. inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
  1528. inputData["fixmedins_name"] = org_name // 定点医药机构名称 必填
  1529. inputData["fixmedins_code"] = fixmedins_code // 定点医药机构编码 必填
  1530. inputData["hi_setl_lv"] = "" // 医保结算等级
  1531. inputData["hi_no"] = struct4101.PsnNo // 医保编号
  1532. inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
  1533. inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
  1534. inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
  1535. inputData["gend"] = struct4101.Gend // 性别 必填
  1536. inputData["brdy"] = struct4101.Brdy // 出生日期 必填
  1537. inputData["age"] = struct4101.Age // 年龄 必填
  1538. inputData["ntly"] = struct4101.Ntly // 国籍 必填
  1539. inputData["nwb_age"] = "" // 年龄 必填
  1540. inputData["naty"] = struct4101.Naty // 民族 必填
  1541. inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
  1542. inputData["certno"] = struct4101.Certno // 证件号码 必填
  1543. inputData["prfs"] = struct4101.Prfs // 职业 必填
  1544. inputData["curr_addr"] = "" // 现住址 必填
  1545. inputData["emp_name"] = "" // 单位名称 必填
  1546. inputData["emp_addr"] = "" // 单位地址 必填
  1547. inputData["emp_tel"] = "" // 单位电话 必填
  1548. inputData["poscode"] = "" // 邮编 必填
  1549. inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
  1550. inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
  1551. inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
  1552. inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
  1553. inputData["hi_type"] = struct4101.HiType // 医保类型 必填
  1554. inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
  1555. inputData["sp_psn_type"] = "" // 特殊人员类型 必填
  1556. inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
  1557. inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
  1558. inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
  1559. inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
  1560. inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
  1561. inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
  1562. inputData["adm_way"] = "" // 入院途径 必填
  1563. inputData["trt_type"] = "" // 治疗类别 必填
  1564. inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
  1565. inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
  1566. inputData["refldept_dept"] = "" // 转科科别 必填
  1567. inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
  1568. inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
  1569. inputData["act_ipt_days"] = "" // 实际住院天数 必填
  1570. inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
  1571. inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
  1572. inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
  1573. inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
  1574. inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
  1575. inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
  1576. inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
  1577. inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
  1578. inputData["bld_cat"] = "" // 输血品种 必填
  1579. inputData["bld_amt"] = "" // 输血量 必填
  1580. inputData["bld_unt"] = "" // 输血计量单位 必填
  1581. inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
  1582. inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
  1583. inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
  1584. inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
  1585. inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
  1586. inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
  1587. inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
  1588. inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
  1589. inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
  1590. inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
  1591. inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
  1592. inputData["chfpdr_name"] = "" // 主诊医师姓名 必填
  1593. inputData["chfpdr_code"] = "" // 主诊医师代码 必填
  1594. inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
  1595. inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
  1596. inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
  1597. inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
  1598. inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
  1599. inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
  1600. inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
  1601. inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
  1602. inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
  1603. inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
  1604. inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
  1605. payinfo := make([]map[string]interface{}, 0) // 基金支付信息
  1606. for _, item := range struct4101.CustomStruct {
  1607. payinfotemp := make(map[string]interface{})
  1608. if item.FundPayType == "310100" || item.FundPayType == "310200" || item.FundPayType == "320100" || item.FundPayType == "330100" || item.FundPayType == "340100" || item.FundPayType == "350100" || item.FundPayType == "370100" || item.FundPayType == "390100" || item.FundPayType == "610100" || item.FundPayType == "640100" || item.FundPayType == "620100" {
  1609. payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
  1610. payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
  1611. payinfo = append(payinfo, payinfotemp)
  1612. }
  1613. }
  1614. opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
  1615. opspdiseinfotemp := make(map[string]interface{})
  1616. opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 诊断名称 必填
  1617. opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 诊断代码 必填
  1618. opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
  1619. opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
  1620. opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
  1621. diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
  1622. for _, item := range struct4101.Diseinfo {
  1623. diseinfotemp := make(map[string]interface{})
  1624. diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
  1625. diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
  1626. diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
  1627. diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
  1628. diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
  1629. diseinfo = append(diseinfo, diseinfotemp)
  1630. }
  1631. iteminfo := make([]map[string]interface{}, 0)
  1632. for _, item := range struct4101.IteminfoStruct {
  1633. iteminfotemp := make(map[string]interface{})
  1634. iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
  1635. iteminfotemp["amt"] = item.Amt // 金额 必填
  1636. iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
  1637. iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
  1638. iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
  1639. iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
  1640. iteminfo = append(iteminfo, iteminfotemp)
  1641. }
  1642. oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
  1643. oprninfotemp := make(map[string]interface{})
  1644. oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
  1645. oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
  1646. oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
  1647. oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
  1648. oprninfotemp["anst_way"] = "" // 麻醉方式 必填
  1649. oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
  1650. oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
  1651. oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
  1652. oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
  1653. oprninfo = append(oprninfo, oprninfotemp)
  1654. icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
  1655. icuinfotemp := make(map[string]interface{})
  1656. icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
  1657. icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
  1658. icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
  1659. icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
  1660. icuinfo = append(icuinfo, icuinfotemp)
  1661. input["setlinfo"] = inputData
  1662. input["payinfo"] = payinfo
  1663. input["opspdiseinfo"] = opspdiseinfo
  1664. input["diseinfo"] = diseinfo
  1665. input["iteminfo"] = iteminfo
  1666. inputMessage["input"] = input //交易输入
  1667. bytesData, err := json.Marshal(inputMessage)
  1668. fmt.Println(string(bytesData))
  1669. if err != nil {
  1670. fmt.Println(err.Error())
  1671. return err.Error(), ""
  1672. }
  1673. var json2 string
  1674. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "4101A", string(bytesData), json2)
  1675. out, err := cmd.Output()
  1676. if err != nil {
  1677. fmt.Println("error:", err.Error())
  1678. }
  1679. fmt.Println(string(out))
  1680. return ConvertToString(string(out), "gbk", "utf-8"), string(bytesData)
  1681. }
  1682. //func Gdyb1201(psnNo string, org_name string, doctor string) string {
  1683. // // 生成签名
  1684. // nonce := GetRandomString(32)
  1685. // timestamp := time.Now().Unix()
  1686. // signature := setSignature(timestamp, nonce)
  1687. //
  1688. // // 生成输入报文
  1689. // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
  1690. // input := make(map[string]interface{})
  1691. // inputData := make(map[string]interface{})
  1692. // inputMessage["infno"] = "1201" // 交易编码
  1693. // inputData["fixmedins_type"] = psnNo // 人员编号 (来自1101接口返回)
  1694. // inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
  1695. // inputData["fixmedins_code"] = "" // 人员编号 (来自1101接口返回)
  1696. //
  1697. // input["medinsinfo"] = inputData
  1698. // inputMessage["input"] = input //交易输入
  1699. //
  1700. // bytesData, err := json.Marshal(inputMessage)
  1701. // fmt.Println(string(bytesData))
  1702. // if err != nil {
  1703. // fmt.Println(err.Error())
  1704. // return err.Error()
  1705. // }
  1706. // reader := bytes.NewReader(bytesData)
  1707. //
  1708. // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
  1709. // request, err := http.NewRequest("POST", url, reader)
  1710. // if err != nil {
  1711. // fmt.Println(err.Error())
  1712. // return err.Error()
  1713. // }
  1714. //
  1715. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1716. // request.Header.Set("x-tif-paasid", "test_hosp")
  1717. // request.Header.Set("x-tif-signature", signature)
  1718. // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1719. // request.Header.Set("x-tif-nonce", nonce)
  1720. //
  1721. // client := http.Client{}
  1722. // resp, err := client.Do(request)
  1723. // if err != nil {
  1724. // fmt.Println(err.Error())
  1725. // return err.Error()
  1726. // }
  1727. // respBytes, err := ioutil.ReadAll(resp.Body)
  1728. // if err != nil {
  1729. // fmt.Println(err.Error())
  1730. // return err.Error()
  1731. // }
  1732. // str := string(respBytes)
  1733. // fmt.Println(str)
  1734. // return str
  1735. //}
  1736. //func Gdyb5203(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
  1737. // // 生成签名
  1738. // nonce := GetRandomString(32)
  1739. // timestamp := time.Now().Unix()
  1740. // signature := setSignature(timestamp, nonce, secret_key)
  1741. //
  1742. // // 生成输入报文
  1743. // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1744. // input := make(map[string]interface{})
  1745. // inputData := make(map[string]interface{})
  1746. // inputMessage["infno"] = "5203" // 交易编码
  1747. //
  1748. // inputData["fixmedins_type"] = "1"
  1749. // inputData["fixmedins_name"] = org_name
  1750. // inputData["fixmedins_code"] = fixmedins_code
  1751. // input["medinsinfo"] = inputData
  1752. // inputMessage["input"] = input //交易输入
  1753. //
  1754. // bytesData, err := json.Marshal(inputMessage)
  1755. // fmt.Println(string(bytesData))
  1756. // if err != nil {
  1757. // fmt.Println(err.Error())
  1758. // return err.Error()
  1759. // }
  1760. // reader := bytes.NewReader(bytesData)
  1761. // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1201"
  1762. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
  1763. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1764. // request, err := http.NewRequest("POST", url, reader)
  1765. // if err != nil {
  1766. // fmt.Println(err.Error())
  1767. // return err.Error()
  1768. // }
  1769. //
  1770. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1771. // request.Header.Set("x-tif-paasid", "sg03_prd")
  1772. // request.Header.Set("x-tif-signature", signature)
  1773. // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1774. // request.Header.Set("x-tif-nonce", nonce)
  1775. //
  1776. // client := http.Client{}
  1777. // resp, err := client.Do(request)
  1778. // if err != nil {
  1779. // fmt.Println(err.Error())
  1780. // return err.Error()
  1781. // }
  1782. // respBytes, err := ioutil.ReadAll(resp.Body)
  1783. // if err != nil {
  1784. // fmt.Println(err.Error())
  1785. // return err.Error()
  1786. // }
  1787. // fmt.Println(string(respBytes))
  1788. // str := string(respBytes)
  1789. // return str
  1790. //}
  1791. func Hbyb2601(psnNo string, omsgid string, oinfno string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
  1792. // 生成签名
  1793. nonce := GetRandomString(32)
  1794. timestamp := time.Now().Unix()
  1795. signature := setSignature(timestamp, nonce, secret_key)
  1796. // 生成输入报文
  1797. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1798. input := make(map[string]interface{})
  1799. inputData := make(map[string]interface{})
  1800. inputMessage["infno"] = "2601" // 交易编码
  1801. inputData["psn_no"] = psnNo
  1802. inputData["omsgid"] = omsgid
  1803. inputData["oinfno"] = oinfno
  1804. input["data"] = inputData
  1805. inputMessage["input"] = input //交易输入
  1806. bytesData, err := json.Marshal(inputMessage)
  1807. fmt.Println(string(bytesData))
  1808. if err != nil {
  1809. fmt.Println(err.Error())
  1810. return err.Error()
  1811. }
  1812. reader := bytes.NewReader(bytesData)
  1813. gdyb_url := beego.AppConfig.String("gdyb_url")
  1814. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1815. url := gdyb_url + "2601"
  1816. request, err := http.NewRequest("POST", url, reader)
  1817. if err != nil {
  1818. fmt.Println(err.Error())
  1819. return err.Error()
  1820. }
  1821. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1822. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1823. request.Header.Set("x-tif-signature", signature)
  1824. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1825. request.Header.Set("x-tif-nonce", nonce)
  1826. client := http.Client{}
  1827. resp, err := client.Do(request)
  1828. if err != nil {
  1829. fmt.Println(err.Error())
  1830. return err.Error()
  1831. }
  1832. respBytes, err := ioutil.ReadAll(resp.Body)
  1833. if err != nil {
  1834. fmt.Println(err.Error())
  1835. return err.Error()
  1836. }
  1837. str := string(respBytes)
  1838. fmt.Println(str)
  1839. return str
  1840. }
  1841. //人员信息版本3
  1842. func Hbyb1101B(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64) string {
  1843. //生成签名
  1844. nonce := GetRandomString(32)
  1845. timestamp := time.Now().Unix()
  1846. signature := setSignature(timestamp, nonce, secret_key)
  1847. //生成输入报文
  1848. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1849. input := make(map[string]interface{})
  1850. inputData := make(map[string]interface{})
  1851. inputMessage["infno"] = "1101" // 交易编码
  1852. if certificates == 3 {
  1853. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1854. inputData["certno"] = certNo // 证件号码
  1855. inputData["psn_cert_type"] = "99" // 人员证件类型
  1856. } else {
  1857. if id_card_type == 1 {
  1858. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1859. inputData["card_sn"] = "" // 卡识别码
  1860. inputData["certno"] = certNo // 证件号码
  1861. inputData["psn_cert_type"] = "01" // 人员证件类型
  1862. } else {
  1863. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1864. inputData["card_sn"] = "" // 卡识别码
  1865. inputData["certno"] = certNo // 证件号码
  1866. inputData["psn_cert_type"] = "1" // 人员证件类型
  1867. }
  1868. }
  1869. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1870. inputData["begntime"] = "" // 开始时间
  1871. inputData["psn_name"] = "" // 人员姓名
  1872. input["data"] = inputData
  1873. inputMessage["input"] = input //交易输入
  1874. bytesData, err := json.Marshal(inputMessage)
  1875. fmt.Println(string(bytesData))
  1876. if err != nil {
  1877. fmt.Println(err.Error())
  1878. return err.Error()
  1879. }
  1880. reader := bytes.NewReader(bytesData)
  1881. gdyb_url := beego.AppConfig.String("gdyb_url")
  1882. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1883. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1884. url := gdyb_url + "1101"
  1885. fmt.Println(url)
  1886. fmt.Println(gdyb_paasid)
  1887. fmt.Println(secret_key)
  1888. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1889. request, err := http.NewRequest("POST", url, reader)
  1890. if err != nil {
  1891. fmt.Println(err.Error())
  1892. return err.Error()
  1893. }
  1894. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1895. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1896. request.Header.Set("x-tif-signature", signature)
  1897. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1898. request.Header.Set("x-tif-nonce", nonce)
  1899. client := http.Client{}
  1900. resp, err := client.Do(request)
  1901. if err != nil {
  1902. fmt.Println(err.Error())
  1903. return err.Error()
  1904. }
  1905. respBytes, err := ioutil.ReadAll(resp.Body)
  1906. if err != nil {
  1907. fmt.Println(err.Error())
  1908. return err.Error()
  1909. }
  1910. fmt.Println(string(respBytes))
  1911. str := string(respBytes)
  1912. return str
  1913. }
  1914. //人员信息版本4
  1915. func Hbyb1101C(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64) (string, string) {
  1916. //生成签名
  1917. nonce := GetRandomString(32)
  1918. timestamp := time.Now().Unix()
  1919. //signature := setSignature(timestamp, nonce, secret_key)
  1920. //生成输入报文
  1921. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1922. input := make(map[string]interface{})
  1923. inputData := make(map[string]interface{})
  1924. inputMessage["infno"] = "1101" // 交易编码
  1925. if certificates == 3 {
  1926. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1927. inputData["certno"] = certNo // 证件号码
  1928. inputData["psn_cert_type"] = "99" // 人员证件类型
  1929. } else {
  1930. if id_card_type == 1 {
  1931. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1932. inputData["card_sn"] = "" // 卡识别码
  1933. inputData["certno"] = "" // 证件号码
  1934. inputData["psn_cert_type"] = "" // 人员证件类型
  1935. } else {
  1936. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1937. inputData["card_sn"] = "" // 卡识别码
  1938. inputData["certno"] = certNo // 证件号码
  1939. inputData["psn_cert_type"] = "1" // 人员证件类型
  1940. }
  1941. }
  1942. inputData["mdtrt_cert_no"] = "" // 就诊凭证编号
  1943. inputData["begntime"] = "" // 开始时间
  1944. inputData["psn_name"] = "" // 人员姓名
  1945. input["data"] = inputData
  1946. inputMessage["input"] = input //交易输入
  1947. bytesData, err := json.Marshal(inputMessage)
  1948. fmt.Println(string(bytesData))
  1949. if err != nil {
  1950. fmt.Println(err.Error())
  1951. return err.Error(), ""
  1952. }
  1953. var json2 string
  1954. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
  1955. out, err := cmd.Output()
  1956. if err != nil {
  1957. fmt.Println("error:", err.Error())
  1958. }
  1959. fmt.Println(string(out))
  1960. return string(out), string(bytesData)
  1961. }
  1962. func Hbyb90991(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, pwd string) string {
  1963. //生成签名
  1964. nonce := GetRandomString(32)
  1965. timestamp := time.Now().Unix()
  1966. signature := setSignature(timestamp, nonce, secret_key)
  1967. //生成输入报文
  1968. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1969. input := make(map[string]interface{})
  1970. inputData := make(map[string]interface{})
  1971. inputMessage["infno"] = "90991" // 交易编码
  1972. inputData["fixmedins_code"] = fixmedins_code // 就诊凭证编号
  1973. inputData["psn_no"] = psn_no // 开始时间
  1974. inputData["card_pwd"] = pwd // 人员姓名
  1975. input["data"] = inputData
  1976. inputMessage["input"] = input //交易输入
  1977. bytesData, err := json.Marshal(inputMessage)
  1978. fmt.Println(string(bytesData))
  1979. if err != nil {
  1980. fmt.Println(err.Error())
  1981. return err.Error()
  1982. }
  1983. reader := bytes.NewReader(bytesData)
  1984. gdyb_url := beego.AppConfig.String("gdyb_url")
  1985. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1986. url := gdyb_url + "90991"
  1987. request, err := http.NewRequest("POST", url, reader)
  1988. if err != nil {
  1989. fmt.Println(err.Error())
  1990. return err.Error()
  1991. }
  1992. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1993. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1994. request.Header.Set("x-tif-signature", signature)
  1995. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1996. request.Header.Set("x-tif-nonce", nonce)
  1997. client := http.Client{}
  1998. resp, err := client.Do(request)
  1999. if err != nil {
  2000. fmt.Println(err.Error())
  2001. return err.Error()
  2002. }
  2003. respBytes, err := ioutil.ReadAll(resp.Body)
  2004. if err != nil {
  2005. fmt.Println(err.Error())
  2006. return err.Error()
  2007. }
  2008. fmt.Println(string(respBytes))
  2009. str := string(respBytes)
  2010. return str
  2011. }
  2012. func Hbyb90100(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
  2013. //生成签名
  2014. nonce := GetRandomString(32)
  2015. timestamp := time.Now().Unix()
  2016. signature := setSignature(timestamp, nonce, secret_key)
  2017. //生成输入报文
  2018. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  2019. input := make(map[string]interface{})
  2020. inputData := make(map[string]interface{})
  2021. inputMessage["infno"] = "90100" // 交易编码
  2022. inputData["psn_no"] = psn_no // 开始时间
  2023. input["data"] = inputData
  2024. inputMessage["input"] = input //交易输入
  2025. bytesData, err := json.Marshal(inputMessage)
  2026. fmt.Println(string(bytesData))
  2027. if err != nil {
  2028. fmt.Println(err.Error())
  2029. return err.Error()
  2030. }
  2031. reader := bytes.NewReader(bytesData)
  2032. gdyb_url := beego.AppConfig.String("gdyb_url")
  2033. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  2034. url := gdyb_url + "90100"
  2035. request, err := http.NewRequest("POST", url, reader)
  2036. if err != nil {
  2037. fmt.Println(err.Error())
  2038. return err.Error()
  2039. }
  2040. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  2041. request.Header.Set("x-tif-paasid", gdyb_paasid)
  2042. request.Header.Set("x-tif-signature", signature)
  2043. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  2044. request.Header.Set("x-tif-nonce", nonce)
  2045. client := http.Client{}
  2046. resp, err := client.Do(request)
  2047. if err != nil {
  2048. fmt.Println(err.Error())
  2049. return err.Error()
  2050. }
  2051. respBytes, err := ioutil.ReadAll(resp.Body)
  2052. if err != nil {
  2053. fmt.Println(err.Error())
  2054. return err.Error()
  2055. }
  2056. fmt.Println(string(respBytes))
  2057. str := string(respBytes)
  2058. return str
  2059. }
  2060. //func StrPtr(s string) uintptr {
  2061. // return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
  2062. //}
  2063. func Hbyb2001(secret_key string, org_name string, doctor_name string, code string, insuplcAdmdvs string, mdtrtareaAdmvs string, psn_no string, insutype string, med_type string) (string, string) {
  2064. if med_type == "1111" || med_type == "1112" {
  2065. med_type = "11"
  2066. }
  2067. // 生成签名
  2068. nonce := GetRandomString(32)
  2069. timestamp := time.Now().Unix()
  2070. //signature := setSignature(timestamp, nonce, secret_key)
  2071. tempTime := time.Unix(timestamp, 0)
  2072. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  2073. // 生成输入报文
  2074. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor_name, code, insuplcAdmdvs, mdtrtareaAdmvs)
  2075. input := make(map[string]interface{})
  2076. inputData := make(map[string]interface{})
  2077. inputMessage["infno"] = "2001" // 交易编码
  2078. inputData["psn_no"] = psn_no
  2079. inputData["insutype"] = insutype
  2080. inputData["med_type"] = med_type
  2081. inputData["begntime"] = timeFormatOne
  2082. input["data"] = inputData
  2083. inputMessage["input"] = input //交易输入
  2084. bytesData, err := json.Marshal(inputMessage)
  2085. fmt.Println(string(bytesData))
  2086. if err != nil {
  2087. fmt.Println(err.Error())
  2088. return err.Error(), ""
  2089. }
  2090. var json2 string
  2091. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
  2092. out, err := cmd.Output()
  2093. if err != nil {
  2094. fmt.Println("error:", err.Error())
  2095. }
  2096. return string(out), string(bytesData)
  2097. }