jx_service.go 136KB

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