jx_service.go 121KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513
  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 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) {
  882. timestamp := time.Now().Unix()
  883. //生成输入报文
  884. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  885. input := make(map[string]interface{})
  886. inputData := make(map[string]interface{})
  887. inputMessage["infno"] = "1101" // 交易编码
  888. if certificates == 3 {
  889. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  890. inputData["certno"] = certNo // 证件号码
  891. inputData["psn_cert_type"] = "99" // 人员证件类型
  892. } else {
  893. if id_card_type == 1 {
  894. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  895. inputData["card_sn"] = card_sn // 卡识别码
  896. inputData["certno"] = id_card_no // 证件号码
  897. inputData["psn_cert_type"] = "01" // 人员证件类型
  898. inputData["mdtrt_cert_no"] = certNo + "|" + pBusiCardInfo // 就诊凭证编号
  899. } else {
  900. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  901. inputData["card_sn"] = "" // 卡识别码
  902. inputData["certno"] = certNo // 证件号码
  903. inputData["psn_cert_type"] = "01" // 人员证件类型
  904. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  905. }
  906. }
  907. inputData["begntime"] = "" // 开始时间
  908. inputData["psn_name"] = "" // 人员姓名
  909. input["data"] = inputData
  910. inputMessage["input"] = input //交易输入
  911. var inputLog string
  912. bytesData, _ := json.Marshal(inputMessage)
  913. inputLog = string(bytesData)
  914. fmt.Println(string(bytesData))
  915. if err != nil {
  916. fmt.Println(err.Error())
  917. return err.Error(), ""
  918. }
  919. request_url = request_url + "1101"
  920. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "1101"), inputLog
  921. }
  922. // 住院登记
  923. 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) {
  924. // 生成签名
  925. timestamp := time.Now().Unix()
  926. //tempTime := time.Unix(timestamp, 0)
  927. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  928. // 生成输入报文
  929. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  930. //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  931. input := make(map[string]interface{})
  932. inputData := make(map[string]interface{})
  933. inputMessage["infno"] = "2401" // 交易编码
  934. inputData["psn_no"] = struct2401.PsnNo // 人员编号 (来自1101接口返回)
  935. inputData["insutype"] = struct2401.Insutype // 险种类型(来自1101接口返回)
  936. inputData["tel"] = ""
  937. inputData["coner_name"] = ""
  938. inputData["begntime"] = struct2401.Begntime // 开始时间
  939. inputData["mdtrt_cert_type"] = struct2401.MdtrtCertType // 就诊凭证类型
  940. inputData["mdtrt_cert_no"] = struct2401.MdtrtCertNo // 就诊凭证编号
  941. inputData["med_type"] = struct2401.MedType // 就诊凭证编号
  942. inputData["ipt_no"] = struct2401.IptNo // 住院/门诊号
  943. inputData["medrcdno"] = ""
  944. inputData["atddr_no"] = struct2401.AtddrNo
  945. inputData["chfpdr_name"] = struct2401.ChfpdrName
  946. inputData["adm_diag_dscr"] = struct2401.AdmDiagDscr
  947. inputData["adm_dept_codg"] = struct2401.AdmDeptCodg
  948. inputData["adm_dept_name"] = struct2401.AdmDeptName
  949. inputData["adm_bed"] = struct2401.AdmBed
  950. inputData["dscg_maindiag_code"] = struct2401.DscgMaindiagCode
  951. inputData["dscg_maindiag_name"] = struct2401.DscgMaindiagName
  952. inputData["main_cond_dscr"] = ""
  953. inputData["dise_codg"] = struct2401.DiseCodg
  954. inputData["dise_name"] = struct2401.DiseName
  955. inputData["oprn_oprt_code"] = ""
  956. inputData["oprn_oprt_name"] = ""
  957. inputData["fpsc_no"] = ""
  958. inputData["matn_type"] = ""
  959. inputData["birctrl_type"] = ""
  960. inputData["latechb_flag"] = ""
  961. inputData["geso_val"] = ""
  962. inputData["fetts"] = ""
  963. inputData["fetus_cnt"] = ""
  964. inputData["pret_flag"] = ""
  965. inputData["birctrl_matn_date"] = ""
  966. inputData["dise_type_code"] = ""
  967. inputData["insuplc_admdvs"] = insuplc_admdvs
  968. inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
  969. inputDataArr := make([]map[string]interface{}, 0)
  970. for _, item := range struct2401.Diseinfo {
  971. inputDataTwo := make(map[string]interface{})
  972. inputDataTwo["psn_no"] = item.PsnNo
  973. inputDataTwo["diag_type"] = item.DiagType
  974. inputDataTwo["maindiag_flag"] = item.MaindiagFlag
  975. inputDataTwo["diag_srt_no"] = item.DiagSrtNo
  976. inputDataTwo["diag_code"] = item.DiagCode
  977. inputDataTwo["diag_name"] = item.DiagName
  978. inputDataTwo["adm_cond"] = ""
  979. inputDataTwo["diag_dept"] = item.DiagDept
  980. inputDataTwo["dise_dor_no"] = item.DiseDorNo
  981. inputDataTwo["dise_dor_name"] = item.DiseDorName
  982. inputDataTwo["diag_time"] = item.DiagTime
  983. inputDataArr = append(inputDataArr, inputDataTwo)
  984. }
  985. input["mdtrtinfo"] = inputData
  986. input["diseinfo"] = inputDataArr
  987. inputMessage["input"] = input //交易输入
  988. bytesData, err := json.Marshal(inputMessage)
  989. fmt.Println(string(bytesData))
  990. requestLog := string(bytesData)
  991. if err != nil {
  992. fmt.Println(err.Error())
  993. return err.Error(), ""
  994. }
  995. request_url = request_url + "2401"
  996. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2401"), requestLog
  997. }
  998. 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) {
  999. // 生成签名
  1000. timestamp := time.Now().Unix()
  1001. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1002. input := make(map[string]interface{})
  1003. inputData := make(map[string]interface{})
  1004. inputMessage["infno"] = "2404" // 交易编码
  1005. inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
  1006. inputData["psn_no"] = psn_no // 人员编号 (来自1101接口返回)
  1007. input["data"] = inputData
  1008. inputMessage["input"] = input //交易输入
  1009. bytesData, err := json.Marshal(inputMessage)
  1010. fmt.Println(string(bytesData))
  1011. requestLog := string(bytesData)
  1012. if err != nil {
  1013. fmt.Println(err.Error())
  1014. return err.Error(), ""
  1015. }
  1016. request_url = request_url + "2404"
  1017. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2404"), requestLog
  1018. }
  1019. 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) {
  1020. // 生成签名
  1021. timestamp := time.Now().Unix()
  1022. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1023. input := make(map[string]interface{})
  1024. inputData := make(map[string]interface{})
  1025. inputMessage["infno"] = "2405" // 交易编码
  1026. inputData["mdtrt_id"] = mdtrt_id // 人员编号 (来自1101接口返回)
  1027. inputData["psn_no"] = psn_no // 人员编号 (来自1101接口返回)
  1028. input["data"] = inputData
  1029. inputMessage["input"] = input //交易输入
  1030. bytesData, err := json.Marshal(inputMessage)
  1031. fmt.Println(string(bytesData))
  1032. requestLog := string(bytesData)
  1033. if err != nil {
  1034. fmt.Println(err.Error())
  1035. return err.Error(), ""
  1036. }
  1037. request_url = request_url + "2405"
  1038. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2405"), requestLog
  1039. }
  1040. 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) {
  1041. // 生成签名
  1042. nonce := GetRandomString(32)
  1043. timestamp := time.Now().Unix()
  1044. // 生成输入报文
  1045. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1046. input := make(map[string]interface{})
  1047. inputData := make(map[string]interface{})
  1048. inputMessage["infno"] = "2402" // 交易编码
  1049. inputData["mdtrt_id"] = struct2402.MdtrtId // 人员编号 (来自1101接口返回)
  1050. inputData["psn_no"] = struct2402.PsnNo // 人员编号 (来自1101接口返回)
  1051. inputData["insutype"] = struct2402.Insutype // 险种类型(来自1101接口返回)
  1052. inputData["endtime"] = struct2402.Endtime // 结束时间
  1053. inputData["dise_codg"] = struct2402.DiseCode // 就诊凭证类型
  1054. inputData["dise_name"] = struct2402.DiseName // 就诊凭证类型
  1055. inputData["oprn_oprt_code"] = "" // 就诊凭证类型
  1056. inputData["oprn_oprt_name"] = "" // 就诊凭证类型
  1057. inputData["fpsc_no"] = "" // 就诊凭证类型
  1058. inputData["matn_type"] = "" // 就诊凭证类型
  1059. inputData["birctrl_type"] = "" // 就诊凭证类型
  1060. inputData["latechb_flag"] = "" // 就诊凭证类型
  1061. inputData["geso_val"] = ""
  1062. inputData["fetts"] = ""
  1063. inputData["fetus_cnt"] = ""
  1064. inputData["pret_flag"] = ""
  1065. inputData["birctrl_matn_date"] = ""
  1066. inputData["cop_flag"] = ""
  1067. inputData["dscg_dept_codg"] = struct2402.DscgDeptCodg
  1068. inputData["dscg_dept_name"] = struct2402.DscgDeptName
  1069. inputData["dscg_bed"] = "待定"
  1070. inputData["dscg_way"] = struct2402.DscgWay
  1071. inputData["die_date"] = ""
  1072. inputDataArr := make([]map[string]interface{}, 0)
  1073. for _, item := range struct2402.Diseinfo {
  1074. inputDataTwo := make(map[string]interface{})
  1075. inputDataTwo["psn_no"] = item.PsnNo
  1076. inputDataTwo["mdtrt_id"] = item.MdtrtId
  1077. inputDataTwo["diag_type"] = item.DiagType
  1078. inputDataTwo["maindiag_flag"] = item.MaindiagFlag
  1079. inputDataTwo["diag_srt_no"] = item.DiagSrtNo
  1080. inputDataTwo["diag_code"] = item.DiagCode
  1081. inputDataTwo["diag_name"] = item.DiagName
  1082. inputDataTwo["diag_dept"] = item.DiagDept
  1083. inputDataTwo["dise_dor_no"] = item.DiseDorNo
  1084. inputDataTwo["dise_dor_name"] = item.DiseDorName
  1085. inputDataTwo["diag_time"] = item.DiagTime
  1086. inputDataArr = append(inputDataArr, inputDataTwo)
  1087. }
  1088. input["dscginfo"] = inputData
  1089. input["diseinfo"] = inputDataArr
  1090. inputMessage["input"] = input //交易输入
  1091. bytesData, err := json.Marshal(inputMessage)
  1092. fmt.Println(string(bytesData))
  1093. requestLog := string(bytesData)
  1094. if err != nil {
  1095. fmt.Println(err.Error())
  1096. return err.Error(), ""
  1097. }
  1098. request_url = request_url + "2402"
  1099. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2402"), requestLog
  1100. }
  1101. 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) {
  1102. // 生成签名
  1103. timestamp := time.Now().Unix()
  1104. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1105. var customs []*models.NewCustom
  1106. customs = hisPrescription
  1107. // 生成输入报文
  1108. input := make(map[string]interface{})
  1109. feedetail := make([]map[string]interface{}, 0)
  1110. inputMessage["infno"] = "2301" // 交易编码
  1111. //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
  1112. for _, item := range customs {
  1113. org_id, _ := beego.AppConfig.Int64("org_id")
  1114. doctor_info, _ := GetAdminUserInfoByID(org_id, item.DoctorId)
  1115. feedetailInfo := make(map[string]interface{})
  1116. feedetailInfo["feedetl_sn"] = item.FeedetlSn
  1117. feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1118. feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1119. feedetailInfo["med_type"] = med_type
  1120. feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间
  1121. feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
  1122. feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码
  1123. feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
  1124. feedetailInfo["cnt"] = item.Cut // 数量
  1125. feedetailInfo["pric"] = item.Price // 单价
  1126. feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
  1127. feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
  1128. feedetailInfo["bilg_dr_codg"] = doctor_info.DoctorNumber // 开单医生编码
  1129. feedetailInfo["bilg_dr_name"] = doctor_info.UserName
  1130. feedetailInfo["acord_dept_codg"] = dept_code // 受单科室编码
  1131. feedetailInfo["acord_dept_name"] = dept // 受单科室名称
  1132. feedetailInfo["orders_dr_code"] = doctor_info.DoctorNumber // 受单医生编码
  1133. feedetailInfo["orders_dr_name"] = doctor_info.UserName // 受单医生姓名
  1134. feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
  1135. feedetailInfo["dise_codg"] = "" // 病种编码
  1136. feedetailInfo["rxno"] = "" // 处方号
  1137. feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
  1138. feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
  1139. feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
  1140. feedetailInfo["prd_days"] = "0" // 周期天数
  1141. feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
  1142. // 开单医师姓名
  1143. if item.HospApprFlag != -1 {
  1144. if item.HospApprFlag == 1 {
  1145. feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
  1146. } else if item.HospApprFlag == 2 {
  1147. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  1148. } else if item.HospApprFlag == 3 {
  1149. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  1150. } else {
  1151. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  1152. }
  1153. } else {
  1154. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  1155. }
  1156. //feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
  1157. feedetailInfo["etip_flag"] = "" // 外检标志
  1158. feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
  1159. feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
  1160. feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
  1161. feedetail = append(feedetail, feedetailInfo)
  1162. }
  1163. input["feedetail"] = feedetail
  1164. inputMessage["input"] = input //交易输入
  1165. bytesData, err := json.Marshal(inputMessage)
  1166. fmt.Println(string(bytesData))
  1167. requestLog := string(bytesData)
  1168. if err != nil {
  1169. fmt.Println(err.Error())
  1170. return err.Error(), ""
  1171. }
  1172. request_url = request_url + "2301"
  1173. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2301"), requestLog
  1174. }
  1175. 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) {
  1176. // 生成签名
  1177. nonce := GetRandomString(32)
  1178. timestamp := time.Now().Unix()
  1179. // 生成输入报文
  1180. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1181. input := make(map[string]interface{})
  1182. inputData := make(map[string]interface{})
  1183. inputMessage["infno"] = "2302" // 交易编码
  1184. if refund_type == 1 {
  1185. inputData["feedetl_sn"] = number //
  1186. } else {
  1187. inputData["feedetl_sn"] = "0000" //
  1188. }
  1189. inputData["mdtrt_id"] = mdtrtId // 就诊 ID
  1190. inputData["psn_no"] = psnNo // 人员编号
  1191. input["data"] = inputData
  1192. inputMessage["input"] = input //交易输入
  1193. bytesData, err := json.Marshal(inputMessage)
  1194. fmt.Println(string(bytesData))
  1195. requestLog := string(bytesData)
  1196. if err != nil {
  1197. fmt.Println(err.Error())
  1198. return err.Error(), ""
  1199. }
  1200. request_url = request_url + "2302"
  1201. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2302"), requestLog
  1202. }
  1203. 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) {
  1204. // 生成签名
  1205. nonce := GetRandomString(32)
  1206. timestamp := time.Now().Unix()
  1207. // 生成输入报文
  1208. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1209. input := make(map[string]interface{})
  1210. inputData := make(map[string]interface{})
  1211. inputMessage["infno"] = "2303" // 交易编码
  1212. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1213. if certificates == 3 {
  1214. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1215. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1216. } else {
  1217. if id_card_type == 1 {
  1218. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1219. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1220. } else {
  1221. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1222. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1223. }
  1224. }
  1225. inputData["mdtrt_cert_sn"] = ""
  1226. inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
  1227. inputData["medfee_sumamt"] = total // 医疗费总额
  1228. inputData["psn_setlway"] = "02" // 个人结算方式 01 按项目结 02 按定额结算
  1229. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1230. inputData["acct_used_flag"] = "1" // 个人账户使用标志 0否 1是
  1231. inputData["insutype"] = insutype // 险种类型
  1232. inputData["invono"] = "" // 发票号
  1233. inputData["dise_codg"] = "M07803" // 发票号
  1234. inputData["insuplc_admdvs"] = insuplc_admdvs // 发票号
  1235. inputData["mdtrtarea_admvs"] = mdtrtarea_admvs // 发票号
  1236. input["data"] = inputData
  1237. inputMessage["input"] = input //交易输入
  1238. bytesData, err := json.Marshal(inputMessage)
  1239. fmt.Println(string(bytesData))
  1240. requestLog := string(bytesData)
  1241. if err != nil {
  1242. fmt.Println(err.Error())
  1243. return err.Error(), ""
  1244. }
  1245. request_url = request_url + "2303"
  1246. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2303"), requestLog
  1247. }
  1248. 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) {
  1249. // 生成签名
  1250. nonce := GetRandomString(32)
  1251. timestamp := time.Now().Unix()
  1252. // 生成输入报文
  1253. inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
  1254. input := make(map[string]interface{})
  1255. inputData := make(map[string]interface{})
  1256. inputMessage["infno"] = "2304" // 交易编码
  1257. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1258. if certificates == 3 {
  1259. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  1260. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1261. } else {
  1262. if id_card_type == 1 {
  1263. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  1264. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1265. } else if id_card_type == 4 {
  1266. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  1267. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1268. } else {
  1269. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  1270. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  1271. }
  1272. }
  1273. inputData["insuplc_admdvs"] = insuplc_admdvs
  1274. inputData["mdtrtarea_admvs"] = mdtrtarea_admvs
  1275. inputData["mdtrt_cert_sn"] = ""
  1276. inputData["mid_setl_flag"] = mid_setl_flag // 中途退费标志
  1277. inputData["medfee_sumamt"] = total // 医疗费总额
  1278. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  1279. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1280. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  1281. inputData["insutype"] = insutype // 险种类型
  1282. input["data"] = inputData
  1283. inputMessage["input"] = input //交易输入
  1284. bytesData, err := json.Marshal(inputMessage)
  1285. fmt.Println(string(bytesData))
  1286. requestLog := string(bytesData)
  1287. if err != nil {
  1288. fmt.Println(err.Error())
  1289. return err.Error(), ""
  1290. }
  1291. request_url = request_url + "2304"
  1292. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2304"), requestLog
  1293. }
  1294. 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) {
  1295. // 生成签名
  1296. timestamp := time.Now().Unix()
  1297. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1298. input := make(map[string]interface{})
  1299. inputData := make(map[string]interface{})
  1300. inputMessage["infno"] = "2305" // 交易编码
  1301. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1302. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  1303. inputData["setl_id"] = setlId // 结算 ID
  1304. input["data"] = inputData
  1305. inputMessage["input"] = input //交易输入
  1306. bytesData, err := json.Marshal(inputMessage)
  1307. fmt.Println(string(bytesData))
  1308. requestLog := string(bytesData)
  1309. if err != nil {
  1310. fmt.Println(err.Error())
  1311. return err.Error(), ""
  1312. }
  1313. request_url = request_url + "2305"
  1314. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2305"), requestLog
  1315. }
  1316. //CBS总线
  1317. func JXHttpRequest(url string, ak string, sk string, timestamp int64, json string, infno string) string {
  1318. fmt.Println(url)
  1319. //step 1. 设置请求参数
  1320. csbHP := csbhttp.NewHttpParams(url) //设置请求地址及url参数
  1321. //设置调用方式 get 或者 post
  1322. csbHP.SetMethod("post")
  1323. //设置 调用的服务名和版本
  1324. csbHP.SetApi("hsa-fsi-" + infno)
  1325. csbHP.SetVersion("1.0.0")
  1326. //添加附加的http请求头 (可以定义多条)
  1327. //key := "_api_access_key=" + ak + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
  1328. csbHP.AddHeader("_api_timestamp", strconv.FormatInt(timestamp, 10))
  1329. csbHP.AddHeader("_api_name", "hsa-fsi-"+infno)
  1330. csbHP.AddHeader("_api_version", "1.0.0")
  1331. csbHP.AddHeader("_api_access_key", ak)
  1332. csbHP.AddHeader("Content-Type", "application/json;charset=UTF-8")
  1333. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1334. //还可以,设置附加的byte[]或者json请求体
  1335. csbHP.SetContentBody(json, nil)
  1336. //设置请求的ak和sk
  1337. csbHP.SetAK(ak)
  1338. csbHP.SetSK(sk)
  1339. //打印请求参数信息
  1340. csbHP.Print()
  1341. //进行调用, 返回的第二项为resonse http headers (map[string][]string类型)
  1342. //res, _, err := csbhttp.Invoke(*csbHP, requestByte)
  1343. res, _, err := csbhttp.Invoke(*csbHP, strconv.FormatInt(timestamp, 10))
  1344. fmt.Println("err:")
  1345. fmt.Println(err)
  1346. //是否发成错误
  1347. if err != nil {
  1348. fmt.Println(err)
  1349. return ""
  1350. }
  1351. fmt.Println(res)
  1352. return res
  1353. }
  1354. // 生成基础报文
  1355. func SetJXInputMessage(timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, cainfo string) map[string]interface{} {
  1356. // 生成签名
  1357. tempTime := time.Unix(timestamp, 0)
  1358. //timeFormat := tempTime.Format("20060102150405")
  1359. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1360. //randNum := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000)
  1361. month := time.Unix(1557042972, 0).Format("1")
  1362. year := time.Now().Format("2006")
  1363. month = time.Now().Format("01")
  1364. day := time.Now().Format("02")
  1365. hour := time.Now().Format("15")
  1366. min := time.Now().Format("04")
  1367. sec := time.Now().Format("05")
  1368. msec := time.Now().Format("000")
  1369. // 生成输入报文
  1370. inputMessage := make(map[string]interface{})
  1371. inputMessage["msgid"] = fixmedins_code + year + month + day + hour + min + sec + msec + "0" // 发送方报文 ID
  1372. inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs // 就医地医保区划
  1373. inputMessage["insuplc_admdvs"] = insuplc_admdvs // 参保地医保区划
  1374. inputMessage["recer_sys_code"] = "1" // 接收方系统代码
  1375. inputMessage["dev_no"] = "1" // 设备编号
  1376. inputMessage["dev_safe_info"] = "1" // 设备安全信息
  1377. inputMessage["cainfo"] = cainfo // 数字签名信息
  1378. inputMessage["signtype"] = "SM3" // 签名类型
  1379. inputMessage["infver"] = "V1.0" // 接收方系统代码
  1380. inputMessage["opter_type"] = "1" // 经办人类别
  1381. if fixmedins_code == "H32090403023" {
  1382. inputMessage["opter"] = "晁海燕" // 经办人
  1383. inputMessage["opter_name"] = "晁海燕" // 经办人姓名
  1384. } else {
  1385. inputMessage["opter"] = doctor // 经办人
  1386. inputMessage["opter_name"] = doctor // 经办人姓名
  1387. }
  1388. inputMessage["inf_time"] = timeFormatOne // 交易时间
  1389. inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
  1390. inputMessage["fixmedins_name"] = org_name
  1391. inputMessage["fixmedins_soft_fcty"] = "深圳市领透科技有限公司" //定点医药机构名称
  1392. //定点医药机构名称
  1393. inputMessage["sign_no"] = "" //交易签到流水号
  1394. return inputMessage
  1395. }
  1396. 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) {
  1397. // 生成签名
  1398. //nonce := GetRandomString(32)
  1399. timestamp := time.Now().Unix()
  1400. //signature := setSignature(timestamp, nonce, secret_key)
  1401. //tempTime := time.Unix(timestamp, 0)
  1402. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  1403. //timeFormatTwo := tempTime.Format("2006-01-02")
  1404. // 生成输入报文
  1405. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1406. input := make(map[string]interface{})
  1407. inputData := make(map[string]interface{})
  1408. inputMessage["infno"] = "5301" // 交易编码
  1409. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1410. input["data"] = inputData
  1411. inputMessage["input"] = input //交易输入
  1412. bytesData, err := json.Marshal(inputMessage)
  1413. fmt.Println(string(bytesData))
  1414. if err != nil {
  1415. fmt.Println(err.Error())
  1416. return err.Error(), ""
  1417. }
  1418. request_url = request_url + "5301"
  1419. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "5301"), string(bytesData)
  1420. }
  1421. 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) {
  1422. timestamp := time.Now().Unix()
  1423. // 生成输入报文
  1424. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1425. input := make(map[string]interface{})
  1426. inputData := make(map[string]interface{})
  1427. inputMessage["infno"] = "2503" // 交易编码
  1428. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  1429. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  1430. inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
  1431. inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
  1432. inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
  1433. inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
  1434. inputData["ide_fixmedins_name"] = org_name // 险种类型(来自1101接口返回)
  1435. inputData["hosp_ide_date"] = check_time // 险种类型(来自1101接口返回)
  1436. inputData["diag_dr_codg"] = doctor_id // 开始时间
  1437. inputData["diag_dr_name"] = doctor // 开始时间
  1438. inputData["begndate"] = start_time // 医师编码
  1439. inputData["tel"] = "" // 医师编码
  1440. inputData["addr"] = "" // 医师编码
  1441. inputData["enddate"] = end_time // 医师编码
  1442. input["data"] = inputData
  1443. inputMessage["input"] = input //交易输入
  1444. bytesData, err := json.Marshal(inputMessage)
  1445. fmt.Println(string(bytesData))
  1446. if err != nil {
  1447. fmt.Println(err.Error())
  1448. return err.Error(), ""
  1449. }
  1450. request_url = request_url + "2503"
  1451. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "2503"), string(bytesData)
  1452. }
  1453. 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) {
  1454. // 生成签名
  1455. timestamp := time.Now().Unix()
  1456. // 生成输入报文
  1457. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1458. input := make(map[string]interface{})
  1459. inputData := make(map[string]interface{})
  1460. inputMessage["infno"] = "3201" // 交易编码
  1461. inputData["insutype"] = insutype // 险种
  1462. inputData["clr_type"] = clr_type // 就诊 ID(来自2201接口返回)
  1463. inputData["setl_optins"] = setl_optins // 结算经办机构
  1464. inputData["stmt_begndate"] = stmt_begndate // 对帐开始时间
  1465. inputData["stmt_enddate"] = stmt_enddate //对帐结束时间
  1466. inputData["medfee_sumamt"] = medfee_sumamt //医疗费总额
  1467. inputData["fund_pay_sumamt"] = fund_pay_sumamt //基金支付总额
  1468. inputData["acct_pay"] = acct_pay //个人账户支付金额
  1469. inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
  1470. inputData["refd_setl_flag"] = 0 //
  1471. input["data"] = inputData
  1472. inputMessage["input"] = input //交易输入
  1473. bytesData, err := json.Marshal(inputMessage)
  1474. fmt.Println(string(bytesData))
  1475. if err != nil {
  1476. fmt.Println(err.Error())
  1477. return err.Error(), ""
  1478. }
  1479. request_url = request_url + "3201"
  1480. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "3201"), string(bytesData)
  1481. }
  1482. 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) {
  1483. // 生成签名
  1484. timestamp := time.Now().Unix()
  1485. // 生成输入报文
  1486. inputMessage := SetJXInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1487. input := make(map[string]interface{})
  1488. inputData := make(map[string]interface{})
  1489. inputMessage["infno"] = "9001" // 交易编码
  1490. inputData["opter_no"] = admin_user_id
  1491. inputData["mac"] = GetMacTwo() // 开始时间
  1492. inputData["ip"] = GetLocalIpTwo()
  1493. input["signIn"] = inputData
  1494. inputMessage["input"] = input //交易输入
  1495. bytesData, err := json.Marshal(inputMessage)
  1496. fmt.Println(string(bytesData))
  1497. if err != nil {
  1498. fmt.Println(err.Error())
  1499. return err.Error(), ""
  1500. }
  1501. //reader := bytes.NewReader(bytesData)
  1502. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
  1503. //gdyb_url := beego.AppConfig.String("gdyb_url")
  1504. //gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1505. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1506. //url := gdyb_url
  1507. //request, err := http.NewRequest("POST", request_url+"9001", reader)
  1508. //if err != nil {
  1509. // fmt.Println(err.Error())
  1510. // return err.Error(), ""
  1511. //}
  1512. //
  1513. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1514. //request.Header.Set("_api_timestamp", strconv.FormatInt(timestamp, 10))
  1515. //request.Header.Set("_api_name", "hssServives")
  1516. //request.Header.Set("_api_version", "1.0.0")
  1517. //request.Header.Set("_api_access_key", access_key)
  1518. //request.Header.Set("_api_signature", "")
  1519. //
  1520. //client := http.Client{}
  1521. //resp, err := client.Do(request)
  1522. //if err != nil {
  1523. // fmt.Println(err.Error())
  1524. // return err.Error(), ""
  1525. //}
  1526. //respBytes, err := ioutil.ReadAll(resp.Body)
  1527. //if err != nil {
  1528. // fmt.Println(err.Error())
  1529. // return err.Error(), ""
  1530. //}
  1531. //str := string(respBytes)
  1532. //fmt.Println(str)
  1533. //return str, ""
  1534. request_url = request_url + "9001"
  1535. return JXHttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData), "9001"), string(bytesData)
  1536. }
  1537. 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) {
  1538. // 生成签名
  1539. timestamp := time.Now().Unix()
  1540. // 生成输入报文
  1541. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1542. input := make(map[string]interface{})
  1543. inputData := make(map[string]interface{})
  1544. patientDtosinputData := make(map[string]interface{})
  1545. fisEncounterDtosData := make(map[string]interface{})
  1546. fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
  1547. fsiOrderDtosDatas := make([]map[string]interface{}, 0)
  1548. fsiOperationDtosData := make(map[string]interface{})
  1549. fsiOperationDtosDatas := make([]map[string]interface{}, 0)
  1550. //就诊信息
  1551. fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
  1552. fisEncounterDtosData["medins_id"] = fed.MedinsID
  1553. fisEncounterDtosData["medins_name"] = fed.MedinsName
  1554. fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
  1555. fisEncounterDtosData["medins_type"] = fed.MedinsType
  1556. fisEncounterDtosData["medins_lv"] = fed.MedinsLv
  1557. fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
  1558. fisEncounterDtosData["wardno"] = fed.Wardno
  1559. fisEncounterDtosData["bedno"] = fed.Bedno
  1560. fisEncounterDtosData["adm_date"] = fed.AdmDate
  1561. fisEncounterDtosData["dscg_date"] = fed.DscgDate
  1562. fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
  1563. fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
  1564. for _, fdd := range fdds {
  1565. fsiDiagnoseDtosData := make(map[string]interface{})
  1566. //诊断集合
  1567. fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
  1568. fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
  1569. fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
  1570. fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
  1571. fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
  1572. fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
  1573. fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
  1574. fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
  1575. }
  1576. fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
  1577. fisEncounterDtosData["dr_codg"] = fed.DrCodg
  1578. fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
  1579. fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
  1580. fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
  1581. fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
  1582. fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
  1583. fisEncounterDtosData["med_type"] = fed.MedType
  1584. for _, fod := range fods {
  1585. fsiOrderDtosData := make(map[string]interface{})
  1586. //医嘱集合
  1587. fsiOrderDtosData["rx_id"] = fod.RxID
  1588. fsiOrderDtosData["rxno"] = fod.Rxno
  1589. fsiOrderDtosData["grpno"] = fod.Grpno
  1590. fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
  1591. fsiOrderDtosData["hilist_type"] = fod.HilistType
  1592. fsiOrderDtosData["chrg_type"] = fod.ChrgType
  1593. fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
  1594. fsiOrderDtosData["hilist_code"] = fod.HilistCode
  1595. fsiOrderDtosData["hilist_name"] = fod.HilistName
  1596. fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
  1597. fsiOrderDtosData["hilist_lv"] = fod.HilistLv
  1598. fsiOrderDtosData["hilist_pric"] = fod.HilistPric
  1599. fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
  1600. fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
  1601. fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
  1602. fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
  1603. fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
  1604. fsiOrderDtosData["hosplist_name"] = fod.HosplistName
  1605. fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
  1606. fsiOrderDtosData["cnt"] = fod.Cnt
  1607. fsiOrderDtosData["pric"] = fod.Pric
  1608. fsiOrderDtosData["sumamt"] = fod.Sumamt
  1609. fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
  1610. fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
  1611. fsiOrderDtosData["spec"] = fod.Spec
  1612. fsiOrderDtosData["spec_unt"] = fod.SpecUnt
  1613. fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
  1614. fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
  1615. fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
  1616. fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
  1617. fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
  1618. fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
  1619. fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
  1620. fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
  1621. fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
  1622. }
  1623. fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
  1624. fisEncounterDtosData["matn_stas"] = fed.MatnStas
  1625. fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
  1626. fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
  1627. fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
  1628. fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
  1629. fisEncounterDtosData["ma_amt"] = fed.MaAmt
  1630. fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
  1631. fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
  1632. fisEncounterDtosData["insutype"] = fed.Insutype
  1633. fisEncounterDtosData["reim_flag"] = fed.ReimFlag
  1634. fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
  1635. //手术操作
  1636. for _, fopd := range fopds {
  1637. fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
  1638. fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
  1639. fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
  1640. fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
  1641. fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
  1642. fsiOperationDtosData["anst_way"] = fopd.Anst_way
  1643. fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
  1644. fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
  1645. fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
  1646. fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
  1647. fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
  1648. }
  1649. fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
  1650. patientDtosinputData["patn_id"] = pd.PatnID
  1651. patientDtosinputData["patn_name"] = pd.PatnName
  1652. patientDtosinputData["gend"] = pd.Gend
  1653. patientDtosinputData["brdy"] = pd.Brdy
  1654. patientDtosinputData["poolarea"] = pd.Poolarea
  1655. patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
  1656. patientDtosinputData["fsi_his_data_dto"] = ""
  1657. patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
  1658. inputData["syscode"] = "LinkDialysis"
  1659. inputData["trig_scen"] = trig_scen
  1660. inputData["rule_ids"] = ""
  1661. inputData["task_id"] = ""
  1662. inputData["patient_dtos"] = patientDtosinputData
  1663. input["data"] = inputData
  1664. inputMessage["infno"] = "3101"
  1665. inputMessage["input"] = input //交易输入
  1666. bytesData, err := json.Marshal(inputMessage)
  1667. fmt.Println(string(bytesData))
  1668. if err != nil {
  1669. fmt.Println(err.Error())
  1670. return err.Error(), ""
  1671. }
  1672. params.RequestUrl = params.RequestUrl + "3101"
  1673. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "3101"), string(bytesData)
  1674. }
  1675. 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) {
  1676. // 生成签名
  1677. timestamp := time.Now().Unix()
  1678. // 生成输入报文
  1679. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1680. input := make(map[string]interface{})
  1681. inputData := make(map[string]interface{})
  1682. patientDtosinputData := make(map[string]interface{})
  1683. fisEncounterDtosData := make(map[string]interface{})
  1684. fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
  1685. fsiOrderDtosDatas := make([]map[string]interface{}, 0)
  1686. fsiOperationDtosData := make(map[string]interface{})
  1687. fsiOperationDtosDatas := make([]map[string]interface{}, 0)
  1688. //就诊信息
  1689. fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
  1690. fisEncounterDtosData["medins_id"] = fed.MedinsID
  1691. fisEncounterDtosData["medins_name"] = fed.MedinsName
  1692. fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
  1693. fisEncounterDtosData["medins_type"] = fed.MedinsType
  1694. fisEncounterDtosData["medins_lv"] = fed.MedinsLv
  1695. fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
  1696. fisEncounterDtosData["wardno"] = fed.Wardno
  1697. fisEncounterDtosData["bedno"] = fed.Bedno
  1698. fisEncounterDtosData["adm_date"] = fed.AdmDate
  1699. fisEncounterDtosData["dscg_date"] = fed.DscgDate
  1700. fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
  1701. fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
  1702. for _, fdd := range fdds {
  1703. fsiDiagnoseDtosData := make(map[string]interface{})
  1704. //诊断集合
  1705. fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
  1706. fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
  1707. fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
  1708. fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
  1709. fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
  1710. fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
  1711. fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
  1712. fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
  1713. }
  1714. fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
  1715. fisEncounterDtosData["dr_codg"] = fed.DrCodg
  1716. fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
  1717. fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
  1718. fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
  1719. fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
  1720. fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
  1721. fisEncounterDtosData["med_type"] = fed.MedType
  1722. for _, fod := range fods {
  1723. fsiOrderDtosData := make(map[string]interface{})
  1724. //医嘱集合
  1725. fsiOrderDtosData["rx_id"] = fod.RxID
  1726. fsiOrderDtosData["rxno"] = fod.Rxno
  1727. fsiOrderDtosData["grpno"] = fod.Grpno
  1728. fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
  1729. fsiOrderDtosData["hilist_type"] = fod.HilistType
  1730. fsiOrderDtosData["chrg_type"] = fod.ChrgType
  1731. fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
  1732. fsiOrderDtosData["hilist_code"] = fod.HilistCode
  1733. fsiOrderDtosData["hilist_name"] = fod.HilistName
  1734. fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
  1735. fsiOrderDtosData["hilist_lv"] = fod.HilistLv
  1736. fsiOrderDtosData["hilist_pric"] = fod.HilistPric
  1737. fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
  1738. fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
  1739. fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
  1740. fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
  1741. fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
  1742. fsiOrderDtosData["hosplist_name"] = fod.HosplistName
  1743. fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
  1744. fsiOrderDtosData["cnt"] = fod.Cnt
  1745. fsiOrderDtosData["pric"] = fod.Pric
  1746. fsiOrderDtosData["sumamt"] = fod.Sumamt
  1747. fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
  1748. fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
  1749. fsiOrderDtosData["spec"] = fod.Spec
  1750. fsiOrderDtosData["spec_unt"] = fod.SpecUnt
  1751. fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
  1752. fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
  1753. fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
  1754. fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
  1755. fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
  1756. fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
  1757. fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
  1758. fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
  1759. fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
  1760. }
  1761. fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
  1762. fisEncounterDtosData["matn_stas"] = fed.MatnStas
  1763. fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
  1764. fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
  1765. fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
  1766. fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
  1767. fisEncounterDtosData["ma_amt"] = fed.MaAmt
  1768. fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
  1769. fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
  1770. fisEncounterDtosData["insutype"] = fed.Insutype
  1771. fisEncounterDtosData["reim_flag"] = fed.ReimFlag
  1772. fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
  1773. //手术操作
  1774. for _, fopd := range fopds {
  1775. fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
  1776. fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
  1777. fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
  1778. fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
  1779. fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
  1780. fsiOperationDtosData["anst_way"] = fopd.Anst_way
  1781. fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
  1782. fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
  1783. fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
  1784. fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
  1785. fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
  1786. }
  1787. fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
  1788. patientDtosinputData["patn_id"] = pd.PatnID
  1789. patientDtosinputData["patn_name"] = pd.PatnName
  1790. patientDtosinputData["gend"] = pd.Gend
  1791. patientDtosinputData["brdy"] = pd.Brdy
  1792. patientDtosinputData["poolarea"] = pd.Poolarea
  1793. patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
  1794. patientDtosinputData["fsi_his_data_dto"] = ""
  1795. patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
  1796. inputData["syscode"] = "LinkDialysis"
  1797. inputData["trig_scen"] = trig_scen
  1798. inputData["rule_ids"] = ""
  1799. inputData["task_id"] = ""
  1800. inputData["patient_dtos"] = patientDtosinputData
  1801. input["data"] = inputData
  1802. inputMessage["infno"] = "3102"
  1803. inputMessage["input"] = input //交易输入
  1804. bytesData, err := json.Marshal(inputMessage)
  1805. fmt.Println(string(bytesData))
  1806. if err != nil {
  1807. fmt.Println(err.Error())
  1808. return err.Error(), ""
  1809. }
  1810. params.RequestUrl = params.RequestUrl + "3102"
  1811. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "3102"), string(bytesData)
  1812. }
  1813. func Jxyb4101(struct4101 Struct4101, params models.PublicParams) (string, string) {
  1814. timestamp := time.Now().Unix()
  1815. inputMessage := SetJXInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1816. // 生成输入报文
  1817. input := make(map[string]interface{})
  1818. inputData := make(map[string]interface{})
  1819. inputMessage["infno"] = "4101A" // 交易编码
  1820. year := time.Now().Format("2006")
  1821. month := time.Now().Format("01")
  1822. day := time.Now().Format("02")
  1823. inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
  1824. inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
  1825. inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
  1826. inputData["fixmedins_name"] = params.FixmedinsName // 定点医药机构名称 必填
  1827. inputData["fixmedins_code"] = params.FixmedinsCode // 定点医药机构编码 必填
  1828. inputData["hi_setl_lv"] = "" // 医保结算等级
  1829. inputData["hi_no"] = struct4101.PsnNo // 医保编号
  1830. inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
  1831. inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
  1832. inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
  1833. inputData["gend"] = struct4101.Gend // 性别 必填
  1834. inputData["brdy"] = struct4101.Brdy // 出生日期 必填
  1835. inputData["age"] = struct4101.Age // 年龄 必填
  1836. inputData["ntly"] = struct4101.Ntly // 国籍 必填
  1837. inputData["nwb_age"] = "" // 年龄 必填
  1838. inputData["naty"] = struct4101.Naty // 民族 必填
  1839. inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
  1840. inputData["certno"] = struct4101.Certno // 证件号码 必填
  1841. inputData["prfs"] = struct4101.Prfs // 职业 必填
  1842. inputData["curr_addr"] = "" // 现住址 必填
  1843. inputData["emp_name"] = "" // 单位名称 必填
  1844. inputData["emp_addr"] = "" // 单位地址 必填
  1845. inputData["emp_tel"] = "" // 单位电话 必填
  1846. inputData["poscode"] = "" // 邮编 必填
  1847. inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
  1848. inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
  1849. inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
  1850. inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
  1851. inputData["hi_type"] = struct4101.HiType // 医保类型 必填
  1852. inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
  1853. inputData["sp_psn_type"] = "" // 特殊人员类型 必填
  1854. inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
  1855. inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
  1856. inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
  1857. inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
  1858. inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
  1859. inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
  1860. inputData["adm_way"] = "" // 入院途径 必填
  1861. inputData["trt_type"] = "" // 治疗类别 必填
  1862. inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
  1863. inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
  1864. inputData["refldept_dept"] = "" // 转科科别 必填
  1865. inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
  1866. inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
  1867. inputData["act_ipt_days"] = "" // 实际住院天数 必填
  1868. inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
  1869. inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
  1870. inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
  1871. inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
  1872. inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
  1873. inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
  1874. inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
  1875. inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
  1876. inputData["bld_cat"] = "" // 输血品种 必填
  1877. inputData["bld_amt"] = "" // 输血量 必填
  1878. inputData["bld_unt"] = "" // 输血计量单位 必填
  1879. inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
  1880. inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
  1881. inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
  1882. inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
  1883. inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
  1884. inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
  1885. inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
  1886. inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
  1887. inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
  1888. inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
  1889. inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
  1890. inputData["chfpdr_name"] = "" // 主诊医师姓名 必填
  1891. inputData["chfpdr_code"] = "" // 主诊医师代码 必填
  1892. inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
  1893. inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
  1894. inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
  1895. inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
  1896. inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
  1897. inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
  1898. inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
  1899. inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
  1900. inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
  1901. inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
  1902. inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
  1903. payinfo := make([]map[string]interface{}, 0) // 基金支付信息
  1904. for _, item := range struct4101.CustomStruct {
  1905. payinfotemp := make(map[string]interface{})
  1906. 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" {
  1907. payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
  1908. payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
  1909. payinfo = append(payinfo, payinfotemp)
  1910. }
  1911. }
  1912. opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
  1913. opspdiseinfotemp := make(map[string]interface{})
  1914. opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 诊断名称 必填
  1915. opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 诊断代码 必填
  1916. opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
  1917. opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
  1918. opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
  1919. diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
  1920. for _, item := range struct4101.Diseinfo {
  1921. diseinfotemp := make(map[string]interface{})
  1922. diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
  1923. diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
  1924. diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
  1925. diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
  1926. diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
  1927. diseinfo = append(diseinfo, diseinfotemp)
  1928. }
  1929. iteminfo := make([]map[string]interface{}, 0)
  1930. for _, item := range struct4101.IteminfoStruct {
  1931. iteminfotemp := make(map[string]interface{})
  1932. iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
  1933. iteminfotemp["amt"] = item.Amt // 金额 必填
  1934. iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
  1935. iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
  1936. iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
  1937. iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
  1938. iteminfo = append(iteminfo, iteminfotemp)
  1939. }
  1940. oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
  1941. oprninfotemp := make(map[string]interface{})
  1942. oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
  1943. oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
  1944. oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
  1945. oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
  1946. oprninfotemp["anst_way"] = "" // 麻醉方式 必填
  1947. oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
  1948. oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
  1949. oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
  1950. oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
  1951. oprninfo = append(oprninfo, oprninfotemp)
  1952. icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
  1953. icuinfotemp := make(map[string]interface{})
  1954. icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
  1955. icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
  1956. icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
  1957. icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
  1958. icuinfo = append(icuinfo, icuinfotemp)
  1959. input["setlinfo"] = inputData
  1960. input["payinfo"] = payinfo
  1961. input["opspdiseinfo"] = opspdiseinfo
  1962. input["diseinfo"] = diseinfo
  1963. input["iteminfo"] = iteminfo
  1964. inputMessage["input"] = input //交易输入
  1965. bytesData, _ := json.Marshal(inputMessage)
  1966. fmt.Println(string(bytesData))
  1967. params.RequestUrl = params.RequestUrl + "4101"
  1968. return JXHttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData), "4101"), string(bytesData)
  1969. }
  1970. func Jxyb3501(struct3501 models.Struct3501) (string, string) {
  1971. timestamp := time.Now().Unix()
  1972. // 生成输入报文
  1973. inputMessage := SetJXInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsCode, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
  1974. input := make(map[string]interface{})
  1975. inputData := make(map[string]interface{})
  1976. inputMessage["infno"] = "3501" // 交易编码
  1977. inputData["med_list_codg"] = struct3501.MedListCodg // 定点医药机构目录编号
  1978. inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
  1979. inputData["fixmedins_hilist_name"] = struct3501.OrgName // 定点医药机构目录名称
  1980. inputData["rx_flag"] = struct3501.RxFlag //
  1981. inputData["invdate"] = struct3501.Invdate // 人员编号 (来自1101接口返回)
  1982. inputData["inv_cnt"] = struct3501.InvCnt // 人员编号 (来自1101接口返回)
  1983. inputData["manu_lotnum"] = struct3501.ManuLotnum // 人员编号 (来自1101接口返回)
  1984. inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1985. inputData["manu_date"] = struct3501.ManuDate // 人员编号 (来自1101接口返回)
  1986. inputData["expy_end"] = struct3501.ExpyEnd // 人员编号 (来自1101接口返回)
  1987. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  1988. input["invinfo"] = inputData
  1989. inputMessage["input"] = input //交易输入
  1990. bytesData, err := json.Marshal(inputMessage)
  1991. fmt.Println(string(bytesData))
  1992. if err != nil {
  1993. fmt.Println(err.Error())
  1994. return err.Error(), ""
  1995. }
  1996. struct3501.RequestUrl = struct3501.RequestUrl + "3501"
  1997. return JXHttpRequest(struct3501.RequestUrl, struct3501.AccessKey, struct3501.SecretKey, timestamp, string(bytesData), "3501"), string(bytesData)
  1998. }
  1999. func Jxyb3502(struct3502 models.Struct3502) (string, string) {
  2000. timestamp := time.Now().Unix()
  2001. // 生成输入报文
  2002. inputMessage := SetJXInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
  2003. input := make(map[string]interface{})
  2004. inputData := make(map[string]interface{})
  2005. inputMessage["infno"] = "3502" // 交易编码
  2006. inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
  2007. inputData["inv_chg_type"] = struct3502.InvChgType // 定点医药机构目录编号
  2008. inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
  2009. inputData["fixmedins_hilist_name"] = struct3502.OrgName // 定点医药机构目录名称
  2010. inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2011. inputData["pric"] = struct3502.Pric // 人员编号 (来自1101接口返回)
  2012. inputData["cnt"] = struct3502.Cnt // 人员编号 (来自1101接口返回)
  2013. inputData["rx_flag"] = struct3502.RxFlag //
  2014. inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
  2015. inputData["inv_chg_opter_name"] = "" // 人员编号 (来自1101接口返回)
  2016. inputData["memo"] = struct3502.Memo // 人员编号 (来自1101接口返回)
  2017. inputData["trdn_flag"] = "" // 人员编号 (来自1101接口返回)
  2018. input["invinfo"] = inputData
  2019. inputMessage["input"] = input //交易输入
  2020. bytesData, err := json.Marshal(inputMessage)
  2021. fmt.Println(string(bytesData))
  2022. if err != nil {
  2023. fmt.Println(err.Error())
  2024. return err.Error(), ""
  2025. }
  2026. struct3502.RequestUrl = struct3502.RequestUrl + "3502"
  2027. return JXHttpRequest(struct3502.RequestUrl, struct3502.AccessKey, struct3502.SecretKey, timestamp, string(bytesData), "3502"), string(bytesData)
  2028. }
  2029. func Jxyb3503(struct3503 models.Struct3503) (string, string) {
  2030. timestamp := time.Now().Unix()
  2031. // 生成输入报文
  2032. inputMessage := SetJXInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsCode, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
  2033. input := make(map[string]interface{})
  2034. inputData := make(map[string]interface{})
  2035. inputMessage["infno"] = "3503"
  2036. inputData["med_list_codg"] = struct3503.MedListCodg
  2037. inputData["fixmedins_hilist_id"] = struct3503.FixmedinsCode
  2038. inputData["fixmedins_hilist_name"] = struct3503.OrgName
  2039. inputData["dynt_no"] = ""
  2040. inputData["fixmedins_bchno"] = struct3503.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2041. inputData["spler_name"] = struct3503.SplerName // 人员编号 (来自1101接口返回)
  2042. inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
  2043. inputData["manu_lotnum"] = struct3503.ManuLotnum // 人员编号 (来自1101接口返回)
  2044. inputData["prodentp_name"] = struct3503.ProdentpName // 人员编号 (来自1101接口返回)
  2045. inputData["aprvno"] = struct3503.Aprvno // 人员编号 (来自1101接口返回)
  2046. inputData["manu_date"] = struct3503.ManuDate // 人员编号 (来自1101接口返回)
  2047. inputData["expy_end"] = struct3503.ExpyEnd // 人员编号 (来自1101接口返回)
  2048. inputData["finl_trns_pric"] = struct3503.FinlTrnsPric // 人员编号 (来自1101接口返回)
  2049. inputData["purc_retn_cnt"] = struct3503.PurcRetnCnt // 人员编号 (来自1101接口返回)
  2050. inputData["purc_invo_codg"] = struct3503.PurcInvoCodg // 人员编号 (来自1101接口返回)
  2051. inputData["purc_invo_no"] = struct3503.PurcInvoNo // 人员编号 (来自1101接口返回)
  2052. inputData["rx_flag"] = struct3503.RxFlag // 人员编号 (来自1101接口返回)
  2053. inputData["purc_retn_stoin_time"] = struct3503.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
  2054. inputData["purc_retn_opter_name"] = struct3503.PurcRetnOpterName // 人员编号 (来自1101接口返回)
  2055. inputData["prod_geay_flag"] = "" // 人员编号 (来自1101接口返回)
  2056. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  2057. input["purcinfo"] = inputData
  2058. inputMessage["input"] = input //交易输入
  2059. bytesData, err := json.Marshal(inputMessage)
  2060. fmt.Println(string(bytesData))
  2061. if err != nil {
  2062. fmt.Println(err.Error())
  2063. return err.Error(), ""
  2064. }
  2065. struct3503.RequestUrl = struct3503.RequestUrl + "3503"
  2066. return JXHttpRequest(struct3503.RequestUrl, struct3503.AccessKey, struct3503.SecretKey, timestamp, string(bytesData), "3503"), string(bytesData)
  2067. }
  2068. func Jxyb3504(struct3504 models.Struct3504) (string, string) {
  2069. timestamp := time.Now().Unix()
  2070. // 生成输入报文
  2071. inputMessage := SetJXInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
  2072. input := make(map[string]interface{})
  2073. inputData := make(map[string]interface{})
  2074. inputMessage["infno"] = "3504" // 交易编码
  2075. inputData["med_list_codg"] = struct3504.MedListCodg // 定点医药机构目录编号
  2076. inputData["fixmedins_hilist_id"] = struct3504.FixmedinsHilistId // 定点医药机构目录编号
  2077. inputData["fixmedins_hilist_name"] = struct3504.FixmedinsHilistName // 定点医药机构目录名称
  2078. inputData["fixmedins_bchno"] = struct3504.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2079. inputData["spler_name"] = struct3504.SplerName // 人员编号 (来自1101接口返回)
  2080. inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
  2081. inputData["manu_date"] = struct3504.ManuDate // 人员编号 (来自1101接口返回)
  2082. inputData["expy_end"] = struct3504.ExpyEnd // 人员编号 (来自1101接口返回)
  2083. inputData["finl_trns_pric"] = struct3504.FinlTrnsPric // 人员编号 (来自1101接口返回)
  2084. inputData["purc_retn_cnt"] = struct3504.PurcRetnCnt // 人员编号 (来自1101接口返回)
  2085. inputData["purc_invo_codg"] = struct3504.PurcInvoCodg // 人员编号 (来自1101接口返回)
  2086. inputData["purc_invo_no"] = struct3504.PurcInvoNo // 人员编号 (来自1101接口返回)
  2087. inputData["rx_flag"] = struct3504.RxFlag // 人员编号 (来自1101接口返回)
  2088. inputData["purc_retn_stoin_time"] = struct3504.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
  2089. inputData["purc_retn_opter_name"] = struct3504.PurcRetnOpterName // 人员编号 (来自1101接口返回)
  2090. inputData["medins_prod_purc_no"] = "" // 人员编号 (来自1101接口返回)
  2091. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  2092. input["purcinfo"] = inputData
  2093. inputMessage["input"] = input //交易输入
  2094. bytesData, err := json.Marshal(inputMessage)
  2095. fmt.Println(string(bytesData))
  2096. if err != nil {
  2097. fmt.Println(err.Error())
  2098. return err.Error(), ""
  2099. }
  2100. struct3504.RequestUrl = struct3504.RequestUrl + "3504"
  2101. return JXHttpRequest(struct3504.RequestUrl, struct3504.AccessKey, struct3504.SecretKey, timestamp, string(bytesData), "3504"), string(bytesData)
  2102. }
  2103. func Jxyb3505(struct3505 models.Struct3505) (string, string) {
  2104. timestamp := time.Now().Unix()
  2105. // 生成输入报文
  2106. inputMessage := SetJXInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsCode, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
  2107. input := make(map[string]interface{})
  2108. inputData := make(map[string]interface{})
  2109. inputMessage["infno"] = "3505" // 交易编码
  2110. inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号
  2111. inputData["fixmedins_hilist_id"] = struct3505.FixmedinsCode // 定点医药机构目录编号
  2112. inputData["fixmedins_hilist_name"] = struct3505.OrgName // 定点医药机构目录名称
  2113. inputData["fixmedins_bchno"] = struct3505.FixmedinsCode // 人员编号 (来自1101接口返回)
  2114. inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
  2115. inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回)
  2116. inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回)
  2117. inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回)
  2118. inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回)
  2119. inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回)
  2120. inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
  2121. inputData["hi_feesetl_type"] = struct3505.HiFeesetlType // 人员编号 (来自1101接口返回)
  2122. inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回)
  2123. inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回)
  2124. inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回)
  2125. inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
  2126. inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回)
  2127. inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回)
  2128. inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回)
  2129. inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回)
  2130. inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回)
  2131. inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回)
  2132. inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
  2133. inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
  2134. inputData["rxno"] = struct3505.Rxno // 人员编号 (来自1101接口返回)
  2135. inputData["rx_circ_flag"] = struct3505.RxCircFlag // 人员编号 (来自1101接口返回)
  2136. inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
  2137. inputData["stoout_no"] = struct3505.StooutNo // 人员编号 (来自1101接口返回)
  2138. inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
  2139. inputData["drug_trac_codg"] = struct3505.DrugTracCodg // 人员编号 (来自1101接口返回)
  2140. inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回)
  2141. inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回)
  2142. inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回)
  2143. inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回)
  2144. inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
  2145. inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回)
  2146. input["selinfo"] = inputData
  2147. inputMessage["input"] = input //交易输入
  2148. bytesData, err := json.Marshal(inputMessage)
  2149. fmt.Println(string(bytesData))
  2150. if err != nil {
  2151. fmt.Println(err.Error())
  2152. return err.Error(), ""
  2153. }
  2154. struct3505.RequestUrl = struct3505.RequestUrl + "3505"
  2155. return JXHttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData), "3505"), string(bytesData)
  2156. }
  2157. func Jxyb3506(struct3506 models.Struct3506) (string, string) {
  2158. timestamp := time.Now().Unix()
  2159. // 生成输入报文
  2160. inputMessage := SetJXInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
  2161. input := make(map[string]interface{})
  2162. inputData := make(map[string]interface{})
  2163. inputMessage["infno"] = "3506" // 交易编码
  2164. inputData["med_list_codg"] = struct3506.MedListCodg // 定点医药机构目录编号
  2165. inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
  2166. inputData["fixmedins_hilist_name"] = struct3506.OrgName // 定点医药机构目录名称
  2167. inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno // 人员编号 (来自1101接口返回)
  2168. inputData["setl_id"] = struct3506.SetlId // 人员编号 (来自1101接口返回)
  2169. inputData["psn_no"] = struct3506.PsnNo // 人员编号 (来自1101接口返回)
  2170. inputData["psn_cert_type"] = struct3506.PsnCertType // 人员编号 (来自1101接口返回)
  2171. inputData["certno"] = struct3506.Certno // 人员编号 (来自1101接口返回)
  2172. inputData["psn_name"] = struct3506.PsnName // 人员编号 (来自1101接口返回)
  2173. inputData["manu_lotnum"] = struct3506.ManuLotnum // 人员编号 (来自1101接口返回)
  2174. inputData["manu_date"] = struct3506.ManuDate // 人员编号 (来自1101接口返回)
  2175. inputData["expy_end"] = struct3506.ExpyEnd // 人员编号 (来自1101接口返回)
  2176. inputData["rx_flag"] = struct3506.RxFlag // 人员编号 (来自1101接口返回)
  2177. inputData["trdn_flag"] = struct3506.TrdnFlag // 人员编号 (来自1101接口返回)
  2178. inputData["finl_trns_pric"] = struct3506.FinlTrnsPric // 人员编号 (来自1101接口返回)
  2179. inputData["sel_retn_cnt"] = struct3506.SelRetnCnt // 人员编号 (来自1101接口返回)
  2180. inputData["sel_retn_time"] = struct3506.SelRetnTime // 人员编号 (来自1101接口返回)
  2181. inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回)
  2182. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  2183. inputData["medins_prod_sel_no"] = "" // 人员编号 (来自1101接口返回)
  2184. input["selinfo"] = inputData
  2185. inputMessage["input"] = input //交易输入
  2186. bytesData, err := json.Marshal(inputMessage)
  2187. fmt.Println(string(bytesData))
  2188. if err != nil {
  2189. fmt.Println(err.Error())
  2190. return err.Error(), ""
  2191. }
  2192. struct3506.RequestUrl = struct3506.RequestUrl + "3506"
  2193. return JXHttpRequest(struct3506.RequestUrl, struct3506.AccessKey, struct3506.SecretKey, timestamp, string(bytesData), "3506"), string(bytesData)
  2194. }
  2195. func Jxyb3507(struct3507 models.Struct3507) (string, string) {
  2196. timestamp := time.Now().Unix()
  2197. // 生成输入报文
  2198. inputMessage := SetJXInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
  2199. input := make(map[string]interface{})
  2200. inputData := make(map[string]interface{})
  2201. inputMessage["infno"] = "3507" // 交易编码
  2202. inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
  2203. inputData["inv_data_type"] = struct3507.InvDataType // 人员编号 (来自1101接口返回)
  2204. input["data"] = inputData
  2205. inputMessage["input"] = input //交易输入
  2206. bytesData, err := json.Marshal(inputMessage)
  2207. fmt.Println(string(bytesData))
  2208. if err != nil {
  2209. fmt.Println(err.Error())
  2210. return err.Error(), ""
  2211. }
  2212. struct3507.RequestUrl = struct3507.RequestUrl + "3507"
  2213. return JXHttpRequest(struct3507.RequestUrl, struct3507.AccessKey, struct3507.SecretKey, timestamp, string(bytesData), "3507"), string(bytesData)
  2214. }