hn_service.go 99KB

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