jx_service.go 130KB

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