hbyb_service.go 90KB

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