jx_service.go 143KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004
  1. package service
  2. import (
  3. //"bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. "gdyb/utils/csbhttp"
  8. "github.com/astaxie/beego"
  9. "strings"
  10. //"net/http"
  11. "strconv"
  12. "time"
  13. )
  14. // 人员基本信息
  15. 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, name string) (string, string) {
  16. timestamp := time.Now().Unix()
  17. //生成输入报文
  18. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, "")
  19. input := make(map[string]interface{})
  20. inputData := make(map[string]interface{})
  21. inputMessage["infno"] = "1101" // 交易编码
  22. if certificates == "3" {
  23. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  24. inputData["certno"] = certNo // 证件号码
  25. inputData["psn_cert_type"] = "99" // 人员证件类型
  26. } else {
  27. if id_card_type == 1 {
  28. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  29. inputData["card_sn"] = card_sn // 卡识别码
  30. inputData["certno"] = certNo // 证件号码
  31. inputData["psn_cert_type"] = "01" // 人员证件类型
  32. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  33. } else if id_card_type == 4 {
  34. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  35. inputData["card_sn"] = "" // 卡识别码
  36. inputData["certno"] = certNo // 证件号码
  37. inputData["psn_cert_type"] = "01" // 人员证件类型
  38. inputData["mdtrt_cert_no"] = card_sn // 就诊凭证编号
  39. }else {
  40. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  41. inputData["card_sn"] = "" // 卡识别码
  42. inputData["certno"] = certNo // 证件号码
  43. inputData["psn_cert_type"] = "01" // 人员证件类型
  44. }
  45. }
  46. inputData["begntime"] = "" // 开始时间
  47. inputData["psn_name"] = name // 人员姓名
  48. input["data"] = inputData
  49. inputMessage["input"] = input //交易输入
  50. var inputLog string
  51. bytesData, _ := json.Marshal(inputMessage)
  52. inputLog = string(bytesData)
  53. fmt.Println(string(bytesData))
  54. if err != nil {
  55. fmt.Println(err.Error())
  56. return err.Error(), ""
  57. }
  58. request_url = request_url + "1101"
  59. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
  60. }
  61. func Jxyb1101bycard(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, name string,id_card_no string) (string, string) {
  62. timestamp := time.Now().Unix()
  63. //生成输入报文
  64. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, "")
  65. input := make(map[string]interface{})
  66. inputData := make(map[string]interface{})
  67. inputMessage["infno"] = "1101" // 交易编码
  68. if certificates == "3" {
  69. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  70. inputData["certno"] = certNo // 证件号码
  71. inputData["psn_cert_type"] = "99" // 人员证件类型
  72. } else {
  73. if id_card_type == 1 {
  74. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  75. inputData["card_sn"] = card_sn // 卡识别码
  76. inputData["certno"] = id_card_no // 证件号码
  77. inputData["psn_cert_type"] = "01" // 人员证件类型
  78. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  79. } else if id_card_type == 4 {
  80. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  81. inputData["card_sn"] = "" // 卡识别码
  82. inputData["certno"] = certNo // 证件号码
  83. inputData["psn_cert_type"] = "01" // 人员证件类型
  84. inputData["mdtrt_cert_no"] = card_sn // 就诊凭证编号
  85. }else {
  86. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  87. inputData["card_sn"] = "" // 卡识别码
  88. inputData["certno"] = certNo // 证件号码
  89. inputData["psn_cert_type"] = "01" // 人员证件类型
  90. }
  91. }
  92. inputData["begntime"] = "" // 开始时间
  93. inputData["psn_name"] = name // 人员姓名
  94. input["data"] = inputData
  95. inputMessage["input"] = input //交易输入
  96. var inputLog string
  97. bytesData, _ := json.Marshal(inputMessage)
  98. inputLog = string(bytesData)
  99. fmt.Println(string(bytesData))
  100. if err != nil {
  101. fmt.Println(err.Error())
  102. return err.Error(), ""
  103. }
  104. request_url = request_url + "1101"
  105. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
  106. }
  107. //人员基本信息版本2
  108. 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) {
  109. timestamp := time.Now().Unix()
  110. //生成输入报文
  111. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  112. input := make(map[string]interface{})
  113. inputData := make(map[string]interface{})
  114. inputMessage["infno"] = "1101" // 交易编码
  115. if certificates == "3" {
  116. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  117. inputData["certno"] = certNo // 证件号码
  118. inputData["psn_cert_type"] = "99" // 人员证件类型
  119. } else {
  120. if id_card_type == 1 {
  121. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  122. inputData["card_sn"] = card_sn // 卡识别码
  123. inputData["certno"] = id_card_no // 证件号码
  124. inputData["psn_cert_type"] = "01" // 人员证件类型
  125. } else {
  126. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  127. inputData["card_sn"] = "" // 卡识别码
  128. inputData["certno"] = certNo // 证件号码
  129. inputData["psn_cert_type"] = "01" // 人员证件类型
  130. }
  131. }
  132. inputData["mdtrt_cert_no"] = certNo + "|" + pBusiCardInfo // 就诊凭证编号
  133. inputData["begntime"] = "" // 开始时间
  134. inputData["psn_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. 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) {
  149. timestamp := time.Now().Unix()
  150. //生成输入报文
  151. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  152. input := make(map[string]interface{})
  153. inputData := make(map[string]interface{})
  154. inputMessage["infno"] = "1101" // 交易编码
  155. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  156. inputData["card_sn"] = "" // 卡识别码
  157. inputData["certno"] = "" // 证件号码
  158. inputData["psn_cert_type"] = "01" // 人员证件类型
  159. inputData["mdtrt_cert_no"] = id_card_no + "|" + Token // 就诊凭证编号
  160. inputData["begntime"] = "" // 开始时间
  161. inputData["psn_name"] = "" // 人员姓名
  162. input["data"] = inputData
  163. inputMessage["input"] = input //交易输入
  164. var inputLog string
  165. bytesData, _ := json.Marshal(inputMessage)
  166. inputLog = string(bytesData)
  167. fmt.Println(string(bytesData))
  168. if err != nil {
  169. fmt.Println(err.Error())
  170. return err.Error(), ""
  171. }
  172. request_url = request_url + "1101"
  173. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
  174. }
  175. 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) {
  176. timestamp := time.Now().Unix()
  177. //生成输入报文
  178. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  179. input := make(map[string]interface{})
  180. inputData := make(map[string]interface{})
  181. inputMessage["infno"] = "1101" // 交易编码
  182. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  183. inputData["card_sn"] = "" // 卡识别码
  184. inputData["certno"] = id_card_no // 证件号码
  185. inputData["psn_cert_type"] = "01" // 人员证件类型
  186. inputData["mdtrt_cert_no"] = Token // 就诊凭证编号
  187. inputData["begntime"] = "" // 开始时间
  188. inputData["psn_name"] = name // 人员姓名
  189. input["data"] = inputData
  190. inputMessage["input"] = input //交易输入
  191. var inputLog string
  192. bytesData, _ := json.Marshal(inputMessage)
  193. inputLog = string(bytesData)
  194. fmt.Println(string(bytesData))
  195. if err != nil {
  196. fmt.Println(err.Error())
  197. return err.Error(), ""
  198. }
  199. request_url = request_url + "1101"
  200. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
  201. }
  202. // 门诊挂号
  203. 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,psn_cert_type string,certno string,psn_type string,psn_name string) (string, string) {
  204. fmt.Println(opera)
  205. // 生成签名
  206. timestamp := time.Now().Unix()
  207. tempTime := time.Unix(timestamp, 0)
  208. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  209. // 生成输入报文
  210. inputMessage := SetJXInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  211. input := make(map[string]interface{})
  212. inputData := make(map[string]interface{})
  213. inputMessage["infno"] = "2201" // 交易编码
  214. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  215. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  216. inputData["begntime"] = timeFormatOne // 开始时间
  217. if id_card_type == 1 {
  218. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  219. inputData["card_sn"] = card_sn // 卡识别码
  220. inputData["certno"] = certNo // 证件号码
  221. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  222. } else if id_card_type == 3 {
  223. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  224. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  225. } else if id_card_type == 4 {
  226. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  227. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  228. } else {
  229. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  230. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  231. }
  232. inputData["card_sn"] = card_sn // 发票号
  233. inputData["psn_cert_type"] = psn_cert_type // 发票号
  234. inputData["certno"] = certno // 发票号
  235. inputData["psn_type"] = psn_type // 发票号
  236. inputData["psn_name"] = psn_name // 发票号
  237. inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
  238. inputData["atddr_no"] = doctor_id // 医师编码
  239. inputData["dr_name"] = doctor_name // 医师姓名
  240. inputData["dept_code"] = dept_code // 科室编码
  241. inputData["dept_name"] = dept // 科室名称
  242. inputData["caty"] = "A03.06" // 科别
  243. inputData["exp_content"] = "" //
  244. input["data"] = inputData
  245. inputMessage["input"] = input //交易输入
  246. var requestLog string
  247. bytesData, err := json.Marshal(inputMessage)
  248. requestLog = string(bytesData)
  249. fmt.Println(string(bytesData))
  250. if err != nil {
  251. fmt.Println(err.Error())
  252. return err.Error(), ""
  253. }
  254. request_url = request_url + "2201"
  255. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2201"), requestLog
  256. }
  257. // 门诊挂号撤销
  258. 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) {
  259. // 生成签名
  260. timestamp := time.Now().Unix()
  261. // 生成输入报文
  262. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  263. input := make(map[string]interface{})
  264. inputData := make(map[string]interface{})
  265. inputMessage["infno"] = "2202" // 交易编码
  266. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  267. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  268. inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
  269. //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  270. inputData["exp_content"] = "" //
  271. input["data"] = inputData
  272. inputMessage["input"] = input //交易输入
  273. var requestLog string
  274. bytesData, err := json.Marshal(inputMessage)
  275. fmt.Println(string(bytesData))
  276. requestLog = string(bytesData)
  277. if err != nil {
  278. fmt.Println(err.Error())
  279. return err.Error(), ""
  280. }
  281. request_url = request_url + "2202"
  282. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  283. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2202"), requestLog
  284. }
  285. // 门诊就诊信息上传
  286. 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) {
  287. // 生成签名
  288. timestamp := time.Now().Unix()
  289. tempTime := time.Unix(timestamp, 0)
  290. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  291. // 生成输入报文
  292. inputMessage := SetJXInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  293. input := make(map[string]interface{})
  294. inputData := make(map[string]interface{})
  295. diseinfo := make([]map[string]interface{}, 0)
  296. if med_type == "1111" || med_type == "1112" {
  297. med_type = "11"
  298. }
  299. inputMessage["infno"] = "2203" // 交易编码
  300. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  301. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  302. inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  303. inputData["begntime"] = begin_time // 开始时间
  304. inputData["main_cond_dscr"] = "" // 主要病情描述
  305. inputData["dise_codg"] = sick_code // 病种编码
  306. inputData["dise_name"] = sick_name // 病种名称
  307. inputData["birctrl_type"] = "" // 计划生育手术类别
  308. inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  309. for index, item := range config {
  310. diseinfo_sun := make(map[string]interface{})
  311. diseinfo_sun["diag_type"] = "1" // 诊断类别
  312. diseinfo_sun["diag_srt_no"] = index // 诊断排序号
  313. diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
  314. diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
  315. diseinfo_sun["diag_dept"] = department // 诊断科室
  316. diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  317. diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
  318. diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  319. diseinfo_sun["vali_flag"] = "1" // 有效标志
  320. diseinfo = append(diseinfo, diseinfo_sun)
  321. }
  322. //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  323. inputData["exp_content"] = "" //
  324. input["diseinfo"] = diseinfo
  325. input["mdtrtinfo"] = inputData
  326. inputMessage["input"] = input //交易输入
  327. var requestLog string
  328. bytesData, err := json.Marshal(inputMessage)
  329. fmt.Println(string(bytesData))
  330. requestLog = string(bytesData)
  331. if err != nil {
  332. fmt.Println(err.Error())
  333. return err.Error(), "", 0
  334. }
  335. request_url = request_url + "2203"
  336. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  337. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2203"), requestLog, timestamp
  338. }
  339. // 门诊就诊信息上传
  340. 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) {
  341. // 生成签名
  342. timestamp := time.Now().Unix()
  343. tempTime := time.Unix(timestamp, 0)
  344. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  345. // 生成输入报文
  346. inputMessage := SetJXInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  347. input := make(map[string]interface{})
  348. inputData := make(map[string]interface{})
  349. diseinfo := make([]map[string]interface{}, 0)
  350. if med_type == "1111" || med_type == "1112" {
  351. med_type = "11"
  352. }
  353. inputMessage["infno"] = "2203" // 交易编码
  354. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  355. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  356. inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  357. inputData["begntime"] = timeFormatOne // 开始时间
  358. inputData["main_cond_dscr"] = "" // 主要病情描述
  359. inputData["dise_codg"] = sick_code // 病种编码
  360. inputData["dise_name"] = sick_name // 病种名称
  361. inputData["birctrl_type"] = "" // 计划生育手术类别
  362. inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  363. inputData["matn_type"] = "" // 生育类别
  364. inputData["geso_val"] = "" // 孕周数
  365. for index, item := range config {
  366. diseinfo_sun := make(map[string]interface{})
  367. diseinfo_sun["diag_type"] = "1" // 诊断类别
  368. diseinfo_sun["diag_srt_no"] = index // 诊断排序号
  369. diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
  370. diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
  371. diseinfo_sun["diag_dept"] = department // 诊断科室
  372. diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  373. diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
  374. diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  375. diseinfo_sun["vali_flag"] = "1" // 有效标志
  376. diseinfo = append(diseinfo, diseinfo_sun)
  377. }
  378. input["diseinfo"] = diseinfo
  379. input["mdtrtinfo"] = inputData
  380. inputMessage["input"] = input //交易输入
  381. var requestLog string
  382. bytesData, err := json.Marshal(inputMessage)
  383. fmt.Println(string(bytesData))
  384. requestLog = string(bytesData)
  385. if err != nil {
  386. fmt.Println(err.Error())
  387. return err.Error(), ""
  388. }
  389. request_url = request_url + "2203"
  390. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  391. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2203"), requestLog
  392. }
  393. // 门诊费用明细信息上传
  394. 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) {
  395. // 生成签名
  396. //timestamp := time.Now().Unix()
  397. timestamp := time.Now().Unix()
  398. timestamp2 := time.Now().Unix()
  399. //tempTime := time.Unix(timestamp2, 0)
  400. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  401. var customs []*Custom
  402. for _, item := range hisPrescription {
  403. tm := time.Now()
  404. if item.Type == 1 { //药品
  405. for _, subItem := range item.HisDoctorAdviceInfo {
  406. if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
  407. //var randNum int
  408. //randNum = rand.Intn(10000) + 1000
  409. cus := &Custom{
  410. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
  411. Cut: fmt.Sprintf("%.4f", subItem.PrescribingNumber),
  412. FeedetlSn: subItem.FeedetlSn,
  413. Price: fmt.Sprintf("%.4f", subItem.Price),
  414. MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber,
  415. HospApprFlag: subItem.HospApprFlag,
  416. DoctorNumber: doctor_id,
  417. DoctorName: new_doctor_name,
  418. ProvinceDrugMedListCodg: "",
  419. ProvinceGoodMedListCodg: "",
  420. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  421. }
  422. if subItem.BaseDrugLib.DrugClassify == "2" {
  423. cus.ProvinceDrugMedListCodg = subItem.BaseDrugLib.ProvincesCode
  424. }
  425. customs = append(customs, cus)
  426. }
  427. }
  428. }
  429. if item.Type == 2 { //项目
  430. for _, subItem := range item.HisPrescriptionProject {
  431. //var randNum int
  432. //randNum = rand.Intn(10000) + 1000
  433. if subItem.Type == 2 {
  434. if len(subItem.HisProject.MedicalCode) > 0 {
  435. cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  436. cus := &Custom{
  437. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
  438. Cut: fmt.Sprintf("%.4f", cnt),
  439. FeedetlSn: subItem.FeedetlSn,
  440. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  441. MedListCodg: subItem.HisProject.MedicalCode,
  442. DoctorNumber: doctor_id,
  443. DoctorName: new_doctor_name,
  444. HospApprFlag: -1,
  445. ProvinceDrugMedListCodg: "",
  446. ProvinceGoodMedListCodg: "",
  447. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  448. }
  449. customs = append(customs, cus)
  450. }
  451. } else if subItem.Type == 3 {
  452. if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
  453. cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  454. cus := &Custom{
  455. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
  456. Cut: fmt.Sprintf("%.4f", cnt),
  457. FeedetlSn: subItem.FeedetlSn,
  458. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  459. MedListCodg: subItem.GoodInfo.MedicalInsuranceNumber,
  460. HospApprFlag: -1,
  461. DoctorNumber: doctor_id,
  462. DoctorName: new_doctor_name,
  463. ProvinceDrugMedListCodg: "",
  464. ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode,
  465. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  466. }
  467. customs = append(customs, cus)
  468. }
  469. }
  470. }
  471. }
  472. for _, subItem := range item.HisAdditionalCharge {
  473. if len(subItem.XtHisAddtionConfig.Code) > 0 {
  474. cus := &Custom{
  475. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*float64(subItem.Count)),
  476. Cut: fmt.Sprintf("%.4f", float64(subItem.Count)),
  477. FeedetlSn: subItem.FeedetlSn,
  478. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  479. MedListCodg: subItem.XtHisAddtionConfig.Code,
  480. HospApprFlag: -1,
  481. DoctorNumber: doctor_id,
  482. DoctorName: new_doctor_name,
  483. }
  484. customs = append(customs, cus)
  485. }
  486. }
  487. }
  488. // 生成输入报文
  489. inputMessage := SetJXInputMessage(timestamp2, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  490. input := make(map[string]interface{})
  491. feedetail := make([]map[string]interface{}, 0)
  492. inputMessage["infno"] = "2204" // 交易编码
  493. //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
  494. for _, item := range customs {
  495. feedetailInfo := make(map[string]interface{})
  496. subfeedetailInfo := make(map[string]interface{})
  497. feedetailInfo["feedetl_sn"] = item.FeedetlSn
  498. feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  499. feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  500. feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
  501. feedetailInfo["dise_codg"] = diag_code // 病种编码
  502. feedetailInfo["rxno"] = "" // 处方号
  503. feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
  504. feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间
  505. feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
  506. feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码
  507. feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
  508. feedetailInfo["cnt"] = item.Cut // 数量
  509. feedetailInfo["pric"] = item.Price // 单价
  510. feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
  511. feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
  512. feedetailInfo["prd_days"] = "0" // 周期天数
  513. feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
  514. feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
  515. feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
  516. feedetailInfo["bilg_dr_codg"] = item.DoctorNumber // 开单医生编码
  517. feedetailInfo["bilg_dr_name"] = item.DoctorName // 开单医师姓名
  518. feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
  519. feedetailInfo["acord_dept_name"] = "" // 受单科室名称
  520. feedetailInfo["orders_dr_code"] = item.DoctorNumber // 受单医生编码
  521. feedetailInfo["orders_dr_name"] = item.DoctorName // 受单医生姓名
  522. if balance_accounts_type == "8" {
  523. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  524. } else {
  525. if item.HospApprFlag != -1 {
  526. if item.HospApprFlag == 1 {
  527. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  528. } else if item.HospApprFlag == 2 {
  529. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  530. } else if item.HospApprFlag == 3 {
  531. feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
  532. } else {
  533. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  534. }
  535. } else {
  536. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  537. }
  538. }
  539. feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
  540. feedetailInfo["etip_flag"] = "" // 外检标志
  541. feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
  542. feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
  543. feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
  544. subfeedetailInfo["tcmherb_prov_code"] = item.ProvinceDrugMedListCodg
  545. subfeedetailInfo["mcs_prov_code"] = item.ProvinceGoodMedListCodg
  546. feedetailInfo["exp_content"] = subfeedetailInfo
  547. feedetail = append(feedetail, feedetailInfo)
  548. }
  549. input["feedetail"] = feedetail
  550. inputMessage["input"] = input //交易输入
  551. var requestLog string
  552. bytesData, err := json.Marshal(inputMessage)
  553. requestLog = string(bytesData)
  554. fmt.Println(string(bytesData))
  555. if err != nil {
  556. fmt.Println(err.Error())
  557. return "", ""
  558. }
  559. request_url = request_url + "2204"
  560. //fmt.Println(JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  561. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2204"), requestLog
  562. }
  563. // 门诊费用明细信息撤销
  564. 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) {
  565. timestamp := time.Now().Unix()
  566. // 生成输入报文
  567. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  568. input := make(map[string]interface{})
  569. inputData := make(map[string]interface{})
  570. inputMessage["infno"] = "2205" // 交易编码
  571. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  572. inputData["chrg_bchno"] = "0000" // 收费批次号(来自2204生成的)
  573. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  574. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  575. input["data"] = inputData
  576. inputMessage["input"] = input //交易输入
  577. bytesData, err := json.Marshal(inputMessage)
  578. fmt.Println(string(bytesData))
  579. var requestLog string
  580. requestLog = string(bytesData)
  581. if err != nil {
  582. fmt.Println(err.Error())
  583. return err.Error(), ""
  584. }
  585. request_url = request_url + "2205"
  586. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2205"), requestLog
  587. }
  588. // 门诊预结算
  589. 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) {
  590. // 生成签名
  591. timestamp := time.Now().Unix() // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  592. // inputData["mdtrt_cert_no"] = certNo
  593. // 生成输入报文
  594. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  595. input := make(map[string]interface{})
  596. inputData := make(map[string]interface{})
  597. inputMessage["infno"] = "2206" // 交易编码
  598. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  599. if certificates == 3 {
  600. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  601. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  602. } else {
  603. if id_card_type == 1 {
  604. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  605. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  606. } else if id_card_type == 3 {
  607. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  608. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  609. } else if id_card_type == 4 {
  610. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  611. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  612. } else {
  613. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  614. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  615. }
  616. }
  617. if insuplc_admdvs == "421300" {
  618. if med_type == "11" || med_type == "1112" || med_type == "1111" {
  619. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  620. } else if med_type == "14" {
  621. inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
  622. }
  623. } else {
  624. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  625. }
  626. inputData["medfee_sumamt"] = total // 医疗费总额
  627. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  628. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  629. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  630. inputData["acct_used_flag"] = "0" // 个人账户使用标志 0否 1是
  631. inputData["insutype"] = insutype // 险种类型
  632. inputData["invono"] = "" // 发票号
  633. inputData2 := make(map[string]interface{})
  634. inputData2["trum_flag"] = ""
  635. inputData2["rel_ttp_flag"] = ""
  636. inputData2["otp_er_refl_flag"] = ""
  637. inputData2["mdtrt_grp_type"] = ""
  638. inputData2["need_ipt_flag"] = ""
  639. inputData["exp_content"] = inputData2 // 发票号
  640. input["data"] = inputData
  641. inputMessage["input"] = input //交易输入
  642. var requestLog string
  643. bytesData, err := json.Marshal(inputMessage)
  644. requestLog = string(bytesData)
  645. fmt.Println(string(bytesData))
  646. if err != nil {
  647. fmt.Println(err.Error())
  648. return err.Error(), ""
  649. }
  650. request_url = request_url + "2206"
  651. //fmt.Println(JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  652. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2206"), requestLog
  653. }
  654. // 门诊预结算
  655. 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,psn_cert_type string,certno string,psn_type string,psn_name string) (string, string) {
  656. // 生成签名
  657. timestamp := time.Now().Unix() // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  658. // inputData["mdtrt_cert_no"] = certNo
  659. // 生成输入报文
  660. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  661. input := make(map[string]interface{})
  662. inputData := make(map[string]interface{})
  663. inputMessage["infno"] = "2206" // 交易编码
  664. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  665. if certificates == 3 {
  666. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  667. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  668. } else {
  669. if id_card_type == 1 {
  670. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  671. inputData["card_sn"] = card_sn // 卡识别码
  672. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  673. } else if id_card_type == 3 {
  674. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  675. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  676. } else if id_card_type == 4 {
  677. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  678. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  679. } else {
  680. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  681. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  682. }
  683. }
  684. if insuplc_admdvs == "421300" {
  685. if med_type == "11" || med_type == "1112" || med_type == "1111" {
  686. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  687. } else if med_type == "14" {
  688. inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
  689. }
  690. } else {
  691. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  692. }
  693. inputData["medfee_sumamt"] = total // 医疗费总额
  694. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  695. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  696. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  697. inputData["acct_used_flag"] = "0" // 个人账户使用标志 0否 1是
  698. inputData["insutype"] = insutype // 险种类型
  699. inputData["invono"] = "" // 发票号
  700. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  701. inputData["card_sn"] = card_sn // 发票号
  702. inputData["psn_cert_type"] = psn_cert_type // 发票号
  703. inputData["certno"] = certno // 发票号
  704. inputData["psn_type"] = psn_type // 发票号
  705. inputData["psn_name"] = psn_name // 发票号
  706. input["data"] = inputData
  707. inputMessage["input"] = input //交易输入
  708. var requestLog string
  709. bytesData, err := json.Marshal(inputMessage)
  710. requestLog = string(bytesData)
  711. fmt.Println(string(bytesData))
  712. if err != nil {
  713. fmt.Println(err.Error())
  714. return err.Error(), ""
  715. }
  716. request_url = request_url + "2206"
  717. //fmt.Println(JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  718. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2206"), requestLog
  719. }
  720. // 门诊结算
  721. 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,card_sn string,psn_cert_type string,certno string,psn_type string,psn_name string) (string, string) {
  722. // 生成签名
  723. timestamp := time.Now().Unix()
  724. // 生成输入报文
  725. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  726. input := make(map[string]interface{})
  727. inputData := make(map[string]interface{})
  728. inputMessage["infno"] = "2207" // 交易编码
  729. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  730. if id_card_type == 1 {
  731. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  732. inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  733. } else if id_card_type == 3 {
  734. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  735. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  736. } else if id_card_type == 4 {
  737. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  738. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  739. } else {
  740. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  741. inputData["mdtrt_cert_no"] = certNo
  742. }
  743. if med_type == "1111" || med_type == "1112" {
  744. med_type = "11"
  745. }
  746. if insuplc_admdvs == "421300" {
  747. if med_type == "11" {
  748. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  749. } else if med_type == "14" {
  750. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  751. }
  752. } else {
  753. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  754. }
  755. inputData["medfee_sumamt"] = total // 医疗费总额
  756. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  757. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  758. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  759. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  760. inputData["insutype"] = insutype // 险种类型
  761. inputData["invono"] = "" // 发票号
  762. inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
  763. inputData["overlmt_selfpay"] = overlmt_selfpay //
  764. inputData["preselfpay_amt"] = preselfpay_amt //
  765. inputData["inscp_scp_amt"] = inscp_scp_amt //
  766. inputData["card_sn"] = card_sn // 发票号
  767. inputData["psn_cert_type"] = psn_cert_type // 发票号
  768. inputData["certno"] = certno // 发票号
  769. inputData["psn_type"] = psn_type // 发票号
  770. inputData["psn_name"] = psn_name // 发票号
  771. inputData2 := make(map[string]interface{})
  772. inputData2["trum_flag"] = ""
  773. inputData2["rel_ttp_flag"] = ""
  774. inputData2["otp_er_refl_flag"] = ""
  775. inputData2["mdtrt_grp_type"] = ""
  776. inputData2["need_ipt_flag"] = ""
  777. inputData["exp_content"] = inputData2
  778. input["data"] = inputData
  779. inputMessage["input"] = input //交易输入
  780. bytesData, err := json.Marshal(inputMessage)
  781. fmt.Println(string(bytesData))
  782. if err != nil {
  783. fmt.Println(err.Error())
  784. return err.Error(), ""
  785. }
  786. request_url = request_url + "2207"
  787. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2207"), string(bytesData)
  788. }
  789. // 门诊结算
  790. 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) {
  791. // 生成签名
  792. timestamp := time.Now().Unix()
  793. // 生成输入报文
  794. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  795. input := make(map[string]interface{})
  796. inputData := make(map[string]interface{})
  797. inputMessage["infno"] = "2207" // 交易编码
  798. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  799. if id_card_type == 1 {
  800. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  801. inputData["card_sn"] = card_sn // 卡识别码
  802. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  803. } else if id_card_type == 3 {
  804. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  805. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  806. } else if id_card_type == 4 {
  807. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  808. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  809. } else {
  810. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  811. inputData["mdtrt_cert_no"] = certNo
  812. }
  813. if med_type == "1111" || med_type == "1112" {
  814. med_type = "11"
  815. }
  816. if insuplc_admdvs == "421300" {
  817. if med_type == "11" {
  818. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  819. } else if med_type == "14" {
  820. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  821. }
  822. } else {
  823. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  824. }
  825. inputData["medfee_sumamt"] = total // 医疗费总额
  826. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  827. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  828. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  829. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  830. inputData["insutype"] = insutype // 险种类型
  831. inputData["invono"] = "" // 发票号
  832. inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
  833. inputData["overlmt_selfpay"] = overlmt_selfpay //
  834. inputData["preselfpay_amt"] = preselfpay_amt //
  835. inputData["inscp_scp_amt"] = inscp_scp_amt //
  836. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  837. input["data"] = inputData
  838. inputMessage["input"] = input //交易输入
  839. bytesData, err := json.Marshal(inputMessage)
  840. fmt.Println(string(bytesData))
  841. if err != nil {
  842. fmt.Println(err.Error())
  843. return err.Error(), ""
  844. }
  845. request_url = request_url + "2207"
  846. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2207"), string(bytesData)
  847. }
  848. 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) {
  849. // 生成签名
  850. timestamp := time.Now().Unix()
  851. // 生成输入报文
  852. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  853. input := make(map[string]interface{})
  854. inputData := make(map[string]interface{})
  855. inputMessage["infno"] = "2207A" // 交易编码
  856. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  857. if certificates == 3 {
  858. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  859. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  860. } else {
  861. if id_card_type == 1 {
  862. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  863. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  864. } else {
  865. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  866. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  867. }
  868. }
  869. if med_type == "1111" || med_type == "1112" {
  870. med_type = "11"
  871. }
  872. if insuplc_admdvs == "421300" {
  873. if med_type == "11" {
  874. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  875. } else if med_type == "14" {
  876. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  877. }
  878. } else {
  879. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  880. }
  881. inputData["medfee_sumamt"] = total // 医疗费总额
  882. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  883. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  884. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  885. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  886. inputData["insutype"] = insutype // 险种类型
  887. inputData["invono"] = "" // 发票号
  888. inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
  889. inputData["overlmt_selfpay"] = overlmt_selfpay //
  890. inputData["preselfpay_amt"] = preselfpay_amt //
  891. inputData["inscp_scp_amt"] = inscp_scp_amt //
  892. input["data"] = inputData
  893. inputMessage["input"] = input //交易输入
  894. bytesData, err := json.Marshal(inputMessage)
  895. fmt.Println(string(bytesData))
  896. if err != nil {
  897. fmt.Println(err.Error())
  898. return err.Error(), ""
  899. }
  900. request_url = request_url + "2207A"
  901. //fmt.Println(JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  902. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2207A"), string(bytesData)
  903. }
  904. // 门诊结算撤销
  905. 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) {
  906. timestamp := time.Now().Unix()
  907. // 生成输入报文
  908. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  909. input := make(map[string]interface{})
  910. inputData := make(map[string]interface{})
  911. inputMessage["infno"] = "2208" // 交易编码
  912. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  913. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  914. inputData["setl_id"] = setlId // 结算 ID
  915. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  916. input["data"] = inputData
  917. inputMessage["input"] = input //交易输入
  918. bytesData, err := json.Marshal(inputMessage)
  919. fmt.Println(string(bytesData))
  920. if err != nil {
  921. fmt.Println(err.Error())
  922. return err.Error(), ""
  923. }
  924. request_url = request_url + "2208"
  925. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2208"), string(bytesData)
  926. }
  927. func Jxyb5203(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
  928. timestamp := time.Now().Unix()
  929. // 生成输入报文
  930. inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, "440300", baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
  931. input := make(map[string]interface{})
  932. inputData := make(map[string]interface{})
  933. inputMessage["infno"] = "5203" // 交易编码
  934. inputData["psn_no"] = businessParams.PsnNo
  935. inputData["setl_id"] = businessParams.SetlId
  936. inputData["mdtrt_id"] = businessParams.MdtrtId
  937. input["data"] = inputData
  938. inputMessage["input"] = input //交易输入
  939. bytesData, err := json.Marshal(inputMessage)
  940. fmt.Println(string(bytesData))
  941. if err != nil {
  942. fmt.Println(err.Error())
  943. return err.Error(), ""
  944. }
  945. baseParams.RequestUrl = baseParams.RequestUrl + "5203"
  946. //fmt.Println(JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
  947. return JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5203"), string(bytesData)
  948. }
  949. func Jxyb5202(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
  950. timestamp := time.Now().Unix()
  951. // 生成输入报文
  952. inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, "440300", baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
  953. input := make(map[string]interface{})
  954. inputData := make(map[string]interface{})
  955. inputMessage["infno"] = "5202" // 交易编码
  956. inputData["psn_no"] = businessParams.PsnNo
  957. inputData["mdtrt_id"] = businessParams.MdtrtId
  958. input["data"] = inputData
  959. inputMessage["input"] = input //交易输入
  960. bytesData, err := json.Marshal(inputMessage)
  961. fmt.Println(string(bytesData))
  962. if err != nil {
  963. fmt.Println(err.Error())
  964. return err.Error(), ""
  965. }
  966. baseParams.RequestUrl = baseParams.RequestUrl + "5202"
  967. //fmt.Println(JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
  968. return JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5202"), string(bytesData)
  969. }
  970. func Jxyb5201(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
  971. timestamp := time.Now().Unix()
  972. // 生成输入报文
  973. inputMessage := SetJXInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
  974. input := make(map[string]interface{})
  975. inputData := make(map[string]interface{})
  976. inputMessage["infno"] = "5201" // 交易编码
  977. inputData["psn_no"] = businessParams.PsnNo
  978. inputData["begntime"] = "2023-06-01"
  979. inputData["endtime"] = "2023-07-30"
  980. inputData["med_type"] = "21"
  981. inputData["mdtrt_id"] = businessParams.MdtrtId
  982. input["data"] = inputData
  983. inputMessage["input"] = input //交易输入
  984. bytesData, err := json.Marshal(inputMessage)
  985. fmt.Println(string(bytesData))
  986. if err != nil {
  987. fmt.Println(err.Error())
  988. return err.Error(), ""
  989. }
  990. baseParams.RequestUrl = baseParams.RequestUrl + "5201"
  991. //fmt.Println(JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
  992. return JXHttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData), "5201"), string(bytesData)
  993. }
  994. func JxybZY1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates int64, request_url string, access_key string, pBusiCardInfo string, id_card_no string, cainfo string) (string, string) {
  995. timestamp := time.Now().Unix()
  996. //生成输入报文
  997. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  998. input := make(map[string]interface{})
  999. inputData := make(map[string]interface{})
  1000. inputMessage["infno"] = "1101" // 交易编码
  1001. if certificates == 3 {
  1002. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1003. inputData["certno"] = certNo // 证件号码
  1004. inputData["psn_cert_type"] = "99" // 人员证件类型
  1005. } else {
  1006. if id_card_type == 1 {
  1007. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1008. inputData["card_sn"] = card_sn // 卡识别码
  1009. inputData["certno"] = id_card_no // 证件号码
  1010. inputData["psn_cert_type"] = "01" // 人员证件类型
  1011. inputData["mdtrt_cert_no"] = certNo + "|" + pBusiCardInfo // 就诊凭证编号
  1012. } else {
  1013. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1014. inputData["card_sn"] = "" // 卡识别码
  1015. inputData["certno"] = certNo // 证件号码
  1016. inputData["psn_cert_type"] = "01" // 人员证件类型
  1017. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1018. }
  1019. }
  1020. inputData["begntime"] = "" // 开始时间
  1021. inputData["psn_name"] = cainfo // 人员姓名
  1022. input["data"] = inputData
  1023. inputMessage["input"] = input //交易输入
  1024. var inputLog string
  1025. bytesData, _ := json.Marshal(inputMessage)
  1026. inputLog = string(bytesData)
  1027. fmt.Println(string(bytesData))
  1028. if err != nil {
  1029. fmt.Println(err.Error())
  1030. return err.Error(), ""
  1031. }
  1032. request_url = request_url + "1101"
  1033. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
  1034. }
  1035. // 住院登记
  1036. func Jxyb2401(struct2401 Struct2401, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
  1037. // 生成签名
  1038. timestamp := time.Now().Unix()
  1039. //tempTime := time.Unix(timestamp, 0)
  1040. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1041. // 生成输入报文
  1042. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1043. //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1044. input := make(map[string]interface{})
  1045. inputData := make(map[string]interface{})
  1046. inputMessage["infno"] = "2401" // 交易编码
  1047. inputData["psn_no"] = struct2401.PsnNo // 人员编号 (来自1101接口返回)
  1048. inputData["insutype"] = struct2401.Insutype // 险种类型(来自1101接口返回)
  1049. inputData["tel"] = ""
  1050. inputData["coner_name"] = ""
  1051. inputData["begntime"] = struct2401.Begntime // 开始时间
  1052. inputData["mdtrt_cert_type"] = struct2401.MdtrtCertType // 就诊凭证类型
  1053. inputData["mdtrt_cert_no"] = struct2401.MdtrtCertNo // 就诊凭证编号
  1054. inputData["med_type"] = struct2401.MedType // 就诊凭证编号
  1055. inputData["ipt_no"] = struct2401.IptNo // 住院/门诊号
  1056. inputData["medrcdno"] = ""
  1057. inputData["atddr_no"] = struct2401.AtddrNo
  1058. inputData["chfpdr_name"] = struct2401.ChfpdrName
  1059. inputData["adm_diag_dscr"] = struct2401.AdmDiagDscr
  1060. inputData["adm_dept_codg"] = struct2401.AdmDeptCodg
  1061. inputData["adm_dept_name"] = struct2401.AdmDeptName
  1062. inputData["adm_bed"] = struct2401.AdmBed
  1063. inputData["dscg_maindiag_code"] = struct2401.DscgMaindiagCode
  1064. inputData["dscg_maindiag_name"] = struct2401.DscgMaindiagName
  1065. inputData["main_cond_dscr"] = ""
  1066. inputData["dise_codg"] = struct2401.DiseCodg
  1067. inputData["dise_name"] = struct2401.DiseName
  1068. inputData["oprn_oprt_code"] = ""
  1069. inputData["oprn_oprt_name"] = ""
  1070. inputData["fpsc_no"] = ""
  1071. inputData["matn_type"] = ""
  1072. inputData["birctrl_type"] = ""
  1073. inputData["latechb_flag"] = ""
  1074. inputData["geso_val"] = ""
  1075. inputData["fetts"] = ""
  1076. inputData["fetus_cnt"] = ""
  1077. inputData["pret_flag"] = ""
  1078. inputData["birctrl_matn_date"] = ""
  1079. inputData["dise_type_code"] = ""
  1080. inputData["insuplc_admdvs"] = insuplc_admdvs
  1081. inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
  1082. inputData["card_sn"] = struct2401.Cardsn
  1083. inputData["psn_cert_type"] = struct2401.PsnCertType
  1084. inputData["certno"] = struct2401.Certno
  1085. inputData["psn_type"] = struct2401.PsnType
  1086. inputData["psn_name"] = struct2401.PsnName
  1087. inputDataArr := make([]map[string]interface{}, 0)
  1088. for _, item := range struct2401.Diseinfo {
  1089. inputDataTwo := make(map[string]interface{})
  1090. inputDataTwo["psn_no"] = item.PsnNo
  1091. inputDataTwo["diag_type"] = item.DiagType
  1092. inputDataTwo["maindiag_flag"] = item.MaindiagFlag
  1093. inputDataTwo["diag_srt_no"] = item.DiagSrtNo
  1094. inputDataTwo["diag_code"] = item.DiagCode
  1095. inputDataTwo["diag_name"] = item.DiagName
  1096. inputDataTwo["adm_cond"] = ""
  1097. inputDataTwo["diag_dept"] = item.DiagDept
  1098. inputDataTwo["dise_dor_no"] = item.DiseDorNo
  1099. inputDataTwo["dise_dor_name"] = item.DiseDorName
  1100. inputDataTwo["diag_time"] = item.DiagTime
  1101. inputDataArr = append(inputDataArr, inputDataTwo)
  1102. }
  1103. input["mdtrtinfo"] = inputData
  1104. input["diseinfo"] = inputDataArr
  1105. inputMessage["input"] = input //交易输入
  1106. bytesData, err := json.Marshal(inputMessage)
  1107. fmt.Println(string(bytesData))
  1108. requestLog := string(bytesData)
  1109. if err != nil {
  1110. fmt.Println(err.Error())
  1111. return err.Error(), ""
  1112. }
  1113. request_url = request_url + "2401"
  1114. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2401"), requestLog
  1115. }
  1116. func Jxyb2403(struct2401 Struct2401, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
  1117. // 生成签名
  1118. timestamp := time.Now().Unix()
  1119. //tempTime := time.Unix(timestamp, 0)
  1120. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1121. // 生成输入报文
  1122. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1123. //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1124. input := make(map[string]interface{})
  1125. inputData := make(map[string]interface{})
  1126. inputMessage["infno"] = "2403" // 交易编码
  1127. inputData["mdtrt_id"] = struct2401.PsnNo // 人员编号 (来自1101接口返回)
  1128. inputData["psn_no"] = struct2401.PsnNo // 人员编号 (来自1101接口返回)
  1129. inputData["coner_name"] = struct2401
  1130. inputData["tel"] = ""
  1131. inputData["begntime"] = struct2401.Begntime // 开始时间
  1132. inputData["endtime"] = struct2401.Begntime // 开始时间
  1133. inputData["mdtrt_cert_type"] = struct2401.MdtrtCertType // 就诊凭证类型
  1134. inputData["med_type"] = struct2401.MedType // 就诊凭证编号
  1135. inputData["ipt_opt_no"] = struct2401.IptNo // 住院/门诊号
  1136. inputData["medrcdno"] = ""
  1137. inputData["atddr_no"] = struct2401.AtddrNo
  1138. inputData["chfpdr_name"] = struct2401.ChfpdrName
  1139. inputData["adm_diag_dscr"] = struct2401.AdmDiagDscr
  1140. inputData["adm_dept_codg"] = struct2401.AdmDeptCodg
  1141. inputData["adm_dept_name"] = struct2401.AdmDeptName
  1142. inputData["adm_bed"] = struct2401.AdmBed
  1143. inputData["dscg_maindiag_code"] = struct2401.DscgMaindiagCode
  1144. inputData["dscg_maindiag_name"] = struct2401.DscgMaindiagName
  1145. inputData["main_cond_dscr"] = ""
  1146. inputData["dise_codg"] = struct2401.DiseCodg
  1147. inputData["dise_name"] = struct2401.DiseName
  1148. inputData["oprn_oprt_code"] = ""
  1149. inputData["oprn_oprt_name"] = ""
  1150. inputData["fpsc_no"] = ""
  1151. inputData["matn_type"] = ""
  1152. inputData["birctrl_type"] = ""
  1153. inputData["latechb_flag"] = ""
  1154. inputData["geso_val"] = ""
  1155. inputData["fetts"] = ""
  1156. inputData["fetus_cnt"] = ""
  1157. inputData["pret_flag"] = ""
  1158. inputData["birctrl_matn_date"] = ""
  1159. inputData["dise_type_code"] = ""
  1160. inputData["expContent"] = ""
  1161. inputDataArr := make([]map[string]interface{}, 0)
  1162. for _, item := range struct2401.Diseinfo {
  1163. inputDataTwo := make(map[string]interface{})
  1164. inputDataTwo["mdtrt_id"] = item.PsnNo
  1165. inputDataTwo["psn_no"] = item.PsnNo
  1166. inputDataTwo["diag_type"] = item.DiagType
  1167. inputDataTwo["maindiag_flag"] = item.MaindiagFlag
  1168. inputDataTwo["diag_srt_no"] = item.DiagSrtNo
  1169. inputDataTwo["diag_code"] = item.DiagCode
  1170. inputDataTwo["diag_name"] = item.DiagName
  1171. inputDataTwo["adm_cond"] = ""
  1172. inputDataTwo["diag_dept"] = item.DiagDept
  1173. inputDataTwo["dise_dor_no"] = item.DiseDorNo
  1174. inputDataTwo["dise_dor_name"] = item.DiseDorName
  1175. inputDataTwo["diag_time"] = item.DiagTime
  1176. inputDataArr = append(inputDataArr, inputDataTwo)
  1177. }
  1178. input["adminfo"] = inputData
  1179. input["diseinfo"] = inputDataArr
  1180. inputMessage["input"] = input //交易输入
  1181. bytesData, err := json.Marshal(inputMessage)
  1182. fmt.Println(string(bytesData))
  1183. requestLog := string(bytesData)
  1184. if err != nil {
  1185. fmt.Println(err.Error())
  1186. return err.Error(), ""
  1187. }
  1188. request_url = request_url + "2403"
  1189. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2403"), requestLog
  1190. }
  1191. func Jxyb2404(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
  1192. // 生成签名
  1193. timestamp := time.Now().Unix()
  1194. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1195. input := make(map[string]interface{})
  1196. inputData := make(map[string]interface{})
  1197. inputMessage["infno"] = "2404" // 交易编码
  1198. inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
  1199. inputData["psn_no"] = psn_no // 人员编号 (来自1101接口返回)
  1200. input["data"] = inputData
  1201. inputMessage["input"] = input //交易输入
  1202. bytesData, err := json.Marshal(inputMessage)
  1203. fmt.Println(string(bytesData))
  1204. requestLog := string(bytesData)
  1205. if err != nil {
  1206. fmt.Println(err.Error())
  1207. return err.Error(), ""
  1208. }
  1209. request_url = request_url + "2404"
  1210. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2404"), requestLog
  1211. }
  1212. func Jxyb2405(mdtrt_id string, psn_no string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
  1213. // 生成签名
  1214. timestamp := time.Now().Unix()
  1215. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1216. input := make(map[string]interface{})
  1217. inputData := make(map[string]interface{})
  1218. inputMessage["infno"] = "2405" // 交易编码
  1219. inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
  1220. inputData["psn_no"] = psn_no // 人员编号 (来自1101接口返回)
  1221. input["data"] = inputData
  1222. inputMessage["input"] = input //交易输入
  1223. bytesData, err := json.Marshal(inputMessage)
  1224. fmt.Println(string(bytesData))
  1225. requestLog := string(bytesData)
  1226. if err != nil {
  1227. fmt.Println(err.Error())
  1228. return err.Error(), ""
  1229. }
  1230. request_url = request_url + "2405"
  1231. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2405"), requestLog
  1232. }
  1233. func Jxyb2402(struct2402 Struct2402, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
  1234. // 生成签名
  1235. nonce := GetRandomString(32)
  1236. timestamp := time.Now().Unix()
  1237. // 生成输入报文
  1238. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1239. input := make(map[string]interface{})
  1240. inputData := make(map[string]interface{})
  1241. inputMessage["infno"] = "2402" // 交易编码
  1242. inputData["mdtrt_id"] = struct2402.MdtrtId // 人员编号 (来自1101接口返回)
  1243. inputData["psn_no"] = struct2402.PsnNo // 人员编号 (来自1101接口返回)
  1244. inputData["insutype"] = struct2402.Insutype // 险种类型(来自1101接口返回)
  1245. inputData["endtime"] = struct2402.Endtime // 结束时间
  1246. inputData["dise_codg"] = struct2402.DiseCode // 就诊凭证类型
  1247. inputData["dise_name"] = struct2402.DiseName // 就诊凭证类型
  1248. inputData["oprn_oprt_code"] = "" // 就诊凭证类型
  1249. inputData["oprn_oprt_name"] = "" // 就诊凭证类型
  1250. inputData["fpsc_no"] = "" // 就诊凭证类型
  1251. inputData["matn_type"] = "" // 就诊凭证类型
  1252. inputData["birctrl_type"] = "" // 就诊凭证类型
  1253. inputData["latechb_flag"] = "" // 就诊凭证类型
  1254. inputData["geso_val"] = ""
  1255. inputData["fetts"] = ""
  1256. inputData["fetus_cnt"] = ""
  1257. inputData["pret_flag"] = ""
  1258. inputData["birctrl_matn_date"] = ""
  1259. inputData["cop_flag"] = ""
  1260. inputData["dscg_dept_codg"] = struct2402.DscgDeptCodg
  1261. inputData["dscg_dept_name"] = struct2402.DscgDeptName
  1262. inputData["dscg_bed"] = "待定"
  1263. inputData["dscg_way"] = struct2402.DscgWay
  1264. inputData["die_date"] = ""
  1265. inputDataArr := make([]map[string]interface{}, 0)
  1266. for _, item := range struct2402.Diseinfo {
  1267. inputDataTwo := make(map[string]interface{})
  1268. inputDataTwo["psn_no"] = item.PsnNo
  1269. inputDataTwo["mdtrt_id"] = item.MdtrtId
  1270. inputDataTwo["diag_type"] = item.DiagType
  1271. inputDataTwo["maindiag_flag"] = item.MaindiagFlag
  1272. inputDataTwo["diag_srt_no"] = item.DiagSrtNo
  1273. inputDataTwo["diag_code"] = item.DiagCode
  1274. inputDataTwo["diag_name"] = item.DiagName
  1275. inputDataTwo["diag_dept"] = item.DiagDept
  1276. inputDataTwo["dise_dor_no"] = item.DiseDorNo
  1277. inputDataTwo["dise_dor_name"] = item.DiseDorName
  1278. inputDataTwo["diag_time"] = item.DiagTime
  1279. inputDataArr = append(inputDataArr, inputDataTwo)
  1280. }
  1281. input["dscginfo"] = inputData
  1282. input["diseinfo"] = inputDataArr
  1283. inputMessage["input"] = input //交易输入
  1284. bytesData, err := json.Marshal(inputMessage)
  1285. fmt.Println(string(bytesData))
  1286. requestLog := string(bytesData)
  1287. if err != nil {
  1288. fmt.Println(err.Error())
  1289. return err.Error(), ""
  1290. }
  1291. request_url = request_url + "2402"
  1292. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2402"), requestLog
  1293. }
  1294. func Jxyb2301(psnNo string, mdtrtId string, hisPrescription []*models.NewCustom, med_type string, chrg_bchno string, dept_code string, dept string, doctor_id string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
  1295. // 生成签名
  1296. timestamp := time.Now().Unix()
  1297. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1298. var customs []*models.NewCustom
  1299. customs = hisPrescription
  1300. // 生成输入报文
  1301. input := make(map[string]interface{})
  1302. feedetail := make([]map[string]interface{}, 0)
  1303. inputMessage["infno"] = "2301" // 交易编码
  1304. //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
  1305. for _, item := range customs {
  1306. org_id, _ := beego.AppConfig.Int64("org_id")
  1307. doctor_info, _ := GetAdminUserInfoByID(org_id, item.DoctorId)
  1308. feedetailInfo := make(map[string]interface{})
  1309. feedetailInfo["feedetl_sn"] = item.FeedetlSn
  1310. feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1311. feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1312. feedetailInfo["med_type"] = med_type
  1313. feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间
  1314. feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
  1315. feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码
  1316. feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
  1317. feedetailInfo["cnt"] = item.Cut // 数量
  1318. feedetailInfo["pric"] = item.Price // 单价
  1319. feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
  1320. feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
  1321. feedetailInfo["bilg_dr_codg"] = doctor_info.DoctorNumber // 开单医生编码
  1322. feedetailInfo["bilg_dr_name"] = doctor_info.UserName
  1323. feedetailInfo["acord_dept_codg"] = dept_code // 受单科室编码
  1324. feedetailInfo["acord_dept_name"] = dept // 受单科室名称
  1325. feedetailInfo["orders_dr_code"] = doctor_info.DoctorNumber // 受单医生编码
  1326. feedetailInfo["orders_dr_name"] = doctor_info.UserName // 受单医生姓名
  1327. feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
  1328. feedetailInfo["dise_codg"] = "" // 病种编码
  1329. feedetailInfo["rxno"] = "" // 处方号
  1330. feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
  1331. feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
  1332. feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
  1333. feedetailInfo["prd_days"] = "0" // 周期天数
  1334. feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
  1335. // 开单医师姓名
  1336. if item.HospApprFlag != -1 {
  1337. if item.HospApprFlag == 1 {
  1338. feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
  1339. } else if item.HospApprFlag == 2 {
  1340. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  1341. } else if item.HospApprFlag == 3 {
  1342. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  1343. } else {
  1344. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  1345. }
  1346. } else {
  1347. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  1348. }
  1349. //feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
  1350. feedetailInfo["etip_flag"] = "" // 外检标志
  1351. feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
  1352. feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
  1353. feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
  1354. feedetail = append(feedetail, feedetailInfo)
  1355. }
  1356. input["feedetail"] = feedetail
  1357. inputMessage["input"] = input //交易输入
  1358. bytesData, err := json.Marshal(inputMessage)
  1359. fmt.Println(string(bytesData))
  1360. requestLog := string(bytesData)
  1361. if err != nil {
  1362. fmt.Println(err.Error())
  1363. return err.Error(), ""
  1364. }
  1365. request_url = request_url + "2301"
  1366. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2301"), requestLog
  1367. }
  1368. func Jxyb2302(psnNo string, mdtrtId string, refund_type int64, number string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
  1369. // 生成签名
  1370. nonce := GetRandomString(32)
  1371. timestamp := time.Now().Unix()
  1372. // 生成输入报文
  1373. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1374. input := make(map[string]interface{})
  1375. inputData := make(map[string]interface{})
  1376. inputMessage["infno"] = "2302" // 交易编码
  1377. if refund_type == 1 {
  1378. inputData["feedetl_sn"] = number //
  1379. } else {
  1380. inputData["feedetl_sn"] = "0000" //
  1381. }
  1382. inputData["mdtrt_id"] = mdtrtId // 就诊 ID
  1383. inputData["psn_no"] = psnNo // 人员编号
  1384. input["data"] = inputData
  1385. inputMessage["input"] = input //交易输入
  1386. bytesData, err := json.Marshal(inputMessage)
  1387. fmt.Println(string(bytesData))
  1388. requestLog := string(bytesData)
  1389. if err != nil {
  1390. fmt.Println(err.Error())
  1391. return err.Error(), ""
  1392. }
  1393. request_url = request_url + "2302"
  1394. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2302"), requestLog
  1395. }
  1396. func Jxyb2303(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string,card_sn string,psn_type int64,psn_cert_type string,certno string,psn_name string) (string, string) {
  1397. // 生成签名
  1398. nonce := GetRandomString(32)
  1399. timestamp := time.Now().Unix()
  1400. // 生成输入报文
  1401. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1402. input := make(map[string]interface{})
  1403. inputData := make(map[string]interface{})
  1404. inputMessage["infno"] = "2303" // 交易编码
  1405. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1406. if certificates == 3 {
  1407. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1408. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1409. } else {
  1410. if id_card_type == 1 {
  1411. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1412. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1413. } else {
  1414. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1415. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1416. }
  1417. }
  1418. inputData["mdtrt_cert_sn"] = ""
  1419. inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
  1420. inputData["medfee_sumamt"] = total // 医疗费总额
  1421. inputData["psn_setlway"] = "02" // 个人结算方式 01 按项目结 02 按定额结算
  1422. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1423. inputData["acct_used_flag"] = "1" // 个人账户使用标志 0否 1是
  1424. inputData["insutype"] = insutype // 险种类型
  1425. inputData["invono"] = "" // 发票号
  1426. inputData["dise_codg"] = "M07803" // 发票号
  1427. inputData["card_sn"] = card_sn // 发票号
  1428. inputData["psn_cert_type"] = psn_cert_type // 发票号
  1429. inputData["certno"] = certno // 发票号
  1430. inputData["psn_type"] = psn_type // 发票号
  1431. inputData["psn_name"] = psn_name // 发票号
  1432. inputData["insuplc_admdvs"] = insuplc_admdvs // 发票号
  1433. inputData["mdtrtarea_admvs"] = mdtrtarea_admvs // 发票号
  1434. input["data"] = inputData
  1435. inputMessage["input"] = input //交易输入
  1436. bytesData, err := json.Marshal(inputMessage)
  1437. fmt.Println(string(bytesData))
  1438. requestLog := string(bytesData)
  1439. if err != nil {
  1440. fmt.Println(err.Error())
  1441. return err.Error(), ""
  1442. }
  1443. request_url = request_url + "2303"
  1444. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2303"), requestLog
  1445. }
  1446. func Jxyb2304(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string, fapiao_number string, acct_used_flag string,card_sn string,psn_type string,psn_cert_type string,certno string,psn_name string) (string, string) {
  1447. // 生成签名
  1448. nonce := GetRandomString(32)
  1449. timestamp := time.Now().Unix()
  1450. // 生成输入报文
  1451. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1452. input := make(map[string]interface{})
  1453. inputData := make(map[string]interface{})
  1454. inputMessage["infno"] = "2304" // 交易编码
  1455. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1456. if certificates == 3 {
  1457. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1458. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1459. } else {
  1460. if id_card_type == 1 {
  1461. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1462. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1463. } else if id_card_type == 4 {
  1464. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  1465. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1466. } else {
  1467. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1468. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1469. }
  1470. }
  1471. inputData["insuplc_admdvs"] = insuplc_admdvs
  1472. inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
  1473. inputData["mdtrt_cert_sn"] = ""
  1474. inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
  1475. inputData["medfee_sumamt"] = total // 医疗费总额
  1476. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  1477. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1478. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  1479. inputData["insutype"] = insutype // 险种类型
  1480. inputData["card_sn"] = card_sn // 发票号
  1481. inputData["psn_cert_type"] = psn_cert_type // 发票号
  1482. inputData["certno"] = certno // 发票号
  1483. inputData["psn_type"] = psn_type // 发票号
  1484. inputData["psn_name"] = psn_name // 发票号
  1485. input["data"] = inputData
  1486. inputMessage["input"] = input //交易输入
  1487. bytesData, err := json.Marshal(inputMessage)
  1488. fmt.Println(string(bytesData))
  1489. requestLog := string(bytesData)
  1490. if err != nil {
  1491. fmt.Println(err.Error())
  1492. return err.Error(), ""
  1493. }
  1494. request_url = request_url + "2304"
  1495. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2304"), requestLog
  1496. }
  1497. func Jxyb2304a(psnNo string, mdtrtId string, certNo string, insutype string, total string, certificates int64, id_card_type int64, mid_setl_flag string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string, fapiao_number string, acct_used_flag string,card_sn string,psn_type int64,psn_cert_type string,certno string,psn_name string) (string, string) {
  1498. // 生成签名
  1499. nonce := GetRandomString(32)
  1500. timestamp := time.Now().Unix()
  1501. // 生成输入报文
  1502. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1503. input := make(map[string]interface{})
  1504. inputData := make(map[string]interface{})
  1505. inputMessage["infno"] = "2304" // 交易编码
  1506. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1507. if certificates == 3 {
  1508. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1509. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1510. } else {
  1511. if id_card_type == 1 {
  1512. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1513. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1514. } else if id_card_type == 4 {
  1515. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  1516. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1517. } else {
  1518. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1519. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1520. }
  1521. }
  1522. inputData["insuplc_admdvs"] = insuplc_admdvs
  1523. inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
  1524. inputData["mdtrt_cert_sn"] = ""
  1525. inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
  1526. inputData["medfee_sumamt"] = total // 医疗费总额
  1527. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  1528. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1529. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  1530. inputData["insutype"] = insutype // 险种类型
  1531. inputData["card_sn"] = card_sn // 发票号
  1532. inputData["psn_cert_type"] = psn_cert_type // 发票号
  1533. inputData["certno"] = certno // 发票号
  1534. inputData["psn_type"] = psn_type // 发票号
  1535. inputData["psn_name"] = psn_name // 发票号
  1536. input["data"] = inputData
  1537. inputMessage["input"] = input //交易输入
  1538. bytesData, err := json.Marshal(inputMessage)
  1539. fmt.Println(string(bytesData))
  1540. requestLog := string(bytesData)
  1541. if err != nil {
  1542. fmt.Println(err.Error())
  1543. return err.Error(), ""
  1544. }
  1545. request_url = request_url + "2304"
  1546. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2304"), requestLog
  1547. }
  1548. func Jxyb2305(psnNo string, mdtrtId string, setlId string, secret_key string, org_name string, fixmedins_code string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, request_url string, cainfo string, access_key string) (string, string) {
  1549. // 生成签名
  1550. timestamp := time.Now().Unix()
  1551. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1552. input := make(map[string]interface{})
  1553. inputData := make(map[string]interface{})
  1554. inputMessage["infno"] = "2305" // 交易编码
  1555. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1556. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1557. inputData["setl_id"] = setlId // 结算 ID
  1558. input["data"] = inputData
  1559. inputMessage["input"] = input //交易输入
  1560. bytesData, err := json.Marshal(inputMessage)
  1561. fmt.Println(string(bytesData))
  1562. requestLog := string(bytesData)
  1563. if err != nil {
  1564. fmt.Println(err.Error())
  1565. return err.Error(), ""
  1566. }
  1567. request_url = request_url + "2305"
  1568. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2305"), requestLog
  1569. }
  1570. func JXyb3505(struct3505 models.Struct3505, secret_key string, ak string,request_url string) (string, string) {
  1571. // 生成签名
  1572. // 生成签名
  1573. timestamp := time.Now().Unix()
  1574. inputMessage := SetJXInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.Code, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, "")
  1575. //inputMessage := SetGZInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, sign)
  1576. input := make(map[string]interface{})
  1577. inputData := make(map[string]interface{})
  1578. inputMessage["infno"] = "3505" // 交易编码
  1579. inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号
  1580. inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
  1581. inputData["fixmedins_hilist_name"] = struct3505.FixmedinsHilistName // 定点医药机构目录名称
  1582. inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1583. inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
  1584. inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回)
  1585. inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回)
  1586. inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回)
  1587. inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回)
  1588. inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回)
  1589. inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
  1590. inputData["hi_feesetl_type"] = struct3505.HiFeesetlType // 人员编号 (来自1101接口返回)
  1591. inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回)
  1592. inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回)
  1593. inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回)
  1594. inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
  1595. inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回)
  1596. inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回)
  1597. inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回)
  1598. inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回)
  1599. inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回)
  1600. inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回)
  1601. inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
  1602. inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1603. inputData["rxno"] = struct3505.Rxno // 人员编号 (来自1101接口返回)
  1604. inputData["rx_circ_flag"] = struct3505.RxCircFlag // 人员编号 (来自1101接口返回)
  1605. inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
  1606. inputData["stoout_no"] = struct3505.StooutNo // 人员编号 (来自1101接口返回)
  1607. inputData["MDTRT_SETL_TYPE"] = struct3505.MdtrtSetlType // 人员编号 (来自1101接口返回)
  1608. inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
  1609. codes := strings.Split(struct3505.DrugTracCodg, ",")
  1610. inputData["drug_trac_codg"] = codes[0] // 人员编号 (来自1101接口返回)
  1611. inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回)
  1612. inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回)
  1613. inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回)
  1614. inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回)
  1615. inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
  1616. inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回)
  1617. //drug_trac_cod .g
  1618. feedetail := make([]map[string]interface{}, 0)
  1619. //codes = strings.Split(struct3505.DrugTracCodg, ",")
  1620. for _, item := range codes {
  1621. if len(item) > 0{
  1622. druginputData := make(map[string]interface{})
  1623. druginputData["drug_trac_codg"] = item
  1624. feedetail = append(feedetail, druginputData)
  1625. }
  1626. }
  1627. inputData["drugtracinfo"] = feedetail
  1628. input["selinfo"] = inputData
  1629. inputMessage["input"] = input //交易输入
  1630. input["selinfo"] = inputData
  1631. inputMessage["input"] = input //交易输入
  1632. bytesData, err := json.Marshal(inputMessage)
  1633. requestLog := string(bytesData)
  1634. if err != nil {
  1635. fmt.Println(err.Error())
  1636. return err.Error(), ""
  1637. }
  1638. request_url = request_url + "3505"
  1639. return JXHttpRequest(request_url, ak, secret_key, timestamp, string(bytesData), "3505"), requestLog
  1640. }
  1641. //CBS总线
  1642. func JXHttpRequest(url string, ak string, sk string, timestamp int64, json string, infno string) string {
  1643. fmt.Println(url)
  1644. //step 1. 设置请求参数
  1645. csbHP := csbhttp.NewHttpParams(url) //设置请求地址及url参数
  1646. //设置调用方式 get 或者 post
  1647. csbHP.SetMethod("post")
  1648. //设置 调用的服务名和版本
  1649. csbHP.SetApi("hsa-fsi-" + infno)
  1650. csbHP.SetVersion("1.0.0")
  1651. //添加附加的http请求头 (可以定义多条)
  1652. //key := "_api_access_key=" + ak + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
  1653. csbHP.AddHeader("_api_timestamp", strconv.FormatInt(timestamp, 10))
  1654. csbHP.AddHeader("_api_name", "hsa-fsi-"+infno)
  1655. csbHP.AddHeader("_api_version", "1.0.0")
  1656. csbHP.AddHeader("_api_access_key", ak)
  1657. csbHP.AddHeader("Content-Type", "application/json;charset=UTF-8")
  1658. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1659. //还可以,设置附加的byte[]或者json请求体
  1660. csbHP.SetContentBody(json, nil)
  1661. //设置请求的ak和sk
  1662. csbHP.SetAK(ak)
  1663. csbHP.SetSK(sk)
  1664. //打印请求参数信息
  1665. csbHP.Print()
  1666. //进行调用, 返回的第二项为resonse http headers (map[string][]string类型)
  1667. //res, _, err := csbhttp.Invoke(*csbHP, requestByte)
  1668. res, _, err := csbhttp.Invoke(*csbHP, strconv.FormatInt(timestamp, 10))
  1669. fmt.Println("err:")
  1670. fmt.Println(err)
  1671. //是否发成错误
  1672. if err != nil {
  1673. fmt.Println(err)
  1674. return ""
  1675. }
  1676. fmt.Println(res)
  1677. return res
  1678. }
  1679. // 生成基础报文
  1680. func SetJXInputMessage(timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, cainfo string) map[string]interface{} {
  1681. // 生成签名
  1682. tempTime := time.Unix(timestamp, 0)
  1683. //timeFormat := tempTime.Format("20060102150405")
  1684. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1685. //randNum := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000)
  1686. month := time.Unix(1557042972, 0).Format("1")
  1687. year := time.Now().Format("2006")
  1688. month = time.Now().Format("01")
  1689. day := time.Now().Format("02")
  1690. hour := time.Now().Format("15")
  1691. min := time.Now().Format("04")
  1692. sec := time.Now().Format("05")
  1693. msec := time.Now().Format("000")
  1694. // 生成输入报文
  1695. inputMessage := make(map[string]interface{})
  1696. inputMessage["msgid"] = fixmedins_code + year + month + day + hour + min + sec + msec + "0" // 发送方报文 ID
  1697. inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs // 就医地医保区划
  1698. inputMessage["insuplc_admdvs"] = insuplc_admdvs // 参保地医保区划
  1699. inputMessage["recer_sys_code"] = "1" // 接收方系统代码
  1700. inputMessage["dev_no"] = "1" // 设备编号
  1701. inputMessage["dev_safe_info"] = "1" // 设备安全信息
  1702. inputMessage["cainfo"] = cainfo // 数字签名信息
  1703. inputMessage["signtype"] = "SM3" // 签名类型
  1704. inputMessage["infver"] = "V1.0" // 接收方系统代码
  1705. inputMessage["opter_type"] = "1" // 经办人类别
  1706. inputMessage["opter"] = doctor // 经办人
  1707. inputMessage["opter_name"] = doctor // 经办人姓名
  1708. inputMessage["inf_time"] = timeFormatOne // 交易时间
  1709. inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
  1710. inputMessage["fixmedins_name"] = org_name
  1711. inputMessage["fixmedins_soft_fcty"] = "深圳市领透科技有限公司" //定点医药机构名称
  1712. //定点医药机构名称
  1713. inputMessage["sign_no"] = "" //交易签到流水号
  1714. return inputMessage
  1715. }
  1716. 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) {
  1717. // 生成签名
  1718. //nonce := GetRandomString(32)
  1719. timestamp := time.Now().Unix()
  1720. //signature := setSignature(timestamp, nonce, secret_key)
  1721. //tempTime := time.Unix(timestamp, 0)
  1722. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1723. //timeFormatTwo := tempTime.Format("2006-01-02")
  1724. // 生成输入报文
  1725. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1726. input := make(map[string]interface{})
  1727. inputData := make(map[string]interface{})
  1728. inputMessage["infno"] = "5301" // 交易编码
  1729. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1730. input["data"] = inputData
  1731. inputMessage["input"] = input //交易输入
  1732. bytesData, err := json.Marshal(inputMessage)
  1733. fmt.Println(string(bytesData))
  1734. if err != nil {
  1735. fmt.Println(err.Error())
  1736. return err.Error(), ""
  1737. }
  1738. request_url = request_url + "5301"
  1739. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "5301"), string(bytesData)
  1740. }
  1741. 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) {
  1742. timestamp := time.Now().Unix()
  1743. // 生成输入报文
  1744. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1745. input := make(map[string]interface{})
  1746. inputData := make(map[string]interface{})
  1747. inputMessage["infno"] = "2503" // 交易编码
  1748. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1749. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  1750. inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
  1751. inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
  1752. inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
  1753. inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
  1754. inputData["ide_fixmedins_name"] = org_name // 险种类型(来自1101接口返回)
  1755. inputData["hosp_ide_date"] = check_time // 险种类型(来自1101接口返回)
  1756. inputData["diag_dr_codg"] = doctor_id // 开始时间
  1757. inputData["diag_dr_name"] = doctor // 开始时间
  1758. inputData["begndate"] = start_time // 医师编码
  1759. inputData["tel"] = "" // 医师编码
  1760. inputData["addr"] = "" // 医师编码
  1761. inputData["enddate"] = end_time // 医师编码
  1762. input["data"] = inputData
  1763. inputMessage["input"] = input //交易输入
  1764. bytesData, err := json.Marshal(inputMessage)
  1765. fmt.Println(string(bytesData))
  1766. if err != nil {
  1767. fmt.Println(err.Error())
  1768. return err.Error(), ""
  1769. }
  1770. request_url = request_url + "2503"
  1771. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2503"), string(bytesData)
  1772. }
  1773. func Jxyb3201(fixmedins_setl_cnt int64, stmt_begndate string, stmt_enddate 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,medfee_sumamt string,fund_pay_sumamt string,acct_pay string) (string, string) {
  1774. // 生成签名
  1775. timestamp := time.Now().Unix()
  1776. // 生成输入报文
  1777. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, "360399", "360399", "")
  1778. input := make(map[string]interface{})
  1779. inputData := make(map[string]interface{})
  1780. inputMessage["infno"] = "3201" // 交易编码
  1781. inputData["insutype"] = insutype // 险种
  1782. inputData["clr_type"] = clr_type // 就诊 ID(来自2201接口返回)
  1783. inputData["setl_optins"] = "360302" // 结算经办机构
  1784. inputData["stmt_begndate"] = stmt_begndate // 对帐开始时间
  1785. inputData["stmt_enddate"] = stmt_enddate //对帐结束时间
  1786. inputData["medfee_sumamt"] = medfee_sumamt //医疗费总额
  1787. inputData["fund_pay_sumamt"] = fund_pay_sumamt //基金支付总额
  1788. inputData["acct_pay"] = acct_pay //个人账户支付金额
  1789. inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
  1790. inputData["refd_setl_flag"] = 0 //
  1791. input["data"] = inputData
  1792. inputMessage["input"] = input //交易输入
  1793. bytesData, err := json.Marshal(inputMessage)
  1794. fmt.Println(string(bytesData))
  1795. if err != nil {
  1796. fmt.Println(err.Error())
  1797. return err.Error(), ""
  1798. }
  1799. request_url = request_url + "3201"
  1800. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3201"), string(bytesData)
  1801. }
  1802. 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) {
  1803. // 生成签名
  1804. timestamp := time.Now().Unix()
  1805. // 生成输入报文
  1806. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1807. input := make(map[string]interface{})
  1808. inputData := make(map[string]interface{})
  1809. inputMessage["infno"] = "9001" // 交易编码
  1810. inputData["opter_no"] = admin_user_id
  1811. inputData["mac"] = GetMacTwo() // 开始时间
  1812. inputData["ip"] = GetLocalIpTwo()
  1813. input["signIn"] = inputData
  1814. inputMessage["input"] = input //交易输入
  1815. bytesData, err := json.Marshal(inputMessage)
  1816. fmt.Println(string(bytesData))
  1817. if err != nil {
  1818. fmt.Println(err.Error())
  1819. return err.Error(), ""
  1820. }
  1821. //reader := bytes.NewReader(bytesData)
  1822. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
  1823. //gdyb_url := beego.AppConfig.String("gdyb_url")
  1824. //gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1825. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1826. //url := gdyb_url
  1827. //request, err := http.NewRequest("POST", request_url+"9001", reader)
  1828. //if err != nil {
  1829. // fmt.Println(err.Error())
  1830. // return err.Error(), ""
  1831. //}
  1832. //
  1833. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1834. //request.Header.Set("_api_timestamp", strconv.FormatInt(timestamp, 10))
  1835. //request.Header.Set("_api_name", "hssServives")
  1836. //request.Header.Set("_api_version", "1.0.0")
  1837. //request.Header.Set("_api_access_key", access_key)
  1838. //request.Header.Set("_api_signature", "")
  1839. //
  1840. //client := http.Client{}
  1841. //resp, err := client.Do(request)
  1842. //if err != nil {
  1843. // fmt.Println(err.Error())
  1844. // return err.Error(), ""
  1845. //}
  1846. //respBytes, err := ioutil.ReadAll(resp.Body)
  1847. //if err != nil {
  1848. // fmt.Println(err.Error())
  1849. // return err.Error(), ""
  1850. //}
  1851. //str := string(respBytes)
  1852. //fmt.Println(str)
  1853. //return str, ""
  1854. request_url = request_url + "9001"
  1855. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "9001"), string(bytesData)
  1856. }
  1857. 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) {
  1858. // 生成签名
  1859. timestamp := time.Now().Unix()
  1860. // 生成输入报文
  1861. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1862. input := make(map[string]interface{})
  1863. inputData := make(map[string]interface{})
  1864. patientDtosinputData := make(map[string]interface{})
  1865. fisEncounterDtosData := make(map[string]interface{})
  1866. fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
  1867. fsiOrderDtosDatas := make([]map[string]interface{}, 0)
  1868. fsiOperationDtosData := make(map[string]interface{})
  1869. fsiOperationDtosDatas := make([]map[string]interface{}, 0)
  1870. //就诊信息
  1871. fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
  1872. fisEncounterDtosData["medins_id"] = fed.MedinsID
  1873. fisEncounterDtosData["medins_name"] = fed.MedinsName
  1874. fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
  1875. fisEncounterDtosData["medins_type"] = fed.MedinsType
  1876. fisEncounterDtosData["medins_lv"] = fed.MedinsLv
  1877. fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
  1878. fisEncounterDtosData["wardno"] = fed.Wardno
  1879. fisEncounterDtosData["bedno"] = fed.Bedno
  1880. fisEncounterDtosData["adm_date"] = fed.AdmDate
  1881. fisEncounterDtosData["dscg_date"] = fed.DscgDate
  1882. fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
  1883. fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
  1884. for _, fdd := range fdds {
  1885. fsiDiagnoseDtosData := make(map[string]interface{})
  1886. //诊断集合
  1887. fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
  1888. fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
  1889. fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
  1890. fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
  1891. fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
  1892. fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
  1893. fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
  1894. fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
  1895. }
  1896. fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
  1897. fisEncounterDtosData["dr_codg"] = fed.DrCodg
  1898. fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
  1899. fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
  1900. fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
  1901. fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
  1902. fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
  1903. fisEncounterDtosData["med_type"] = fed.MedType
  1904. for _, fod := range fods {
  1905. fsiOrderDtosData := make(map[string]interface{})
  1906. //医嘱集合
  1907. fsiOrderDtosData["rx_id"] = fod.RxID
  1908. fsiOrderDtosData["rxno"] = fod.Rxno
  1909. fsiOrderDtosData["grpno"] = fod.Grpno
  1910. fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
  1911. fsiOrderDtosData["hilist_type"] = fod.HilistType
  1912. fsiOrderDtosData["chrg_type"] = fod.ChrgType
  1913. fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
  1914. fsiOrderDtosData["hilist_code"] = fod.HilistCode
  1915. fsiOrderDtosData["hilist_name"] = fod.HilistName
  1916. fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
  1917. fsiOrderDtosData["hilist_lv"] = fod.HilistLv
  1918. fsiOrderDtosData["hilist_pric"] = fod.HilistPric
  1919. fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
  1920. fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
  1921. fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
  1922. fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
  1923. fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
  1924. fsiOrderDtosData["hosplist_name"] = fod.HosplistName
  1925. fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
  1926. fsiOrderDtosData["cnt"] = fod.Cnt
  1927. fsiOrderDtosData["pric"] = fod.Pric
  1928. fsiOrderDtosData["sumamt"] = fod.Sumamt
  1929. fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
  1930. fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
  1931. fsiOrderDtosData["spec"] = fod.Spec
  1932. fsiOrderDtosData["spec_unt"] = fod.SpecUnt
  1933. fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
  1934. fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
  1935. fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
  1936. fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
  1937. fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
  1938. fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
  1939. fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
  1940. fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
  1941. fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
  1942. }
  1943. fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
  1944. fisEncounterDtosData["matn_stas"] = fed.MatnStas
  1945. fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
  1946. fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
  1947. fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
  1948. fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
  1949. fisEncounterDtosData["ma_amt"] = fed.MaAmt
  1950. fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
  1951. fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
  1952. fisEncounterDtosData["insutype"] = fed.Insutype
  1953. fisEncounterDtosData["reim_flag"] = fed.ReimFlag
  1954. fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
  1955. //手术操作
  1956. for _, fopd := range fopds {
  1957. fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
  1958. fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
  1959. fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
  1960. fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
  1961. fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
  1962. fsiOperationDtosData["anst_way"] = fopd.Anst_way
  1963. fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
  1964. fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
  1965. fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
  1966. fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
  1967. fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
  1968. }
  1969. fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
  1970. patientDtosinputData["patn_id"] = pd.PatnID
  1971. patientDtosinputData["patn_name"] = pd.PatnName
  1972. patientDtosinputData["gend"] = pd.Gend
  1973. patientDtosinputData["brdy"] = pd.Brdy
  1974. patientDtosinputData["poolarea"] = pd.Poolarea
  1975. patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
  1976. patientDtosinputData["fsi_his_data_dto"] = ""
  1977. patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
  1978. inputData["syscode"] = "LinkDialysis"
  1979. inputData["trig_scen"] = trig_scen
  1980. inputData["rule_ids"] = ""
  1981. inputData["task_id"] = ""
  1982. inputData["patient_dtos"] = patientDtosinputData
  1983. input["data"] = inputData
  1984. inputMessage["infno"] = "3101"
  1985. inputMessage["input"] = input //交易输入
  1986. bytesData, err := json.Marshal(inputMessage)
  1987. fmt.Println(string(bytesData))
  1988. if err != nil {
  1989. fmt.Println(err.Error())
  1990. return err.Error(), ""
  1991. }
  1992. params.RequestUrl = params.RequestUrl + "3101"
  1993. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "3101"), string(bytesData)
  1994. }
  1995. 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) {
  1996. // 生成签名
  1997. timestamp := time.Now().Unix()
  1998. // 生成输入报文
  1999. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  2000. input := make(map[string]interface{})
  2001. inputData := make(map[string]interface{})
  2002. patientDtosinputData := make(map[string]interface{})
  2003. fisEncounterDtosData := make(map[string]interface{})
  2004. fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
  2005. fsiOrderDtosDatas := make([]map[string]interface{}, 0)
  2006. fsiOperationDtosData := make(map[string]interface{})
  2007. fsiOperationDtosDatas := make([]map[string]interface{}, 0)
  2008. //就诊信息
  2009. fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
  2010. fisEncounterDtosData["medins_id"] = fed.MedinsID
  2011. fisEncounterDtosData["medins_name"] = fed.MedinsName
  2012. fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
  2013. fisEncounterDtosData["medins_type"] = fed.MedinsType
  2014. fisEncounterDtosData["medins_lv"] = fed.MedinsLv
  2015. fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
  2016. fisEncounterDtosData["wardno"] = fed.Wardno
  2017. fisEncounterDtosData["bedno"] = fed.Bedno
  2018. fisEncounterDtosData["adm_date"] = fed.AdmDate
  2019. fisEncounterDtosData["dscg_date"] = fed.DscgDate
  2020. fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
  2021. fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
  2022. for _, fdd := range fdds {
  2023. fsiDiagnoseDtosData := make(map[string]interface{})
  2024. //诊断集合
  2025. fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
  2026. fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
  2027. fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
  2028. fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
  2029. fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
  2030. fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
  2031. fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
  2032. fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
  2033. }
  2034. fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
  2035. fisEncounterDtosData["dr_codg"] = fed.DrCodg
  2036. fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
  2037. fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
  2038. fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
  2039. fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
  2040. fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
  2041. fisEncounterDtosData["med_type"] = fed.MedType
  2042. for _, fod := range fods {
  2043. fsiOrderDtosData := make(map[string]interface{})
  2044. //医嘱集合
  2045. fsiOrderDtosData["rx_id"] = fod.RxID
  2046. fsiOrderDtosData["rxno"] = fod.Rxno
  2047. fsiOrderDtosData["grpno"] = fod.Grpno
  2048. fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
  2049. fsiOrderDtosData["hilist_type"] = fod.HilistType
  2050. fsiOrderDtosData["chrg_type"] = fod.ChrgType
  2051. fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
  2052. fsiOrderDtosData["hilist_code"] = fod.HilistCode
  2053. fsiOrderDtosData["hilist_name"] = fod.HilistName
  2054. fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
  2055. fsiOrderDtosData["hilist_lv"] = fod.HilistLv
  2056. fsiOrderDtosData["hilist_pric"] = fod.HilistPric
  2057. fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
  2058. fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
  2059. fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
  2060. fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
  2061. fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
  2062. fsiOrderDtosData["hosplist_name"] = fod.HosplistName
  2063. fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
  2064. fsiOrderDtosData["cnt"] = fod.Cnt
  2065. fsiOrderDtosData["pric"] = fod.Pric
  2066. fsiOrderDtosData["sumamt"] = fod.Sumamt
  2067. fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
  2068. fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
  2069. fsiOrderDtosData["spec"] = fod.Spec
  2070. fsiOrderDtosData["spec_unt"] = fod.SpecUnt
  2071. fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
  2072. fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
  2073. fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
  2074. fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
  2075. fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
  2076. fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
  2077. fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
  2078. fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
  2079. fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
  2080. }
  2081. fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
  2082. fisEncounterDtosData["matn_stas"] = fed.MatnStas
  2083. fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
  2084. fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
  2085. fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
  2086. fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
  2087. fisEncounterDtosData["ma_amt"] = fed.MaAmt
  2088. fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
  2089. fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
  2090. fisEncounterDtosData["insutype"] = fed.Insutype
  2091. fisEncounterDtosData["reim_flag"] = fed.ReimFlag
  2092. fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
  2093. //手术操作
  2094. for _, fopd := range fopds {
  2095. fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
  2096. fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
  2097. fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
  2098. fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
  2099. fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
  2100. fsiOperationDtosData["anst_way"] = fopd.Anst_way
  2101. fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
  2102. fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
  2103. fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
  2104. fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
  2105. fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
  2106. }
  2107. fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
  2108. patientDtosinputData["patn_id"] = pd.PatnID
  2109. patientDtosinputData["patn_name"] = pd.PatnName
  2110. patientDtosinputData["gend"] = pd.Gend
  2111. patientDtosinputData["brdy"] = pd.Brdy
  2112. patientDtosinputData["poolarea"] = pd.Poolarea
  2113. patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
  2114. patientDtosinputData["fsi_his_data_dto"] = ""
  2115. patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
  2116. inputData["syscode"] = "LinkDialysis"
  2117. inputData["trig_scen"] = trig_scen
  2118. inputData["rule_ids"] = ""
  2119. inputData["task_id"] = ""
  2120. inputData["patient_dtos"] = patientDtosinputData
  2121. input["data"] = inputData
  2122. inputMessage["infno"] = "3102"
  2123. inputMessage["input"] = input //交易输入
  2124. bytesData, err := json.Marshal(inputMessage)
  2125. fmt.Println(string(bytesData))
  2126. if err != nil {
  2127. fmt.Println(err.Error())
  2128. return err.Error(), ""
  2129. }
  2130. params.RequestUrl = params.RequestUrl + "3102"
  2131. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "3102"), string(bytesData)
  2132. }
  2133. func Jxyb4101(struct4101 Struct4101, params models.PublicParams) (string, string) {
  2134. timestamp := time.Now().Unix()
  2135. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  2136. // 生成输入报文
  2137. input := make(map[string]interface{})
  2138. inputData := make(map[string]interface{})
  2139. inputMessage["infno"] = "4101A" // 交易编码
  2140. year := time.Now().Format("2006")
  2141. month := time.Now().Format("01")
  2142. day := time.Now().Format("02")
  2143. inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
  2144. inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
  2145. inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
  2146. inputData["fixmedins_name"] = params.FixmedinsName // 定点医药机构名称 必填
  2147. inputData["fixmedins_code"] = params.FixmedinsCode // 定点医药机构编码 必填
  2148. inputData["hi_setl_lv"] = "" // 医保结算等级
  2149. inputData["hi_no"] = struct4101.PsnNo // 医保编号
  2150. inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
  2151. inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
  2152. inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
  2153. inputData["gend"] = struct4101.Gend // 性别 必填
  2154. inputData["brdy"] = struct4101.Brdy // 出生日期 必填
  2155. inputData["age"] = struct4101.Age // 年龄 必填
  2156. inputData["ntly"] = struct4101.Ntly // 国籍 必填
  2157. inputData["nwb_age"] = "" // 年龄 必填
  2158. inputData["naty"] = struct4101.Naty // 民族 必填
  2159. inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
  2160. inputData["certno"] = struct4101.Certno // 证件号码 必填
  2161. inputData["prfs"] = struct4101.Prfs // 职业 必填
  2162. inputData["curr_addr"] = "" // 现住址 必填
  2163. inputData["emp_name"] = "" // 单位名称 必填
  2164. inputData["emp_addr"] = "" // 单位地址 必填
  2165. inputData["emp_tel"] = "" // 单位电话 必填
  2166. inputData["poscode"] = "" // 邮编 必填
  2167. inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
  2168. inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
  2169. inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
  2170. inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
  2171. inputData["hi_type"] = struct4101.HiType // 医保类型 必填
  2172. inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
  2173. inputData["sp_psn_type"] = "" // 特殊人员类型 必填
  2174. inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
  2175. inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
  2176. inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
  2177. inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
  2178. inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
  2179. inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
  2180. inputData["adm_way"] = "" // 入院途径 必填
  2181. inputData["trt_type"] = "" // 治疗类别 必填
  2182. inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
  2183. inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
  2184. inputData["refldept_dept"] = "" // 转科科别 必填
  2185. inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
  2186. inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
  2187. inputData["act_ipt_days"] = "" // 实际住院天数 必填
  2188. inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
  2189. inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
  2190. inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
  2191. inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
  2192. inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
  2193. inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
  2194. inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
  2195. inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
  2196. inputData["bld_cat"] = "" // 输血品种 必填
  2197. inputData["bld_amt"] = "" // 输血量 必填
  2198. inputData["bld_unt"] = "" // 输血计量单位 必填
  2199. inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
  2200. inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
  2201. inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
  2202. inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
  2203. inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
  2204. inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
  2205. inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
  2206. inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
  2207. inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
  2208. inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
  2209. inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
  2210. inputData["chfpdr_name"] = "" // 主诊医师姓名 必填
  2211. inputData["chfpdr_code"] = "" // 主诊医师代码 必填
  2212. inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
  2213. inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
  2214. inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
  2215. inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
  2216. inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
  2217. inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
  2218. inputData["hsorg"] = params.FixmedinsName // 医保机构 必填
  2219. inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
  2220. inputData["medins_fill_dept"] = params.FixmedinsName // 医疗机构填报部门 必填
  2221. inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
  2222. inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
  2223. payinfo := make([]map[string]interface{}, 0) // 基金支付信息
  2224. for _, item := range struct4101.CustomStruct {
  2225. payinfotemp := make(map[string]interface{})
  2226. 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" {
  2227. payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
  2228. payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
  2229. payinfo = append(payinfo, payinfotemp)
  2230. }
  2231. }
  2232. opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
  2233. opspdiseinfotemp := make(map[string]interface{})
  2234. opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 诊断名称 必填
  2235. opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 诊断代码 必填
  2236. opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
  2237. opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
  2238. opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
  2239. diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
  2240. for _, item := range struct4101.Diseinfo {
  2241. diseinfotemp := make(map[string]interface{})
  2242. diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
  2243. diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
  2244. diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
  2245. diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
  2246. diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
  2247. diseinfo = append(diseinfo, diseinfotemp)
  2248. }
  2249. iteminfo := make([]map[string]interface{}, 0)
  2250. for _, item := range struct4101.IteminfoStruct {
  2251. iteminfotemp := make(map[string]interface{})
  2252. iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
  2253. iteminfotemp["amt"] = item.Amt // 金额 必填
  2254. iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
  2255. iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
  2256. iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
  2257. iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
  2258. iteminfo = append(iteminfo, iteminfotemp)
  2259. }
  2260. oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
  2261. oprninfotemp := make(map[string]interface{})
  2262. oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
  2263. oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
  2264. oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
  2265. oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
  2266. oprninfotemp["anst_way"] = "" // 麻醉方式 必填
  2267. oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
  2268. oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
  2269. oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
  2270. oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
  2271. oprninfo = append(oprninfo, oprninfotemp)
  2272. icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
  2273. icuinfotemp := make(map[string]interface{})
  2274. icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
  2275. icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
  2276. icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
  2277. icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
  2278. icuinfo = append(icuinfo, icuinfotemp)
  2279. input["setlinfo"] = inputData
  2280. input["payinfo"] = payinfo
  2281. input["opspdiseinfo"] = opspdiseinfo
  2282. input["diseinfo"] = diseinfo
  2283. input["iteminfo"] = iteminfo
  2284. inputMessage["input"] = input //交易输入
  2285. bytesData, _ := json.Marshal(inputMessage)
  2286. fmt.Println(string(bytesData))
  2287. params.RequestUrl = params.RequestUrl + "4101"
  2288. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4101A"), string(bytesData)
  2289. }
  2290. func Jxyb4102(psn_no string, setl_id string, params models.PublicParams, stas_type string) (string, string) {
  2291. timestamp := time.Now().Unix()
  2292. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  2293. // 生成输入报文
  2294. input := make(map[string]interface{})
  2295. inputData := make(map[string]interface{})
  2296. inputData2 := make(map[string]interface{})
  2297. inputMessage["infno"] = "4102" // 交易编码
  2298. inputData["setl_id"] = setl_id // 结算 ID 必填
  2299. inputData["psn_no"] = psn_no // 结算 ID 必填
  2300. inputData["stas_type"] = stas_type // 结算 ID 必填
  2301. inputData2["stastinfo"] = inputData
  2302. input["data"] = inputData2
  2303. inputMessage["input"] = input //交易输入
  2304. bytesData, _ := json.Marshal(inputMessage)
  2305. fmt.Println(string(bytesData))
  2306. params.RequestUrl = params.RequestUrl + "4102"
  2307. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4102"), string(bytesData)
  2308. }
  2309. func Jxyb4103(psn_no string, setl_id string, params models.PublicParams) (string, string) {
  2310. timestamp := time.Now().Unix()
  2311. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  2312. // 生成输入报文
  2313. input := make(map[string]interface{})
  2314. inputData := make(map[string]interface{})
  2315. inputMessage["infno"] = "4103" // 交易编码
  2316. inputData["setl_id"] = setl_id // 结算 ID 必填
  2317. inputData["psn_no"] = psn_no // 结算 ID 必填
  2318. input["data"] = inputData
  2319. inputMessage["input"] = input //交易输入
  2320. bytesData, _ := json.Marshal(inputMessage)
  2321. fmt.Println(string(bytesData))
  2322. params.RequestUrl = params.RequestUrl + "4103"
  2323. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4103"), string(bytesData)
  2324. }
  2325. func Jxyb4105( params models.PublicParams) (string, string) {
  2326. var meds []string
  2327. meds = append(meds,"21")
  2328. timestamp := time.Now().Unix()
  2329. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  2330. // 生成输入报文
  2331. input := make(map[string]interface{})
  2332. inputData := make(map[string]interface{})
  2333. inputMessage["infno"] = "4105" // 交易编码
  2334. inputData["fixmedins_code"] = params.FixmedinsCode // 结算 ID 必填
  2335. inputData["medtype_list"] = meds // 结算 ID 必填
  2336. inputData["stt_begntime"] = "2023-11-01"// 结算 ID 必填
  2337. inputData["stt_endtime"] = "2023-11-31"// 结算 ID 必填
  2338. input["data"] = inputData
  2339. inputMessage["input"] = input //交易输入
  2340. bytesData, _ := json.Marshal(inputMessage)
  2341. fmt.Println(string(bytesData))
  2342. params.RequestUrl = params.RequestUrl + "4105"
  2343. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4105"), string(bytesData)
  2344. }
  2345. func Jxyb3501(struct3501 models.Struct3501) (string, string) {
  2346. timestamp := time.Now().Unix()
  2347. // 生成输入报文
  2348. inputMessage := SetJXInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsCode, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
  2349. input := make(map[string]interface{})
  2350. inputData := make(map[string]interface{})
  2351. inputMessage["infno"] = "3501" // 交易编码
  2352. inputData["med_list_codg"] = struct3501.MedListCodg // 定点医药机构目录编号
  2353. inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
  2354. inputData["fixmedins_hilist_name"] = struct3501.OrgName // 定点医药机构目录名称
  2355. inputData["rx_flag"] = struct3501.RxFlag //
  2356. inputData["invdate"] = struct3501.Invdate // 人员编号 (来自1101接口返回)
  2357. inputData["inv_cnt"] = struct3501.InvCnt // 人员编号 (来自1101接口返回)
  2358. inputData["manu_lotnum"] = struct3501.ManuLotnum // 人员编号 (来自1101接口返回)
  2359. inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2360. inputData["manu_date"] = struct3501.ManuDate // 人员编号 (来自1101接口返回)
  2361. inputData["expy_end"] = struct3501.ExpyEnd // 人员编号 (来自1101接口返回)
  2362. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  2363. input["invinfo"] = inputData
  2364. inputMessage["input"] = input //交易输入
  2365. bytesData, err := json.Marshal(inputMessage)
  2366. fmt.Println(string(bytesData))
  2367. if err != nil {
  2368. fmt.Println(err.Error())
  2369. return err.Error(), ""
  2370. }
  2371. struct3501.RequestUrl = struct3501.RequestUrl + "3501"
  2372. return JXHttpRequest(struct3501.RequestUrl, struct3501.AccessKey, struct3501.SecretKey, timestamp, string(bytesData), "3501"), string(bytesData)
  2373. }
  2374. func Jxyb3502(struct3502 models.Struct3502) (string, string) {
  2375. timestamp := time.Now().Unix()
  2376. // 生成输入报文
  2377. inputMessage := SetJXInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
  2378. input := make(map[string]interface{})
  2379. inputData := make(map[string]interface{})
  2380. inputMessage["infno"] = "3502" // 交易编码
  2381. inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
  2382. inputData["inv_chg_type"] = struct3502.InvChgType // 定点医药机构目录编号
  2383. inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
  2384. inputData["fixmedins_hilist_name"] = struct3502.OrgName // 定点医药机构目录名称
  2385. inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2386. inputData["pric"] = struct3502.Pric // 人员编号 (来自1101接口返回)
  2387. inputData["cnt"] = struct3502.Cnt // 人员编号 (来自1101接口返回)
  2388. inputData["rx_flag"] = struct3502.RxFlag //
  2389. inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
  2390. inputData["inv_chg_opter_name"] = "" // 人员编号 (来自1101接口返回)
  2391. inputData["memo"] = struct3502.Memo // 人员编号 (来自1101接口返回)
  2392. inputData["trdn_flag"] = "" // 人员编号 (来自1101接口返回)
  2393. input["invinfo"] = inputData
  2394. inputMessage["input"] = input //交易输入
  2395. bytesData, err := json.Marshal(inputMessage)
  2396. fmt.Println(string(bytesData))
  2397. if err != nil {
  2398. fmt.Println(err.Error())
  2399. return err.Error(), ""
  2400. }
  2401. struct3502.RequestUrl = struct3502.RequestUrl + "3502"
  2402. return JXHttpRequest(struct3502.RequestUrl, struct3502.AccessKey, struct3502.SecretKey, timestamp, string(bytesData), "3502"), string(bytesData)
  2403. }
  2404. func Jxyb3503(struct3503 models.Struct3503) (string, string) {
  2405. timestamp := time.Now().Unix()
  2406. // 生成输入报文
  2407. inputMessage := SetJXInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsCode, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
  2408. input := make(map[string]interface{})
  2409. inputData := make(map[string]interface{})
  2410. inputMessage["infno"] = "3503"
  2411. inputData["med_list_codg"] = struct3503.MedListCodg
  2412. inputData["fixmedins_hilist_id"] = struct3503.FixmedinsCode
  2413. inputData["fixmedins_hilist_name"] = struct3503.OrgName
  2414. inputData["dynt_no"] = ""
  2415. inputData["fixmedins_bchno"] = struct3503.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2416. inputData["spler_name"] = struct3503.SplerName // 人员编号 (来自1101接口返回)
  2417. inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
  2418. inputData["manu_lotnum"] = struct3503.ManuLotnum // 人员编号 (来自1101接口返回)
  2419. inputData["prodentp_name"] = struct3503.ProdentpName // 人员编号 (来自1101接口返回)
  2420. inputData["aprvno"] = struct3503.Aprvno // 人员编号 (来自1101接口返回)
  2421. inputData["manu_date"] = struct3503.ManuDate // 人员编号 (来自1101接口返回)
  2422. inputData["expy_end"] = struct3503.ExpyEnd // 人员编号 (来自1101接口返回)
  2423. inputData["finl_trns_pric"] = struct3503.FinlTrnsPric // 人员编号 (来自1101接口返回)
  2424. inputData["purc_retn_cnt"] = struct3503.PurcRetnCnt // 人员编号 (来自1101接口返回)
  2425. inputData["purc_invo_codg"] = struct3503.PurcInvoCodg // 人员编号 (来自1101接口返回)
  2426. inputData["purc_invo_no"] = struct3503.PurcInvoNo // 人员编号 (来自1101接口返回)
  2427. inputData["rx_flag"] = struct3503.RxFlag // 人员编号 (来自1101接口返回)
  2428. inputData["purc_retn_stoin_time"] = struct3503.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
  2429. inputData["purc_retn_opter_name"] = struct3503.PurcRetnOpterName // 人员编号 (来自1101接口返回)
  2430. inputData["prod_geay_flag"] = "" // 人员编号 (来自1101接口返回)
  2431. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  2432. input["purcinfo"] = inputData
  2433. inputMessage["input"] = input //交易输入
  2434. bytesData, err := json.Marshal(inputMessage)
  2435. fmt.Println(string(bytesData))
  2436. if err != nil {
  2437. fmt.Println(err.Error())
  2438. return err.Error(), ""
  2439. }
  2440. struct3503.RequestUrl = struct3503.RequestUrl + "3503"
  2441. return JXHttpRequest(struct3503.RequestUrl, struct3503.AccessKey, struct3503.SecretKey, timestamp, string(bytesData), "3503"), string(bytesData)
  2442. }
  2443. func Jxyb3504(struct3504 models.Struct3504) (string, string) {
  2444. timestamp := time.Now().Unix()
  2445. // 生成输入报文
  2446. inputMessage := SetJXInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
  2447. input := make(map[string]interface{})
  2448. inputData := make(map[string]interface{})
  2449. inputMessage["infno"] = "3504" // 交易编码
  2450. inputData["med_list_codg"] = struct3504.MedListCodg // 定点医药机构目录编号
  2451. inputData["fixmedins_hilist_id"] = struct3504.FixmedinsHilistId // 定点医药机构目录编号
  2452. inputData["fixmedins_hilist_name"] = struct3504.FixmedinsHilistName // 定点医药机构目录名称
  2453. inputData["fixmedins_bchno"] = struct3504.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2454. inputData["spler_name"] = struct3504.SplerName // 人员编号 (来自1101接口返回)
  2455. inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
  2456. inputData["manu_date"] = struct3504.ManuDate // 人员编号 (来自1101接口返回)
  2457. inputData["expy_end"] = struct3504.ExpyEnd // 人员编号 (来自1101接口返回)
  2458. inputData["finl_trns_pric"] = struct3504.FinlTrnsPric // 人员编号 (来自1101接口返回)
  2459. inputData["purc_retn_cnt"] = struct3504.PurcRetnCnt // 人员编号 (来自1101接口返回)
  2460. inputData["purc_invo_codg"] = struct3504.PurcInvoCodg // 人员编号 (来自1101接口返回)
  2461. inputData["purc_invo_no"] = struct3504.PurcInvoNo // 人员编号 (来自1101接口返回)
  2462. inputData["rx_flag"] = struct3504.RxFlag // 人员编号 (来自1101接口返回)
  2463. inputData["purc_retn_stoin_time"] = struct3504.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
  2464. inputData["purc_retn_opter_name"] = struct3504.PurcRetnOpterName // 人员编号 (来自1101接口返回)
  2465. inputData["medins_prod_purc_no"] = "" // 人员编号 (来自1101接口返回)
  2466. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  2467. input["purcinfo"] = inputData
  2468. inputMessage["input"] = input //交易输入
  2469. bytesData, err := json.Marshal(inputMessage)
  2470. fmt.Println(string(bytesData))
  2471. if err != nil {
  2472. fmt.Println(err.Error())
  2473. return err.Error(), ""
  2474. }
  2475. struct3504.RequestUrl = struct3504.RequestUrl + "3504"
  2476. return JXHttpRequest(struct3504.RequestUrl, struct3504.AccessKey, struct3504.SecretKey, timestamp, string(bytesData), "3504"), string(bytesData)
  2477. }
  2478. func Jxyb3505(struct3505 models.Struct3505) (string, string) {
  2479. timestamp := time.Now().Unix()
  2480. // 生成输入报文
  2481. inputMessage := SetJXInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
  2482. input := make(map[string]interface{})
  2483. inputData := make(map[string]interface{})
  2484. inputMessage["infno"] = "3505" // 交易编码
  2485. inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号
  2486. inputData["fixmedins_hilist_id"] = struct3505.FixmedinsCode // 定点医药机构目录编号
  2487. inputData["fixmedins_hilist_name"] = struct3505.OrgName // 定点医药机构目录名称
  2488. inputData["fixmedins_bchno"] = struct3505.FixmedinsCode // 人员编号 (来自1101接口返回)
  2489. inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
  2490. inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回)
  2491. inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回)
  2492. inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回)
  2493. inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回)
  2494. inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回)
  2495. inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
  2496. inputData["hi_feesetl_type"] = struct3505.HiFeesetlType // 人员编号 (来自1101接口返回)
  2497. inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回)
  2498. inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回)
  2499. inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回)
  2500. inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
  2501. inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回)
  2502. inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回)
  2503. inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回)
  2504. inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回)
  2505. inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回)
  2506. inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回)
  2507. inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
  2508. inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
  2509. inputData["rxno"] = struct3505.Rxno // 人员编号 (来自1101接口返回)
  2510. inputData["rx_circ_flag"] = struct3505.RxCircFlag // 人员编号 (来自1101接口返回)
  2511. inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
  2512. inputData["stoout_no"] = struct3505.StooutNo // 人员编号 (来自1101接口返回)
  2513. inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
  2514. inputData["drug_trac_codg"] = struct3505.DrugTracCodg // 人员编号 (来自1101接口返回)
  2515. inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回)
  2516. inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回)
  2517. inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回)
  2518. inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回)
  2519. inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
  2520. inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回)
  2521. input["selinfo"] = inputData
  2522. inputMessage["input"] = input //交易输入
  2523. bytesData, err := json.Marshal(inputMessage)
  2524. fmt.Println(string(bytesData))
  2525. if err != nil {
  2526. fmt.Println(err.Error())
  2527. return err.Error(), ""
  2528. }
  2529. struct3505.RequestUrl = struct3505.RequestUrl + "3505"
  2530. return JXHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
  2531. }
  2532. func Jxyb3506(struct3506 models.Struct3506) (string, string) {
  2533. timestamp := time.Now().Unix()
  2534. // 生成输入报文
  2535. inputMessage := SetJXInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
  2536. input := make(map[string]interface{})
  2537. inputData := make(map[string]interface{})
  2538. inputMessage["infno"] = "3506" // 交易编码
  2539. inputData["med_list_codg"] = struct3506.MedListCodg // 定点医药机构目录编号
  2540. inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
  2541. inputData["fixmedins_hilist_name"] = struct3506.OrgName // 定点医药机构目录名称
  2542. inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2543. inputData["setl_id"] = struct3506.SetlId // 人员编号 (来自1101接口返回)
  2544. inputData["psn_no"] = struct3506.PsnNo // 人员编号 (来自1101接口返回)
  2545. inputData["psn_cert_type"] = struct3506.PsnCertType // 人员编号 (来自1101接口返回)
  2546. inputData["certno"] = struct3506.Certno // 人员编号 (来自1101接口返回)
  2547. inputData["psn_name"] = struct3506.PsnName // 人员编号 (来自1101接口返回)
  2548. inputData["manu_lotnum"] = struct3506.ManuLotnum // 人员编号 (来自1101接口返回)
  2549. inputData["manu_date"] = struct3506.ManuDate // 人员编号 (来自1101接口返回)
  2550. inputData["expy_end"] = struct3506.ExpyEnd // 人员编号 (来自1101接口返回)
  2551. inputData["rx_flag"] = struct3506.RxFlag // 人员编号 (来自1101接口返回)
  2552. inputData["trdn_flag"] = struct3506.TrdnFlag // 人员编号 (来自1101接口返回)
  2553. inputData["finl_trns_pric"] = struct3506.FinlTrnsPric // 人员编号 (来自1101接口返回)
  2554. inputData["sel_retn_cnt"] = struct3506.SelRetnCnt // 人员编号 (来自1101接口返回)
  2555. inputData["sel_retn_time"] = struct3506.SelRetnTime // 人员编号 (来自1101接口返回)
  2556. inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回)
  2557. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  2558. inputData["medins_prod_sel_no"] = "" // 人员编号 (来自1101接口返回)
  2559. input["selinfo"] = inputData
  2560. inputMessage["input"] = input //交易输入
  2561. bytesData, err := json.Marshal(inputMessage)
  2562. fmt.Println(string(bytesData))
  2563. if err != nil {
  2564. fmt.Println(err.Error())
  2565. return err.Error(), ""
  2566. }
  2567. struct3506.RequestUrl = struct3506.RequestUrl + "3506"
  2568. return JXHttpRequest(struct3506.RequestUrl, struct3506.AccessKey, struct3506.SecretKey, timestamp, string(bytesData), "3506"), string(bytesData)
  2569. }
  2570. func Jxyb3507(struct3507 models.Struct3507) (string, string) {
  2571. timestamp := time.Now().Unix()
  2572. // 生成输入报文
  2573. inputMessage := SetJXInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
  2574. input := make(map[string]interface{})
  2575. inputData := make(map[string]interface{})
  2576. inputMessage["infno"] = "3507" // 交易编码
  2577. inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
  2578. inputData["inv_data_type"] = struct3507.InvDataType // 人员编号 (来自1101接口返回)
  2579. input["data"] = inputData
  2580. inputMessage["input"] = input //交易输入
  2581. bytesData, err := json.Marshal(inputMessage)
  2582. fmt.Println(string(bytesData))
  2583. if err != nil {
  2584. fmt.Println(err.Error())
  2585. return err.Error(), ""
  2586. }
  2587. struct3507.RequestUrl = struct3507.RequestUrl + "3507"
  2588. return JXHttpRequest(struct3507.RequestUrl, struct3507.AccessKey, struct3507.SecretKey, timestamp, string(bytesData), "3507"), string(bytesData)
  2589. }
  2590. func Jxyb3203(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) {
  2591. // 生成签名
  2592. timestamp := time.Now().Unix()
  2593. // 生成输入报文
  2594. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  2595. input := make(map[string]interface{})
  2596. inputData := make(map[string]interface{})
  2597. inputMessage["infno"] = "3203" // 交易编码
  2598. inputData["stmt_begndate"] = stmt_begndate // 对帐开始时间
  2599. inputData["stmt_enddate"] = stmt_enddate //对帐结束时间
  2600. inputData["medfee_sumamt"] = medfee_sumamt //医疗费总额
  2601. inputData["fund_pay_sumamt"] = fund_pay_sumamt //基金支付总额
  2602. inputData["acct_pay"] = acct_pay //个人账户支付金额
  2603. inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
  2604. inputData["fixmedins_code"] = fixmedins_code //个人账户支付金额
  2605. input["data"] = inputData
  2606. inputMessage["input"] = input //交易输入
  2607. bytesData, err := json.Marshal(inputMessage)
  2608. fmt.Println(string(bytesData))
  2609. if err != nil {
  2610. fmt.Println(err.Error())
  2611. return err.Error(), ""
  2612. }
  2613. request_url = request_url + "3203"
  2614. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3203"), string(bytesData)
  2615. }