jsyb_service.go 97KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986
  1. package service
  2. import (
  3. //"bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. "gdyb/utils/csbhttp"
  8. //"io/ioutil"
  9. "net"
  10. //"net/http"
  11. "strconv"
  12. "time"
  13. )
  14. func Jsyb2201F() (string, string) {
  15. // 生成签名
  16. timestamp := time.Now().Unix()
  17. tempTime := time.Unix(timestamp, 0)
  18. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  19. // 生成输入报文
  20. inputMessage := SetJSInputMessage(timestamp, "盐城响水悦达血液透析中心有限公司", "王曙光", "H32092103007", "320921", "320921", "04aaa201baecc02c5f5e67d123810f2442dc04444e60a95ce529708bef8143f2fd3c5af38e21cccf9377c0ae3eef0a05528321f6265101a324802581709e2cdc297d94a3b176ed4112c8bc435d4f4362948720ea989bc58399fd251dd49b41d03356a1b99b6fd2c0bef2c6a2c970b03de9e3ce33499cc52b0c98a508d1eca0e104")
  21. //inputMessage := Se/**/tJSInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  22. input := make(map[string]interface{})
  23. inputData := make(map[string]interface{})
  24. inputMessage["infno"] = "2201" // 交易编码
  25. inputData["psn_no"] = "32090000000000001004606391" // 人员编号 (来自1101接口返回)
  26. inputData["insutype"] = "390" // 险种类型(来自1101接口返回)
  27. inputData["begntime"] = timeFormatOne // 开始时间
  28. //
  29. //if id_card_type == 1 {
  30. // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  31. // inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  32. //} else if id_card_type == 3 {
  33. // inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  34. // inputData["mdtrt_cert_no"] = "320822197705194836" + "|" + verify_number // 就诊凭证编号
  35. //} else {
  36. // inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  37. // inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  38. //
  39. //}
  40. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  41. inputData["mdtrt_cert_no"] = "320822197705194836|Y9gJ7nijh+DzGkn2W8El9YxSR0x1/zb2+tcA4a5fsVC4RLNACwi93U4Q9xEJVKKnN6LCbomuiCuxDOI+Skz/wsjlScPKIzyXxBcKl9ZrZjCrr+cRTRRKRdz6JqhoexGR/Cxnipr62JOW2fmrI1X2XA==" // 就诊凭证编号
  42. inputData["ipt_otp_no"] = timeFormatOne // 住院/门诊号
  43. inputData["atddr_no"] = "2484" // 医师编码
  44. inputData["dr_name"] = "王曙光" // 医师姓名
  45. inputData["dept_code"] = "01" // 科室编码
  46. inputData["dept_name"] = "血透室" // 科室名称
  47. inputData["caty"] = "A03.06" // 科别
  48. input["data"] = inputData
  49. inputMessage["input"] = input //交易输入
  50. var requestLog string
  51. bytesData, err := json.Marshal(inputMessage)
  52. requestLog = string(bytesData)
  53. fmt.Println(string(bytesData))
  54. if err != nil {
  55. fmt.Println(err.Error())
  56. return err.Error(), ""
  57. }
  58. request_url := "http://10.72.3.87:8086/CSB/" + "2201"
  59. //request_url = request_url + "2201"
  60. return HttpRequest(request_url, "1781ce9fb73a478289326c16ba8bf2c4", "b5DPOGjc08DAAMJ8FP31pwwNHKo=", timestamp, string(bytesData)), requestLog
  61. }
  62. func Jsyb1101F() (string, string) {
  63. timestamp := time.Now().Unix()
  64. //生成输入报文
  65. inputMessage := SetJSInputMessage(timestamp, "盐城响水悦达血液透析中心有限公司", "王曙光", "H32092103007", "320921", "320921", "04aaa201baecc02c5f5e67d123810f2442dc04444e60a95ce529708bef8143f2fd3c5af38e21cccf9377c0ae3eef0a05528321f6265101a324802581709e2cdc297d94a3b176ed4112c8bc435d4f4362948720ea989bc58399fd251dd49b41d03356a1b99b6fd2c0bef2c6a2c970b03de9e3ce33499cc52b0c98a508d1eca0e104")
  66. input := make(map[string]interface{})
  67. inputData := make(map[string]interface{})
  68. inputMessage["infno"] = "1101" // 交易编码
  69. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  70. inputData["card_sn"] = "" // 卡识别码
  71. inputData["certno"] = "" // 证件号码
  72. inputData["psn_cert_type"] = "01" // 人员证件类型
  73. inputData["mdtrt_cert_no"] = "320926196707111797|" // 就诊凭证编号
  74. inputData["begntime"] = "" // 开始时间
  75. inputData["psn_name"] = "" // 人员姓名
  76. input["data"] = inputData
  77. inputMessage["input"] = input //交易输入
  78. var inputLog string
  79. bytesData, _ := json.Marshal(inputMessage)
  80. inputLog = string(bytesData)
  81. fmt.Println(string(bytesData))
  82. if err != nil {
  83. fmt.Println(err.Error())
  84. return err.Error(), ""
  85. }
  86. request_url := "http://10.72.3.87:8086/CSB/" + "1101"
  87. return HttpRequest(request_url, "1781ce9fb73a478289326c16ba8bf2c4", "b5DPOGjc08DAAMJ8FP31pwwNHKo=", timestamp, string(bytesData)), inputLog
  88. }
  89. // 人员基本信息
  90. func Jsyb1101(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, request_url string, access_key string, cainfo string) (string, string) {
  91. timestamp := time.Now().Unix()
  92. //生成输入报文
  93. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  94. input := make(map[string]interface{})
  95. inputData := make(map[string]interface{})
  96. inputMessage["infno"] = "1101" // 交易编码
  97. if certificates == "3" {
  98. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  99. inputData["certno"] = certNo // 证件号码
  100. inputData["psn_cert_type"] = "99" // 人员证件类型
  101. } else {
  102. if id_card_type == 1 {
  103. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  104. inputData["card_sn"] = card_sn // 卡识别码
  105. inputData["certno"] = certNo // 证件号码
  106. inputData["psn_cert_type"] = "01" // 人员证件类型
  107. } else {
  108. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  109. inputData["card_sn"] = "" // 卡识别码
  110. inputData["certno"] = certNo // 证件号码
  111. inputData["psn_cert_type"] = "01" // 人员证件类型
  112. }
  113. }
  114. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  115. inputData["begntime"] = "" // 开始时间
  116. inputData["psn_name"] = "" // 人员姓名
  117. input["data"] = inputData
  118. inputMessage["input"] = input //交易输入
  119. var inputLog string
  120. bytesData, _ := json.Marshal(inputMessage)
  121. inputLog = string(bytesData)
  122. fmt.Println(string(bytesData))
  123. if err != nil {
  124. fmt.Println(err.Error())
  125. return err.Error(), ""
  126. }
  127. request_url = request_url + "1101"
  128. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
  129. }
  130. //人员基本信息版本2
  131. func Jsyb1101A(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, request_url string, access_key string, pBusiCardInfo string, id_card_no string, cainfo string) (string, string) {
  132. timestamp := time.Now().Unix()
  133. //生成输入报文
  134. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  135. input := make(map[string]interface{})
  136. inputData := make(map[string]interface{})
  137. inputMessage["infno"] = "1101" // 交易编码
  138. if certificates == "3" {
  139. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  140. inputData["certno"] = certNo // 证件号码
  141. inputData["psn_cert_type"] = "99" // 人员证件类型
  142. } else {
  143. if id_card_type == 1 {
  144. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  145. inputData["card_sn"] = card_sn // 卡识别码
  146. inputData["certno"] = id_card_no // 证件号码
  147. inputData["psn_cert_type"] = "01" // 人员证件类型
  148. } else {
  149. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  150. inputData["card_sn"] = "" // 卡识别码
  151. inputData["certno"] = certNo // 证件号码
  152. inputData["psn_cert_type"] = "01" // 人员证件类型
  153. }
  154. }
  155. inputData["mdtrt_cert_no"] = certNo + "|" + pBusiCardInfo // 就诊凭证编号
  156. inputData["begntime"] = "" // 开始时间
  157. inputData["psn_name"] = "" // 人员姓名
  158. input["data"] = inputData
  159. inputMessage["input"] = input //交易输入
  160. var inputLog string
  161. bytesData, _ := json.Marshal(inputMessage)
  162. inputLog = string(bytesData)
  163. fmt.Println(string(bytesData))
  164. if err != nil {
  165. fmt.Println(err.Error())
  166. return err.Error(), ""
  167. }
  168. request_url = request_url + "1101"
  169. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
  170. }
  171. func Jsyb1101B(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, Token string, cainfo string, id_card_no string) (string, string) {
  172. timestamp := time.Now().Unix()
  173. //生成输入报文
  174. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  175. input := make(map[string]interface{})
  176. inputData := make(map[string]interface{})
  177. inputMessage["infno"] = "1101" // 交易编码
  178. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  179. inputData["card_sn"] = "" // 卡识别码
  180. inputData["certno"] = "" // 证件号码
  181. inputData["psn_cert_type"] = "01" // 人员证件类型
  182. inputData["mdtrt_cert_no"] = id_card_no + "|" + Token // 就诊凭证编号
  183. inputData["begntime"] = "" // 开始时间
  184. inputData["psn_name"] = "" // 人员姓名
  185. input["data"] = inputData
  186. inputMessage["input"] = input //交易输入
  187. var inputLog string
  188. bytesData, _ := json.Marshal(inputMessage)
  189. inputLog = string(bytesData)
  190. fmt.Println(string(bytesData))
  191. if err != nil {
  192. fmt.Println(err.Error())
  193. return err.Error(), ""
  194. }
  195. request_url = request_url + "1101"
  196. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
  197. }
  198. func Jsyb1101ForEleCert(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, Token string, cainfo string, id_card_no string, name string) (string, string) {
  199. timestamp := time.Now().Unix()
  200. //生成输入报文
  201. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  202. input := make(map[string]interface{})
  203. inputData := make(map[string]interface{})
  204. inputMessage["infno"] = "1101" // 交易编码
  205. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  206. inputData["card_sn"] = "" // 卡识别码
  207. inputData["certno"] = id_card_no // 证件号码
  208. inputData["psn_cert_type"] = "1" // 人员证件类型
  209. inputData["mdtrt_cert_no"] = Token // 就诊凭证编号
  210. inputData["begntime"] = "" // 开始时间
  211. inputData["psn_name"] = name // 人员姓名
  212. input["data"] = inputData
  213. inputMessage["input"] = input //交易输入
  214. var inputLog string
  215. bytesData, _ := json.Marshal(inputMessage)
  216. inputLog = string(bytesData)
  217. fmt.Println(string(bytesData))
  218. if err != nil {
  219. fmt.Println(err.Error())
  220. return err.Error(), ""
  221. }
  222. request_url = request_url + "1101"
  223. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
  224. }
  225. // 门诊挂号
  226. func Jsyb2201(psnNo string, insutype string, certNo string, org_name string, opera 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, doctor_name string, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
  227. fmt.Println(opera)
  228. // 生成签名
  229. timestamp := time.Now().Unix()
  230. tempTime := time.Unix(timestamp, 0)
  231. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  232. // 生成输入报文
  233. inputMessage := SetJSInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  234. input := make(map[string]interface{})
  235. inputData := make(map[string]interface{})
  236. inputMessage["infno"] = "2201" // 交易编码
  237. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  238. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  239. inputData["begntime"] = timeFormatOne // 开始时间
  240. if id_card_type == 1 {
  241. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  242. inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  243. } else if id_card_type == 3 {
  244. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  245. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  246. } else if id_card_type == 4 {
  247. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  248. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  249. } else {
  250. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  251. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  252. }
  253. inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
  254. inputData["atddr_no"] = doctor_id // 医师编码
  255. inputData["dr_name"] = doctor_name // 医师姓名
  256. inputData["dept_code"] = dept_code // 科室编码
  257. inputData["dept_name"] = dept // 科室名称
  258. inputData["caty"] = "A03.06" // 科别
  259. inputData["exp_content"] = "" //
  260. input["data"] = inputData
  261. inputMessage["input"] = input //交易输入
  262. var requestLog string
  263. bytesData, err := json.Marshal(inputMessage)
  264. requestLog = string(bytesData)
  265. fmt.Println(string(bytesData))
  266. if err != nil {
  267. fmt.Println(err.Error())
  268. return err.Error(), ""
  269. }
  270. request_url = request_url + "2201"
  271. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  272. }
  273. // 门诊挂号撤销
  274. func Jsyb2202(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, request_url string, access_key string, cainfo string) (string, string) {
  275. // 生成签名
  276. timestamp := time.Now().Unix()
  277. // 生成输入报文
  278. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  279. input := make(map[string]interface{})
  280. inputData := make(map[string]interface{})
  281. inputMessage["infno"] = "2202" // 交易编码
  282. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  283. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  284. inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
  285. //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  286. inputData["exp_content"] = "" //
  287. input["data"] = inputData
  288. inputMessage["input"] = input //交易输入
  289. var requestLog string
  290. bytesData, err := json.Marshal(inputMessage)
  291. fmt.Println(string(bytesData))
  292. requestLog = string(bytesData)
  293. if err != nil {
  294. fmt.Println(err.Error())
  295. return err.Error(), ""
  296. }
  297. request_url = request_url + "2202"
  298. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  299. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  300. }
  301. // 门诊就诊信息上传
  302. func Jsyb2203(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, request_url string, access_key string, begin_time string, cainfo string) (string, string, int64) {
  303. // 生成签名
  304. timestamp := time.Now().Unix()
  305. tempTime := time.Unix(timestamp, 0)
  306. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  307. // 生成输入报文
  308. inputMessage := SetJSInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  309. input := make(map[string]interface{})
  310. inputData := make(map[string]interface{})
  311. diseinfo := make([]map[string]interface{}, 0)
  312. if med_type == "1111" || med_type == "1112" {
  313. med_type = "11"
  314. }
  315. inputMessage["infno"] = "2203A" // 交易编码
  316. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  317. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  318. inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  319. inputData["begntime"] = begin_time // 开始时间
  320. inputData["main_cond_dscr"] = "" // 主要病情描述
  321. inputData["dise_codg"] = sick_code // 病种编码
  322. inputData["dise_name"] = sick_name // 病种名称
  323. inputData["birctrl_type"] = "" // 计划生育手术类别
  324. inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  325. for index, item := range config {
  326. diseinfo_sun := make(map[string]interface{})
  327. diseinfo_sun["diag_type"] = "1" // 诊断类别
  328. diseinfo_sun["diag_srt_no"] = index // 诊断排序号
  329. diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
  330. diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
  331. diseinfo_sun["diag_dept"] = department // 诊断科室
  332. diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  333. diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
  334. diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  335. diseinfo_sun["vali_flag"] = "1" // 有效标志
  336. diseinfo = append(diseinfo, diseinfo_sun)
  337. }
  338. //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  339. inputData["exp_content"] = "" //
  340. input["diseinfo"] = diseinfo
  341. input["mdtrtinfo"] = inputData
  342. inputMessage["input"] = input //交易输入
  343. var requestLog string
  344. bytesData, err := json.Marshal(inputMessage)
  345. fmt.Println(string(bytesData))
  346. requestLog = string(bytesData)
  347. if err != nil {
  348. fmt.Println(err.Error())
  349. return err.Error(), "", 0
  350. }
  351. request_url = request_url + "2203A"
  352. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  353. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog, timestamp
  354. }
  355. // 门诊就诊信息上传
  356. func Jsyb2203A(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, request_url string, access_key string, cainfo string) (string, string) {
  357. // 生成签名
  358. timestamp := time.Now().Unix()
  359. tempTime := time.Unix(timestamp, 0)
  360. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  361. // 生成输入报文
  362. inputMessage := SetJSInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  363. input := make(map[string]interface{})
  364. inputData := make(map[string]interface{})
  365. diseinfo := make([]map[string]interface{}, 0)
  366. if med_type == "1111" || med_type == "1112" {
  367. med_type = "11"
  368. }
  369. inputMessage["infno"] = "2203A" // 交易编码
  370. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  371. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  372. inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  373. inputData["begntime"] = timeFormatOne // 开始时间
  374. inputData["main_cond_dscr"] = "" // 主要病情描述
  375. inputData["dise_codg"] = sick_code // 病种编码
  376. inputData["dise_name"] = sick_name // 病种名称
  377. inputData["birctrl_type"] = "" // 计划生育手术类别
  378. inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  379. inputData["matn_type"] = "" // 生育类别
  380. inputData["geso_val"] = "" // 孕周数
  381. for index, item := range config {
  382. diseinfo_sun := make(map[string]interface{})
  383. diseinfo_sun["diag_type"] = "1" // 诊断类别
  384. diseinfo_sun["diag_srt_no"] = index // 诊断排序号
  385. diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
  386. diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
  387. diseinfo_sun["diag_dept"] = department // 诊断科室
  388. diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  389. diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
  390. diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  391. diseinfo_sun["vali_flag"] = "1" // 有效标志
  392. diseinfo = append(diseinfo, diseinfo_sun)
  393. }
  394. input["diseinfo"] = diseinfo
  395. input["mdtrtinfo"] = inputData
  396. inputMessage["input"] = input //交易输入
  397. var requestLog string
  398. bytesData, err := json.Marshal(inputMessage)
  399. fmt.Println(string(bytesData))
  400. requestLog = string(bytesData)
  401. if err != nil {
  402. fmt.Println(err.Error())
  403. return err.Error(), ""
  404. }
  405. request_url = request_url + "2203A"
  406. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  407. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  408. }
  409. // 门诊费用明细信息上传
  410. func Jsyb2204(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, diag_code string, request_url string, access_key string, new_doctor_name string, time_stamp_2203 string, cainfo string) (string, string) {
  411. // 生成签名
  412. //timestamp := time.Now().Unix()
  413. timestamp := time.Now().Unix()
  414. timestamp2 := time.Now().Unix()
  415. //tempTime := time.Unix(timestamp2, 0)
  416. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  417. var customs []*Custom
  418. for _, item := range hisPrescription {
  419. tm := time.Unix(item.PreTime, 0)
  420. if item.Type == 1 { //药品
  421. for _, subItem := range item.HisDoctorAdviceInfo {
  422. if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
  423. //var randNum int
  424. //randNum = rand.Intn(10000) + 1000
  425. cus := &Custom{
  426. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
  427. Cut: fmt.Sprintf("%.4f", subItem.PrescribingNumber),
  428. FeedetlSn: subItem.FeedetlSn,
  429. Price: fmt.Sprintf("%.4f", subItem.Price),
  430. MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber,
  431. HospApprFlag: subItem.HospApprFlag,
  432. DoctorNumber: doctor_id,
  433. DoctorName: new_doctor_name,
  434. ProvinceDrugMedListCodg: "",
  435. ProvinceGoodMedListCodg: "",
  436. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  437. }
  438. if subItem.BaseDrugLib.DrugClassify == "2" {
  439. cus.ProvinceDrugMedListCodg = subItem.BaseDrugLib.ProvincesCode
  440. }
  441. customs = append(customs, cus)
  442. }
  443. }
  444. }
  445. if item.Type == 2 { //项目
  446. for _, subItem := range item.HisPrescriptionProject {
  447. //var randNum int
  448. //randNum = rand.Intn(10000) + 1000
  449. if subItem.Type == 2 {
  450. if len(subItem.HisProject.MedicalCode) > 0 {
  451. cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  452. cus := &Custom{
  453. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
  454. Cut: fmt.Sprintf("%.4f", cnt),
  455. FeedetlSn: subItem.FeedetlSn,
  456. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  457. MedListCodg: subItem.HisProject.MedicalCode,
  458. DoctorNumber: doctor_id,
  459. DoctorName: new_doctor_name,
  460. HospApprFlag: -1,
  461. ProvinceDrugMedListCodg: "",
  462. ProvinceGoodMedListCodg: "",
  463. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  464. }
  465. customs = append(customs, cus)
  466. }
  467. } else if subItem.Type == 3 {
  468. if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
  469. cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  470. cus := &Custom{
  471. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
  472. Cut: fmt.Sprintf("%.4f", cnt),
  473. FeedetlSn: subItem.FeedetlSn,
  474. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  475. MedListCodg: subItem.GoodInfo.MedicalInsuranceNumber,
  476. HospApprFlag: -1,
  477. DoctorNumber: doctor_id,
  478. DoctorName: new_doctor_name,
  479. ProvinceDrugMedListCodg: "",
  480. ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode,
  481. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  482. }
  483. customs = append(customs, cus)
  484. }
  485. }
  486. }
  487. }
  488. for _, subItem := range item.HisAdditionalCharge {
  489. if len(subItem.XtHisAddtionConfig.Code) > 0 {
  490. cus := &Custom{
  491. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*float64(subItem.Count)),
  492. Cut: fmt.Sprintf("%.4f", float64(subItem.Count)),
  493. FeedetlSn: subItem.FeedetlSn,
  494. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  495. MedListCodg: subItem.XtHisAddtionConfig.Code,
  496. HospApprFlag: -1,
  497. DoctorNumber: doctor_id,
  498. DoctorName: new_doctor_name,
  499. }
  500. customs = append(customs, cus)
  501. }
  502. }
  503. }
  504. // 生成输入报文
  505. inputMessage := SetJSInputMessage(timestamp2, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  506. input := make(map[string]interface{})
  507. feedetail := make([]map[string]interface{}, 0)
  508. inputMessage["infno"] = "2204" // 交易编码
  509. //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
  510. for _, item := range customs {
  511. feedetailInfo := make(map[string]interface{})
  512. subfeedetailInfo := make(map[string]interface{})
  513. feedetailInfo["feedetl_sn"] = item.FeedetlSn
  514. feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  515. feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  516. feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
  517. feedetailInfo["dise_codg"] = diag_code // 病种编码
  518. feedetailInfo["rxno"] = "" // 处方号
  519. feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
  520. feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间
  521. feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
  522. feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码
  523. feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
  524. feedetailInfo["cnt"] = item.Cut // 数量
  525. feedetailInfo["pric"] = item.Price // 单价
  526. feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
  527. feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
  528. feedetailInfo["prd_days"] = "0" // 周期天数
  529. feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
  530. feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
  531. feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
  532. feedetailInfo["bilg_dr_codg"] = "D371621008686" // 开单医生编码
  533. feedetailInfo["bilg_dr_name"] = "王云刚" // 开单医师姓名
  534. feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
  535. feedetailInfo["acord_dept_name"] = "" // 受单科室名称
  536. feedetailInfo["orders_dr_code"] = "D371621008686" // 受单医生编码
  537. feedetailInfo["orders_dr_name"] = "王云刚" // 受单医生姓名
  538. if balance_accounts_type == "8" {
  539. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  540. } else {
  541. if item.HospApprFlag != -1 {
  542. if item.HospApprFlag == 1 {
  543. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  544. } else if item.HospApprFlag == 2 {
  545. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  546. } else if item.HospApprFlag == 3 {
  547. feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
  548. } else {
  549. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  550. }
  551. } else {
  552. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  553. }
  554. }
  555. feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
  556. feedetailInfo["etip_flag"] = "" // 外检标志
  557. feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
  558. feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
  559. feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
  560. subfeedetailInfo["tcmherb_prov_code"] = item.ProvinceDrugMedListCodg
  561. subfeedetailInfo["mcs_prov_code"] = item.ProvinceGoodMedListCodg
  562. feedetailInfo["exp_content"] = subfeedetailInfo
  563. feedetail = append(feedetail, feedetailInfo)
  564. }
  565. input["feedetail"] = feedetail
  566. inputMessage["input"] = input //交易输入
  567. var requestLog string
  568. bytesData, err := json.Marshal(inputMessage)
  569. requestLog = string(bytesData)
  570. fmt.Println(string(bytesData))
  571. if err != nil {
  572. fmt.Println(err.Error())
  573. return "", ""
  574. }
  575. request_url = request_url + "2204"
  576. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  577. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  578. }
  579. // 门诊费用明细信息撤销
  580. func Jsyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, request_url string, access_key string, cainfo string) (string, string) {
  581. timestamp := time.Now().Unix()
  582. // 生成输入报文
  583. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  584. input := make(map[string]interface{})
  585. inputData := make(map[string]interface{})
  586. inputMessage["infno"] = "2205" // 交易编码
  587. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  588. inputData["chrg_bchno"] = "0000" // 收费批次号(来自2204生成的)
  589. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  590. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  591. input["data"] = inputData
  592. inputMessage["input"] = input //交易输入
  593. bytesData, err := json.Marshal(inputMessage)
  594. fmt.Println(string(bytesData))
  595. var requestLog string
  596. requestLog = string(bytesData)
  597. if err != nil {
  598. fmt.Println(err.Error())
  599. return err.Error(), ""
  600. }
  601. request_url = request_url + "2205"
  602. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  603. }
  604. // 门诊预结算
  605. func Jsyb2206(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, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
  606. // 生成签名
  607. timestamp := time.Now().Unix() // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  608. // inputData["mdtrt_cert_no"] = certNo
  609. // 生成输入报文
  610. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  611. input := make(map[string]interface{})
  612. inputData := make(map[string]interface{})
  613. inputMessage["infno"] = "2206" // 交易编码
  614. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  615. if certificates == 3 {
  616. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  617. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  618. } else {
  619. if id_card_type == 1 {
  620. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  621. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  622. } else if id_card_type == 3 {
  623. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  624. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  625. } else if id_card_type == 4 {
  626. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  627. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  628. } else {
  629. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  630. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  631. }
  632. }
  633. if insuplc_admdvs == "421300" {
  634. if med_type == "11" || med_type == "1112" || med_type == "1111" {
  635. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  636. } else if med_type == "14" {
  637. inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
  638. }
  639. } else {
  640. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  641. }
  642. inputData["medfee_sumamt"] = total // 医疗费总额
  643. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  644. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  645. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  646. inputData["acct_used_flag"] = "0" // 个人账户使用标志 0否 1是
  647. inputData["insutype"] = insutype // 险种类型
  648. inputData["invono"] = "" // 发票号
  649. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  650. input["data"] = inputData
  651. inputMessage["input"] = input //交易输入
  652. var requestLog string
  653. bytesData, err := json.Marshal(inputMessage)
  654. requestLog = string(bytesData)
  655. fmt.Println(string(bytesData))
  656. if err != nil {
  657. fmt.Println(err.Error())
  658. return err.Error(), ""
  659. }
  660. request_url = request_url + "2206"
  661. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  662. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  663. }
  664. // 门诊结算
  665. func Jsyb2207(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 string, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
  666. // 生成签名
  667. timestamp := time.Now().Unix()
  668. // 生成输入报文
  669. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  670. input := make(map[string]interface{})
  671. inputData := make(map[string]interface{})
  672. inputMessage["infno"] = "2207" // 交易编码
  673. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  674. if certificates == 3 {
  675. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  676. inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  677. } else {
  678. if id_card_type == 1 {
  679. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  680. inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  681. } else if id_card_type == 3 {
  682. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  683. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  684. } else if id_card_type == 4 {
  685. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  686. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  687. } else {
  688. }
  689. }
  690. if med_type == "1111" || med_type == "1112" {
  691. med_type = "11"
  692. }
  693. if insuplc_admdvs == "421300" {
  694. if med_type == "11" {
  695. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  696. } else if med_type == "14" {
  697. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  698. }
  699. } else {
  700. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  701. }
  702. inputData["medfee_sumamt"] = total // 医疗费总额
  703. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  704. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  705. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  706. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  707. inputData["insutype"] = insutype // 险种类型
  708. inputData["invono"] = "" // 发票号
  709. inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
  710. inputData["overlmt_selfpay"] = overlmt_selfpay //
  711. inputData["preselfpay_amt"] = preselfpay_amt //
  712. inputData["inscp_scp_amt"] = inscp_scp_amt //
  713. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  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. request_url = request_url + "2207"
  723. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  724. }
  725. func Jsyb2207A(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 string, request_url string, access_key string, cainfo string) (string, string) {
  726. // 生成签名
  727. timestamp := time.Now().Unix()
  728. // 生成输入报文
  729. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  730. input := make(map[string]interface{})
  731. inputData := make(map[string]interface{})
  732. inputMessage["infno"] = "2207A" // 交易编码
  733. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  734. if certificates == 3 {
  735. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  736. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  737. } else {
  738. if id_card_type == 1 {
  739. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  740. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  741. } else {
  742. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  743. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  744. }
  745. }
  746. if med_type == "1111" || med_type == "1112" {
  747. med_type = "11"
  748. }
  749. if insuplc_admdvs == "421300" {
  750. if med_type == "11" {
  751. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  752. } else if med_type == "14" {
  753. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  754. }
  755. } else {
  756. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  757. }
  758. inputData["medfee_sumamt"] = total // 医疗费总额
  759. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  760. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  761. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  762. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  763. inputData["insutype"] = insutype // 险种类型
  764. inputData["invono"] = "" // 发票号
  765. inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
  766. inputData["overlmt_selfpay"] = overlmt_selfpay //
  767. inputData["preselfpay_amt"] = preselfpay_amt //
  768. inputData["inscp_scp_amt"] = inscp_scp_amt //
  769. input["data"] = inputData
  770. inputMessage["input"] = input //交易输入
  771. bytesData, err := json.Marshal(inputMessage)
  772. fmt.Println(string(bytesData))
  773. if err != nil {
  774. fmt.Println(err.Error())
  775. return err.Error(), ""
  776. }
  777. request_url = request_url + "2207A"
  778. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  779. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  780. }
  781. // 门诊结算撤销
  782. func Jsyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, cainfo string) (string, string) {
  783. timestamp := time.Now().Unix()
  784. // 生成输入报文
  785. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  786. input := make(map[string]interface{})
  787. inputData := make(map[string]interface{})
  788. inputMessage["infno"] = "2208" // 交易编码
  789. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  790. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  791. inputData["setl_id"] = setlId // 结算 ID
  792. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  793. input["data"] = inputData
  794. inputMessage["input"] = input //交易输入
  795. bytesData, err := json.Marshal(inputMessage)
  796. fmt.Println(string(bytesData))
  797. if err != nil {
  798. fmt.Println(err.Error())
  799. return err.Error(), ""
  800. }
  801. request_url = request_url + "2208"
  802. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  803. }
  804. func Jsyb5203(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
  805. timestamp := time.Now().Unix()
  806. // 生成输入报文
  807. inputMessage := SetJSInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
  808. input := make(map[string]interface{})
  809. inputData := make(map[string]interface{})
  810. inputMessage["infno"] = "5203" // 交易编码
  811. inputData["psn_no"] = businessParams.PsnNo
  812. inputData["setl_id"] = businessParams.SetlId
  813. inputData["mdtrt_id"] = businessParams.MdtrtId
  814. input["data"] = inputData
  815. inputMessage["input"] = input //交易输入
  816. bytesData, err := json.Marshal(inputMessage)
  817. fmt.Println(string(bytesData))
  818. if err != nil {
  819. fmt.Println(err.Error())
  820. return err.Error(), ""
  821. }
  822. baseParams.RequestUrl = baseParams.RequestUrl + "5203"
  823. //fmt.Println(HttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
  824. return HttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)), string(bytesData)
  825. }
  826. //CBS总线
  827. func HttpRequest(url string, ak string, sk string, timestamp int64, json string) string {
  828. fmt.Println(url)
  829. //step 1. 设置请求参数
  830. csbHP := csbhttp.NewHttpParams(url) //设置请求地址及url参数
  831. //设置调用方式 get 或者 post
  832. csbHP.SetMethod("post")
  833. //csbHP.AddParam("input", "")
  834. //设置 调用的服务名和版本
  835. csbHP.SetApi("hssServives")
  836. csbHP.SetVersion("1.0.0")
  837. //添加附加的http请求头 (可以定义多条)
  838. //key := "_api_access_key=" + ak + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
  839. csbHP.AddHeader("_api_timestamp", strconv.FormatInt(timestamp, 10))
  840. csbHP.AddHeader("_api_name", "hssServives")
  841. csbHP.AddHeader("_api_version", "1.0.0")
  842. csbHP.AddHeader("_api_access_key", ak)
  843. csbHP.AddHeader("Content-Type", "application/json;charset=UTF-8")
  844. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  845. //还可以,设置附加的byte[]或者json请求体
  846. csbHP.SetContentBody(json, nil)
  847. //设置请求的ak和sk
  848. csbHP.SetAK(ak)
  849. csbHP.SetSK(sk)
  850. //打印请求参数信息
  851. csbHP.Print()
  852. //进行调用, 返回的第二项为resonse http headers (map[string][]string类型)
  853. //res, _, err := csbhttp.Invoke(*csbHP, requestByte)
  854. res, _, err := csbhttp.Invoke(*csbHP, strconv.FormatInt(timestamp, 10))
  855. //是否发成错误
  856. if err != nil {
  857. fmt.Println(err)
  858. return ""
  859. }
  860. fmt.Println(res)
  861. return res
  862. }
  863. // 生成基础报文
  864. func SetJSInputMessage(timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, cainfo string) map[string]interface{} {
  865. // 生成签名
  866. tempTime := time.Unix(timestamp, 0)
  867. //timeFormat := tempTime.Format("20060102150405")
  868. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  869. //randNum := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000)
  870. month := time.Unix(1557042972, 0).Format("1")
  871. year := time.Now().Format("2006")
  872. month = time.Now().Format("01")
  873. day := time.Now().Format("02")
  874. hour := time.Now().Format("15")
  875. min := time.Now().Format("04")
  876. sec := time.Now().Format("05")
  877. msec := time.Now().Format("000")
  878. // 生成输入报文
  879. inputMessage := make(map[string]interface{})
  880. inputMessage["msgid"] = fixmedins_code + year + month + day + hour + min + sec + msec + "0" // 发送方报文 ID
  881. inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs // 就医地医保区划
  882. inputMessage["insuplc_admdvs"] = insuplc_admdvs // 参保地医保区划
  883. inputMessage["recer_sys_code"] = "MBS_LOCAL" // 接收方系统代码
  884. inputMessage["dev_no"] = "1" // 设备编号
  885. inputMessage["dev_safe_info"] = "1" // 设备安全信息
  886. inputMessage["cainfo"] = cainfo // 数字签名信息
  887. inputMessage["signtype"] = "SM3" // 签名类型
  888. inputMessage["infver"] = "1.0.0" // 接收方系统代码
  889. inputMessage["opter_type"] = "1" // 经办人类别
  890. if fixmedins_code == "H32090403023" {
  891. inputMessage["opter"] = "晁海燕" // 经办人
  892. inputMessage["opter_name"] = "晁海燕" // 经办人姓名
  893. } else {
  894. inputMessage["opter"] = "孙欣欣" // 经办人
  895. inputMessage["opter_name"] = "孙欣欣" // 经办人姓名
  896. }
  897. inputMessage["inf_time"] = timeFormatOne // 交易时间
  898. inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
  899. inputMessage["fixmedins_name"] = org_name
  900. inputMessage["fixmedins_soft_fcty"] = "深圳市领透科技有限公司" //定点医药机构名称
  901. //定点医药机构名称
  902. inputMessage["sign_no"] = "" //交易签到流水号
  903. return inputMessage
  904. }
  905. func Jsyb5301(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, request_url string, access_key string, cainfo string) (string, string) {
  906. // 生成签名
  907. //nonce := GetRandomString(32)
  908. timestamp := time.Now().Unix()
  909. //signature := setSignature(timestamp, nonce, secret_key)
  910. //tempTime := time.Unix(timestamp, 0)
  911. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  912. //timeFormatTwo := tempTime.Format("2006-01-02")
  913. // 生成输入报文
  914. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  915. input := make(map[string]interface{})
  916. inputData := make(map[string]interface{})
  917. inputMessage["infno"] = "5301" // 交易编码
  918. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  919. input["data"] = inputData
  920. inputMessage["input"] = input //交易输入
  921. bytesData, err := json.Marshal(inputMessage)
  922. fmt.Println(string(bytesData))
  923. if err != nil {
  924. fmt.Println(err.Error())
  925. return err.Error(), ""
  926. }
  927. request_url = request_url + "5301"
  928. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  929. }
  930. func Jsyb2503(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, start_time string, end_time string, check_time string, request_url string, access_key string, cainfo string) (string, string) {
  931. timestamp := time.Now().Unix()
  932. // 生成输入报文
  933. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  934. input := make(map[string]interface{})
  935. inputData := make(map[string]interface{})
  936. inputMessage["infno"] = "2503" // 交易编码
  937. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  938. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  939. inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
  940. inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
  941. inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
  942. inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
  943. inputData["ide_fixmedins_name"] = org_name // 险种类型(来自1101接口返回)
  944. inputData["hosp_ide_date"] = check_time // 险种类型(来自1101接口返回)
  945. inputData["diag_dr_codg"] = doctor_id // 开始时间
  946. inputData["diag_dr_name"] = doctor // 开始时间
  947. inputData["begndate"] = start_time // 医师编码
  948. inputData["tel"] = "" // 医师编码
  949. inputData["addr"] = "" // 医师编码
  950. inputData["enddate"] = end_time // 医师编码
  951. input["data"] = inputData
  952. inputMessage["input"] = input //交易输入
  953. bytesData, err := json.Marshal(inputMessage)
  954. fmt.Println(string(bytesData))
  955. if err != nil {
  956. fmt.Println(err.Error())
  957. return err.Error(), ""
  958. }
  959. request_url = request_url + "2503"
  960. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  961. }
  962. func Jsyb3201(fixmedins_setl_cnt int64, acct_pay float64, fund_pay_sumamt float64, medfee_sumamt float64, stmt_begndate string, stmt_enddate string, setl_optins string, clr_type string, insutype string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, access_key string, secret_key string, cainfo string) (string, string) {
  963. // 生成签名
  964. timestamp := time.Now().Unix()
  965. // 生成输入报文
  966. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  967. input := make(map[string]interface{})
  968. inputData := make(map[string]interface{})
  969. inputMessage["infno"] = "3201" // 交易编码
  970. inputData["insutype"] = insutype // 险种
  971. inputData["clr_type"] = clr_type // 就诊 ID(来自2201接口返回)
  972. inputData["setl_optins"] = setl_optins // 结算经办机构
  973. inputData["stmt_begndate"] = stmt_begndate // 对帐开始时间
  974. inputData["stmt_enddate"] = stmt_enddate //对帐结束时间
  975. inputData["medfee_sumamt"] = medfee_sumamt //医疗费总额
  976. inputData["fund_pay_sumamt"] = fund_pay_sumamt //基金支付总额
  977. inputData["acct_pay"] = acct_pay //个人账户支付金额
  978. inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
  979. inputData["refd_setl_flag"] = 0 //
  980. input["data"] = inputData
  981. inputMessage["input"] = input //交易输入
  982. bytesData, err := json.Marshal(inputMessage)
  983. fmt.Println(string(bytesData))
  984. if err != nil {
  985. fmt.Println(err.Error())
  986. return err.Error(), ""
  987. }
  988. request_url = request_url + "3201"
  989. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  990. }
  991. func Jsyb9001(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, admin_user_id int64, request_url string, cainfo string, access_key string) (string, string) {
  992. // 生成签名
  993. timestamp := time.Now().Unix()
  994. // 生成输入报文
  995. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  996. input := make(map[string]interface{})
  997. inputData := make(map[string]interface{})
  998. inputMessage["infno"] = "9001" // 交易编码
  999. inputData["opter_no"] = admin_user_id
  1000. inputData["mac"] = GetMacTwo() // 开始时间
  1001. inputData["ip"] = GetLocalIpTwo()
  1002. input["signIn"] = inputData
  1003. inputMessage["input"] = input //交易输入
  1004. bytesData, err := json.Marshal(inputMessage)
  1005. fmt.Println(string(bytesData))
  1006. if err != nil {
  1007. fmt.Println(err.Error())
  1008. return err.Error(), ""
  1009. }
  1010. //reader := bytes.NewReader(bytesData)
  1011. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
  1012. //gdyb_url := beego.AppConfig.String("gdyb_url")
  1013. //gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1014. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1015. //url := gdyb_url
  1016. //request, err := http.NewRequest("POST", request_url+"9001", reader)
  1017. //if err != nil {
  1018. // fmt.Println(err.Error())
  1019. // return err.Error(), ""
  1020. //}
  1021. //
  1022. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1023. //request.Header.Set("_api_timestamp", strconv.FormatInt(timestamp, 10))
  1024. //request.Header.Set("_api_name", "hssServives")
  1025. //request.Header.Set("_api_version", "1.0.0")
  1026. //request.Header.Set("_api_access_key", access_key)
  1027. //request.Header.Set("_api_signature", "")
  1028. //
  1029. //client := http.Client{}
  1030. //resp, err := client.Do(request)
  1031. //if err != nil {
  1032. // fmt.Println(err.Error())
  1033. // return err.Error(), ""
  1034. //}
  1035. //respBytes, err := ioutil.ReadAll(resp.Body)
  1036. //if err != nil {
  1037. // fmt.Println(err.Error())
  1038. // return err.Error(), ""
  1039. //}
  1040. //str := string(respBytes)
  1041. //fmt.Println(str)
  1042. //return str, ""
  1043. request_url = request_url + "9001"
  1044. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  1045. }
  1046. //获取本机ip
  1047. func GetLocalIpTwo() string {
  1048. addrs, err := net.InterfaceAddrs()
  1049. if err != nil {
  1050. fmt.Println("get local ip failed")
  1051. }
  1052. for _, address := range addrs {
  1053. if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
  1054. if ipnet.IP.To4() != nil {
  1055. return ipnet.IP.String()
  1056. }
  1057. }
  1058. }
  1059. return ""
  1060. }
  1061. //获取本机Mac
  1062. func GetMacTwo() string {
  1063. interfaces, err := net.Interfaces()
  1064. if err != nil {
  1065. fmt.Println("Get loacl Mac failed")
  1066. }
  1067. for _, inter := range interfaces {
  1068. mac := inter.HardwareAddr
  1069. fmt.Println("+======" + mac.String())
  1070. if mac.String() != "" {
  1071. return mac.String()
  1072. }
  1073. }
  1074. return ""
  1075. }
  1076. func Jsyb3101(pd models.PatientDtos, fed models.FsiEncounterDtos, fdds []*models.FsiDiagnoseDtos, fods []*models.FsiOrderDtos, fopds []*models.FsiOperationDtosData, params models.PublicParams, trig_scen string) (string, string) {
  1077. // 生成签名
  1078. timestamp := time.Now().Unix()
  1079. // 生成输入报文
  1080. inputMessage := SetJSInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1081. input := make(map[string]interface{})
  1082. inputData := make(map[string]interface{})
  1083. patientDtosinputData := make(map[string]interface{})
  1084. fisEncounterDtosData := make(map[string]interface{})
  1085. fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
  1086. fsiOrderDtosDatas := make([]map[string]interface{}, 0)
  1087. fsiOperationDtosData := make(map[string]interface{})
  1088. fsiOperationDtosDatas := make([]map[string]interface{}, 0)
  1089. //就诊信息
  1090. fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
  1091. fisEncounterDtosData["medins_id"] = fed.MedinsID
  1092. fisEncounterDtosData["medins_name"] = fed.MedinsName
  1093. fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
  1094. fisEncounterDtosData["medins_type"] = fed.MedinsType
  1095. fisEncounterDtosData["medins_lv"] = fed.MedinsLv
  1096. fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
  1097. fisEncounterDtosData["wardno"] = fed.Wardno
  1098. fisEncounterDtosData["bedno"] = fed.Bedno
  1099. fisEncounterDtosData["adm_date"] = fed.AdmDate
  1100. fisEncounterDtosData["dscg_date"] = fed.DscgDate
  1101. fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
  1102. fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
  1103. for _, fdd := range fdds {
  1104. fsiDiagnoseDtosData := make(map[string]interface{})
  1105. //诊断集合
  1106. fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
  1107. fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
  1108. fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
  1109. fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
  1110. fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
  1111. fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
  1112. fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
  1113. fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
  1114. }
  1115. fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
  1116. fisEncounterDtosData["dr_codg"] = fed.DrCodg
  1117. fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
  1118. fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
  1119. fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
  1120. fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
  1121. fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
  1122. fisEncounterDtosData["med_type"] = fed.MedType
  1123. for _, fod := range fods {
  1124. fsiOrderDtosData := make(map[string]interface{})
  1125. //医嘱集合
  1126. fsiOrderDtosData["rx_id"] = fod.RxID
  1127. fsiOrderDtosData["rxno"] = fod.Rxno
  1128. fsiOrderDtosData["grpno"] = fod.Grpno
  1129. fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
  1130. fsiOrderDtosData["hilist_type"] = fod.HilistType
  1131. fsiOrderDtosData["chrg_type"] = fod.ChrgType
  1132. fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
  1133. fsiOrderDtosData["hilist_code"] = fod.HilistCode
  1134. fsiOrderDtosData["hilist_name"] = fod.HilistName
  1135. fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
  1136. fsiOrderDtosData["hilist_lv"] = fod.HilistLv
  1137. fsiOrderDtosData["hilist_pric"] = fod.HilistPric
  1138. fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
  1139. fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
  1140. fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
  1141. fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
  1142. fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
  1143. fsiOrderDtosData["hosplist_name"] = fod.HosplistName
  1144. fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
  1145. fsiOrderDtosData["cnt"] = fod.Cnt
  1146. fsiOrderDtosData["pric"] = fod.Pric
  1147. fsiOrderDtosData["sumamt"] = fod.Sumamt
  1148. fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
  1149. fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
  1150. fsiOrderDtosData["spec"] = fod.Spec
  1151. fsiOrderDtosData["spec_unt"] = fod.SpecUnt
  1152. fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
  1153. fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
  1154. fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
  1155. fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
  1156. fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
  1157. fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
  1158. fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
  1159. fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
  1160. fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
  1161. }
  1162. fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
  1163. fisEncounterDtosData["matn_stas"] = fed.MatnStas
  1164. fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
  1165. fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
  1166. fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
  1167. fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
  1168. fisEncounterDtosData["ma_amt"] = fed.MaAmt
  1169. fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
  1170. fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
  1171. fisEncounterDtosData["insutype"] = fed.Insutype
  1172. fisEncounterDtosData["reim_flag"] = fed.ReimFlag
  1173. fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
  1174. //手术操作
  1175. for _, fopd := range fopds {
  1176. fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
  1177. fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
  1178. fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
  1179. fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
  1180. fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
  1181. fsiOperationDtosData["anst_way"] = fopd.Anst_way
  1182. fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
  1183. fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
  1184. fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
  1185. fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
  1186. fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
  1187. }
  1188. fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
  1189. patientDtosinputData["patn_id"] = pd.PatnID
  1190. patientDtosinputData["patn_name"] = pd.PatnName
  1191. patientDtosinputData["gend"] = pd.Gend
  1192. patientDtosinputData["brdy"] = pd.Brdy
  1193. patientDtosinputData["poolarea"] = pd.Poolarea
  1194. patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
  1195. patientDtosinputData["fsi_his_data_dto"] = ""
  1196. patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
  1197. inputData["syscode"] = "LinkDialysis"
  1198. inputData["trig_scen"] = trig_scen
  1199. inputData["rule_ids"] = ""
  1200. inputData["task_id"] = ""
  1201. inputData["patient_dtos"] = patientDtosinputData
  1202. input["data"] = inputData
  1203. inputMessage["infno"] = "3101"
  1204. inputMessage["input"] = input //交易输入
  1205. bytesData, err := json.Marshal(inputMessage)
  1206. fmt.Println(string(bytesData))
  1207. if err != nil {
  1208. fmt.Println(err.Error())
  1209. return err.Error(), ""
  1210. }
  1211. params.RequestUrl = params.RequestUrl + "3101"
  1212. return HttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1213. }
  1214. func Jsyb3102(pd models.PatientDtos, fed models.FsiEncounterDtos, fdds []*models.FsiDiagnoseDtos, fods []*models.FsiOrderDtos, fopds []*models.FsiOperationDtosData, params models.PublicParams, trig_scen string) (string, string) {
  1215. // 生成签名
  1216. timestamp := time.Now().Unix()
  1217. // 生成输入报文
  1218. inputMessage := SetJSInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1219. input := make(map[string]interface{})
  1220. inputData := make(map[string]interface{})
  1221. patientDtosinputData := make(map[string]interface{})
  1222. fisEncounterDtosData := make(map[string]interface{})
  1223. fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
  1224. fsiOrderDtosDatas := make([]map[string]interface{}, 0)
  1225. fsiOperationDtosData := make(map[string]interface{})
  1226. fsiOperationDtosDatas := make([]map[string]interface{}, 0)
  1227. //就诊信息
  1228. fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
  1229. fisEncounterDtosData["medins_id"] = fed.MedinsID
  1230. fisEncounterDtosData["medins_name"] = fed.MedinsName
  1231. fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
  1232. fisEncounterDtosData["medins_type"] = fed.MedinsType
  1233. fisEncounterDtosData["medins_lv"] = fed.MedinsLv
  1234. fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
  1235. fisEncounterDtosData["wardno"] = fed.Wardno
  1236. fisEncounterDtosData["bedno"] = fed.Bedno
  1237. fisEncounterDtosData["adm_date"] = fed.AdmDate
  1238. fisEncounterDtosData["dscg_date"] = fed.DscgDate
  1239. fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
  1240. fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
  1241. for _, fdd := range fdds {
  1242. fsiDiagnoseDtosData := make(map[string]interface{})
  1243. //诊断集合
  1244. fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
  1245. fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
  1246. fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
  1247. fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
  1248. fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
  1249. fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
  1250. fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
  1251. fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
  1252. }
  1253. fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
  1254. fisEncounterDtosData["dr_codg"] = fed.DrCodg
  1255. fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
  1256. fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
  1257. fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
  1258. fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
  1259. fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
  1260. fisEncounterDtosData["med_type"] = fed.MedType
  1261. for _, fod := range fods {
  1262. fsiOrderDtosData := make(map[string]interface{})
  1263. //医嘱集合
  1264. fsiOrderDtosData["rx_id"] = fod.RxID
  1265. fsiOrderDtosData["rxno"] = fod.Rxno
  1266. fsiOrderDtosData["grpno"] = fod.Grpno
  1267. fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
  1268. fsiOrderDtosData["hilist_type"] = fod.HilistType
  1269. fsiOrderDtosData["chrg_type"] = fod.ChrgType
  1270. fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
  1271. fsiOrderDtosData["hilist_code"] = fod.HilistCode
  1272. fsiOrderDtosData["hilist_name"] = fod.HilistName
  1273. fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
  1274. fsiOrderDtosData["hilist_lv"] = fod.HilistLv
  1275. fsiOrderDtosData["hilist_pric"] = fod.HilistPric
  1276. fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
  1277. fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
  1278. fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
  1279. fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
  1280. fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
  1281. fsiOrderDtosData["hosplist_name"] = fod.HosplistName
  1282. fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
  1283. fsiOrderDtosData["cnt"] = fod.Cnt
  1284. fsiOrderDtosData["pric"] = fod.Pric
  1285. fsiOrderDtosData["sumamt"] = fod.Sumamt
  1286. fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
  1287. fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
  1288. fsiOrderDtosData["spec"] = fod.Spec
  1289. fsiOrderDtosData["spec_unt"] = fod.SpecUnt
  1290. fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
  1291. fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
  1292. fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
  1293. fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
  1294. fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
  1295. fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
  1296. fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
  1297. fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
  1298. fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
  1299. }
  1300. fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
  1301. fisEncounterDtosData["matn_stas"] = fed.MatnStas
  1302. fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
  1303. fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
  1304. fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
  1305. fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
  1306. fisEncounterDtosData["ma_amt"] = fed.MaAmt
  1307. fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
  1308. fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
  1309. fisEncounterDtosData["insutype"] = fed.Insutype
  1310. fisEncounterDtosData["reim_flag"] = fed.ReimFlag
  1311. fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
  1312. //手术操作
  1313. for _, fopd := range fopds {
  1314. fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
  1315. fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
  1316. fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
  1317. fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
  1318. fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
  1319. fsiOperationDtosData["anst_way"] = fopd.Anst_way
  1320. fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
  1321. fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
  1322. fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
  1323. fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
  1324. fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
  1325. }
  1326. fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
  1327. patientDtosinputData["patn_id"] = pd.PatnID
  1328. patientDtosinputData["patn_name"] = pd.PatnName
  1329. patientDtosinputData["gend"] = pd.Gend
  1330. patientDtosinputData["brdy"] = pd.Brdy
  1331. patientDtosinputData["poolarea"] = pd.Poolarea
  1332. patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
  1333. patientDtosinputData["fsi_his_data_dto"] = ""
  1334. patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
  1335. inputData["syscode"] = "LinkDialysis"
  1336. inputData["trig_scen"] = trig_scen
  1337. inputData["rule_ids"] = ""
  1338. inputData["task_id"] = ""
  1339. inputData["patient_dtos"] = patientDtosinputData
  1340. input["data"] = inputData
  1341. inputMessage["infno"] = "3102"
  1342. inputMessage["input"] = input //交易输入
  1343. bytesData, err := json.Marshal(inputMessage)
  1344. fmt.Println(string(bytesData))
  1345. if err != nil {
  1346. fmt.Println(err.Error())
  1347. return err.Error(), ""
  1348. }
  1349. params.RequestUrl = params.RequestUrl + "3102"
  1350. return HttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1351. }
  1352. func Jsyb4101(struct4101 Struct4101, params models.PublicParams) (string, string) {
  1353. timestamp := time.Now().Unix()
  1354. inputMessage := SetJSInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1355. // 生成输入报文
  1356. input := make(map[string]interface{})
  1357. inputData := make(map[string]interface{})
  1358. inputMessage["infno"] = "4101A" // 交易编码
  1359. year := time.Now().Format("2006")
  1360. month := time.Now().Format("01")
  1361. day := time.Now().Format("02")
  1362. inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
  1363. inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
  1364. inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
  1365. inputData["fixmedins_name"] = params.FixmedinsName // 定点医药机构名称 必填
  1366. inputData["fixmedins_code"] = params.FixmedinsCode // 定点医药机构编码 必填
  1367. inputData["hi_setl_lv"] = "" // 医保结算等级
  1368. inputData["hi_no"] = struct4101.PsnNo // 医保编号
  1369. inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
  1370. inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
  1371. inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
  1372. inputData["gend"] = struct4101.Gend // 性别 必填
  1373. inputData["brdy"] = struct4101.Brdy // 出生日期 必填
  1374. inputData["age"] = struct4101.Age // 年龄 必填
  1375. inputData["ntly"] = struct4101.Ntly // 国籍 必填
  1376. inputData["nwb_age"] = "" // 年龄 必填
  1377. inputData["naty"] = struct4101.Naty // 民族 必填
  1378. inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
  1379. inputData["certno"] = struct4101.Certno // 证件号码 必填
  1380. inputData["prfs"] = struct4101.Prfs // 职业 必填
  1381. inputData["curr_addr"] = "" // 现住址 必填
  1382. inputData["emp_name"] = "" // 单位名称 必填
  1383. inputData["emp_addr"] = "" // 单位地址 必填
  1384. inputData["emp_tel"] = "" // 单位电话 必填
  1385. inputData["poscode"] = "" // 邮编 必填
  1386. inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
  1387. inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
  1388. inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
  1389. inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
  1390. inputData["hi_type"] = struct4101.HiType // 医保类型 必填
  1391. inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
  1392. inputData["sp_psn_type"] = "" // 特殊人员类型 必填
  1393. inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
  1394. inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
  1395. inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
  1396. inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
  1397. inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
  1398. inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
  1399. inputData["adm_way"] = "" // 入院途径 必填
  1400. inputData["trt_type"] = "" // 治疗类别 必填
  1401. inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
  1402. inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
  1403. inputData["refldept_dept"] = "" // 转科科别 必填
  1404. inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
  1405. inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
  1406. inputData["act_ipt_days"] = "" // 实际住院天数 必填
  1407. inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
  1408. inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
  1409. inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
  1410. inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
  1411. inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
  1412. inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
  1413. inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
  1414. inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
  1415. inputData["bld_cat"] = "" // 输血品种 必填
  1416. inputData["bld_amt"] = "" // 输血量 必填
  1417. inputData["bld_unt"] = "" // 输血计量单位 必填
  1418. inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
  1419. inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
  1420. inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
  1421. inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
  1422. inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
  1423. inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
  1424. inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
  1425. inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
  1426. inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
  1427. inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
  1428. inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
  1429. inputData["chfpdr_name"] = "" // 主诊医师姓名 必填
  1430. inputData["chfpdr_code"] = "" // 主诊医师代码 必填
  1431. inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
  1432. inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
  1433. inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
  1434. inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
  1435. inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
  1436. inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
  1437. inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
  1438. inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
  1439. inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
  1440. inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
  1441. inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
  1442. payinfo := make([]map[string]interface{}, 0) // 基金支付信息
  1443. for _, item := range struct4101.CustomStruct {
  1444. payinfotemp := make(map[string]interface{})
  1445. 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" {
  1446. payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
  1447. payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
  1448. payinfo = append(payinfo, payinfotemp)
  1449. }
  1450. }
  1451. opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
  1452. opspdiseinfotemp := make(map[string]interface{})
  1453. opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 诊断名称 必填
  1454. opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 诊断代码 必填
  1455. opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
  1456. opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
  1457. opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
  1458. diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
  1459. for _, item := range struct4101.Diseinfo {
  1460. diseinfotemp := make(map[string]interface{})
  1461. diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
  1462. diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
  1463. diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
  1464. diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
  1465. diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
  1466. diseinfo = append(diseinfo, diseinfotemp)
  1467. }
  1468. iteminfo := make([]map[string]interface{}, 0)
  1469. for _, item := range struct4101.IteminfoStruct {
  1470. iteminfotemp := make(map[string]interface{})
  1471. iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
  1472. iteminfotemp["amt"] = item.Amt // 金额 必填
  1473. iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
  1474. iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
  1475. iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
  1476. iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
  1477. iteminfo = append(iteminfo, iteminfotemp)
  1478. }
  1479. oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
  1480. oprninfotemp := make(map[string]interface{})
  1481. oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
  1482. oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
  1483. oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
  1484. oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
  1485. oprninfotemp["anst_way"] = "" // 麻醉方式 必填
  1486. oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
  1487. oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
  1488. oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
  1489. oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
  1490. oprninfo = append(oprninfo, oprninfotemp)
  1491. icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
  1492. icuinfotemp := make(map[string]interface{})
  1493. icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
  1494. icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
  1495. icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
  1496. icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
  1497. icuinfo = append(icuinfo, icuinfotemp)
  1498. input["setlinfo"] = inputData
  1499. input["payinfo"] = payinfo
  1500. input["opspdiseinfo"] = opspdiseinfo
  1501. input["diseinfo"] = diseinfo
  1502. input["iteminfo"] = iteminfo
  1503. inputMessage["input"] = input //交易输入
  1504. bytesData, _ := json.Marshal(inputMessage)
  1505. fmt.Println(string(bytesData))
  1506. params.RequestUrl = params.RequestUrl + "4101A"
  1507. return HttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1508. }
  1509. func Jsyb3501(struct3501 models.Struct3501) (string, string) {
  1510. timestamp := time.Now().Unix()
  1511. // 生成输入报文
  1512. inputMessage := SetJSInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
  1513. input := make(map[string]interface{})
  1514. inputData := make(map[string]interface{})
  1515. inputMessage["infno"] = "3501" // 交易编码
  1516. inputData["med_list_codg"] = struct3501.MedListCodg // 定点医药机构目录编号
  1517. inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
  1518. inputData["fixmedins_hilist_name"] = struct3501.OrgName // 定点医药机构目录名称
  1519. inputData["rx_flag"] = struct3501.RxFlag //
  1520. inputData["invdate"] = struct3501.Invdate // 人员编号 (来自1101接口返回)
  1521. inputData["inv_cnt"] = struct3501.InvCnt // 人员编号 (来自1101接口返回)
  1522. inputData["manu_lotnum"] = struct3501.ManuLotnum // 人员编号 (来自1101接口返回)
  1523. inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1524. inputData["manu_date"] = struct3501.ManuDate // 人员编号 (来自1101接口返回)
  1525. inputData["expy_end"] = struct3501.ExpyEnd // 人员编号 (来自1101接口返回)
  1526. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  1527. input["invinfo"] = inputData
  1528. inputMessage["input"] = input //交易输入
  1529. bytesData, err := json.Marshal(inputMessage)
  1530. fmt.Println(string(bytesData))
  1531. if err != nil {
  1532. fmt.Println(err.Error())
  1533. return err.Error(), ""
  1534. }
  1535. struct3501.RequestUrl = struct3501.RequestUrl + "3501"
  1536. return HttpRequest(struct3501.RequestUrl, struct3501.AccessKey, struct3501.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1537. }
  1538. func Jsyb3502(struct3502 models.Struct3502) (string, string) {
  1539. timestamp := time.Now().Unix()
  1540. // 生成输入报文
  1541. inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
  1542. input := make(map[string]interface{})
  1543. inputData := make(map[string]interface{})
  1544. inputMessage["infno"] = "3502" // 交易编码
  1545. inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
  1546. inputData["inv_chg_type"] = struct3502.InvChgType // 定点医药机构目录编号
  1547. inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
  1548. inputData["fixmedins_hilist_name"] = struct3502.OrgName // 定点医药机构目录名称
  1549. inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1550. inputData["pric"] = struct3502.Pric // 人员编号 (来自1101接口返回)
  1551. inputData["cnt"] = struct3502.Cnt // 人员编号 (来自1101接口返回)
  1552. inputData["rx_flag"] = struct3502.RxFlag //
  1553. inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
  1554. inputData["inv_chg_opter_name"] = "" // 人员编号 (来自1101接口返回)
  1555. inputData["memo"] = struct3502.Memo // 人员编号 (来自1101接口返回)
  1556. inputData["trdn_flag"] = "" // 人员编号 (来自1101接口返回)
  1557. input["invinfo"] = inputData
  1558. inputMessage["input"] = input //交易输入
  1559. bytesData, err := json.Marshal(inputMessage)
  1560. fmt.Println(string(bytesData))
  1561. if err != nil {
  1562. fmt.Println(err.Error())
  1563. return err.Error(), ""
  1564. }
  1565. struct3502.RequestUrl = struct3502.RequestUrl + "3502"
  1566. return HttpRequest(struct3502.RequestUrl, struct3502.AccessKey, struct3502.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1567. }
  1568. func Jsyb3503(struct3503 models.Struct3503) (string, string) {
  1569. timestamp := time.Now().Unix()
  1570. // 生成输入报文
  1571. fmt.Println(struct3503)
  1572. inputMessage := SetJSInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
  1573. input := make(map[string]interface{})
  1574. inputMessage["infno"] = "3503"
  1575. item := struct3503
  1576. feedetailInfo := make(map[string]interface{})
  1577. feedetailInfo["med_list_codg"] = item.MedListCodg
  1578. feedetailInfo["fixmedins_hilist_id"] = item.FixmedinsHilistId
  1579. feedetailInfo["fixmedins_hilist_name"] = item.FixmedinsHilistName
  1580. feedetailInfo["dynt_no"] = ""
  1581. feedetailInfo["fixmedins_bchno"] = item.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1582. feedetailInfo["spler_name"] = item.SplerName // 人员编号 (来自1101接口返回)
  1583. feedetailInfo["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
  1584. feedetailInfo["manu_lotnum"] = item.ManuLotnum // 人员编号 (来自1101接口返回)
  1585. feedetailInfo["prodentp_name"] = item.ProdentpName // 人员编号 (来自1101接口返回)
  1586. feedetailInfo["aprvno"] = item.Aprvno // 人员编号 (来自1101接口返回)
  1587. feedetailInfo["manu_date"] = item.ManuDate // 人员编号 (来自1101接口返回)
  1588. feedetailInfo["expy_end"] = item.ExpyEnd // 人员编号 (来自1101接口返回)
  1589. feedetailInfo["finl_trns_pric"] = item.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1590. feedetailInfo["purc_retn_cnt"] = item.PurcRetnCnt // 人员编号 (来自1101接口返回)
  1591. feedetailInfo["purc_invo_codg"] = item.PurcInvoCodg // 人员编号 (来自1101接口返回)
  1592. feedetailInfo["purc_invo_no"] = item.PurcInvoNo // 人员编号 (来自1101接口返回)
  1593. feedetailInfo["rx_flag"] = item.RxFlag // 人员编号 (来自1101接口返回)
  1594. feedetailInfo["purc_retn_stoin_time"] = item.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
  1595. feedetailInfo["purc_retn_opter_name"] = item.PurcRetnOpterName // 人员编号 (来自1101接口返回)
  1596. feedetailInfo["prod_geay_flag"] = "" // 人员编号 (来自1101接口返回)
  1597. feedetailInfo["memo"] = "" // 人员编号 (来自1101接口返回)
  1598. input["purcinfo"] = feedetailInfo
  1599. inputMessage["input"] = input //交易输入
  1600. bytesData, err := json.Marshal(inputMessage)
  1601. fmt.Println(string(bytesData))
  1602. if err != nil {
  1603. fmt.Println(err.Error())
  1604. return err.Error(), ""
  1605. }
  1606. struct3503.RequestUrl = struct3503.RequestUrl + "3503"
  1607. return HttpRequest(struct3503.RequestUrl, struct3503.AccessKey, struct3503.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1608. }
  1609. func Jsyb3504(struct3504 models.Struct3504) (string, string) {
  1610. timestamp := time.Now().Unix()
  1611. // 生成输入报文
  1612. inputMessage := SetJSInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
  1613. input := make(map[string]interface{})
  1614. inputData := make(map[string]interface{})
  1615. inputMessage["infno"] = "3504" // 交易编码
  1616. inputData["med_list_codg"] = struct3504.MedListCodg // 定点医药机构目录编号
  1617. inputData["fixmedins_hilist_id"] = struct3504.FixmedinsHilistId // 定点医药机构目录编号
  1618. inputData["fixmedins_hilist_name"] = struct3504.FixmedinsHilistName // 定点医药机构目录名称
  1619. inputData["fixmedins_bchno"] = struct3504.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1620. inputData["spler_name"] = struct3504.SplerName // 人员编号 (来自1101接口返回)
  1621. inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
  1622. inputData["manu_date"] = struct3504.ManuDate // 人员编号 (来自1101接口返回)
  1623. inputData["expy_end"] = struct3504.ExpyEnd // 人员编号 (来自1101接口返回)
  1624. inputData["finl_trns_pric"] = struct3504.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1625. inputData["purc_retn_cnt"] = struct3504.PurcRetnCnt // 人员编号 (来自1101接口返回)
  1626. inputData["purc_invo_codg"] = struct3504.PurcInvoCodg // 人员编号 (来自1101接口返回)
  1627. inputData["purc_invo_no"] = struct3504.PurcInvoNo // 人员编号 (来自1101接口返回)
  1628. inputData["rx_flag"] = struct3504.RxFlag // 人员编号 (来自1101接口返回)
  1629. inputData["purc_retn_stoin_time"] = struct3504.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
  1630. inputData["purc_retn_opter_name"] = struct3504.PurcRetnOpterName // 人员编号 (来自1101接口返回)
  1631. inputData["medins_prod_purc_no"] = "" // 人员编号 (来自1101接口返回)
  1632. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  1633. input["purcinfo"] = inputData
  1634. inputMessage["input"] = input //交易输入
  1635. bytesData, err := json.Marshal(inputMessage)
  1636. fmt.Println(string(bytesData))
  1637. if err != nil {
  1638. fmt.Println(err.Error())
  1639. return err.Error(), ""
  1640. }
  1641. struct3504.RequestUrl = struct3504.RequestUrl + "3504"
  1642. return HttpRequest(struct3504.RequestUrl, struct3504.AccessKey, struct3504.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1643. }
  1644. func Jsyb3505(struct3505 models.Struct3505) (string, string) {
  1645. timestamp := time.Now().Unix()
  1646. // 生成输入报文
  1647. inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
  1648. input := make(map[string]interface{})
  1649. inputData := make(map[string]interface{})
  1650. inputMessage["infno"] = "3505" // 交易编码
  1651. inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号
  1652. inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
  1653. inputData["fixmedins_hilist_name"] = struct3505.OrgName // 定点医药机构目录名称
  1654. inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1655. inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
  1656. inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回)
  1657. inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回)
  1658. inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回)
  1659. inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回)
  1660. inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回)
  1661. inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
  1662. inputData["hi_feesetl_type"] = struct3505.HiFeesetlType // 人员编号 (来自1101接口返回)
  1663. inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回)
  1664. inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回)
  1665. inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回)
  1666. inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
  1667. inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回)
  1668. inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回)
  1669. inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回)
  1670. inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回)
  1671. inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回)
  1672. inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回)
  1673. inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
  1674. inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1675. inputData["rxno"] = struct3505.Rxno // 人员编号 (来自1101接口返回)
  1676. inputData["rx_circ_flag"] = struct3505.RxCircFlag // 人员编号 (来自1101接口返回)
  1677. inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
  1678. inputData["stoout_no"] = struct3505.StooutNo // 人员编号 (来自1101接口返回)
  1679. inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
  1680. inputData["drug_trac_codg"] = struct3505.DrugTracCodg // 人员编号 (来自1101接口返回)
  1681. inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回)
  1682. inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回)
  1683. inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回)
  1684. inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回)
  1685. inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
  1686. inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回)
  1687. input["selinfo"] = inputData
  1688. inputMessage["input"] = input //交易输入
  1689. bytesData, err := json.Marshal(inputMessage)
  1690. fmt.Println(string(bytesData))
  1691. if err != nil {
  1692. fmt.Println(err.Error())
  1693. return err.Error(), ""
  1694. }
  1695. struct3505.RequestUrl = struct3505.RequestUrl + "3505"
  1696. return HttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1697. }
  1698. func Jsyb3506(struct3506 models.Struct3506) (string, string) {
  1699. timestamp := time.Now().Unix()
  1700. // 生成输入报文
  1701. inputMessage := SetJSInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
  1702. input := make(map[string]interface{})
  1703. inputData := make(map[string]interface{})
  1704. inputMessage["infno"] = "3506" // 交易编码
  1705. inputData["med_list_codg"] = struct3506.MedListCodg // 定点医药机构目录编号
  1706. inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
  1707. inputData["fixmedins_hilist_name"] = struct3506.OrgName // 定点医药机构目录名称
  1708. inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1709. inputData["setl_id"] = struct3506.SetlId // 人员编号 (来自1101接口返回)
  1710. inputData["psn_no"] = struct3506.PsnNo // 人员编号 (来自1101接口返回)
  1711. inputData["psn_cert_type"] = struct3506.PsnCertType // 人员编号 (来自1101接口返回)
  1712. inputData["certno"] = struct3506.Certno // 人员编号 (来自1101接口返回)
  1713. inputData["psn_name"] = struct3506.PsnName // 人员编号 (来自1101接口返回)
  1714. inputData["manu_lotnum"] = struct3506.ManuLotnum // 人员编号 (来自1101接口返回)
  1715. inputData["manu_date"] = struct3506.ManuDate // 人员编号 (来自1101接口返回)
  1716. inputData["expy_end"] = struct3506.ExpyEnd // 人员编号 (来自1101接口返回)
  1717. inputData["rx_flag"] = struct3506.RxFlag // 人员编号 (来自1101接口返回)
  1718. inputData["trdn_flag"] = struct3506.TrdnFlag // 人员编号 (来自1101接口返回)
  1719. inputData["finl_trns_pric"] = struct3506.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1720. inputData["sel_retn_cnt"] = struct3506.SelRetnCnt // 人员编号 (来自1101接口返回)
  1721. inputData["sel_retn_time"] = struct3506.SelRetnTime // 人员编号 (来自1101接口返回)
  1722. inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回)
  1723. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  1724. inputData["medins_prod_sel_no"] = "" // 人员编号 (来自1101接口返回)
  1725. input["selinfo"] = inputData
  1726. inputMessage["input"] = input //交易输入
  1727. bytesData, err := json.Marshal(inputMessage)
  1728. fmt.Println(string(bytesData))
  1729. if err != nil {
  1730. fmt.Println(err.Error())
  1731. return err.Error(), ""
  1732. }
  1733. struct3506.RequestUrl = struct3506.RequestUrl + "3506"
  1734. return HttpRequest(struct3506.RequestUrl, struct3506.AccessKey, struct3506.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1735. }
  1736. func Jsyb3507(struct3507 models.Struct3507) (string, string) {
  1737. timestamp := time.Now().Unix()
  1738. // 生成输入报文
  1739. inputMessage := SetJSInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
  1740. input := make(map[string]interface{})
  1741. inputData := make(map[string]interface{})
  1742. inputMessage["infno"] = "3507" // 交易编码
  1743. inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
  1744. inputData["inv_data_type"] = struct3507.InvDataType // 人员编号 (来自1101接口返回)
  1745. input["data"] = inputData
  1746. inputMessage["input"] = input //交易输入
  1747. bytesData, err := json.Marshal(inputMessage)
  1748. fmt.Println(string(bytesData))
  1749. if err != nil {
  1750. fmt.Println(err.Error())
  1751. return err.Error(), ""
  1752. }
  1753. struct3507.RequestUrl = struct3507.RequestUrl + "3507"
  1754. return HttpRequest(struct3507.RequestUrl, struct3507.AccessKey, struct3507.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1755. }