jx_service.go 99KB

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