jx_service.go 99KB

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