ahyb_service.go 151KB

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