jx_service.go 141KB

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