hbyb_service.go 90KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338
  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. //inputDatas := []make(map[string]interface{})
  767. inputDatas := make([]map[string]interface{}, 0)
  768. inputMessage["infno"] = "3202a" // 交易编码
  769. inputData["insutype"] = businessParams.Insutype // 险种
  770. inputData["clr_type"] = businessParams.ClrType // 就诊 ID(来自2201接口返回)
  771. inputData["setl_optins"] = businessParams.SetlOptins // 结算经办机构
  772. inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
  773. inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
  774. inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
  775. inputData["acct_pay"] = businessParams.AcctPay //个人账户支付金额
  776. inputDatas = append(inputDatas, inputData)
  777. input["clrdata"] = inputDatas
  778. inputMessage["input"] = input //交易输入
  779. bytesData, err := json.Marshal(inputMessage)
  780. fmt.Println(string(bytesData))
  781. if err != nil {
  782. fmt.Println(err.Error())
  783. return err.Error()
  784. }
  785. var json2 string
  786. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "3202a", string(bytesData), json2)
  787. out, err := cmd.Output()
  788. if err != nil {
  789. fmt.Println("error:", err.Error())
  790. }
  791. fmt.Println(string(out))
  792. return ConvertToString(string(out), "gbk", "utf-8")
  793. }
  794. //文件上传
  795. //文件上传
  796. func Hbyb9101(baseParams models.BaseParams, file_name string, file_byte []byte) string {
  797. // 生成签名
  798. nonce := GetRandomString(32)
  799. timestamp := time.Now().Unix()
  800. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  801. buf := new(bytes.Buffer)
  802. buf.ReadFrom(strings.NewReader(string(file_byte)))
  803. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  804. input := make(map[string]interface{})
  805. inputData := make(map[string]interface{})
  806. inputMessage["infno"] = "9101" // 交易编码
  807. inputData["file_name"] = file_name //文件名
  808. inputData["in"] = file_byte //文件数据
  809. inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
  810. input["fsUploadIn"] = inputData
  811. inputMessage["input"] = input //交易输入
  812. bytesData, err := json.Marshal(inputMessage)
  813. fmt.Println(string(bytesData))
  814. if err != nil {
  815. fmt.Println(err.Error())
  816. return err.Error()
  817. }
  818. reader := bytes.NewReader(bytesData)
  819. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9101"
  820. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
  821. gdyb_url := beego.AppConfig.String("gdyb_url")
  822. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  823. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  824. url := gdyb_url + "9101"
  825. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
  826. request, err := http.NewRequest("POST", url, reader)
  827. if err != nil {
  828. fmt.Println(err.Error())
  829. return err.Error()
  830. }
  831. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  832. request.Header.Set("x-tif-paasid", gdyb_paasid)
  833. request.Header.Set("x-tif-signature", signature)
  834. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  835. request.Header.Set("x-tif-nonce", nonce)
  836. client := http.Client{}
  837. resp, err := client.Do(request)
  838. if err != nil {
  839. fmt.Println(err.Error())
  840. return err.Error()
  841. }
  842. respBytes, err := ioutil.ReadAll(resp.Body)
  843. if err != nil {
  844. fmt.Println(err.Error())
  845. return err.Error()
  846. }
  847. str := string(respBytes)
  848. fmt.Println(str)
  849. return str
  850. }
  851. func Hbyb9102(baseParams models.BaseParams, file_name string, file_qury_no string) string {
  852. // 生成签名
  853. nonce := GetRandomString(32)
  854. timestamp := time.Now().Unix()
  855. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  856. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  857. input := make(map[string]interface{})
  858. inputData := make(map[string]interface{})
  859. inputMessage["infno"] = "9102" // 交易编码
  860. inputData["file_name"] = file_name //文件名
  861. inputData["file_qury_no"] = file_qury_no //文件数据
  862. inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
  863. input["fsDownloadIn"] = inputData
  864. inputMessage["input"] = input //交易输入
  865. bytesData, err := json.Marshal(inputMessage)
  866. fmt.Println(string(bytesData))
  867. if err != nil {
  868. fmt.Println(err.Error())
  869. return err.Error()
  870. }
  871. reader := bytes.NewReader(bytesData)
  872. gdyb_url := beego.AppConfig.String("gdyb_url")
  873. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  874. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  875. url := gdyb_url + "9102"
  876. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9102"
  877. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
  878. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
  879. request, err := http.NewRequest("POST", url, reader)
  880. if err != nil {
  881. fmt.Println(err.Error())
  882. return err.Error()
  883. }
  884. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  885. request.Header.Set("x-tif-paasid", gdyb_paasid)
  886. request.Header.Set("x-tif-signature", signature)
  887. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  888. request.Header.Set("x-tif-nonce", nonce)
  889. client := http.Client{}
  890. resp, err := client.Do(request)
  891. if err != nil {
  892. fmt.Println(err.Error())
  893. return err.Error()
  894. }
  895. respBytes, err := ioutil.ReadAll(resp.Body)
  896. if err != nil {
  897. fmt.Println(err.Error())
  898. return err.Error()
  899. }
  900. str := string(respBytes)
  901. fmt.Println(str)
  902. return str
  903. }
  904. func Hbyb3202(baseParams models.BaseParams, businessParams models.BusinessParams) string {
  905. // 生成签名
  906. nonce := GetRandomString(32)
  907. timestamp := time.Now().Unix()
  908. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  909. // 生成输入报文
  910. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  911. input := make(map[string]interface{})
  912. inputData := make(map[string]interface{})
  913. inputMessage["infno"] = "3202" // 交易编码
  914. inputData["file_qury_no"] = businessParams.FileQuryNo // 险种
  915. inputData["setl_optins"] = baseParams.InsuplcAdmdvs // 结算经办机构
  916. inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
  917. inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
  918. inputData["medfee_sumamt"] = businessParams.MedfeeSumamt //医疗费总额
  919. inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
  920. inputData["cash_payamt"] = businessParams.CashPayamt //现金支付金额
  921. inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
  922. inputData["clr_type"] = "11" // 就诊 ID(来自2201接口返回)
  923. inputData["refd_setl_flag"] = 1 // 就诊 ID(来自2201接口返回)
  924. input["data"] = inputData
  925. inputMessage["input"] = input //交易输入
  926. bytesData, err := json.Marshal(inputMessage)
  927. fmt.Println(string(bytesData))
  928. if err != nil {
  929. fmt.Println(err.Error())
  930. return err.Error()
  931. }
  932. reader := bytes.NewReader(bytesData)
  933. gdyb_url := beego.AppConfig.String("gdyb_url")
  934. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  935. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  936. url := gdyb_url + "3202"
  937. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3202"
  938. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
  939. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
  940. request, err := http.NewRequest("POST", url, reader)
  941. if err != nil {
  942. fmt.Println(err.Error())
  943. return err.Error()
  944. }
  945. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  946. request.Header.Set("x-tif-paasid", gdyb_paasid)
  947. request.Header.Set("x-tif-signature", signature)
  948. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  949. request.Header.Set("x-tif-nonce", nonce)
  950. client := http.Client{}
  951. resp, err := client.Do(request)
  952. if err != nil {
  953. fmt.Println(err.Error())
  954. return err.Error()
  955. }
  956. respBytes, err := ioutil.ReadAll(resp.Body)
  957. if err != nil {
  958. fmt.Println(err.Error())
  959. return err.Error()
  960. }
  961. str := string(respBytes)
  962. fmt.Println(str)
  963. return str
  964. }
  965. //func Hbyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
  966. // // 生成签名
  967. // nonce := GetRandomString(32)
  968. // timestamp := time.Now().Unix()
  969. // signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  970. //
  971. // // 生成输入报文
  972. // inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  973. // input := make(map[string]interface{})
  974. // inputData := make(map[string]interface{})
  975. // inputMessage["infno"] = "2001" // 交易编码
  976. // inputData["psn_no"] = psn_no
  977. // inputData["insutype"] = insutype
  978. // inputData["med_type"] = med_type
  979. // inputData["begntime"] = "2021-01-01 00:00:00"
  980. // input["data"] = inputData
  981. // inputMessage["input"] = input //交易输入
  982. // bytesData, err := json.Marshal(inputMessage)
  983. // fmt.Println(string(bytesData))
  984. // if err != nil {
  985. // fmt.Println(err.Error())
  986. // return err.Error()
  987. // }
  988. // reader := bytes.NewReader(bytesData)
  989. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
  990. //
  991. // gdyb_url := beego.AppConfig.String("gdyb_url")
  992. // gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  993. //
  994. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  995. // url := gdyb_url + "2001"
  996. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
  997. // request, err := http.NewRequest("POST", url, reader)
  998. // if err != nil {
  999. // fmt.Println(err.Error())
  1000. // return err.Error()
  1001. // }
  1002. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1003. // request.Header.Set("x-tif-paasid", gdyb_paasid)
  1004. // request.Header.Set("x-tif-signature", signature)
  1005. // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1006. // request.Header.Set("x-tif-nonce", nonce)
  1007. // client := http.Client{}
  1008. // resp, err := client.Do(request)
  1009. // if err != nil {
  1010. // fmt.Println(err.Error())
  1011. // return err.Error()
  1012. // }
  1013. // respBytes, err := ioutil.ReadAll(resp.Body)
  1014. // if err != nil {
  1015. // fmt.Println(err.Error())
  1016. // return err.Error()
  1017. // }
  1018. // str := string(respBytes)
  1019. // fmt.Println(str)
  1020. // return str
  1021. //}
  1022. func Hbyb3301(baseParams *models.BaseParams, name string, codg string, list_type_code string, start_time string, ent_time string, list_type string) string {
  1023. // 生成签名
  1024. nonce := GetRandomString(32)
  1025. timestamp := time.Now().Unix()
  1026. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  1027. // 生成输入报文
  1028. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  1029. input := make(map[string]interface{})
  1030. inputData := make(map[string]interface{})
  1031. inputMessage["infno"] = "3301" // 交易编码
  1032. inputData["fixmedins_hilist_id"] = codg
  1033. inputData["fixmedins_hilist_name"] = name
  1034. inputData["list_type"] = list_type
  1035. inputData["med_list_codg"] = codg
  1036. inputData["begndate"] = start_time
  1037. inputData["enddate"] = ent_time
  1038. inputData["aprvno"] = ""
  1039. inputData["dosform"] = ""
  1040. inputData["exct_cont"] = ""
  1041. inputData["item_cont"] = ""
  1042. inputData["prcunt"] = ""
  1043. inputData["spec"] = ""
  1044. inputData["pacspec"] = ""
  1045. inputData["memo"] = ""
  1046. input["data"] = inputData
  1047. inputMessage["input"] = input //交易输入
  1048. bytesData, err := json.Marshal(inputMessage)
  1049. fmt.Println(string(bytesData))
  1050. if err != nil {
  1051. fmt.Println(err.Error())
  1052. return err.Error()
  1053. }
  1054. reader := bytes.NewReader(bytesData)
  1055. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
  1056. //
  1057. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
  1058. gdyb_url := beego.AppConfig.String("gdyb_url")
  1059. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1060. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1061. url := gdyb_url + "3301"
  1062. request, err := http.NewRequest("POST", url, reader)
  1063. if err != nil {
  1064. fmt.Println(err.Error())
  1065. return err.Error()
  1066. }
  1067. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1068. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1069. request.Header.Set("x-tif-signature", signature)
  1070. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1071. request.Header.Set("x-tif-nonce", nonce)
  1072. client := http.Client{}
  1073. resp, err := client.Do(request)
  1074. if err != nil {
  1075. fmt.Println(err.Error())
  1076. return err.Error()
  1077. }
  1078. respBytes, err := ioutil.ReadAll(resp.Body)
  1079. if err != nil {
  1080. fmt.Println(err.Error())
  1081. return err.Error()
  1082. }
  1083. str := string(respBytes)
  1084. fmt.Println(str)
  1085. return str
  1086. }
  1087. func Hbyb3302(baseParams *models.BaseParams, name string, codg string, list_type_code string) string {
  1088. // 生成签名
  1089. nonce := GetRandomString(32)
  1090. timestamp := time.Now().Unix()
  1091. signature := setSignature(timestamp, nonce, baseParams.SecretKey)
  1092. // 生成输入报文
  1093. inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
  1094. input := make(map[string]interface{})
  1095. inputData := make(map[string]interface{})
  1096. inputMessage["infno"] = "3302" // 交易编码
  1097. inputData["fixmedins_code"] = baseParams.FixmedinsCode
  1098. inputData["fixmedins_hilist_id"] = codg
  1099. inputData["list_type"] = list_type_code
  1100. inputData["med_list_codg"] = codg
  1101. input["data"] = inputData
  1102. inputMessage["input"] = input //交易输入
  1103. bytesData, err := json.Marshal(inputMessage)
  1104. fmt.Println(string(bytesData))
  1105. if err != nil {
  1106. fmt.Println(err.Error())
  1107. return err.Error()
  1108. }
  1109. reader := bytes.NewReader(bytesData)
  1110. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3302"
  1111. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3302"
  1112. gdyb_url := beego.AppConfig.String("gdyb_url")
  1113. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1114. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1115. url := gdyb_url + "3302"
  1116. request, err := http.NewRequest("POST", url, reader)
  1117. if err != nil {
  1118. fmt.Println(err.Error())
  1119. return err.Error()
  1120. }
  1121. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1122. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1123. request.Header.Set("x-tif-signature", signature)
  1124. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1125. request.Header.Set("x-tif-nonce", nonce)
  1126. client := http.Client{}
  1127. resp, err := client.Do(request)
  1128. if err != nil {
  1129. fmt.Println(err.Error())
  1130. return err.Error()
  1131. }
  1132. respBytes, err := ioutil.ReadAll(resp.Body)
  1133. if err != nil {
  1134. fmt.Println(err.Error())
  1135. return err.Error()
  1136. }
  1137. str := string(respBytes)
  1138. fmt.Println(str)
  1139. return str
  1140. }
  1141. 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 {
  1142. // 生成签名
  1143. nonce := GetRandomString(32)
  1144. timestamp := time.Now().Unix()
  1145. signature := setSignature(timestamp, nonce, secret_key)
  1146. // 生成输入报文
  1147. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1148. input := make(map[string]interface{})
  1149. inputData := make(map[string]interface{})
  1150. inputMessage["infno"] = "2505"
  1151. inputData["psn_no"] = psnNo
  1152. inputData["biz_appy_type"] = "03"
  1153. inputData["begndate"] = start_time
  1154. inputData["enddate"] = end_time
  1155. inputData["fixmedins_code"] = fixmedins_code
  1156. inputData["fixmedins_name"] = org_name
  1157. inputData["tel"] = ""
  1158. inputData["addr"] = ""
  1159. inputData["agnter_name"] = ""
  1160. inputData["agnter_cert_type"] = ""
  1161. inputData["agnter_certno"] = ""
  1162. inputData["agnter_tel"] = ""
  1163. inputData["agnter_addr"] = ""
  1164. inputData["agnter_rlts"] = ""
  1165. inputData["fix_srt_no"] = ""
  1166. inputData["memo"] = ""
  1167. input["data"] = inputData
  1168. inputMessage["input"] = input //交易输入
  1169. bytesData, err := json.Marshal(inputMessage)
  1170. if err != nil {
  1171. fmt.Println(err.Error())
  1172. return err.Error()
  1173. }
  1174. reader := bytes.NewReader(bytesData)
  1175. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
  1176. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2505"
  1177. gdyb_url := beego.AppConfig.String("gdyb_url")
  1178. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1179. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1180. url := gdyb_url + "2505"
  1181. request, err := http.NewRequest("POST", url, reader)
  1182. if err != nil {
  1183. fmt.Println(err.Error())
  1184. return err.Error()
  1185. }
  1186. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1187. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1188. request.Header.Set("x-tif-signature", signature)
  1189. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1190. request.Header.Set("x-tif-nonce", nonce)
  1191. client := http.Client{}
  1192. resp, err := client.Do(request)
  1193. if err != nil {
  1194. fmt.Println(err.Error())
  1195. return err.Error()
  1196. }
  1197. respBytes, err := ioutil.ReadAll(resp.Body)
  1198. if err != nil {
  1199. fmt.Println(err.Error())
  1200. return err.Error()
  1201. }
  1202. str := string(respBytes)
  1203. fmt.Println(str)
  1204. return str
  1205. }
  1206. 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 {
  1207. // 生成签名
  1208. nonce := GetRandomString(32)
  1209. timestamp := time.Now().Unix()
  1210. signature := setSignature(timestamp, nonce, secret_key)
  1211. // 生成输入报文
  1212. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1213. input := make(map[string]interface{})
  1214. inputData := make(map[string]interface{})
  1215. inputMessage["infno"] = "2506"
  1216. inputData["psn_no"] = psnNo
  1217. inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn
  1218. inputData["memo"] = ""
  1219. input["data"] = inputData
  1220. inputMessage["input"] = input //交易输入
  1221. bytesData, err := json.Marshal(inputMessage)
  1222. fmt.Println(string(bytesData))
  1223. if err != nil {
  1224. fmt.Println(err.Error())
  1225. return err.Error()
  1226. }
  1227. reader := bytes.NewReader(bytesData)
  1228. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2506"
  1229. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2506"
  1230. gdyb_url := beego.AppConfig.String("gdyb_url")
  1231. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1232. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1233. url := gdyb_url + "2506"
  1234. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
  1235. request, err := http.NewRequest("POST", url, reader)
  1236. if err != nil {
  1237. fmt.Println(err.Error())
  1238. return err.Error()
  1239. }
  1240. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1241. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1242. request.Header.Set("x-tif-signature", signature)
  1243. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1244. request.Header.Set("x-tif-nonce", nonce)
  1245. client := http.Client{}
  1246. resp, err := client.Do(request)
  1247. if err != nil {
  1248. fmt.Println(err.Error())
  1249. return err.Error()
  1250. }
  1251. respBytes, err := ioutil.ReadAll(resp.Body)
  1252. if err != nil {
  1253. fmt.Println(err.Error())
  1254. return err.Error()
  1255. }
  1256. str := string(respBytes)
  1257. fmt.Println(str)
  1258. return str
  1259. }
  1260. 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 {
  1261. // 生成签名
  1262. nonce := GetRandomString(32)
  1263. timestamp := time.Now().Unix()
  1264. signature := setSignature(timestamp, nonce, secret_key)
  1265. tempTime := time.Unix(timestamp, 0)
  1266. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1267. timeFormatTwo := tempTime.Format("2006-01-02")
  1268. t := time.Now()
  1269. last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC)
  1270. tm := time.Unix(last.Unix(), 0)
  1271. // 生成输入报文
  1272. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1273. input := make(map[string]interface{})
  1274. inputData := make(map[string]interface{})
  1275. inputMessage["infno"] = "2503" // 交易编码
  1276. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1277. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  1278. inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
  1279. inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
  1280. inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
  1281. inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
  1282. inputData["ide_fixmedins_name"] = org_name // 险种类型(来自1101接口返回)
  1283. inputData["hosp_ide_date"] = timeFormatTwo // 险种类型(来自1101接口返回)
  1284. inputData["diag_dr_codg"] = doctor_id // 开始时间
  1285. inputData["diag_dr_name"] = doctor // 开始时间
  1286. inputData["begndate"] = timeFormatTwo // 医师编码
  1287. inputData["tel"] = "" // 医师编码
  1288. inputData["addr"] = "" // 医师编码
  1289. inputData["enddate"] = tm.Format("2006-01-02") // 医师编码
  1290. input["data"] = inputData
  1291. inputMessage["input"] = input //交易输入
  1292. bytesData, err := json.Marshal(inputMessage)
  1293. fmt.Println(string(bytesData))
  1294. if err != nil {
  1295. fmt.Println(err.Error())
  1296. return err.Error()
  1297. }
  1298. reader := bytes.NewReader(bytesData)
  1299. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
  1300. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
  1301. gdyb_url := beego.AppConfig.String("gdyb_url")
  1302. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1303. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1304. url := gdyb_url + "2503"
  1305. request, err := http.NewRequest("POST", url, reader)
  1306. if err != nil {
  1307. fmt.Println(err.Error())
  1308. return err.Error()
  1309. }
  1310. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1311. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1312. request.Header.Set("x-tif-signature", signature)
  1313. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1314. request.Header.Set("x-tif-nonce", nonce)
  1315. client := http.Client{}
  1316. resp, err := client.Do(request)
  1317. if err != nil {
  1318. fmt.Println(err.Error())
  1319. return err.Error()
  1320. }
  1321. respBytes, err := ioutil.ReadAll(resp.Body)
  1322. if err != nil {
  1323. fmt.Println(err.Error())
  1324. return err.Error()
  1325. }
  1326. str := string(respBytes)
  1327. fmt.Println(str)
  1328. return str
  1329. }
  1330. 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 {
  1331. // 生成签名
  1332. nonce := GetRandomString(32)
  1333. timestamp := time.Now().Unix()
  1334. signature := setSignature(timestamp, nonce, secret_key)
  1335. // 生成输入报文
  1336. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1337. input := make(map[string]interface{})
  1338. inputData := make(map[string]interface{})
  1339. inputMessage["infno"] = "2504" // 交易编码
  1340. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1341. inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn // 人员编号 (来自1101接口返回)
  1342. inputData["memo"] = "撤销备案" // 人员编号 (来自1101接口返回)
  1343. input["data"] = inputData
  1344. inputMessage["input"] = input //交易输入
  1345. bytesData, err := json.Marshal(inputMessage)
  1346. fmt.Println(string(bytesData))
  1347. if err != nil {
  1348. fmt.Println(err.Error())
  1349. return err.Error()
  1350. }
  1351. reader := bytes.NewReader(bytesData)
  1352. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2504"
  1353. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2504"
  1354. gdyb_url := beego.AppConfig.String("gdyb_url")
  1355. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1356. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1357. url := gdyb_url + "2504"
  1358. request, err := http.NewRequest("POST", url, reader)
  1359. if err != nil {
  1360. fmt.Println(err.Error())
  1361. return err.Error()
  1362. }
  1363. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1364. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1365. request.Header.Set("x-tif-signature", signature)
  1366. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1367. request.Header.Set("x-tif-nonce", nonce)
  1368. client := http.Client{}
  1369. resp, err := client.Do(request)
  1370. if err != nil {
  1371. fmt.Println(err.Error())
  1372. return err.Error()
  1373. }
  1374. respBytes, err := ioutil.ReadAll(resp.Body)
  1375. if err != nil {
  1376. fmt.Println(err.Error())
  1377. return err.Error()
  1378. }
  1379. str := string(respBytes)
  1380. fmt.Println(str)
  1381. return str
  1382. }
  1383. //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 {
  1384. // // 生成签名
  1385. // nonce := GetRandomString(32)
  1386. // timestamp := time.Now().Unix()
  1387. // signature := setSignature(timestamp, nonce, secret_key)
  1388. // tempTime := time.Unix(timestamp, 0)
  1389. // timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1390. //
  1391. // // 生成输入报文
  1392. // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1393. // input := make(map[string]interface{})
  1394. // inputData := make(map[string]interface{})
  1395. // diseinfo := make([]map[string]interface{}, 0)
  1396. //
  1397. // inputMessage["infno"] = "2203" // 交易编码
  1398. // inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1399. // inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1400. // inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  1401. // inputData["begntime"] = timeFormatOne // 开始时间
  1402. // inputData["main_cond_dscr"] = "" // 主要病情描述
  1403. // inputData["dise_codg"] = sick_code // 病种编码
  1404. // inputData["dise_name"] = sick_name // 病种名称
  1405. // inputData["birctrl_type"] = "" // 计划生育手术类别
  1406. // inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  1407. //
  1408. // diseinfo_sun := make(map[string]interface{})
  1409. // diseinfo_sun["diag_type"] = "1" // 诊断类别
  1410. // diseinfo_sun["diag_srt_no"] = "1" // 诊断排序号
  1411. // diseinfo_sun["diag_code"] = diag_code // 诊断代码
  1412. // diseinfo_sun["diag_name"] = diag // 诊断名称
  1413. // diseinfo_sun["diag_dept"] = department // 诊断科室
  1414. // diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  1415. // diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
  1416. // diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  1417. // diseinfo_sun["vali_flag"] = "1" // 有效标志
  1418. //
  1419. // diseinfo = append(diseinfo, diseinfo_sun)
  1420. // input["diseinfo"] = diseinfo
  1421. // input["mdtrtinfo"] = inputData
  1422. // inputMessage["input"] = input //交易输入
  1423. //
  1424. // bytesData, err := json.Marshal(inputMessage)
  1425. // fmt.Println(string(bytesData))
  1426. // if err != nil {
  1427. // fmt.Println(err.Error())
  1428. // return err.Error()
  1429. // }
  1430. // reader := bytes.NewReader(bytesData)
  1431. //
  1432. // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203"
  1433. //
  1434. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
  1435. // request, err := http.NewRequest("POST", url, reader)
  1436. // if err != nil {
  1437. // fmt.Println(err.Error())
  1438. // return err.Error()
  1439. // }
  1440. //
  1441. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1442. // request.Header.Set("x-tif-paasid", "sg03_prd")
  1443. // request.Header.Set("x-tif-signature", signature)
  1444. // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1445. // request.Header.Set("x-tif-nonce", nonce)
  1446. //
  1447. // client := http.Client{}
  1448. // resp, err := client.Do(request)
  1449. // if err != nil {
  1450. // fmt.Println(err.Error())
  1451. // return err.Error()
  1452. // }
  1453. // respBytes, err := ioutil.ReadAll(resp.Body)
  1454. // if err != nil {
  1455. // fmt.Println(err.Error())
  1456. // return err.Error()
  1457. // }
  1458. // str := string(respBytes)
  1459. // fmt.Println(str)
  1460. // return str
  1461. //}
  1462. 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 {
  1463. // 生成签名
  1464. nonce := GetRandomString(32)
  1465. timestamp := time.Now().Unix()
  1466. signature := setSignature(timestamp, nonce, secret_key)
  1467. //tempTime := time.Unix(timestamp, 0)
  1468. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1469. //timeFormatTwo := tempTime.Format("2006-01-02")
  1470. // 生成输入报文
  1471. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1472. input := make(map[string]interface{})
  1473. inputData := make(map[string]interface{})
  1474. inputMessage["infno"] = "5301" // 交易编码
  1475. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1476. input["data"] = inputData
  1477. inputMessage["input"] = input //交易输入
  1478. bytesData, err := json.Marshal(inputMessage)
  1479. fmt.Println(string(bytesData))
  1480. if err != nil {
  1481. fmt.Println(err.Error())
  1482. return err.Error()
  1483. }
  1484. reader := bytes.NewReader(bytesData)
  1485. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
  1486. gdyb_url := beego.AppConfig.String("gdyb_url")
  1487. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1488. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1489. url := gdyb_url + "5301"
  1490. request, err := http.NewRequest("POST", url, reader)
  1491. if err != nil {
  1492. fmt.Println(err.Error())
  1493. return err.Error()
  1494. }
  1495. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1496. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1497. request.Header.Set("x-tif-signature", signature)
  1498. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1499. request.Header.Set("x-tif-nonce", nonce)
  1500. client := http.Client{}
  1501. resp, err := client.Do(request)
  1502. if err != nil {
  1503. fmt.Println(err.Error())
  1504. return err.Error()
  1505. }
  1506. respBytes, err := ioutil.ReadAll(resp.Body)
  1507. if err != nil {
  1508. fmt.Println(err.Error())
  1509. return err.Error()
  1510. }
  1511. str := string(respBytes)
  1512. fmt.Println(str)
  1513. return str
  1514. }
  1515. //
  1516. func Hbyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) (string, string) {
  1517. // 生成签名
  1518. nonce := GetRandomString(32)
  1519. timestamp := time.Now().Unix()
  1520. // 生成输入报文
  1521. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1522. input := make(map[string]interface{})
  1523. inputData := make(map[string]interface{})
  1524. inputMessage["infno"] = "4101" // 交易编码
  1525. year := time.Now().Format("2006")
  1526. month := time.Now().Format("01")
  1527. day := time.Now().Format("02")
  1528. inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
  1529. inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
  1530. inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
  1531. inputData["fixmedins_name"] = org_name // 定点医药机构名称 必填
  1532. inputData["fixmedins_code"] = fixmedins_code // 定点医药机构编码 必填
  1533. inputData["hi_setl_lv"] = "" // 医保结算等级
  1534. inputData["hi_no"] = struct4101.PsnNo // 医保编号
  1535. inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
  1536. inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
  1537. inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
  1538. inputData["gend"] = struct4101.Gend // 性别 必填
  1539. inputData["brdy"] = struct4101.Brdy // 出生日期 必填
  1540. inputData["age"] = struct4101.Age // 年龄 必填
  1541. inputData["ntly"] = struct4101.Ntly // 国籍 必填
  1542. inputData["nwb_age"] = "" // 年龄 必填
  1543. inputData["naty"] = struct4101.Naty // 民族 必填
  1544. inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
  1545. inputData["certno"] = struct4101.Certno // 证件号码 必填
  1546. inputData["prfs"] = struct4101.Prfs // 职业 必填
  1547. inputData["curr_addr"] = "" // 现住址 必填
  1548. inputData["emp_name"] = "" // 单位名称 必填
  1549. inputData["emp_addr"] = "" // 单位地址 必填
  1550. inputData["emp_tel"] = "" // 单位电话 必填
  1551. inputData["poscode"] = "" // 邮编 必填
  1552. inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
  1553. inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
  1554. inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
  1555. inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
  1556. inputData["hi_type"] = struct4101.HiType // 医保类型 必填
  1557. inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
  1558. inputData["sp_psn_type"] = "" // 特殊人员类型 必填
  1559. inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
  1560. inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
  1561. inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
  1562. inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
  1563. inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
  1564. inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
  1565. inputData["adm_way"] = "" // 入院途径 必填
  1566. inputData["trt_type"] = "" // 治疗类别 必填
  1567. inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
  1568. inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
  1569. inputData["refldept_dept"] = "" // 转科科别 必填
  1570. inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
  1571. inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
  1572. inputData["act_ipt_days"] = "" // 实际住院天数 必填
  1573. inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
  1574. inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
  1575. inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
  1576. inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
  1577. inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
  1578. inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
  1579. inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
  1580. inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
  1581. inputData["bld_cat"] = "" // 输血品种 必填
  1582. inputData["bld_amt"] = "" // 输血量 必填
  1583. inputData["bld_unt"] = "" // 输血计量单位 必填
  1584. inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
  1585. inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
  1586. inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
  1587. inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
  1588. inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
  1589. inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
  1590. inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
  1591. inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
  1592. inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
  1593. inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
  1594. inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
  1595. inputData["chfpdr_name"] = "" // 主诊医师姓名 必填
  1596. inputData["chfpdr_code"] = "" // 主诊医师代码 必填
  1597. inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
  1598. inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
  1599. inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
  1600. inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
  1601. inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
  1602. inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
  1603. inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
  1604. inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
  1605. inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
  1606. inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
  1607. inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
  1608. payinfo := make([]map[string]interface{}, 0) // 基金支付信息
  1609. for _, item := range struct4101.CustomStruct {
  1610. payinfotemp := make(map[string]interface{})
  1611. 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" {
  1612. payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
  1613. payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
  1614. payinfo = append(payinfo, payinfotemp)
  1615. }
  1616. }
  1617. opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
  1618. opspdiseinfotemp := make(map[string]interface{})
  1619. opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 诊断名称 必填
  1620. opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 诊断代码 必填
  1621. opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
  1622. opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
  1623. opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
  1624. diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
  1625. for _, item := range struct4101.Diseinfo {
  1626. diseinfotemp := make(map[string]interface{})
  1627. diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
  1628. diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
  1629. diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
  1630. diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
  1631. diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
  1632. diseinfo = append(diseinfo, diseinfotemp)
  1633. }
  1634. iteminfo := make([]map[string]interface{}, 0)
  1635. for _, item := range struct4101.IteminfoStruct {
  1636. iteminfotemp := make(map[string]interface{})
  1637. iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
  1638. iteminfotemp["amt"] = item.Amt // 金额 必填
  1639. iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
  1640. iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
  1641. iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
  1642. iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
  1643. iteminfo = append(iteminfo, iteminfotemp)
  1644. }
  1645. oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
  1646. oprninfotemp := make(map[string]interface{})
  1647. oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
  1648. oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
  1649. oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
  1650. oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
  1651. oprninfotemp["anst_way"] = "" // 麻醉方式 必填
  1652. oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
  1653. oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
  1654. oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
  1655. oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
  1656. oprninfo = append(oprninfo, oprninfotemp)
  1657. icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
  1658. icuinfotemp := make(map[string]interface{})
  1659. icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
  1660. icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
  1661. icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
  1662. icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
  1663. icuinfo = append(icuinfo, icuinfotemp)
  1664. input["setlinfo"] = inputData
  1665. input["payinfo"] = payinfo
  1666. input["opspdiseinfo"] = opspdiseinfo
  1667. input["diseinfo"] = diseinfo
  1668. input["iteminfo"] = iteminfo
  1669. inputMessage["input"] = input //交易输入
  1670. bytesData, err := json.Marshal(inputMessage)
  1671. fmt.Println(string(bytesData))
  1672. if err != nil {
  1673. fmt.Println(err.Error())
  1674. return err.Error(), ""
  1675. }
  1676. var json2 string
  1677. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "4101A", string(bytesData), json2)
  1678. out, err := cmd.Output()
  1679. if err != nil {
  1680. fmt.Println("error:", err.Error())
  1681. }
  1682. fmt.Println(string(out))
  1683. return ConvertToString(string(out), "gbk", "utf-8"), string(bytesData)
  1684. }
  1685. //func Gdyb1201(psnNo string, org_name string, doctor string) string {
  1686. // // 生成签名
  1687. // nonce := GetRandomString(32)
  1688. // timestamp := time.Now().Unix()
  1689. // signature := setSignature(timestamp, nonce)
  1690. //
  1691. // // 生成输入报文
  1692. // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
  1693. // input := make(map[string]interface{})
  1694. // inputData := make(map[string]interface{})
  1695. // inputMessage["infno"] = "1201" // 交易编码
  1696. // inputData["fixmedins_type"] = psnNo // 人员编号 (来自1101接口返回)
  1697. // inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
  1698. // inputData["fixmedins_code"] = "" // 人员编号 (来自1101接口返回)
  1699. //
  1700. // input["medinsinfo"] = inputData
  1701. // inputMessage["input"] = input //交易输入
  1702. //
  1703. // bytesData, err := json.Marshal(inputMessage)
  1704. // fmt.Println(string(bytesData))
  1705. // if err != nil {
  1706. // fmt.Println(err.Error())
  1707. // return err.Error()
  1708. // }
  1709. // reader := bytes.NewReader(bytesData)
  1710. //
  1711. // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
  1712. // request, err := http.NewRequest("POST", url, reader)
  1713. // if err != nil {
  1714. // fmt.Println(err.Error())
  1715. // return err.Error()
  1716. // }
  1717. //
  1718. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1719. // request.Header.Set("x-tif-paasid", "test_hosp")
  1720. // request.Header.Set("x-tif-signature", signature)
  1721. // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1722. // request.Header.Set("x-tif-nonce", nonce)
  1723. //
  1724. // client := http.Client{}
  1725. // resp, err := client.Do(request)
  1726. // if err != nil {
  1727. // fmt.Println(err.Error())
  1728. // return err.Error()
  1729. // }
  1730. // respBytes, err := ioutil.ReadAll(resp.Body)
  1731. // if err != nil {
  1732. // fmt.Println(err.Error())
  1733. // return err.Error()
  1734. // }
  1735. // str := string(respBytes)
  1736. // fmt.Println(str)
  1737. // return str
  1738. //}
  1739. //func Gdyb5203(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
  1740. // // 生成签名
  1741. // nonce := GetRandomString(32)
  1742. // timestamp := time.Now().Unix()
  1743. // signature := setSignature(timestamp, nonce, secret_key)
  1744. //
  1745. // // 生成输入报文
  1746. // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1747. // input := make(map[string]interface{})
  1748. // inputData := make(map[string]interface{})
  1749. // inputMessage["infno"] = "5203" // 交易编码
  1750. //
  1751. // inputData["fixmedins_type"] = "1"
  1752. // inputData["fixmedins_name"] = org_name
  1753. // inputData["fixmedins_code"] = fixmedins_code
  1754. // input["medinsinfo"] = inputData
  1755. // inputMessage["input"] = input //交易输入
  1756. //
  1757. // bytesData, err := json.Marshal(inputMessage)
  1758. // fmt.Println(string(bytesData))
  1759. // if err != nil {
  1760. // fmt.Println(err.Error())
  1761. // return err.Error()
  1762. // }
  1763. // reader := bytes.NewReader(bytesData)
  1764. // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1201"
  1765. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
  1766. // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1767. // request, err := http.NewRequest("POST", url, reader)
  1768. // if err != nil {
  1769. // fmt.Println(err.Error())
  1770. // return err.Error()
  1771. // }
  1772. //
  1773. // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1774. // request.Header.Set("x-tif-paasid", "sg03_prd")
  1775. // request.Header.Set("x-tif-signature", signature)
  1776. // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1777. // request.Header.Set("x-tif-nonce", nonce)
  1778. //
  1779. // client := http.Client{}
  1780. // resp, err := client.Do(request)
  1781. // if err != nil {
  1782. // fmt.Println(err.Error())
  1783. // return err.Error()
  1784. // }
  1785. // respBytes, err := ioutil.ReadAll(resp.Body)
  1786. // if err != nil {
  1787. // fmt.Println(err.Error())
  1788. // return err.Error()
  1789. // }
  1790. // fmt.Println(string(respBytes))
  1791. // str := string(respBytes)
  1792. // return str
  1793. //}
  1794. 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 {
  1795. // 生成签名
  1796. nonce := GetRandomString(32)
  1797. timestamp := time.Now().Unix()
  1798. signature := setSignature(timestamp, nonce, secret_key)
  1799. // 生成输入报文
  1800. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1801. input := make(map[string]interface{})
  1802. inputData := make(map[string]interface{})
  1803. inputMessage["infno"] = "2601" // 交易编码
  1804. inputData["psn_no"] = psnNo
  1805. inputData["omsgid"] = omsgid
  1806. inputData["oinfno"] = oinfno
  1807. input["data"] = inputData
  1808. inputMessage["input"] = input //交易输入
  1809. bytesData, err := json.Marshal(inputMessage)
  1810. fmt.Println(string(bytesData))
  1811. if err != nil {
  1812. fmt.Println(err.Error())
  1813. return err.Error()
  1814. }
  1815. reader := bytes.NewReader(bytesData)
  1816. gdyb_url := beego.AppConfig.String("gdyb_url")
  1817. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1818. url := gdyb_url + "2601"
  1819. request, err := http.NewRequest("POST", url, reader)
  1820. if err != nil {
  1821. fmt.Println(err.Error())
  1822. return err.Error()
  1823. }
  1824. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1825. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1826. request.Header.Set("x-tif-signature", signature)
  1827. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1828. request.Header.Set("x-tif-nonce", nonce)
  1829. client := http.Client{}
  1830. resp, err := client.Do(request)
  1831. if err != nil {
  1832. fmt.Println(err.Error())
  1833. return err.Error()
  1834. }
  1835. respBytes, err := ioutil.ReadAll(resp.Body)
  1836. if err != nil {
  1837. fmt.Println(err.Error())
  1838. return err.Error()
  1839. }
  1840. str := string(respBytes)
  1841. fmt.Println(str)
  1842. return str
  1843. }
  1844. //人员信息版本3
  1845. 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 {
  1846. //生成签名
  1847. nonce := GetRandomString(32)
  1848. timestamp := time.Now().Unix()
  1849. signature := setSignature(timestamp, nonce, secret_key)
  1850. //生成输入报文
  1851. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1852. input := make(map[string]interface{})
  1853. inputData := make(map[string]interface{})
  1854. inputMessage["infno"] = "1101" // 交易编码
  1855. if certificates == 3 {
  1856. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1857. inputData["certno"] = certNo // 证件号码
  1858. inputData["psn_cert_type"] = "99" // 人员证件类型
  1859. } else {
  1860. if id_card_type == 1 {
  1861. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1862. inputData["card_sn"] = "" // 卡识别码
  1863. inputData["certno"] = certNo // 证件号码
  1864. inputData["psn_cert_type"] = "01" // 人员证件类型
  1865. } else {
  1866. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1867. inputData["card_sn"] = "" // 卡识别码
  1868. inputData["certno"] = certNo // 证件号码
  1869. inputData["psn_cert_type"] = "1" // 人员证件类型
  1870. }
  1871. }
  1872. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1873. inputData["begntime"] = "" // 开始时间
  1874. inputData["psn_name"] = "" // 人员姓名
  1875. input["data"] = inputData
  1876. inputMessage["input"] = input //交易输入
  1877. bytesData, err := json.Marshal(inputMessage)
  1878. fmt.Println(string(bytesData))
  1879. if err != nil {
  1880. fmt.Println(err.Error())
  1881. return err.Error()
  1882. }
  1883. reader := bytes.NewReader(bytesData)
  1884. gdyb_url := beego.AppConfig.String("gdyb_url")
  1885. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1886. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1887. url := gdyb_url + "1101"
  1888. fmt.Println(url)
  1889. fmt.Println(gdyb_paasid)
  1890. fmt.Println(secret_key)
  1891. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
  1892. request, err := http.NewRequest("POST", url, reader)
  1893. if err != nil {
  1894. fmt.Println(err.Error())
  1895. return err.Error()
  1896. }
  1897. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1898. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1899. request.Header.Set("x-tif-signature", signature)
  1900. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1901. request.Header.Set("x-tif-nonce", nonce)
  1902. client := http.Client{}
  1903. resp, err := client.Do(request)
  1904. if err != nil {
  1905. fmt.Println(err.Error())
  1906. return err.Error()
  1907. }
  1908. respBytes, err := ioutil.ReadAll(resp.Body)
  1909. if err != nil {
  1910. fmt.Println(err.Error())
  1911. return err.Error()
  1912. }
  1913. fmt.Println(string(respBytes))
  1914. str := string(respBytes)
  1915. return str
  1916. }
  1917. //人员信息版本4
  1918. 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) {
  1919. //生成签名
  1920. nonce := GetRandomString(32)
  1921. timestamp := time.Now().Unix()
  1922. //signature := setSignature(timestamp, nonce, secret_key)
  1923. //生成输入报文
  1924. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1925. input := make(map[string]interface{})
  1926. inputData := make(map[string]interface{})
  1927. inputMessage["infno"] = "1101" // 交易编码
  1928. if certificates == 3 {
  1929. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1930. inputData["certno"] = certNo // 证件号码
  1931. inputData["psn_cert_type"] = "99" // 人员证件类型
  1932. } else {
  1933. if id_card_type == 1 {
  1934. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1935. inputData["card_sn"] = "" // 卡识别码
  1936. inputData["certno"] = "" // 证件号码
  1937. inputData["psn_cert_type"] = "" // 人员证件类型
  1938. } else {
  1939. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1940. inputData["card_sn"] = "" // 卡识别码
  1941. inputData["certno"] = certNo // 证件号码
  1942. inputData["psn_cert_type"] = "1" // 人员证件类型
  1943. }
  1944. }
  1945. inputData["mdtrt_cert_no"] = "" // 就诊凭证编号
  1946. inputData["begntime"] = "" // 开始时间
  1947. inputData["psn_name"] = "" // 人员姓名
  1948. input["data"] = inputData
  1949. inputMessage["input"] = input //交易输入
  1950. bytesData, err := json.Marshal(inputMessage)
  1951. fmt.Println(string(bytesData))
  1952. if err != nil {
  1953. fmt.Println(err.Error())
  1954. return err.Error(), ""
  1955. }
  1956. var json2 string
  1957. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
  1958. out, err := cmd.Output()
  1959. if err != nil {
  1960. fmt.Println("error:", err.Error())
  1961. }
  1962. fmt.Println(string(out))
  1963. return string(out), string(bytesData)
  1964. }
  1965. 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 {
  1966. //生成签名
  1967. nonce := GetRandomString(32)
  1968. timestamp := time.Now().Unix()
  1969. signature := setSignature(timestamp, nonce, secret_key)
  1970. //生成输入报文
  1971. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1972. input := make(map[string]interface{})
  1973. inputData := make(map[string]interface{})
  1974. inputMessage["infno"] = "90991" // 交易编码
  1975. inputData["fixmedins_code"] = fixmedins_code // 就诊凭证编号
  1976. inputData["psn_no"] = psn_no // 开始时间
  1977. inputData["card_pwd"] = pwd // 人员姓名
  1978. input["data"] = inputData
  1979. inputMessage["input"] = input //交易输入
  1980. bytesData, err := json.Marshal(inputMessage)
  1981. fmt.Println(string(bytesData))
  1982. if err != nil {
  1983. fmt.Println(err.Error())
  1984. return err.Error()
  1985. }
  1986. reader := bytes.NewReader(bytesData)
  1987. gdyb_url := beego.AppConfig.String("gdyb_url")
  1988. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1989. url := gdyb_url + "90991"
  1990. request, err := http.NewRequest("POST", url, reader)
  1991. if err != nil {
  1992. fmt.Println(err.Error())
  1993. return err.Error()
  1994. }
  1995. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1996. request.Header.Set("x-tif-paasid", gdyb_paasid)
  1997. request.Header.Set("x-tif-signature", signature)
  1998. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  1999. request.Header.Set("x-tif-nonce", nonce)
  2000. client := http.Client{}
  2001. resp, err := client.Do(request)
  2002. if err != nil {
  2003. fmt.Println(err.Error())
  2004. return err.Error()
  2005. }
  2006. respBytes, err := ioutil.ReadAll(resp.Body)
  2007. if err != nil {
  2008. fmt.Println(err.Error())
  2009. return err.Error()
  2010. }
  2011. fmt.Println(string(respBytes))
  2012. str := string(respBytes)
  2013. return str
  2014. }
  2015. func Hbyb90100(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
  2016. //生成签名
  2017. nonce := GetRandomString(32)
  2018. timestamp := time.Now().Unix()
  2019. signature := setSignature(timestamp, nonce, secret_key)
  2020. //生成输入报文
  2021. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  2022. input := make(map[string]interface{})
  2023. inputData := make(map[string]interface{})
  2024. inputMessage["infno"] = "90100" // 交易编码
  2025. inputData["psn_no"] = psn_no // 开始时间
  2026. input["data"] = inputData
  2027. inputMessage["input"] = input //交易输入
  2028. bytesData, err := json.Marshal(inputMessage)
  2029. fmt.Println(string(bytesData))
  2030. if err != nil {
  2031. fmt.Println(err.Error())
  2032. return err.Error()
  2033. }
  2034. reader := bytes.NewReader(bytesData)
  2035. gdyb_url := beego.AppConfig.String("gdyb_url")
  2036. gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  2037. url := gdyb_url + "90100"
  2038. request, err := http.NewRequest("POST", url, reader)
  2039. if err != nil {
  2040. fmt.Println(err.Error())
  2041. return err.Error()
  2042. }
  2043. request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  2044. request.Header.Set("x-tif-paasid", gdyb_paasid)
  2045. request.Header.Set("x-tif-signature", signature)
  2046. request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
  2047. request.Header.Set("x-tif-nonce", nonce)
  2048. client := http.Client{}
  2049. resp, err := client.Do(request)
  2050. if err != nil {
  2051. fmt.Println(err.Error())
  2052. return err.Error()
  2053. }
  2054. respBytes, err := ioutil.ReadAll(resp.Body)
  2055. if err != nil {
  2056. fmt.Println(err.Error())
  2057. return err.Error()
  2058. }
  2059. fmt.Println(string(respBytes))
  2060. str := string(respBytes)
  2061. return str
  2062. }
  2063. //func StrPtr(s string) uintptr {
  2064. // return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
  2065. //}
  2066. 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) {
  2067. if med_type == "1111" || med_type == "1112" {
  2068. med_type = "11"
  2069. }
  2070. // 生成签名
  2071. nonce := GetRandomString(32)
  2072. timestamp := time.Now().Unix()
  2073. //signature := setSignature(timestamp, nonce, secret_key)
  2074. tempTime := time.Unix(timestamp, 0)
  2075. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  2076. // 生成输入报文
  2077. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor_name, code, insuplcAdmdvs, mdtrtareaAdmvs)
  2078. input := make(map[string]interface{})
  2079. inputData := make(map[string]interface{})
  2080. inputMessage["infno"] = "2001" // 交易编码
  2081. inputData["psn_no"] = psn_no
  2082. inputData["insutype"] = insutype
  2083. inputData["med_type"] = med_type
  2084. inputData["begntime"] = timeFormatOne
  2085. input["data"] = inputData
  2086. inputMessage["input"] = input //交易输入
  2087. bytesData, err := json.Marshal(inputMessage)
  2088. fmt.Println(string(bytesData))
  2089. if err != nil {
  2090. fmt.Println(err.Error())
  2091. return err.Error(), ""
  2092. }
  2093. var json2 string
  2094. cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
  2095. out, err := cmd.Output()
  2096. if err != nil {
  2097. fmt.Println("error:", err.Error())
  2098. }
  2099. return string(out), string(bytesData)
  2100. }