jsyb_service.go 98KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009
  1. package service
  2. import (
  3. //"bytes"
  4. "encoding/json"
  5. "fmt"
  6. "gdyb/models"
  7. "gdyb/utils/csbhttp"
  8. //"io/ioutil"
  9. "net"
  10. //"net/http"
  11. "strconv"
  12. "time"
  13. )
  14. func Jsyb2201F() (string, string) {
  15. // 生成签名
  16. timestamp := time.Now().Unix()
  17. tempTime := time.Unix(timestamp, 0)
  18. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  19. // 生成输入报文
  20. inputMessage := SetJSInputMessage(timestamp, "盐城响水悦达血液透析中心有限公司", "王曙光", "H32092103007", "320921", "320921", "04aaa201baecc02c5f5e67d123810f2442dc04444e60a95ce529708bef8143f2fd3c5af38e21cccf9377c0ae3eef0a05528321f6265101a324802581709e2cdc297d94a3b176ed4112c8bc435d4f4362948720ea989bc58399fd251dd49b41d03356a1b99b6fd2c0bef2c6a2c970b03de9e3ce33499cc52b0c98a508d1eca0e104")
  21. //inputMessage := Se/**/tJSInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  22. input := make(map[string]interface{})
  23. inputData := make(map[string]interface{})
  24. inputMessage["infno"] = "2201" // 交易编码
  25. inputData["psn_no"] = "32090000000000001004606391" // 人员编号 (来自1101接口返回)
  26. inputData["insutype"] = "390" // 险种类型(来自1101接口返回)
  27. inputData["begntime"] = timeFormatOne // 开始时间
  28. //
  29. //if id_card_type == 1 {
  30. // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  31. // inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  32. //} else if id_card_type == 3 {
  33. // inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  34. // inputData["mdtrt_cert_no"] = "320822197705194836" + "|" + verify_number // 就诊凭证编号
  35. //} else {
  36. // inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  37. // inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  38. //
  39. //}
  40. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  41. inputData["mdtrt_cert_no"] = "320822197705194836|Y9gJ7nijh+DzGkn2W8El9YxSR0x1/zb2+tcA4a5fsVC4RLNACwi93U4Q9xEJVKKnN6LCbomuiCuxDOI+Skz/wsjlScPKIzyXxBcKl9ZrZjCrr+cRTRRKRdz6JqhoexGR/Cxnipr62JOW2fmrI1X2XA==" // 就诊凭证编号
  42. inputData["ipt_otp_no"] = timeFormatOne // 住院/门诊号
  43. inputData["atddr_no"] = "2484" // 医师编码
  44. inputData["dr_name"] = "王曙光" // 医师姓名
  45. inputData["dept_code"] = "01" // 科室编码
  46. inputData["dept_name"] = "血透室" // 科室名称
  47. inputData["caty"] = "A03.06" // 科别
  48. input["data"] = inputData
  49. inputMessage["input"] = input //交易输入
  50. var requestLog string
  51. bytesData, err := json.Marshal(inputMessage)
  52. requestLog = string(bytesData)
  53. fmt.Println(string(bytesData))
  54. if err != nil {
  55. fmt.Println(err.Error())
  56. return err.Error(), ""
  57. }
  58. request_url := "http://10.72.3.87:8086/CSB/" + "2201"
  59. //request_url = request_url + "2201"
  60. return HttpRequest(request_url, "1781ce9fb73a478289326c16ba8bf2c4", "b5DPOGjc08DAAMJ8FP31pwwNHKo=", timestamp, string(bytesData)), requestLog
  61. }
  62. func Jsyb1101F() (string, string) {
  63. timestamp := time.Now().Unix()
  64. //生成输入报文
  65. inputMessage := SetJSInputMessage(timestamp, "盐城响水悦达血液透析中心有限公司", "王曙光", "H32092103007", "320921", "320921", "04aaa201baecc02c5f5e67d123810f2442dc04444e60a95ce529708bef8143f2fd3c5af38e21cccf9377c0ae3eef0a05528321f6265101a324802581709e2cdc297d94a3b176ed4112c8bc435d4f4362948720ea989bc58399fd251dd49b41d03356a1b99b6fd2c0bef2c6a2c970b03de9e3ce33499cc52b0c98a508d1eca0e104")
  66. input := make(map[string]interface{})
  67. inputData := make(map[string]interface{})
  68. inputMessage["infno"] = "1101" // 交易编码
  69. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  70. inputData["card_sn"] = "" // 卡识别码
  71. inputData["certno"] = "" // 证件号码
  72. inputData["psn_cert_type"] = "01" // 人员证件类型
  73. inputData["mdtrt_cert_no"] = "320926196707111797|" // 就诊凭证编号
  74. inputData["begntime"] = "" // 开始时间
  75. inputData["psn_name"] = "" // 人员姓名
  76. input["data"] = inputData
  77. inputMessage["input"] = input //交易输入
  78. var inputLog string
  79. bytesData, _ := json.Marshal(inputMessage)
  80. inputLog = string(bytesData)
  81. fmt.Println(string(bytesData))
  82. if err != nil {
  83. fmt.Println(err.Error())
  84. return err.Error(), ""
  85. }
  86. request_url := "http://10.72.3.87:8086/CSB/" + "1101"
  87. return HttpRequest(request_url, "1781ce9fb73a478289326c16ba8bf2c4", "b5DPOGjc08DAAMJ8FP31pwwNHKo=", timestamp, string(bytesData)), inputLog
  88. }
  89. // 人员基本信息
  90. func Jsyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, id_card_type int64, card_sn string, certificates string, request_url string, access_key string, cainfo string) (string, string) {
  91. timestamp := time.Now().Unix()
  92. //生成输入报文
  93. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  94. input := make(map[string]interface{})
  95. inputData := make(map[string]interface{})
  96. inputMessage["infno"] = "1101" // 交易编码
  97. if certificates == "3" {
  98. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  99. inputData["certno"] = certNo // 证件号码
  100. inputData["psn_cert_type"] = "99" // 人员证件类型
  101. } else {
  102. if id_card_type == 1 {
  103. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  104. inputData["card_sn"] = card_sn // 卡识别码
  105. inputData["certno"] = certNo // 证件号码
  106. inputData["psn_cert_type"] = "01" // 人员证件类型
  107. } else {
  108. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  109. inputData["card_sn"] = "" // 卡识别码
  110. inputData["certno"] = certNo // 证件号码
  111. inputData["psn_cert_type"] = "01" // 人员证件类型
  112. }
  113. }
  114. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  115. inputData["begntime"] = "" // 开始时间
  116. inputData["psn_name"] = "" // 人员姓名
  117. input["data"] = inputData
  118. inputMessage["input"] = input //交易输入
  119. var inputLog string
  120. bytesData, _ := json.Marshal(inputMessage)
  121. inputLog = string(bytesData)
  122. fmt.Println(string(bytesData))
  123. if err != nil {
  124. fmt.Println(err.Error())
  125. return err.Error(), ""
  126. }
  127. request_url = request_url + "1101"
  128. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
  129. }
  130. //人员基本信息版本2
  131. func Jsyb1101A(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) {
  132. timestamp := time.Now().Unix()
  133. //生成输入报文
  134. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  135. input := make(map[string]interface{})
  136. inputData := make(map[string]interface{})
  137. inputMessage["infno"] = "1101" // 交易编码
  138. if certificates == "3" {
  139. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  140. inputData["certno"] = certNo // 证件号码
  141. inputData["psn_cert_type"] = "99" // 人员证件类型
  142. } else {
  143. if id_card_type == 1 {
  144. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  145. inputData["card_sn"] = card_sn // 卡识别码
  146. inputData["certno"] = id_card_no // 证件号码
  147. inputData["psn_cert_type"] = "01" // 人员证件类型
  148. } else {
  149. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  150. inputData["card_sn"] = "" // 卡识别码
  151. inputData["certno"] = certNo // 证件号码
  152. inputData["psn_cert_type"] = "01" // 人员证件类型
  153. }
  154. }
  155. inputData["mdtrt_cert_no"] = certNo + "|" + pBusiCardInfo // 就诊凭证编号
  156. inputData["begntime"] = "" // 开始时间
  157. inputData["psn_name"] = "" // 人员姓名
  158. input["data"] = inputData
  159. inputMessage["input"] = input //交易输入
  160. var inputLog string
  161. bytesData, _ := json.Marshal(inputMessage)
  162. inputLog = string(bytesData)
  163. fmt.Println(string(bytesData))
  164. if err != nil {
  165. fmt.Println(err.Error())
  166. return err.Error(), ""
  167. }
  168. request_url = request_url + "1101"
  169. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
  170. }
  171. func Jsyb1101B(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) {
  172. timestamp := time.Now().Unix()
  173. //生成输入报文
  174. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  175. input := make(map[string]interface{})
  176. inputData := make(map[string]interface{})
  177. inputMessage["infno"] = "1101" // 交易编码
  178. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  179. inputData["card_sn"] = "" // 卡识别码
  180. inputData["certno"] = "" // 证件号码
  181. inputData["psn_cert_type"] = "01" // 人员证件类型
  182. inputData["mdtrt_cert_no"] = id_card_no + "|" + Token // 就诊凭证编号
  183. inputData["begntime"] = "" // 开始时间
  184. inputData["psn_name"] = "" // 人员姓名
  185. input["data"] = inputData
  186. inputMessage["input"] = input //交易输入
  187. var inputLog string
  188. bytesData, _ := json.Marshal(inputMessage)
  189. inputLog = string(bytesData)
  190. fmt.Println(string(bytesData))
  191. if err != nil {
  192. fmt.Println(err.Error())
  193. return err.Error(), ""
  194. }
  195. request_url = request_url + "1101"
  196. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
  197. }
  198. func Jsyb1101ForEleCert(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) {
  199. timestamp := time.Now().Unix()
  200. //生成输入报文
  201. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  202. input := make(map[string]interface{})
  203. inputData := make(map[string]interface{})
  204. inputMessage["infno"] = "1101" // 交易编码
  205. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  206. inputData["card_sn"] = "" // 卡识别码
  207. inputData["certno"] = id_card_no // 证件号码
  208. inputData["psn_cert_type"] = "1" // 人员证件类型
  209. inputData["mdtrt_cert_no"] = Token // 就诊凭证编号
  210. inputData["begntime"] = "" // 开始时间
  211. inputData["psn_name"] = name // 人员姓名
  212. input["data"] = inputData
  213. inputMessage["input"] = input //交易输入
  214. var inputLog string
  215. bytesData, _ := json.Marshal(inputMessage)
  216. inputLog = string(bytesData)
  217. fmt.Println(string(bytesData))
  218. if err != nil {
  219. fmt.Println(err.Error())
  220. return err.Error(), ""
  221. }
  222. request_url = request_url + "1101"
  223. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), inputLog
  224. }
  225. // 门诊挂号
  226. func Jsyb2201(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) (string, string) {
  227. fmt.Println(opera)
  228. // 生成签名
  229. timestamp := time.Now().Unix()
  230. tempTime := time.Unix(timestamp, 0)
  231. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  232. // 生成输入报文
  233. inputMessage := SetJSInputMessage(timestamp, org_name, opera, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  234. input := make(map[string]interface{})
  235. inputData := make(map[string]interface{})
  236. inputMessage["infno"] = "2201" // 交易编码
  237. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  238. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  239. inputData["begntime"] = timeFormatOne // 开始时间
  240. if id_card_type == 1 {
  241. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  242. inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  243. } else if id_card_type == 3 {
  244. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  245. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  246. } else if id_card_type == 4 {
  247. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  248. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  249. } else {
  250. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  251. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  252. }
  253. inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
  254. inputData["atddr_no"] = doctor_id // 医师编码
  255. inputData["dr_name"] = doctor_name // 医师姓名
  256. inputData["dept_code"] = dept_code // 科室编码
  257. inputData["dept_name"] = dept // 科室名称
  258. inputData["caty"] = "A03.06" // 科别
  259. inputData["exp_content"] = "" //
  260. input["data"] = inputData
  261. inputMessage["input"] = input //交易输入
  262. var requestLog string
  263. bytesData, err := json.Marshal(inputMessage)
  264. requestLog = string(bytesData)
  265. fmt.Println(string(bytesData))
  266. if err != nil {
  267. fmt.Println(err.Error())
  268. return err.Error(), ""
  269. }
  270. request_url = request_url + "2201"
  271. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  272. }
  273. // 门诊挂号撤销
  274. func Jsyb2202(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) {
  275. // 生成签名
  276. timestamp := time.Now().Unix()
  277. // 生成输入报文
  278. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  279. input := make(map[string]interface{})
  280. inputData := make(map[string]interface{})
  281. inputMessage["infno"] = "2202" // 交易编码
  282. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  283. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  284. inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
  285. //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  286. inputData["exp_content"] = "" //
  287. input["data"] = inputData
  288. inputMessage["input"] = input //交易输入
  289. var requestLog string
  290. bytesData, err := json.Marshal(inputMessage)
  291. fmt.Println(string(bytesData))
  292. requestLog = string(bytesData)
  293. if err != nil {
  294. fmt.Println(err.Error())
  295. return err.Error(), ""
  296. }
  297. request_url = request_url + "2202"
  298. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  299. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  300. }
  301. // 门诊就诊信息上传
  302. func Jsyb2203(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) {
  303. // 生成签名
  304. timestamp := time.Now().Unix()
  305. tempTime := time.Unix(timestamp, 0)
  306. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  307. // 生成输入报文
  308. inputMessage := SetJSInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  309. input := make(map[string]interface{})
  310. inputData := make(map[string]interface{})
  311. diseinfo := make([]map[string]interface{}, 0)
  312. if med_type == "1111" || med_type == "1112" {
  313. med_type = "11"
  314. }
  315. inputMessage["infno"] = "2203A" // 交易编码
  316. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  317. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  318. inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  319. inputData["begntime"] = begin_time // 开始时间
  320. inputData["main_cond_dscr"] = "" // 主要病情描述
  321. inputData["dise_codg"] = sick_code // 病种编码
  322. inputData["dise_name"] = sick_name // 病种名称
  323. inputData["birctrl_type"] = "" // 计划生育手术类别
  324. inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  325. for index, item := range config {
  326. diseinfo_sun := make(map[string]interface{})
  327. diseinfo_sun["diag_type"] = "1" // 诊断类别
  328. diseinfo_sun["diag_srt_no"] = index // 诊断排序号
  329. diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
  330. diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
  331. diseinfo_sun["diag_dept"] = department // 诊断科室
  332. diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  333. diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
  334. diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  335. diseinfo_sun["vali_flag"] = "1" // 有效标志
  336. diseinfo = append(diseinfo, diseinfo_sun)
  337. }
  338. //inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  339. inputData["exp_content"] = "" //
  340. input["diseinfo"] = diseinfo
  341. input["mdtrtinfo"] = inputData
  342. inputMessage["input"] = input //交易输入
  343. var requestLog string
  344. bytesData, err := json.Marshal(inputMessage)
  345. fmt.Println(string(bytesData))
  346. requestLog = string(bytesData)
  347. if err != nil {
  348. fmt.Println(err.Error())
  349. return err.Error(), "", 0
  350. }
  351. request_url = request_url + "2203A"
  352. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  353. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog, timestamp
  354. }
  355. // 门诊就诊信息上传
  356. func Jsyb2203A(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) {
  357. // 生成签名
  358. timestamp := time.Now().Unix()
  359. tempTime := time.Unix(timestamp, 0)
  360. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  361. // 生成输入报文
  362. inputMessage := SetJSInputMessage(timestamp, org_name, dept, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  363. input := make(map[string]interface{})
  364. inputData := make(map[string]interface{})
  365. diseinfo := make([]map[string]interface{}, 0)
  366. if med_type == "1111" || med_type == "1112" {
  367. med_type = "11"
  368. }
  369. inputMessage["infno"] = "2203A" // 交易编码
  370. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  371. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  372. inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
  373. inputData["begntime"] = timeFormatOne // 开始时间
  374. inputData["main_cond_dscr"] = "" // 主要病情描述
  375. inputData["dise_codg"] = sick_code // 病种编码
  376. inputData["dise_name"] = sick_name // 病种名称
  377. inputData["birctrl_type"] = "" // 计划生育手术类别
  378. inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
  379. inputData["matn_type"] = "" // 生育类别
  380. inputData["geso_val"] = "" // 孕周数
  381. for index, item := range config {
  382. diseinfo_sun := make(map[string]interface{})
  383. diseinfo_sun["diag_type"] = "1" // 诊断类别
  384. diseinfo_sun["diag_srt_no"] = index // 诊断排序号
  385. diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
  386. diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
  387. diseinfo_sun["diag_dept"] = department // 诊断科室
  388. diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
  389. diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
  390. diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
  391. diseinfo_sun["vali_flag"] = "1" // 有效标志
  392. diseinfo = append(diseinfo, diseinfo_sun)
  393. }
  394. input["diseinfo"] = diseinfo
  395. input["mdtrtinfo"] = inputData
  396. inputMessage["input"] = input //交易输入
  397. var requestLog string
  398. bytesData, err := json.Marshal(inputMessage)
  399. fmt.Println(string(bytesData))
  400. requestLog = string(bytesData)
  401. if err != nil {
  402. fmt.Println(err.Error())
  403. return err.Error(), ""
  404. }
  405. request_url = request_url + "2203A"
  406. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  407. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  408. }
  409. // 门诊费用明细信息上传
  410. func Jsyb2204(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) {
  411. // 生成签名
  412. //timestamp := time.Now().Unix()
  413. timestamp := time.Now().Unix()
  414. timestamp2 := time.Now().Unix()
  415. //tempTime := time.Unix(timestamp2, 0)
  416. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  417. var customs []*Custom
  418. for _, item := range hisPrescription {
  419. tm := time.Unix(item.PreTime, 0)
  420. if item.Type == 1 { //药品
  421. for _, subItem := range item.HisDoctorAdviceInfo {
  422. if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
  423. //var randNum int
  424. //randNum = rand.Intn(10000) + 1000
  425. cus := &Custom{
  426. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*subItem.PrescribingNumber),
  427. Cut: fmt.Sprintf("%.4f", subItem.PrescribingNumber),
  428. FeedetlSn: subItem.FeedetlSn,
  429. Price: fmt.Sprintf("%.4f", subItem.Price),
  430. MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber,
  431. HospApprFlag: subItem.HospApprFlag,
  432. DoctorNumber: doctor_id,
  433. DoctorName: new_doctor_name,
  434. ProvinceDrugMedListCodg: "",
  435. ProvinceGoodMedListCodg: "",
  436. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  437. }
  438. if subItem.BaseDrugLib.DrugClassify == "2" {
  439. cus.ProvinceDrugMedListCodg = subItem.BaseDrugLib.ProvincesCode
  440. }
  441. customs = append(customs, cus)
  442. }
  443. }
  444. }
  445. if item.Type == 2 { //项目
  446. for _, subItem := range item.HisPrescriptionProject {
  447. //var randNum int
  448. //randNum = rand.Intn(10000) + 1000
  449. if subItem.Type == 2 {
  450. if len(subItem.HisProject.MedicalCode) > 0 {
  451. cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  452. cus := &Custom{
  453. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
  454. Cut: fmt.Sprintf("%.4f", cnt),
  455. FeedetlSn: subItem.FeedetlSn,
  456. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  457. MedListCodg: subItem.HisProject.MedicalCode,
  458. DoctorNumber: doctor_id,
  459. DoctorName: new_doctor_name,
  460. HospApprFlag: -1,
  461. ProvinceDrugMedListCodg: "",
  462. ProvinceGoodMedListCodg: "",
  463. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  464. }
  465. customs = append(customs, cus)
  466. }
  467. } else if subItem.Type == 3 {
  468. if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
  469. cnt, _ := strconv.ParseFloat(subItem.Count, 64)
  470. cus := &Custom{
  471. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*cnt),
  472. Cut: fmt.Sprintf("%.4f", cnt),
  473. FeedetlSn: subItem.FeedetlSn,
  474. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  475. MedListCodg: subItem.GoodInfo.MedicalInsuranceNumber,
  476. HospApprFlag: -1,
  477. DoctorNumber: doctor_id,
  478. DoctorName: new_doctor_name,
  479. ProvinceDrugMedListCodg: "",
  480. ProvinceGoodMedListCodg: subItem.GoodInfo.ProvincesCode,
  481. FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
  482. }
  483. customs = append(customs, cus)
  484. }
  485. }
  486. }
  487. }
  488. for _, subItem := range item.HisAdditionalCharge {
  489. if len(subItem.XtHisAddtionConfig.Code) > 0 {
  490. cus := &Custom{
  491. DetItemFeeSumamt: fmt.Sprintf("%.4f", subItem.Price*float64(subItem.Count)),
  492. Cut: fmt.Sprintf("%.4f", float64(subItem.Count)),
  493. FeedetlSn: subItem.FeedetlSn,
  494. Price: fmt.Sprintf("%.4f", float64(subItem.Price)),
  495. MedListCodg: subItem.XtHisAddtionConfig.Code,
  496. HospApprFlag: -1,
  497. DoctorNumber: doctor_id,
  498. DoctorName: new_doctor_name,
  499. }
  500. customs = append(customs, cus)
  501. }
  502. }
  503. }
  504. // 生成输入报文
  505. inputMessage := SetJSInputMessage(timestamp2, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  506. input := make(map[string]interface{})
  507. feedetail := make([]map[string]interface{}, 0)
  508. inputMessage["infno"] = "2204" // 交易编码
  509. //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
  510. for _, item := range customs {
  511. feedetailInfo := make(map[string]interface{})
  512. subfeedetailInfo := make(map[string]interface{})
  513. feedetailInfo["feedetl_sn"] = item.FeedetlSn
  514. feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  515. feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  516. feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
  517. feedetailInfo["dise_codg"] = diag_code // 病种编码
  518. feedetailInfo["rxno"] = "" // 处方号
  519. feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
  520. feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间
  521. feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
  522. feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码
  523. feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
  524. feedetailInfo["cnt"] = item.Cut // 数量
  525. feedetailInfo["pric"] = item.Price // 单价
  526. feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
  527. feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
  528. feedetailInfo["prd_days"] = "0" // 周期天数
  529. feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
  530. feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
  531. feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
  532. if fixmedins_code == "H32092103007" {
  533. feedetailInfo["bilg_dr_codg"] = "D320923012139" // 开单医生编码
  534. feedetailInfo["bilg_dr_name"] = "王曙光" // 开单医师姓名
  535. feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
  536. feedetailInfo["acord_dept_name"] = "" // 受单科室名称
  537. feedetailInfo["orders_dr_code"] = "D320923012139" // 受单医生编码
  538. feedetailInfo["orders_dr_name"] = "王曙光" // 受单医生姓名
  539. } else {
  540. feedetailInfo["bilg_dr_codg"] = "D371621008686" // 开单医生编码
  541. feedetailInfo["bilg_dr_name"] = "王云刚" // 开单医师姓名
  542. feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
  543. feedetailInfo["acord_dept_name"] = "" // 受单科室名称
  544. feedetailInfo["orders_dr_code"] = "D371621008686" // 受单医生编码
  545. feedetailInfo["orders_dr_name"] = "王云刚" // 受单医生姓名
  546. }
  547. if balance_accounts_type == "8" {
  548. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  549. } else {
  550. if item.HospApprFlag != -1 {
  551. if item.HospApprFlag == 1 {
  552. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  553. } else if item.HospApprFlag == 2 {
  554. feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
  555. } else if item.HospApprFlag == 3 {
  556. feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
  557. } else {
  558. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  559. }
  560. } else {
  561. feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
  562. }
  563. }
  564. feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
  565. feedetailInfo["etip_flag"] = "" // 外检标志
  566. feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
  567. feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
  568. feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
  569. subfeedetailInfo["tcmherb_prov_code"] = item.ProvinceDrugMedListCodg
  570. subfeedetailInfo["mcs_prov_code"] = item.ProvinceGoodMedListCodg
  571. feedetailInfo["exp_content"] = subfeedetailInfo
  572. feedetail = append(feedetail, feedetailInfo)
  573. }
  574. input["feedetail"] = feedetail
  575. inputMessage["input"] = input //交易输入
  576. var requestLog string
  577. bytesData, err := json.Marshal(inputMessage)
  578. requestLog = string(bytesData)
  579. fmt.Println(string(bytesData))
  580. if err != nil {
  581. fmt.Println(err.Error())
  582. return "", ""
  583. }
  584. request_url = request_url + "2204"
  585. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  586. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  587. }
  588. // 门诊费用明细信息撤销
  589. func Jsyb2205(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) {
  590. timestamp := time.Now().Unix()
  591. // 生成输入报文
  592. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  593. input := make(map[string]interface{})
  594. inputData := make(map[string]interface{})
  595. inputMessage["infno"] = "2205" // 交易编码
  596. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  597. inputData["chrg_bchno"] = "0000" // 收费批次号(来自2204生成的)
  598. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  599. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  600. input["data"] = inputData
  601. inputMessage["input"] = input //交易输入
  602. bytesData, err := json.Marshal(inputMessage)
  603. fmt.Println(string(bytesData))
  604. var requestLog string
  605. requestLog = string(bytesData)
  606. if err != nil {
  607. fmt.Println(err.Error())
  608. return err.Error(), ""
  609. }
  610. request_url = request_url + "2205"
  611. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  612. }
  613. // 门诊预结算
  614. func Jsyb2206(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) {
  615. // 生成签名
  616. timestamp := time.Now().Unix() // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  617. // inputData["mdtrt_cert_no"] = certNo
  618. // 生成输入报文
  619. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  620. input := make(map[string]interface{})
  621. inputData := make(map[string]interface{})
  622. inputMessage["infno"] = "2206" // 交易编码
  623. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  624. if certificates == 3 {
  625. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  626. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  627. } else {
  628. if id_card_type == 1 {
  629. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  630. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  631. } else if id_card_type == 3 {
  632. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  633. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  634. } else if id_card_type == 4 {
  635. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  636. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  637. } else {
  638. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  639. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  640. }
  641. }
  642. if insuplc_admdvs == "421300" {
  643. if med_type == "11" || med_type == "1112" || med_type == "1111" {
  644. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  645. } else if med_type == "14" {
  646. inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
  647. }
  648. } else {
  649. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  650. }
  651. inputData["medfee_sumamt"] = total // 医疗费总额
  652. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  653. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  654. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  655. inputData["acct_used_flag"] = "0" // 个人账户使用标志 0否 1是
  656. inputData["insutype"] = insutype // 险种类型
  657. inputData["invono"] = "" // 发票号
  658. inputData2 := make(map[string]interface{})
  659. inputData2["trum_flag"] = ""
  660. inputData2["rel_ttp_flag"] = ""
  661. inputData2["otp_er_refl_flag"] = ""
  662. inputData2["mdtrt_grp_type"] = ""
  663. inputData2["need_ipt_flag"] = ""
  664. inputData["exp_content"] = inputData2
  665. input["data"] = inputData
  666. inputMessage["input"] = input //交易输入
  667. var requestLog string
  668. bytesData, err := json.Marshal(inputMessage)
  669. requestLog = string(bytesData)
  670. fmt.Println(string(bytesData))
  671. if err != nil {
  672. fmt.Println(err.Error())
  673. return err.Error(), ""
  674. }
  675. request_url = request_url + "2206"
  676. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  677. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), requestLog
  678. }
  679. // 门诊结算
  680. func Jsyb2207(psnNo string, mdtrtId string, chrgBchno string, certNo string, insutype string, total string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, med_type string, id_card_type int64, fulamt_ownpay_amt float64, overlmt_selfpay float64, preselfpay_amt float64, inscp_scp_amt float64, certificates int64, acct_used_flag string, request_url string, access_key string, verify_number string, cainfo string) (string, string) {
  681. // 生成签名
  682. timestamp := time.Now().Unix()
  683. // 生成输入报文
  684. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  685. input := make(map[string]interface{})
  686. inputData := make(map[string]interface{})
  687. inputMessage["infno"] = "2207" // 交易编码
  688. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  689. if certificates == 3 {
  690. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  691. inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  692. } else {
  693. if id_card_type == 1 {
  694. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  695. inputData["mdtrt_cert_no"] = certNo + "|" + verify_number // 就诊凭证编号
  696. } else if id_card_type == 3 {
  697. inputData["mdtrt_cert_type"] = "04" // 就诊凭证类型
  698. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  699. } else if id_card_type == 4 {
  700. inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
  701. inputData["mdtrt_cert_no"] = verify_number // 就诊凭证编号
  702. } else {
  703. }
  704. }
  705. if med_type == "1111" || med_type == "1112" {
  706. med_type = "11"
  707. }
  708. if insuplc_admdvs == "421300" {
  709. if med_type == "11" {
  710. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  711. } else if med_type == "14" {
  712. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  713. }
  714. } else {
  715. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  716. }
  717. inputData["medfee_sumamt"] = total // 医疗费总额
  718. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  719. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  720. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  721. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  722. inputData["insutype"] = insutype // 险种类型
  723. inputData["invono"] = "" // 发票号
  724. inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
  725. inputData["overlmt_selfpay"] = overlmt_selfpay //
  726. inputData["preselfpay_amt"] = preselfpay_amt //
  727. inputData["inscp_scp_amt"] = inscp_scp_amt //
  728. inputData2 := make(map[string]interface{})
  729. inputData2["trum_flag"] = ""
  730. inputData2["rel_ttp_flag"] = ""
  731. inputData2["otp_er_refl_flag"] = ""
  732. inputData2["mdtrt_grp_type"] = ""
  733. inputData2["need_ipt_flag"] = ""
  734. inputData["exp_content"] = inputData2
  735. input["data"] = inputData
  736. inputMessage["input"] = input //交易输入
  737. bytesData, err := json.Marshal(inputMessage)
  738. fmt.Println(string(bytesData))
  739. if err != nil {
  740. fmt.Println(err.Error())
  741. return err.Error(), ""
  742. }
  743. request_url = request_url + "2207"
  744. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  745. }
  746. func Jsyb2207A(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) {
  747. // 生成签名
  748. timestamp := time.Now().Unix()
  749. // 生成输入报文
  750. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  751. input := make(map[string]interface{})
  752. inputData := make(map[string]interface{})
  753. inputMessage["infno"] = "2207A" // 交易编码
  754. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  755. if certificates == 3 {
  756. inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
  757. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  758. } else {
  759. if id_card_type == 1 {
  760. inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
  761. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  762. } else {
  763. inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
  764. inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
  765. }
  766. }
  767. if med_type == "1111" || med_type == "1112" {
  768. med_type = "11"
  769. }
  770. if insuplc_admdvs == "421300" {
  771. if med_type == "11" {
  772. inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
  773. } else if med_type == "14" {
  774. inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
  775. }
  776. } else {
  777. inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
  778. }
  779. inputData["medfee_sumamt"] = total // 医疗费总额
  780. inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
  781. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  782. inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
  783. inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
  784. inputData["insutype"] = insutype // 险种类型
  785. inputData["invono"] = "" // 发票号
  786. inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
  787. inputData["overlmt_selfpay"] = overlmt_selfpay //
  788. inputData["preselfpay_amt"] = preselfpay_amt //
  789. inputData["inscp_scp_amt"] = inscp_scp_amt //
  790. 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 + "2207A"
  799. //fmt.Println(HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)))
  800. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  801. }
  802. // 门诊结算撤销
  803. func Jsyb2208(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) {
  804. timestamp := time.Now().Unix()
  805. // 生成输入报文
  806. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  807. input := make(map[string]interface{})
  808. inputData := make(map[string]interface{})
  809. inputMessage["infno"] = "2208" // 交易编码
  810. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  811. inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
  812. inputData["setl_id"] = setlId // 结算 ID
  813. inputData["exp_content"] = "" // 人员编号 (来自1101接口返回)
  814. input["data"] = inputData
  815. inputMessage["input"] = input //交易输入
  816. bytesData, err := json.Marshal(inputMessage)
  817. fmt.Println(string(bytesData))
  818. if err != nil {
  819. fmt.Println(err.Error())
  820. return err.Error(), ""
  821. }
  822. request_url = request_url + "2208"
  823. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  824. }
  825. func Jsyb5203(baseParams models.BaseParams, businessParams models.BusinessParams) (string, string) {
  826. timestamp := time.Now().Unix()
  827. // 生成输入报文
  828. inputMessage := SetJSInputMessage(timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, baseParams.Cainfo)
  829. input := make(map[string]interface{})
  830. inputData := make(map[string]interface{})
  831. inputMessage["infno"] = "5203" // 交易编码
  832. inputData["psn_no"] = businessParams.PsnNo
  833. inputData["setl_id"] = businessParams.SetlId
  834. inputData["mdtrt_id"] = businessParams.MdtrtId
  835. input["data"] = inputData
  836. inputMessage["input"] = input //交易输入
  837. bytesData, err := json.Marshal(inputMessage)
  838. fmt.Println(string(bytesData))
  839. if err != nil {
  840. fmt.Println(err.Error())
  841. return err.Error(), ""
  842. }
  843. baseParams.RequestUrl = baseParams.RequestUrl + "5203"
  844. //fmt.Println(HttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)))
  845. return HttpRequest(baseParams.RequestUrl, baseParams.AccessKey, baseParams.SecretKey, timestamp, string(bytesData)), string(bytesData)
  846. }
  847. //CBS总线
  848. func HttpRequest(url string, ak string, sk string, timestamp int64, json string) string {
  849. fmt.Println(url)
  850. //step 1. 设置请求参数
  851. csbHP := csbhttp.NewHttpParams(url) //设置请求地址及url参数
  852. //设置调用方式 get 或者 post
  853. csbHP.SetMethod("post")
  854. //csbHP.AddParam("input", "")
  855. //设置 调用的服务名和版本
  856. csbHP.SetApi("hssServives")
  857. csbHP.SetVersion("1.0.0")
  858. //添加附加的http请求头 (可以定义多条)
  859. //key := "_api_access_key=" + ak + "&_api_name=" + "hssServives" + "&_api_timestamp=" + strconv.FormatInt(timestamp, 10) + "&_api_version=" + "1.0.0"
  860. csbHP.AddHeader("_api_timestamp", strconv.FormatInt(timestamp, 10))
  861. csbHP.AddHeader("_api_name", "hssServives")
  862. csbHP.AddHeader("_api_version", "1.0.0")
  863. csbHP.AddHeader("_api_access_key", ak)
  864. csbHP.AddHeader("Content-Type", "application/json;charset=UTF-8")
  865. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  866. //还可以,设置附加的byte[]或者json请求体
  867. csbHP.SetContentBody(json, nil)
  868. //设置请求的ak和sk
  869. csbHP.SetAK(ak)
  870. csbHP.SetSK(sk)
  871. //打印请求参数信息
  872. csbHP.Print()
  873. //进行调用, 返回的第二项为resonse http headers (map[string][]string类型)
  874. //res, _, err := csbhttp.Invoke(*csbHP, requestByte)
  875. res, _, err := csbhttp.Invoke(*csbHP, strconv.FormatInt(timestamp, 10))
  876. //是否发成错误
  877. if err != nil {
  878. fmt.Println(err)
  879. return ""
  880. }
  881. fmt.Println(res)
  882. return res
  883. }
  884. // 生成基础报文
  885. func SetJSInputMessage(timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, cainfo string) map[string]interface{} {
  886. // 生成签名
  887. tempTime := time.Unix(timestamp, 0)
  888. //timeFormat := tempTime.Format("20060102150405")
  889. timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  890. //randNum := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000)
  891. month := time.Unix(1557042972, 0).Format("1")
  892. year := time.Now().Format("2006")
  893. month = time.Now().Format("01")
  894. day := time.Now().Format("02")
  895. hour := time.Now().Format("15")
  896. min := time.Now().Format("04")
  897. sec := time.Now().Format("05")
  898. msec := time.Now().Format("000")
  899. // 生成输入报文
  900. inputMessage := make(map[string]interface{})
  901. inputMessage["msgid"] = fixmedins_code + year + month + day + hour + min + sec + msec + "0" // 发送方报文 ID
  902. inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs // 就医地医保区划
  903. inputMessage["insuplc_admdvs"] = insuplc_admdvs // 参保地医保区划
  904. inputMessage["recer_sys_code"] = "MBS_LOCAL" // 接收方系统代码
  905. inputMessage["dev_no"] = "1" // 设备编号
  906. inputMessage["dev_safe_info"] = "1" // 设备安全信息
  907. inputMessage["cainfo"] = cainfo // 数字签名信息
  908. inputMessage["signtype"] = "SM3" // 签名类型
  909. inputMessage["infver"] = "1.0.0" // 接收方系统代码
  910. inputMessage["opter_type"] = "1" // 经办人类别
  911. if fixmedins_code == "H32090403023" {
  912. inputMessage["opter"] = "晁海燕" // 经办人
  913. inputMessage["opter_name"] = "晁海燕" // 经办人姓名
  914. } else {
  915. inputMessage["opter"] = "孙欣欣" // 经办人
  916. inputMessage["opter_name"] = "孙欣欣" // 经办人姓名
  917. }
  918. inputMessage["inf_time"] = timeFormatOne // 交易时间
  919. inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
  920. inputMessage["fixmedins_name"] = org_name
  921. inputMessage["fixmedins_soft_fcty"] = "深圳市领透科技有限公司" //定点医药机构名称
  922. //定点医药机构名称
  923. inputMessage["sign_no"] = "" //交易签到流水号
  924. return inputMessage
  925. }
  926. func Jsyb5301(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) {
  927. // 生成签名
  928. //nonce := GetRandomString(32)
  929. timestamp := time.Now().Unix()
  930. //signature := setSignature(timestamp, nonce, secret_key)
  931. //tempTime := time.Unix(timestamp, 0)
  932. //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
  933. //timeFormatTwo := tempTime.Format("2006-01-02")
  934. // 生成输入报文
  935. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  936. input := make(map[string]interface{})
  937. inputData := make(map[string]interface{})
  938. inputMessage["infno"] = "5301" // 交易编码
  939. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  940. input["data"] = inputData
  941. inputMessage["input"] = input //交易输入
  942. bytesData, err := json.Marshal(inputMessage)
  943. fmt.Println(string(bytesData))
  944. if err != nil {
  945. fmt.Println(err.Error())
  946. return err.Error(), ""
  947. }
  948. request_url = request_url + "5301"
  949. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  950. }
  951. func Jsyb2503(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) {
  952. timestamp := time.Now().Unix()
  953. // 生成输入报文
  954. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  955. input := make(map[string]interface{})
  956. inputData := make(map[string]interface{})
  957. inputMessage["infno"] = "2503" // 交易编码
  958. inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
  959. inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
  960. inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
  961. inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
  962. inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
  963. inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
  964. inputData["ide_fixmedins_name"] = org_name // 险种类型(来自1101接口返回)
  965. inputData["hosp_ide_date"] = check_time // 险种类型(来自1101接口返回)
  966. inputData["diag_dr_codg"] = doctor_id // 开始时间
  967. inputData["diag_dr_name"] = doctor // 开始时间
  968. inputData["begndate"] = start_time // 医师编码
  969. inputData["tel"] = "" // 医师编码
  970. inputData["addr"] = "" // 医师编码
  971. inputData["enddate"] = end_time // 医师编码
  972. input["data"] = inputData
  973. inputMessage["input"] = input //交易输入
  974. bytesData, err := json.Marshal(inputMessage)
  975. fmt.Println(string(bytesData))
  976. if err != nil {
  977. fmt.Println(err.Error())
  978. return err.Error(), ""
  979. }
  980. request_url = request_url + "2503"
  981. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  982. }
  983. func Jsyb3201(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) {
  984. // 生成签名
  985. timestamp := time.Now().Unix()
  986. // 生成输入报文
  987. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  988. input := make(map[string]interface{})
  989. inputData := make(map[string]interface{})
  990. inputMessage["infno"] = "3201" // 交易编码
  991. inputData["insutype"] = insutype // 险种
  992. inputData["clr_type"] = clr_type // 就诊 ID(来自2201接口返回)
  993. inputData["setl_optins"] = setl_optins // 结算经办机构
  994. inputData["stmt_begndate"] = stmt_begndate // 对帐开始时间
  995. inputData["stmt_enddate"] = stmt_enddate //对帐结束时间
  996. inputData["medfee_sumamt"] = medfee_sumamt //医疗费总额
  997. inputData["fund_pay_sumamt"] = fund_pay_sumamt //基金支付总额
  998. inputData["acct_pay"] = acct_pay //个人账户支付金额
  999. inputData["fixmedins_setl_cnt"] = fixmedins_setl_cnt //定点医药机构结算笔数
  1000. inputData["refd_setl_flag"] = 0 //
  1001. input["data"] = inputData
  1002. inputMessage["input"] = input //交易输入
  1003. bytesData, err := json.Marshal(inputMessage)
  1004. fmt.Println(string(bytesData))
  1005. if err != nil {
  1006. fmt.Println(err.Error())
  1007. return err.Error(), ""
  1008. }
  1009. request_url = request_url + "3201"
  1010. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  1011. }
  1012. func Jsyb9001(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) {
  1013. // 生成签名
  1014. timestamp := time.Now().Unix()
  1015. // 生成输入报文
  1016. inputMessage := SetJSInputMessage(timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, cainfo)
  1017. input := make(map[string]interface{})
  1018. inputData := make(map[string]interface{})
  1019. inputMessage["infno"] = "9001" // 交易编码
  1020. inputData["opter_no"] = admin_user_id
  1021. inputData["mac"] = GetMacTwo() // 开始时间
  1022. inputData["ip"] = GetLocalIpTwo()
  1023. input["signIn"] = inputData
  1024. inputMessage["input"] = input //交易输入
  1025. bytesData, err := json.Marshal(inputMessage)
  1026. fmt.Println(string(bytesData))
  1027. if err != nil {
  1028. fmt.Println(err.Error())
  1029. return err.Error(), ""
  1030. }
  1031. //reader := bytes.NewReader(bytesData)
  1032. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
  1033. //gdyb_url := beego.AppConfig.String("gdyb_url")
  1034. //gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
  1035. //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
  1036. //url := gdyb_url
  1037. //request, err := http.NewRequest("POST", request_url+"9001", reader)
  1038. //if err != nil {
  1039. // fmt.Println(err.Error())
  1040. // return err.Error(), ""
  1041. //}
  1042. //
  1043. //request.Header.Set("Content-Type", "application/json;charset=UTF-8")
  1044. //request.Header.Set("_api_timestamp", strconv.FormatInt(timestamp, 10))
  1045. //request.Header.Set("_api_name", "hssServives")
  1046. //request.Header.Set("_api_version", "1.0.0")
  1047. //request.Header.Set("_api_access_key", access_key)
  1048. //request.Header.Set("_api_signature", "")
  1049. //
  1050. //client := http.Client{}
  1051. //resp, err := client.Do(request)
  1052. //if err != nil {
  1053. // fmt.Println(err.Error())
  1054. // return err.Error(), ""
  1055. //}
  1056. //respBytes, err := ioutil.ReadAll(resp.Body)
  1057. //if err != nil {
  1058. // fmt.Println(err.Error())
  1059. // return err.Error(), ""
  1060. //}
  1061. //str := string(respBytes)
  1062. //fmt.Println(str)
  1063. //return str, ""
  1064. request_url = request_url + "9001"
  1065. return HttpRequest(request_url, access_key, secret_key, timestamp, string(bytesData)), string(bytesData)
  1066. }
  1067. //获取本机ip
  1068. func GetLocalIpTwo() string {
  1069. addrs, err := net.InterfaceAddrs()
  1070. if err != nil {
  1071. fmt.Println("get local ip failed")
  1072. }
  1073. for _, address := range addrs {
  1074. if ipnet, ok := address.(*net.IPNet); ok && !ipnet.IP.IsLoopback() {
  1075. if ipnet.IP.To4() != nil {
  1076. return ipnet.IP.String()
  1077. }
  1078. }
  1079. }
  1080. return ""
  1081. }
  1082. //获取本机Mac
  1083. func GetMacTwo() string {
  1084. interfaces, err := net.Interfaces()
  1085. if err != nil {
  1086. fmt.Println("Get loacl Mac failed")
  1087. }
  1088. for _, inter := range interfaces {
  1089. mac := inter.HardwareAddr
  1090. fmt.Println("+======" + mac.String())
  1091. if mac.String() != "" {
  1092. return mac.String()
  1093. }
  1094. }
  1095. return ""
  1096. }
  1097. func Jsyb3101(pd models.PatientDtos, fed models.FsiEncounterDtos, fdds []*models.FsiDiagnoseDtos, fods []*models.FsiOrderDtos, fopds []*models.FsiOperationDtosData, params models.PublicParams, trig_scen string) (string, string) {
  1098. // 生成签名
  1099. timestamp := time.Now().Unix()
  1100. // 生成输入报文
  1101. inputMessage := SetJSInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1102. input := make(map[string]interface{})
  1103. inputData := make(map[string]interface{})
  1104. patientDtosinputData := make(map[string]interface{})
  1105. fisEncounterDtosData := make(map[string]interface{})
  1106. fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
  1107. fsiOrderDtosDatas := make([]map[string]interface{}, 0)
  1108. fsiOperationDtosData := make(map[string]interface{})
  1109. fsiOperationDtosDatas := make([]map[string]interface{}, 0)
  1110. //就诊信息
  1111. fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
  1112. fisEncounterDtosData["medins_id"] = fed.MedinsID
  1113. fisEncounterDtosData["medins_name"] = fed.MedinsName
  1114. fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
  1115. fisEncounterDtosData["medins_type"] = fed.MedinsType
  1116. fisEncounterDtosData["medins_lv"] = fed.MedinsLv
  1117. fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
  1118. fisEncounterDtosData["wardno"] = fed.Wardno
  1119. fisEncounterDtosData["bedno"] = fed.Bedno
  1120. fisEncounterDtosData["adm_date"] = fed.AdmDate
  1121. fisEncounterDtosData["dscg_date"] = fed.DscgDate
  1122. fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
  1123. fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
  1124. for _, fdd := range fdds {
  1125. fsiDiagnoseDtosData := make(map[string]interface{})
  1126. //诊断集合
  1127. fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
  1128. fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
  1129. fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
  1130. fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
  1131. fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
  1132. fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
  1133. fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
  1134. fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
  1135. }
  1136. fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
  1137. fisEncounterDtosData["dr_codg"] = fed.DrCodg
  1138. fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
  1139. fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
  1140. fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
  1141. fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
  1142. fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
  1143. fisEncounterDtosData["med_type"] = fed.MedType
  1144. for _, fod := range fods {
  1145. fsiOrderDtosData := make(map[string]interface{})
  1146. //医嘱集合
  1147. fsiOrderDtosData["rx_id"] = fod.RxID
  1148. fsiOrderDtosData["rxno"] = fod.Rxno
  1149. fsiOrderDtosData["grpno"] = fod.Grpno
  1150. fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
  1151. fsiOrderDtosData["hilist_type"] = fod.HilistType
  1152. fsiOrderDtosData["chrg_type"] = fod.ChrgType
  1153. fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
  1154. fsiOrderDtosData["hilist_code"] = fod.HilistCode
  1155. fsiOrderDtosData["hilist_name"] = fod.HilistName
  1156. fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
  1157. fsiOrderDtosData["hilist_lv"] = fod.HilistLv
  1158. fsiOrderDtosData["hilist_pric"] = fod.HilistPric
  1159. fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
  1160. fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
  1161. fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
  1162. fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
  1163. fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
  1164. fsiOrderDtosData["hosplist_name"] = fod.HosplistName
  1165. fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
  1166. fsiOrderDtosData["cnt"] = fod.Cnt
  1167. fsiOrderDtosData["pric"] = fod.Pric
  1168. fsiOrderDtosData["sumamt"] = fod.Sumamt
  1169. fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
  1170. fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
  1171. fsiOrderDtosData["spec"] = fod.Spec
  1172. fsiOrderDtosData["spec_unt"] = fod.SpecUnt
  1173. fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
  1174. fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
  1175. fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
  1176. fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
  1177. fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
  1178. fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
  1179. fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
  1180. fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
  1181. fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
  1182. }
  1183. fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
  1184. fisEncounterDtosData["matn_stas"] = fed.MatnStas
  1185. fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
  1186. fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
  1187. fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
  1188. fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
  1189. fisEncounterDtosData["ma_amt"] = fed.MaAmt
  1190. fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
  1191. fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
  1192. fisEncounterDtosData["insutype"] = fed.Insutype
  1193. fisEncounterDtosData["reim_flag"] = fed.ReimFlag
  1194. fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
  1195. //手术操作
  1196. for _, fopd := range fopds {
  1197. fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
  1198. fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
  1199. fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
  1200. fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
  1201. fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
  1202. fsiOperationDtosData["anst_way"] = fopd.Anst_way
  1203. fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
  1204. fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
  1205. fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
  1206. fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
  1207. fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
  1208. }
  1209. fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
  1210. patientDtosinputData["patn_id"] = pd.PatnID
  1211. patientDtosinputData["patn_name"] = pd.PatnName
  1212. patientDtosinputData["gend"] = pd.Gend
  1213. patientDtosinputData["brdy"] = pd.Brdy
  1214. patientDtosinputData["poolarea"] = pd.Poolarea
  1215. patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
  1216. patientDtosinputData["fsi_his_data_dto"] = ""
  1217. patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
  1218. inputData["syscode"] = "LinkDialysis"
  1219. inputData["trig_scen"] = trig_scen
  1220. inputData["rule_ids"] = ""
  1221. inputData["task_id"] = ""
  1222. inputData["patient_dtos"] = patientDtosinputData
  1223. input["data"] = inputData
  1224. inputMessage["infno"] = "3101"
  1225. inputMessage["input"] = input //交易输入
  1226. bytesData, err := json.Marshal(inputMessage)
  1227. fmt.Println(string(bytesData))
  1228. if err != nil {
  1229. fmt.Println(err.Error())
  1230. return err.Error(), ""
  1231. }
  1232. params.RequestUrl = params.RequestUrl + "3101"
  1233. return HttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1234. }
  1235. func Jsyb3102(pd models.PatientDtos, fed models.FsiEncounterDtos, fdds []*models.FsiDiagnoseDtos, fods []*models.FsiOrderDtos, fopds []*models.FsiOperationDtosData, params models.PublicParams, trig_scen string) (string, string) {
  1236. // 生成签名
  1237. timestamp := time.Now().Unix()
  1238. // 生成输入报文
  1239. inputMessage := SetJSInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1240. input := make(map[string]interface{})
  1241. inputData := make(map[string]interface{})
  1242. patientDtosinputData := make(map[string]interface{})
  1243. fisEncounterDtosData := make(map[string]interface{})
  1244. fsiDiagnoseDtosDatas := make([]map[string]interface{}, 0)
  1245. fsiOrderDtosDatas := make([]map[string]interface{}, 0)
  1246. fsiOperationDtosData := make(map[string]interface{})
  1247. fsiOperationDtosDatas := make([]map[string]interface{}, 0)
  1248. //就诊信息
  1249. fisEncounterDtosData["mdtrt_id"] = fed.MdtrtID
  1250. fisEncounterDtosData["medins_id"] = fed.MedinsID
  1251. fisEncounterDtosData["medins_name"] = fed.MedinsName
  1252. fisEncounterDtosData["medins_admdvs"] = fed.MedinsAdmdvs
  1253. fisEncounterDtosData["medins_type"] = fed.MedinsType
  1254. fisEncounterDtosData["medins_lv"] = fed.MedinsLv
  1255. fisEncounterDtosData["wardarea_codg"] = fed.WardareaCodg
  1256. fisEncounterDtosData["wardno"] = fed.Wardno
  1257. fisEncounterDtosData["bedno"] = fed.Bedno
  1258. fisEncounterDtosData["adm_date"] = fed.AdmDate
  1259. fisEncounterDtosData["dscg_date"] = fed.DscgDate
  1260. fisEncounterDtosData["dscg_main_dise_codg"] = fed.DscgMainDiseCodg
  1261. fisEncounterDtosData["dscg_main_dise_name"] = fed.DscgMainDiseName
  1262. for _, fdd := range fdds {
  1263. fsiDiagnoseDtosData := make(map[string]interface{})
  1264. //诊断集合
  1265. fsiDiagnoseDtosData["dise_id"] = fdd.DiseID
  1266. fsiDiagnoseDtosData["inout_dise_type"] = fdd.InoutDiseType
  1267. fsiDiagnoseDtosData["maindise_flag"] = fdd.MaindiseFlag
  1268. fsiDiagnoseDtosData["dias_srt_no"] = fdd.DiasSrtNo
  1269. fsiDiagnoseDtosData["dise_codg"] = fdd.DiseCodg
  1270. fsiDiagnoseDtosData["dise_name"] = fdd.DiseName
  1271. fsiDiagnoseDtosData["dise_date"] = fdd.DiseDate
  1272. fsiDiagnoseDtosDatas = append(fsiDiagnoseDtosDatas, fsiDiagnoseDtosData)
  1273. }
  1274. fisEncounterDtosData["fsi_diagnose_dtos"] = fsiDiagnoseDtosDatas
  1275. fisEncounterDtosData["dr_codg"] = fed.DrCodg
  1276. fisEncounterDtosData["adm_dept_codg"] = fed.AdmDeptCodg
  1277. fisEncounterDtosData["adm_dept_name"] = fed.AdmDeptName
  1278. fisEncounterDtosData["dscg_dept_codg"] = fed.DscgDeptCodg
  1279. fisEncounterDtosData["dscg_dept_name"] = fed.DscgDeptName
  1280. fisEncounterDtosData["med_mdtrt_type"] = fed.MedMdtrtType
  1281. fisEncounterDtosData["med_type"] = fed.MedType
  1282. for _, fod := range fods {
  1283. fsiOrderDtosData := make(map[string]interface{})
  1284. //医嘱集合
  1285. fsiOrderDtosData["rx_id"] = fod.RxID
  1286. fsiOrderDtosData["rxno"] = fod.Rxno
  1287. fsiOrderDtosData["grpno"] = fod.Grpno
  1288. fsiOrderDtosData["long_drord_flag"] = fod.LongDrordFlag
  1289. fsiOrderDtosData["hilist_type"] = fod.HilistType
  1290. fsiOrderDtosData["chrg_type"] = fod.ChrgType
  1291. fsiOrderDtosData["drord_bhvr"] = fod.DrordBhvr
  1292. fsiOrderDtosData["hilist_code"] = fod.HilistCode
  1293. fsiOrderDtosData["hilist_name"] = fod.HilistName
  1294. fsiOrderDtosData["hilist_dosform"] = fod.HilistDosform
  1295. fsiOrderDtosData["hilist_lv"] = fod.HilistLv
  1296. fsiOrderDtosData["hilist_pric"] = fod.HilistPric
  1297. fsiOrderDtosData["lv1_hosp_item_pric"] = fod.Lv1HospItemPric
  1298. fsiOrderDtosData["lv2_hosp_item_pric"] = fod.Lv2HospItemPric
  1299. fsiOrderDtosData["lv3_hosp_item_pric"] = fod.Lv3HospItemPric
  1300. fsiOrderDtosData["hilist_memo"] = fod.HilistMemo
  1301. fsiOrderDtosData["hosplist_code"] = fod.HosplistCode
  1302. fsiOrderDtosData["hosplist_name"] = fod.HosplistName
  1303. fsiOrderDtosData["hosplist_dosform"] = fod.HosplistDosform
  1304. fsiOrderDtosData["cnt"] = fod.Cnt
  1305. fsiOrderDtosData["pric"] = fod.Pric
  1306. fsiOrderDtosData["sumamt"] = fod.Sumamt
  1307. fsiOrderDtosData["ownpay_amt"] = fod.OwnpayAmt
  1308. fsiOrderDtosData["selfpay_amt"] = fod.SelfpayAmt
  1309. fsiOrderDtosData["spec"] = fod.Spec
  1310. fsiOrderDtosData["spec_unt"] = fod.SpecUnt
  1311. fsiOrderDtosData["drord_begn_date"] = fod.DrordBegnDate
  1312. fsiOrderDtosData["drord_stop_date"] = fod.DrordStopDate
  1313. fsiOrderDtosData["drord_dept_codg"] = fod.DrordDeptCodg
  1314. fsiOrderDtosData["drord_dept_name"] = fod.DrordDeptName
  1315. fsiOrderDtosData["drord_dr_codg"] = fod.DrordDrCodg
  1316. fsiOrderDtosData["drord_dr_name"] = fod.DrordDrName
  1317. fsiOrderDtosData["drord_dr_profttl"] = fod.DrordDrProfttl
  1318. fsiOrderDtosData["curr_drord_flag"] = fod.CurrDrordFlag
  1319. fsiOrderDtosDatas = append(fsiOrderDtosDatas, fsiOrderDtosData)
  1320. }
  1321. fisEncounterDtosData["fsi_order_dtos"] = fsiOrderDtosDatas
  1322. fisEncounterDtosData["matn_stas"] = fed.MatnStas
  1323. fisEncounterDtosData["medfee_sumamt"] = fed.MedfeeSumamt
  1324. fisEncounterDtosData["ownpay_amt"] = fed.OwnpayAmt
  1325. fisEncounterDtosData["selfpay_amt"] = fed.SelfpayAmt
  1326. fisEncounterDtosData["acct_payamt"] = fed.AcctPayamt
  1327. fisEncounterDtosData["ma_amt"] = fed.MaAmt
  1328. fisEncounterDtosData["hifp_payamt"] = fed.HifpPayamt
  1329. fisEncounterDtosData["setl_totlnum"] = fed.SetlTotlnum
  1330. fisEncounterDtosData["insutype"] = fed.Insutype
  1331. fisEncounterDtosData["reim_flag"] = fed.ReimFlag
  1332. fisEncounterDtosData["out_setl_flag"] = fed.OutSetlFlag
  1333. //手术操作
  1334. for _, fopd := range fopds {
  1335. fsiOperationDtosData["setl_list_oprn_id"] = fopd.Setl_list_oprn_id
  1336. fsiOperationDtosData["oprn_code"] = fopd.Oprn_code
  1337. fsiOperationDtosData["oprn_name"] = fopd.Oprn_name
  1338. fsiOperationDtosData["main_oprn_flag"] = fopd.Main_oprn_flag
  1339. fsiOperationDtosData["oprn_date"] = fopd.Oprn_date
  1340. fsiOperationDtosData["anst_way"] = fopd.Anst_way
  1341. fsiOperationDtosData["oper_dr_name"] = fopd.Oper_dr_name
  1342. fsiOperationDtosData["oper_dr_code"] = fopd.Oper_dr_code
  1343. fsiOperationDtosData["anst_dr_name"] = fopd.Anst_dr_name
  1344. fsiOperationDtosData["anst_dr_code"] = fopd.Anst_dr_code
  1345. fsiOperationDtosDatas = append(fsiOperationDtosDatas, fsiOperationDtosData)
  1346. }
  1347. fisEncounterDtosData["fsi_operation_dtos"] = fsiOperationDtosDatas
  1348. patientDtosinputData["patn_id"] = pd.PatnID
  1349. patientDtosinputData["patn_name"] = pd.PatnName
  1350. patientDtosinputData["gend"] = pd.Gend
  1351. patientDtosinputData["brdy"] = pd.Brdy
  1352. patientDtosinputData["poolarea"] = pd.Poolarea
  1353. patientDtosinputData["curr_mdtrt_id"] = pd.CurrMdtrtID
  1354. patientDtosinputData["fsi_his_data_dto"] = ""
  1355. patientDtosinputData["fsi_encounter_dtos"] = fisEncounterDtosData
  1356. inputData["syscode"] = "LinkDialysis"
  1357. inputData["trig_scen"] = trig_scen
  1358. inputData["rule_ids"] = ""
  1359. inputData["task_id"] = ""
  1360. inputData["patient_dtos"] = patientDtosinputData
  1361. input["data"] = inputData
  1362. inputMessage["infno"] = "3102"
  1363. inputMessage["input"] = input //交易输入
  1364. bytesData, err := json.Marshal(inputMessage)
  1365. fmt.Println(string(bytesData))
  1366. if err != nil {
  1367. fmt.Println(err.Error())
  1368. return err.Error(), ""
  1369. }
  1370. params.RequestUrl = params.RequestUrl + "3102"
  1371. return HttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1372. }
  1373. func Jsyb4101(struct4101 Struct4101, params models.PublicParams) (string, string) {
  1374. timestamp := time.Now().Unix()
  1375. inputMessage := SetJSInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
  1376. // 生成输入报文
  1377. input := make(map[string]interface{})
  1378. inputData := make(map[string]interface{})
  1379. inputMessage["infno"] = "4101A" // 交易编码
  1380. year := time.Now().Format("2006")
  1381. month := time.Now().Format("01")
  1382. day := time.Now().Format("02")
  1383. inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
  1384. inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
  1385. inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
  1386. inputData["fixmedins_name"] = params.FixmedinsName // 定点医药机构名称 必填
  1387. inputData["fixmedins_code"] = params.FixmedinsCode // 定点医药机构编码 必填
  1388. inputData["hi_setl_lv"] = "" // 医保结算等级
  1389. inputData["hi_no"] = struct4101.PsnNo // 医保编号
  1390. inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
  1391. inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
  1392. inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
  1393. inputData["gend"] = struct4101.Gend // 性别 必填
  1394. inputData["brdy"] = struct4101.Brdy // 出生日期 必填
  1395. inputData["age"] = struct4101.Age // 年龄 必填
  1396. inputData["ntly"] = struct4101.Ntly // 国籍 必填
  1397. inputData["nwb_age"] = "" // 年龄 必填
  1398. inputData["naty"] = struct4101.Naty // 民族 必填
  1399. inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
  1400. inputData["certno"] = struct4101.Certno // 证件号码 必填
  1401. inputData["prfs"] = struct4101.Prfs // 职业 必填
  1402. inputData["curr_addr"] = "" // 现住址 必填
  1403. inputData["emp_name"] = "" // 单位名称 必填
  1404. inputData["emp_addr"] = "" // 单位地址 必填
  1405. inputData["emp_tel"] = "" // 单位电话 必填
  1406. inputData["poscode"] = "" // 邮编 必填
  1407. inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
  1408. inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
  1409. inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
  1410. inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
  1411. inputData["hi_type"] = struct4101.HiType // 医保类型 必填
  1412. inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
  1413. inputData["sp_psn_type"] = "" // 特殊人员类型 必填
  1414. inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
  1415. inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
  1416. inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
  1417. inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
  1418. inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
  1419. inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
  1420. inputData["adm_way"] = "" // 入院途径 必填
  1421. inputData["trt_type"] = "" // 治疗类别 必填
  1422. inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
  1423. inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
  1424. inputData["refldept_dept"] = "" // 转科科别 必填
  1425. inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
  1426. inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
  1427. inputData["act_ipt_days"] = "" // 实际住院天数 必填
  1428. inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
  1429. inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
  1430. inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
  1431. inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
  1432. inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
  1433. inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
  1434. inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
  1435. inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
  1436. inputData["bld_cat"] = "" // 输血品种 必填
  1437. inputData["bld_amt"] = "" // 输血量 必填
  1438. inputData["bld_unt"] = "" // 输血计量单位 必填
  1439. inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
  1440. inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
  1441. inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
  1442. inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
  1443. inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
  1444. inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
  1445. inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
  1446. inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
  1447. inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
  1448. inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
  1449. inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
  1450. inputData["chfpdr_name"] = "" // 主诊医师姓名 必填
  1451. inputData["chfpdr_code"] = "" // 主诊医师代码 必填
  1452. inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
  1453. inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
  1454. inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
  1455. inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
  1456. inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
  1457. inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
  1458. inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
  1459. inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
  1460. inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
  1461. inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
  1462. inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
  1463. payinfo := make([]map[string]interface{}, 0) // 基金支付信息
  1464. for _, item := range struct4101.CustomStruct {
  1465. payinfotemp := make(map[string]interface{})
  1466. 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" {
  1467. payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
  1468. payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
  1469. payinfo = append(payinfo, payinfotemp)
  1470. }
  1471. }
  1472. opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
  1473. opspdiseinfotemp := make(map[string]interface{})
  1474. opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 诊断名称 必填
  1475. opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 诊断代码 必填
  1476. opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
  1477. opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
  1478. opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
  1479. diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
  1480. for _, item := range struct4101.Diseinfo {
  1481. diseinfotemp := make(map[string]interface{})
  1482. diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
  1483. diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
  1484. diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
  1485. diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
  1486. diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
  1487. diseinfo = append(diseinfo, diseinfotemp)
  1488. }
  1489. iteminfo := make([]map[string]interface{}, 0)
  1490. for _, item := range struct4101.IteminfoStruct {
  1491. iteminfotemp := make(map[string]interface{})
  1492. iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
  1493. iteminfotemp["amt"] = item.Amt // 金额 必填
  1494. iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
  1495. iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
  1496. iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
  1497. iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
  1498. iteminfo = append(iteminfo, iteminfotemp)
  1499. }
  1500. oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
  1501. oprninfotemp := make(map[string]interface{})
  1502. oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
  1503. oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
  1504. oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
  1505. oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
  1506. oprninfotemp["anst_way"] = "" // 麻醉方式 必填
  1507. oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
  1508. oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
  1509. oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
  1510. oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
  1511. oprninfo = append(oprninfo, oprninfotemp)
  1512. icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
  1513. icuinfotemp := make(map[string]interface{})
  1514. icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
  1515. icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
  1516. icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
  1517. icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
  1518. icuinfo = append(icuinfo, icuinfotemp)
  1519. input["setlinfo"] = inputData
  1520. input["payinfo"] = payinfo
  1521. input["opspdiseinfo"] = opspdiseinfo
  1522. input["diseinfo"] = diseinfo
  1523. input["iteminfo"] = iteminfo
  1524. inputMessage["input"] = input //交易输入
  1525. bytesData, _ := json.Marshal(inputMessage)
  1526. fmt.Println(string(bytesData))
  1527. params.RequestUrl = params.RequestUrl + "4101A"
  1528. return HttpRequest(params.RequestUrl, params.AccessKey, params.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1529. }
  1530. func Jsyb3501(struct3501 models.Struct3501) (string, string) {
  1531. timestamp := time.Now().Unix()
  1532. // 生成输入报文
  1533. inputMessage := SetJSInputMessage(timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Cainfo)
  1534. input := make(map[string]interface{})
  1535. inputData := make(map[string]interface{})
  1536. inputMessage["infno"] = "3501" // 交易编码
  1537. inputData["med_list_codg"] = struct3501.MedListCodg // 定点医药机构目录编号
  1538. inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
  1539. inputData["fixmedins_hilist_name"] = struct3501.OrgName // 定点医药机构目录名称
  1540. inputData["rx_flag"] = struct3501.RxFlag //
  1541. inputData["invdate"] = struct3501.Invdate // 人员编号 (来自1101接口返回)
  1542. inputData["inv_cnt"] = struct3501.InvCnt // 人员编号 (来自1101接口返回)
  1543. inputData["manu_lotnum"] = struct3501.ManuLotnum // 人员编号 (来自1101接口返回)
  1544. inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1545. inputData["manu_date"] = struct3501.ManuDate // 人员编号 (来自1101接口返回)
  1546. inputData["expy_end"] = struct3501.ExpyEnd // 人员编号 (来自1101接口返回)
  1547. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  1548. input["invinfo"] = inputData
  1549. inputMessage["input"] = input //交易输入
  1550. bytesData, err := json.Marshal(inputMessage)
  1551. fmt.Println(string(bytesData))
  1552. if err != nil {
  1553. fmt.Println(err.Error())
  1554. return err.Error(), ""
  1555. }
  1556. struct3501.RequestUrl = struct3501.RequestUrl + "3501"
  1557. return HttpRequest(struct3501.RequestUrl, struct3501.AccessKey, struct3501.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1558. }
  1559. func Jsyb3502(struct3502 models.Struct3502) (string, string) {
  1560. timestamp := time.Now().Unix()
  1561. // 生成输入报文
  1562. inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
  1563. input := make(map[string]interface{})
  1564. inputData := make(map[string]interface{})
  1565. inputMessage["infno"] = "3502" // 交易编码
  1566. inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
  1567. inputData["inv_chg_type"] = struct3502.InvChgType // 定点医药机构目录编号
  1568. inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
  1569. inputData["fixmedins_hilist_name"] = struct3502.OrgName // 定点医药机构目录名称
  1570. inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1571. inputData["pric"] = struct3502.Pric // 人员编号 (来自1101接口返回)
  1572. inputData["cnt"] = struct3502.Cnt // 人员编号 (来自1101接口返回)
  1573. inputData["rx_flag"] = struct3502.RxFlag //
  1574. inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
  1575. inputData["inv_chg_opter_name"] = "" // 人员编号 (来自1101接口返回)
  1576. inputData["memo"] = struct3502.Memo // 人员编号 (来自1101接口返回)
  1577. inputData["trdn_flag"] = "" // 人员编号 (来自1101接口返回)
  1578. input["invinfo"] = inputData
  1579. inputMessage["input"] = input //交易输入
  1580. bytesData, err := json.Marshal(inputMessage)
  1581. fmt.Println(string(bytesData))
  1582. if err != nil {
  1583. fmt.Println(err.Error())
  1584. return err.Error(), ""
  1585. }
  1586. struct3502.RequestUrl = struct3502.RequestUrl + "3502"
  1587. return HttpRequest(struct3502.RequestUrl, struct3502.AccessKey, struct3502.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1588. }
  1589. func Jsyb3503(struct3503 models.Struct3503) (string, string) {
  1590. timestamp := time.Now().Unix()
  1591. // 生成输入报文
  1592. fmt.Println(struct3503)
  1593. inputMessage := SetJSInputMessage(timestamp, struct3503.OrgName, struct3503.Opter, struct3503.FixmedinsHilistId, struct3503.InsuplcAdmdvs, struct3503.MdtrtareaAdmvs, struct3503.Cainfo)
  1594. input := make(map[string]interface{})
  1595. inputMessage["infno"] = "3503"
  1596. item := struct3503
  1597. feedetailInfo := make(map[string]interface{})
  1598. feedetailInfo["med_list_codg"] = item.MedListCodg
  1599. feedetailInfo["fixmedins_hilist_id"] = item.FixmedinsHilistId
  1600. feedetailInfo["fixmedins_hilist_name"] = item.FixmedinsHilistName
  1601. feedetailInfo["dynt_no"] = ""
  1602. feedetailInfo["fixmedins_bchno"] = item.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1603. feedetailInfo["spler_name"] = item.SplerName // 人员编号 (来自1101接口返回)
  1604. feedetailInfo["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
  1605. feedetailInfo["manu_lotnum"] = item.ManuLotnum // 人员编号 (来自1101接口返回)
  1606. feedetailInfo["prodentp_name"] = item.ProdentpName // 人员编号 (来自1101接口返回)
  1607. feedetailInfo["aprvno"] = item.Aprvno // 人员编号 (来自1101接口返回)
  1608. feedetailInfo["manu_date"] = item.ManuDate // 人员编号 (来自1101接口返回)
  1609. feedetailInfo["expy_end"] = item.ExpyEnd // 人员编号 (来自1101接口返回)
  1610. feedetailInfo["finl_trns_pric"] = item.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1611. feedetailInfo["purc_retn_cnt"] = item.PurcRetnCnt // 人员编号 (来自1101接口返回)
  1612. feedetailInfo["purc_invo_codg"] = item.PurcInvoCodg // 人员编号 (来自1101接口返回)
  1613. feedetailInfo["purc_invo_no"] = item.PurcInvoNo // 人员编号 (来自1101接口返回)
  1614. feedetailInfo["rx_flag"] = item.RxFlag // 人员编号 (来自1101接口返回)
  1615. feedetailInfo["purc_retn_stoin_time"] = item.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
  1616. feedetailInfo["purc_retn_opter_name"] = item.PurcRetnOpterName // 人员编号 (来自1101接口返回)
  1617. feedetailInfo["prod_geay_flag"] = "" // 人员编号 (来自1101接口返回)
  1618. feedetailInfo["memo"] = "" // 人员编号 (来自1101接口返回)
  1619. input["purcinfo"] = feedetailInfo
  1620. inputMessage["input"] = input //交易输入
  1621. bytesData, err := json.Marshal(inputMessage)
  1622. fmt.Println(string(bytesData))
  1623. if err != nil {
  1624. fmt.Println(err.Error())
  1625. return err.Error(), ""
  1626. }
  1627. struct3503.RequestUrl = struct3503.RequestUrl + "3503"
  1628. return HttpRequest(struct3503.RequestUrl, struct3503.AccessKey, struct3503.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1629. }
  1630. func Jsyb3504(struct3504 models.Struct3504) (string, string) {
  1631. timestamp := time.Now().Unix()
  1632. // 生成输入报文
  1633. inputMessage := SetJSInputMessage(timestamp, struct3504.OrgName, struct3504.Opter, struct3504.FixmedinsCode, struct3504.InsuplcAdmdvs, struct3504.MdtrtareaAdmvs, struct3504.Cainfo)
  1634. input := make(map[string]interface{})
  1635. inputData := make(map[string]interface{})
  1636. inputMessage["infno"] = "3504" // 交易编码
  1637. inputData["med_list_codg"] = struct3504.MedListCodg // 定点医药机构目录编号
  1638. inputData["fixmedins_hilist_id"] = struct3504.FixmedinsHilistId // 定点医药机构目录编号
  1639. inputData["fixmedins_hilist_name"] = struct3504.FixmedinsHilistName // 定点医药机构目录名称
  1640. inputData["fixmedins_bchno"] = struct3504.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1641. inputData["spler_name"] = struct3504.SplerName // 人员编号 (来自1101接口返回)
  1642. inputData["spler_pmtno"] = "" // 人员编号 (来自1101接口返回)
  1643. inputData["manu_date"] = struct3504.ManuDate // 人员编号 (来自1101接口返回)
  1644. inputData["expy_end"] = struct3504.ExpyEnd // 人员编号 (来自1101接口返回)
  1645. inputData["finl_trns_pric"] = struct3504.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1646. inputData["purc_retn_cnt"] = struct3504.PurcRetnCnt // 人员编号 (来自1101接口返回)
  1647. inputData["purc_invo_codg"] = struct3504.PurcInvoCodg // 人员编号 (来自1101接口返回)
  1648. inputData["purc_invo_no"] = struct3504.PurcInvoNo // 人员编号 (来自1101接口返回)
  1649. inputData["rx_flag"] = struct3504.RxFlag // 人员编号 (来自1101接口返回)
  1650. inputData["purc_retn_stoin_time"] = struct3504.PurcRetnStoinTime // 人员编号 (来自1101接口返回)
  1651. inputData["purc_retn_opter_name"] = struct3504.PurcRetnOpterName // 人员编号 (来自1101接口返回)
  1652. inputData["medins_prod_purc_no"] = "" // 人员编号 (来自1101接口返回)
  1653. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  1654. input["purcinfo"] = inputData
  1655. inputMessage["input"] = input //交易输入
  1656. bytesData, err := json.Marshal(inputMessage)
  1657. fmt.Println(string(bytesData))
  1658. if err != nil {
  1659. fmt.Println(err.Error())
  1660. return err.Error(), ""
  1661. }
  1662. struct3504.RequestUrl = struct3504.RequestUrl + "3504"
  1663. return HttpRequest(struct3504.RequestUrl, struct3504.AccessKey, struct3504.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1664. }
  1665. func Jsyb3505(struct3505 models.Struct3505) (string, string) {
  1666. timestamp := time.Now().Unix()
  1667. // 生成输入报文
  1668. inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
  1669. input := make(map[string]interface{})
  1670. inputData := make(map[string]interface{})
  1671. inputMessage["infno"] = "3505" // 交易编码
  1672. inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号
  1673. inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
  1674. inputData["fixmedins_hilist_name"] = struct3505.OrgName // 定点医药机构目录名称
  1675. inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1676. inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
  1677. inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回)
  1678. inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回)
  1679. inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回)
  1680. inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回)
  1681. inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回)
  1682. inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
  1683. inputData["hi_feesetl_type"] = struct3505.HiFeesetlType // 人员编号 (来自1101接口返回)
  1684. inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回)
  1685. inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回)
  1686. inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回)
  1687. inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
  1688. inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回)
  1689. inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回)
  1690. inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回)
  1691. inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回)
  1692. inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回)
  1693. inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回)
  1694. inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
  1695. inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1696. inputData["rxno"] = struct3505.Rxno // 人员编号 (来自1101接口返回)
  1697. inputData["rx_circ_flag"] = struct3505.RxCircFlag // 人员编号 (来自1101接口返回)
  1698. inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
  1699. inputData["stoout_no"] = struct3505.StooutNo // 人员编号 (来自1101接口返回)
  1700. inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
  1701. inputData["drug_trac_codg"] = struct3505.DrugTracCodg // 人员编号 (来自1101接口返回)
  1702. inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回)
  1703. inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回)
  1704. inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回)
  1705. inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回)
  1706. inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
  1707. inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回)
  1708. input["selinfo"] = inputData
  1709. inputMessage["input"] = input //交易输入
  1710. bytesData, err := json.Marshal(inputMessage)
  1711. fmt.Println(string(bytesData))
  1712. if err != nil {
  1713. fmt.Println(err.Error())
  1714. return err.Error(), ""
  1715. }
  1716. struct3505.RequestUrl = struct3505.RequestUrl + "3505"
  1717. return HttpRequest(struct3505.RequestUrl, struct3505.AccessKey, struct3505.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1718. }
  1719. func Jsyb3506(struct3506 models.Struct3506) (string, string) {
  1720. timestamp := time.Now().Unix()
  1721. // 生成输入报文
  1722. inputMessage := SetJSInputMessage(timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsCode, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Cainfo)
  1723. input := make(map[string]interface{})
  1724. inputData := make(map[string]interface{})
  1725. inputMessage["infno"] = "3506" // 交易编码
  1726. inputData["med_list_codg"] = struct3506.MedListCodg // 定点医药机构目录编号
  1727. inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
  1728. inputData["fixmedins_hilist_name"] = struct3506.OrgName // 定点医药机构目录名称
  1729. inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno // 人员编号 (来自1101接口返回)
  1730. inputData["setl_id"] = struct3506.SetlId // 人员编号 (来自1101接口返回)
  1731. inputData["psn_no"] = struct3506.PsnNo // 人员编号 (来自1101接口返回)
  1732. inputData["psn_cert_type"] = struct3506.PsnCertType // 人员编号 (来自1101接口返回)
  1733. inputData["certno"] = struct3506.Certno // 人员编号 (来自1101接口返回)
  1734. inputData["psn_name"] = struct3506.PsnName // 人员编号 (来自1101接口返回)
  1735. inputData["manu_lotnum"] = struct3506.ManuLotnum // 人员编号 (来自1101接口返回)
  1736. inputData["manu_date"] = struct3506.ManuDate // 人员编号 (来自1101接口返回)
  1737. inputData["expy_end"] = struct3506.ExpyEnd // 人员编号 (来自1101接口返回)
  1738. inputData["rx_flag"] = struct3506.RxFlag // 人员编号 (来自1101接口返回)
  1739. inputData["trdn_flag"] = struct3506.TrdnFlag // 人员编号 (来自1101接口返回)
  1740. inputData["finl_trns_pric"] = struct3506.FinlTrnsPric // 人员编号 (来自1101接口返回)
  1741. inputData["sel_retn_cnt"] = struct3506.SelRetnCnt // 人员编号 (来自1101接口返回)
  1742. inputData["sel_retn_time"] = struct3506.SelRetnTime // 人员编号 (来自1101接口返回)
  1743. inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回)
  1744. inputData["memo"] = "" // 人员编号 (来自1101接口返回)
  1745. inputData["medins_prod_sel_no"] = "" // 人员编号 (来自1101接口返回)
  1746. input["selinfo"] = inputData
  1747. inputMessage["input"] = input //交易输入
  1748. bytesData, err := json.Marshal(inputMessage)
  1749. fmt.Println(string(bytesData))
  1750. if err != nil {
  1751. fmt.Println(err.Error())
  1752. return err.Error(), ""
  1753. }
  1754. struct3506.RequestUrl = struct3506.RequestUrl + "3506"
  1755. return HttpRequest(struct3506.RequestUrl, struct3506.AccessKey, struct3506.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1756. }
  1757. func Jsyb3507(struct3507 models.Struct3507) (string, string) {
  1758. timestamp := time.Now().Unix()
  1759. // 生成输入报文
  1760. inputMessage := SetJSInputMessage(timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Cainfo)
  1761. input := make(map[string]interface{})
  1762. inputData := make(map[string]interface{})
  1763. inputMessage["infno"] = "3507" // 交易编码
  1764. inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
  1765. inputData["inv_data_type"] = struct3507.InvDataType // 人员编号 (来自1101接口返回)
  1766. input["data"] = inputData
  1767. inputMessage["input"] = input //交易输入
  1768. bytesData, err := json.Marshal(inputMessage)
  1769. fmt.Println(string(bytesData))
  1770. if err != nil {
  1771. fmt.Println(err.Error())
  1772. return err.Error(), ""
  1773. }
  1774. struct3507.RequestUrl = struct3507.RequestUrl + "3507"
  1775. return HttpRequest(struct3507.RequestUrl, struct3507.AccessKey, struct3507.SecretKey, timestamp, string(bytesData)), string(bytesData)
  1776. }