12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281 |
- package service
-
- import (
- "bytes"
- "gdyb/models"
- "github.com/astaxie/beego"
- "github.com/axgle/mahonia"
- "golang.org/x/text/encoding/simplifiedchinese"
- "io/ioutil"
- "net/http"
- "regexp"
- "strconv"
- "strings"
- "syscall"
- "time"
- "unsafe"
- )
-
- //import (
- // "os/exec"
- // "time"
- //)
-
- //
- import (
- "encoding/json"
- "fmt"
- "os/exec"
- )
-
- // 人员基本信息
- func FJyb1101(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string, name string, id_card_no string) (string, string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //生成输入报文
-
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, "", mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = card_sn // 卡识别码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = "" // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- }
- }
- inputData["certno"] = id_card_no // 证件号码
-
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = name // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, inputLog, err_msg
- }
- func FJybidcomfirm(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string, name string) (string, string, string) {
- //生成签名
- //nonce := GetRandomString(32)
- //timestamp := time.Now().Unix()
- //生成输入报文
-
- //i nputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
- //input := make(map[string]interface{})
- inputMessage := make(map[string]interface{})
-
- inputData := make(map[string]interface{})
- inputMessage["funid"] = "yb04.10.01.16" // 交易编码
- inputMessage["info"] = "" // 交易编码
-
- inputData["bkz543"] = "" // 就诊凭证类型
- inputData["aaz501"] = card_sn // 卡识别码
- inputData["bke284"] = "01" // 人员证件类型
- inputData["aaz500"] = certNo // 就诊凭证编号
- inputData["aac002"] = certNo // 证件号码
- inputData["aac003"] = name // 人员姓名
- inputMessage["data"] = inputData //交易输入
-
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, inputLog, err_msg
- }
-
- func FJyb1101ForEleToken(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, id_card_type int64, card_sn string, certificates int64, url string, app_id string, app_secret string, sign_key string, enc_key string, token string, name string) (string, string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //生成输入报文
-
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
- inputData["psn_name"] = "" // 人员姓名
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = card_sn // 卡识别码
- inputData["psn_cert_type"] = "" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- inputData["psn_name"] = "" // 人员姓名
-
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["mdtrt_cert_no"] = token // 就诊凭证编号
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["psn_name"] = name // 人员姓名
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["psn_cert_type"] = "01" // 人员证件类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- inputData["psn_name"] = "" // 人员姓名
-
- }
- }
- inputData["certno"] = certNo // 证件号码
-
- inputData["begntime"] = "" // 开始时间
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var inputLog string
- bytesData, err := json.Marshal(inputMessage)
- inputLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, inputLog, err_msg
- }
-
- // 门诊挂号
- func FJyb2201(psnNo string, insutype string, certNo string, org_name string, doctor 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, opter string, doctor_name string, url string, app_id string, app_secret string, sign_key string, enc_key string, card_number string, record_time string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2201" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
- inputData["begntime"] = record_time + " " + strings.Split(timeFormatOne, " ")[1] // 开始时间
-
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = card_number // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = card_number // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = card_number // 就诊凭证编号
- }
-
- inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
- inputData["atddr_no"] = doctor_id // 医师编码
- inputData["dr_name"] = doctor_name // 医师姓名
- inputData["dept_code"] = dept_code // 科室编码
- inputData["dept_name"] = dept // 科室名称
- inputData["caty"] = "A03.06" // 科别
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- return output, requestLog, err_msg
- }
-
- // 门诊挂号撤销
- func FJyb2202(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, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2202" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["ipt_otp_no"] = ipt_otp_no // 住院/门诊号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var requestLog string
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- return output, requestLog, err_msg
- }
-
- // 门诊就诊信息上传
- func FJyb2203(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, begin_time string, doctor_name string, opter string, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- diseinfo := make([]map[string]interface{}, 0)
-
- inputMessage["infno"] = "2203A" // 交易编码
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- //inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
- inputData["begntime"] = begin_time // 开始时间
- //inputData["begntime"] = // 开始时间
- inputData["main_cond_dscr"] = "" // 主要病情描述
- inputData["dise_codg"] = sick_code // 病种编码
- inputData["dise_name"] = sick_name // 病种名称
- inputData["birctrl_type"] = "" // 计划生育手术类别
- inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
-
- if insuplc_admdvs == "421300" {
- if med_type == "11" || med_type == "1111" || med_type == "1112" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
-
- for index, item := range config {
- diseinfo_sun := make(map[string]interface{})
- diseinfo_sun["diag_type"] = "1" // 诊断类别
- diseinfo_sun["diag_srt_no"] = index + 1 // 诊断排序号
- diseinfo_sun["diag_code"] = item.CountryCode // 诊断代码
- diseinfo_sun["diag_name"] = item.ClassName // 诊断名称
- diseinfo_sun["diag_dept"] = department // 诊断科室
- diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
- diseinfo_sun["dise_dor_name"] = doctor_name // 诊断医生姓名
- diseinfo_sun["diag_time"] = begin_time + " " + strings.Split(timeFormatOne, " ")[1] // 诊断时间
- diseinfo_sun["vali_flag"] = "1" // 有效标志
- diseinfo = append(diseinfo, diseinfo_sun)
- }
-
- input["diseinfo"] = diseinfo
- input["mdtrtinfo"] = inputData
- inputMessage["input"] = input //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- return output, requestLog, err_msg
- }
-
- // 门诊费用明细信息上传
- func FJyb2204(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, opter string, url string, app_id string, app_secret string, sign_key string, enc_key string, dise_code string, doctor_number string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- var customs []*Custom
-
- for _, item := range hisPrescription {
- tm := time.Unix(item.PreTime, 0)
-
- if item.Type == 1 { //药品
-
- for _, subItem := range item.HisDoctorAdviceInfo {
- if len(subItem.BaseDrugLib.MedicalInsuranceNumber) > 0 {
- //var randNum int
- //randNum = rand.Intn(10000) + 1000
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*subItem.PrescribingNumber),
- Cut: fmt.Sprintf("%.2f", subItem.PrescribingNumber),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", subItem.Price),
- MedListCodg: subItem.BaseDrugLib.MedicalInsuranceNumber,
- HospApprFlag: subItem.BaseDrugLib.HospApprFlag,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- Unit: subItem.PrescribingNumberUnit,
- }
-
- customs = append(customs, cus)
- }
- }
- }
-
- if item.Type == 2 { //项目
- for _, subItem := range item.HisPrescriptionProject {
- //var randNum int
- //randNum = rand.Intn(10000) + 1000
- if subItem.Type == 2 {
- if len(subItem.HisProject.MedicalCode) > 0 {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
-
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
- Cut: fmt.Sprintf("%.2f", cnt),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
- MedListCodg: subItem.HisProject.MedicalCode,
- HospApprFlag: -1,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- Unit: subItem.HisProject.Unit,
- }
- customs = append(customs, cus)
- }
-
- } else if subItem.Type == 3 {
- if len(subItem.GoodInfo.MedicalInsuranceNumber) > 0 {
- cnt, _ := strconv.ParseFloat(subItem.Count, 64)
-
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*cnt),
- Cut: fmt.Sprintf("%.2f", cnt),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
- MedListCodg: subItem.GoodInfo.MedicalInsuranceNumber,
- HospApprFlag: -1,
- FeeOcurTime: tm.Format("2006-01-02 15:04:05"),
- Unit: subItem.GoodInfo.PackingUnit,
- }
- customs = append(customs, cus)
- }
-
- }
-
- }
- }
-
- for _, subItem := range item.HisAdditionalCharge {
- if len(subItem.XtHisAddtionConfig.Code) > 0 {
- cus := &Custom{
- DetItemFeeSumamt: fmt.Sprintf("%.2f", subItem.Price*float64(subItem.Count)),
- Cut: fmt.Sprintf("%.2f", float64(subItem.Count)),
- FeedetlSn: subItem.FeedetlSn,
- Price: fmt.Sprintf("%.2f", float64(subItem.Price)),
- MedListCodg: subItem.XtHisAddtionConfig.Code,
- HospApprFlag: -1,
- }
- customs = append(customs, cus)
- }
- }
- }
-
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, opter, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- feedetail := make([]map[string]interface{}, 0)
- inputMessage["infno"] = "2204" // 交易编码
-
- //chrg_bchno := timeFormat + strconv.FormatInt(int64(chrgBchno), 10)
- for _, item := range customs {
- feedetailInfo := make(map[string]interface{})
- subfeedetail := make(map[string]interface{})
- feedetailInfo["feedetl_sn"] = item.FeedetlSn
- feedetailInfo["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- feedetailInfo["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- feedetailInfo["chrg_bchno"] = chrg_bchno // 收费批次号
- feedetailInfo["dise_codg"] = dise_code // 病种编码
- feedetailInfo["rxno"] = "" // 处方号
- feedetailInfo["rx_circ_flag"] = "0" // 外购处方标志
- feedetailInfo["fee_ocur_time"] = item.FeeOcurTime // 费用发生时间
- feedetailInfo["med_list_codg"] = item.MedListCodg // 医疗目录编码
- feedetailInfo["medins_list_codg"] = fixmedins_code // 医药机构目录编码
- feedetailInfo["det_item_fee_sumamt"] = item.DetItemFeeSumamt // 明细项目费用总额
- feedetailInfo["cnt"] = item.Cut // 数量
- feedetailInfo["pric"] = item.Price // 单价
- feedetailInfo["sin_dos_dscr"] = "" // 单次剂量描述
- feedetailInfo["used_frqu_dscr"] = "" // 使用频次描述
- feedetailInfo["prd_days"] = "0" // 周期天数
- feedetailInfo["medc_way_dscr"] = "" // 用药途径描述
- feedetailInfo["bilg_dept_codg"] = dept_code // 开单科室编码
- feedetailInfo["bilg_dept_name"] = dept // 开单科室名称
- feedetailInfo["bilg_dr_codg"] = doctor_number // 开单医生编码
- feedetailInfo["bilg_dr_name"] = doctor // 开单医师姓名
- feedetailInfo["acord_dept_codg"] = "" // 受单科室编码
- feedetailInfo["acord_dept_name"] = "" // 受单科室名称
- feedetailInfo["orders_dr_code"] = "" // 受单医生编码
- feedetailInfo["orders_dr_name"] = "" // 受单医生姓名
- subfeedetail["prcunt"] = item.Unit
- feedetailInfo["exp_content"] = subfeedetail // 中药使用方式
-
- if balance_accounts_type == "8" {
- feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
- } else {
-
- if item.HospApprFlag != -1 {
- if item.HospApprFlag == 1 {
- feedetailInfo["hosp_appr_flag"] = "0" // 医院审批标志
- } else if item.HospApprFlag == 2 {
- feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
- } else if item.HospApprFlag == 3 {
- feedetailInfo["hosp_appr_flag"] = "2" // 医院审批标志
- } else {
- feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
- }
- } else {
- feedetailInfo["hosp_appr_flag"] = "1" // 医院审批标志
- }
-
- }
-
- feedetailInfo["tcmdrug_used_way"] = "" // 中药使用方式
- feedetailInfo["etip_flag"] = "" // 外检标志
- feedetailInfo["etip_hosp_code"] = "" // 外检医院编码
- feedetailInfo["dscg_tkdrug_flag"] = "" // 出院带药标志
- feedetailInfo["matn_fee_flag"] = "" // 生育费用标志
- feedetail = append(feedetail, feedetailInfo)
- }
- input["feedetail"] = feedetail
- inputMessage["input"] = input //交易输入
- var requestLog string
- bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return "", "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- return output, requestLog, err_msg
-
- }
-
- // 门诊费用明细信息撤销
- func FJyb2205(psnNo string, mdtrtId string, chrgBchno string, org_name string, doctor string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, fixmedins_code string, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2205" // 交易编码
-
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
-
- var requestLog string
- requestLog = string(bytesData)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- return output, requestLog, err_msg
- }
-
- // 门诊预结算
- func FJyb2206(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, url string, app_id string, app_secret string, sign_key string, enc_key string, acct_used_flag string) (string, string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2206" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
- }
- if med_type == "1111" || med_type == "1112" {
-
- med_type = "11"
- }
-
- if insuplc_admdvs == "421300" {
- if med_type == "11" || med_type == "1111" || med_type == "1112" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
-
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
-
- inputData2 := make(map[string]interface{})
- inputData2["trum_flag"] = "0"
- inputData2["rel_ttp_flag"] = ""
- inputData2["otp_er_refl_flag"] = ""
-
- inputData["exp_content"] = inputData2 // 发票号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var requestLog string
-
- bytesData, err := json.Marshal(inputMessage)
-
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- return output, requestLog, err_msg
- }
-
- func FJyb2206ForToken(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, url string, app_id string, app_secret string, sign_key string, enc_key string, acct_used_flag string) (string, string, string) {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2206" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
- }
- if med_type == "1111" || med_type == "1112" {
-
- med_type = "11"
- }
-
- if insuplc_admdvs == "421300" {
- if med_type == "11" || med_type == "1111" || med_type == "1112" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140110" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
-
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- var requestLog string
-
- bytesData, err := json.Marshal(inputMessage)
-
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- return output, requestLog, err_msg
- }
-
- // 门诊结算
- func FJyb2207(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, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2207" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
- }
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
-
- if insuplc_admdvs == "421300" {
- if med_type == "11" || med_type == "1111" || med_type == "1112" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
-
- inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
- inputData["overlmt_selfpay"] = overlmt_selfpay //
- inputData["preselfpay_amt"] = preselfpay_amt //
- inputData["inscp_scp_amt"] = inscp_scp_amt //
-
- inputData2 := make(map[string]interface{})
- inputData2["trum_flag"] = "0"
- inputData2["rel_ttp_flag"] = ""
- inputData2["otp_er_refl_flag"] = ""
- inputData["exp_content"] = inputData2 // 发票号
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- var requestLog string
- requestLog = string(bytesData)
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
- }
-
- func FJyb2207ForToken(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, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2207" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- } else if id_card_type == 4 {
- inputData["mdtrt_cert_type"] = "01" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- }
- }
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
-
- if insuplc_admdvs == "421300" {
- if med_type == "11" || med_type == "1111" || med_type == "1112" {
- inputData["med_type"] = "110104" // 医疗类别 11 普通门诊 12 门诊挂号
- } else if med_type == "14" {
- inputData["med_type"] = "140101" // 医疗类别 11 普通门诊 12 门诊挂号
- }
- } else {
- inputData["med_type"] = med_type // 医疗类别 11 普通门诊 12 门诊挂号
- }
- inputData["medfee_sumamt"] = total // 医疗费总额
- inputData["psn_setlway"] = "01" // 个人结算方式 01 按项目结 02 按定额结算
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["chrg_bchno"] = chrgBchno // 收费批次号(来自2204生成的)
- inputData["acct_used_flag"] = acct_used_flag // 个人账户使用标志 0否 1是
- inputData["insutype"] = insutype // 险种类型
- inputData["invono"] = "" // 发票号
-
- inputData["fulamt_ownpay_amt"] = fulamt_ownpay_amt //
- inputData["overlmt_selfpay"] = overlmt_selfpay //
- inputData["preselfpay_amt"] = preselfpay_amt //
- inputData["inscp_scp_amt"] = inscp_scp_amt //
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- var requestLog string
- requestLog = string(bytesData)
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
- }
-
- // 门诊结算撤销
- func FJyb2208(psnNo string, mdtrtId string, setlId string, org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
-
- //inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2208" // 交易编码
-
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- inputData["setl_id"] = setlId // 结算 ID
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
- var requestLog string
- requestLog = string(bytesData)
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
- }
-
- func FJyb5203(baseParams models.BaseParams, businessParams models.BusinessParams, url string, app_id string, app_secret string, sign_key string, enc_key string) (string, string, string) {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
-
- inputMessage := SetFjInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs, url, app_id, app_secret, sign_key, enc_key)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5203" // 交易编码
- inputData["psn_no"] = businessParams.PsnNo
- inputData["setl_id"] = businessParams.SetlId
- inputData["mdtrt_id"] = businessParams.MdtrtId
- //inputData["med_type"] = med_type
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
-
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- var requestLog string
- requestLog = string(bytesData)
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
- }
-
- // 确认订单
- func FJyb6201(org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, order models.HisOrder, url string, app_id string, app_secret string, sign_key string, enc_key string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetFjInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs, url, app_id, app_secret, sign_key, enc_key)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "6201" // 交易编码
-
- inputData["mdtrt_id"] = order.MdtrtId
- inputData["chrg_bchno"] = order.Number
- inputData["psn_no"] = order.PsnNo
- inputData["psn_name"] = order.PsnName
- inputData["psn_cert_type"] = order.PsnCertType
- inputData["certno"] = order.Certno
- inputData["insutype"] = order.Insutype
- inputData["med_type"] = order.MedType
- inputData["medfee_sumamt"] = order.MedfeeSumamt
- inputData["fulamt_ownpay_amt"] = order.FulamtOwnpayAmt
- inputData["overlmt_selfpay"] = order.OverlmtSelfPay
- inputData["preselfpay_amt"] = order.PreselfpayAmt
- inputData["inscp_scp_amt"] = order.InscpScpAmt
- inputData["act_pay_dedc"] = order.ActPayDedc
- inputData["hifp_pay"] = order.HifpPay
- inputData["pool_prop_selfpay"] = order.PoolPropSelfpay
- inputData["cvlserv_pay"] = order.CvlservPay
- inputData["hifes_pay"] = order.HifesPay
- inputData["hifmi_pay"] = order.HifmiPay
- inputData["hifob_pay"] = order.HifobPay
- inputData["maf_pay"] = order.MafPay
- inputData["oth_pay"] = order.OthPay
- inputData["fund_pay_sumamt"] = order.FundPaySumamt
- inputData["psn_part_amt"] = order.PsnPartAmt
- inputData["acct_pay"] = order.AcctPay
- inputData["psn_cash_pay"] = order.PsnCashPay
- inputData["hosp_part_amt"] = order.HospPartAmt
- inputData["acct_mulaid_pay"] = order.AcctMulaidPay
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url = gdyb_url + "6201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/6201"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/6201"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2207"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- // 医药机构费用结算对总账 func Gdyb3201( org_name string, doctor string, secret_key string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
- func FJyb3201(baseParams models.BaseParams, businessParams models.BusinessParams, med string, fund string) (string, string, string) {
-
- fmt.Println(baseParams)
- fmt.Println(businessParams)
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3201" // 交易编码
- inputMessage["url"] = baseParams.RequestUrl // 险种
- inputMessage["app_id"] = baseParams.AppID // 险种
- inputMessage["app_secret"] = baseParams.AppSecret // 险种
- inputMessage["sign_key"] = baseParams.SignKey // 险种
- inputMessage["enc_key"] = baseParams.EncKey // 险种
-
- inputData["insutype"] = businessParams.Insutype // 险种
- fmt.Println(businessParams.ClrType)
- if len(businessParams.ClrType) > 0 {
- inputData["clr_type"] = "9903"
- } else {
-
- inputData["clr_type"] = "11"
-
- }
- // 就诊 ID(来自2201接口返回)
- inputData["setl_optins"] = "350581" // 结算经办机构
- inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
- inputData["medfee_sumamt"] = med //医疗费总额
- inputData["fund_pay_sumamt"] = fund //基金支付总额
- inputData["acct_pay"] = businessParams.AcctPay //个人账户支付金额
- inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
- inputData["refd_setl_flag"] = "0" // 就诊 ID(来自2201接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- var requestLog string
- requestLog = string(bytesData)
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
-
- }
-
- // 文件上传
- // 文件上传
- func FJyb9101(baseParams models.BaseParams, file_name string, file_byte []byte) string {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- buf := new(bytes.Buffer)
- buf.ReadFrom(strings.NewReader(string(file_byte)))
-
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
-
- inputMessage["infno"] = "9101" // 交易编码
- inputData["file_name"] = file_name //文件名
- inputData["in"] = file_byte //文件数据
- inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
-
- input["fsUploadIn"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9101"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "9101"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func FJyb9102(baseParams models.BaseParams, file_name string, file_qury_no string) string {
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "9102" // 交易编码
- inputData["file_name"] = file_name //文件名
- inputData["file_qury_no"] = file_qury_no //文件数据
-
- inputData["fixmedins_code"] = baseParams.FixmedinsCode //编码
- input["fsDownloadIn"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "9102"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/9102"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/9102"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func FJyb3202(baseParams models.BaseParams, businessParams models.BusinessParams) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3202" // 交易编码
- inputData["file_qury_no"] = businessParams.FileQuryNo // 险种
- inputData["setl_optins"] = baseParams.InsuplcAdmdvs // 结算经办机构
- inputData["stmt_begndate"] = businessParams.StmtBegndate // 对帐开始时间
- inputData["stmt_enddate"] = businessParams.StmtEnddate //对帐结束时间
- inputData["medfee_sumamt"] = businessParams.MedfeeSumamt //医疗费总额
- inputData["fund_pay_sumamt"] = businessParams.FundPaySumamt //基金支付总额
- inputData["cash_payamt"] = businessParams.CashPayamt //现金支付金额
- inputData["fixmedins_setl_cnt"] = businessParams.FixmedinsSetlCnt //定点医药机构结算笔数
- inputData["clr_type"] = "11" // 就诊 ID(来自2201接口返回)
- inputData["refd_setl_flag"] = 1 // 就诊 ID(来自2201接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "3202"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3202"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3202"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- //func Hbyb2001(baseParams models.BaseParams, psn_no string, insutype string, med_type string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, baseParams.SecretKey)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "2001" // 交易编码
- // inputData["psn_no"] = psn_no
- // inputData["insutype"] = insutype
- // inputData["med_type"] = med_type
- // inputData["begntime"] = "2021-01-01 00:00:00"
- // input["data"] = inputData
- // inputMessage["input"] = input //交易输入
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
- //
- // gdyb_url := beego.AppConfig.String("gdyb_url")
- // gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- // url := gdyb_url + "2001"
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", gdyb_paasid)
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // str := string(respBytes)
- // fmt.Println(str)
- // return str
- //}
-
- func FJyb3301(baseParams *models.BaseParams, name string, codg string, list_type_code string, start_time string, ent_time string, list_type string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3301" // 交易编码
- inputData["fixmedins_hilist_id"] = codg
- inputData["fixmedins_hilist_name"] = name
- inputData["list_type"] = list_type
- inputData["med_list_codg"] = codg
- inputData["begndate"] = start_time
- inputData["enddate"] = ent_time
-
- inputData["aprvno"] = ""
- inputData["dosform"] = ""
- inputData["exct_cont"] = ""
- inputData["item_cont"] = ""
- inputData["prcunt"] = ""
- inputData["spec"] = ""
- inputData["pacspec"] = ""
- inputData["memo"] = ""
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3301"
- //
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3301"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "3301"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func FJyb3302(baseParams *models.BaseParams, name string, codg string, list_type_code string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, baseParams.SecretKey)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, baseParams.OrgName, baseParams.Doctor, baseParams.FixmedinsCode, baseParams.InsuplcAdmdvs, baseParams.MdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3302" // 交易编码
- inputData["fixmedins_code"] = baseParams.FixmedinsCode
- inputData["fixmedins_hilist_id"] = codg
- inputData["list_type"] = list_type_code
- inputData["med_list_codg"] = codg
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/3302"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/3302"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "3302"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func FJyb2505(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, start_time string, end_time string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2505"
- inputData["psn_no"] = psnNo
- inputData["biz_appy_type"] = "03"
- inputData["begndate"] = start_time
- inputData["enddate"] = end_time
- inputData["fixmedins_code"] = fixmedins_code
- inputData["fixmedins_name"] = org_name
- inputData["tel"] = ""
- inputData["addr"] = ""
- inputData["agnter_name"] = ""
- inputData["agnter_cert_type"] = ""
- inputData["agnter_certno"] = ""
- inputData["agnter_tel"] = ""
- inputData["agnter_addr"] = ""
- inputData["agnter_rlts"] = ""
- inputData["fix_srt_no"] = ""
- inputData["memo"] = ""
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2505"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2505"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "2505"
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func FJyb2506(psnNo string, doctor string, org_name string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2506"
- inputData["psn_no"] = psnNo
- inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn
- inputData["memo"] = ""
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2506"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2506"
-
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "2506"
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func FJyb2503(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) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- timeFormatTwo := tempTime.Format("2006-01-02")
-
- t := time.Now()
- last := time.Date(t.Year(), time.December, 31, 0, 0, 0, 0, time.UTC)
- tm := time.Unix(last.Unix(), 0)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2503" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["insutype"] = insutype // 险种类型(来自1101接口返回)
- inputData["opsp_dise_code"] = sick_code // 险种类型(来自1101接口返回)
- inputData["opsp_dise_name"] = sick_name // 险种类型(来自1101接口返回)
- inputData["insu_optins"] = insuplc_admdvs // 险种类型(来自1101接口返回)
- inputData["ide_fixmedins_no"] = fixmedins_code // 险种类型(来自1101接口返回)
- inputData["ide_fixmedins_name"] = org_name // 险种类型(来自1101接口返回)
- inputData["hosp_ide_date"] = timeFormatTwo // 险种类型(来自1101接口返回)
- inputData["diag_dr_codg"] = doctor_id // 开始时间
- inputData["diag_dr_name"] = doctor // 开始时间
- inputData["begndate"] = timeFormatTwo // 医师编码
- inputData["tel"] = "" // 医师编码
- inputData["addr"] = "" // 医师编码
- inputData["enddate"] = tm.Format("2006-01-02") // 医师编码
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2503"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2503"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "2503"
-
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
- func FJyb2504(psnNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, trt_dcla_detl_sn string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2504" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- inputData["trt_dcla_detl_sn"] = trt_dcla_detl_sn // 人员编号 (来自1101接口返回)
- inputData["memo"] = "撤销备案" // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2504"
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2504"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "2504"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- //func Gdyb2503(psnNo string, doctor string, department string, diag string, org_name string, med_type string, doctor_id int64, fixmedins_code string, diag_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, sick_code string, sick_name string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, secret_key)
- // tempTime := time.Unix(timestamp, 0)
- // timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // diseinfo := make([]map[string]interface{}, 0)
- //
- // inputMessage["infno"] = "2203" // 交易编码
- // inputData["mdtrt_id"] = mdtrtId // 就诊 ID(来自2201接口返回)
- // inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- // inputData["med_type"] = med_type // 医疗类别 16门诊特殊病
- // inputData["begntime"] = timeFormatOne // 开始时间
- // inputData["main_cond_dscr"] = "" // 主要病情描述
- // inputData["dise_codg"] = sick_code // 病种编码
- // inputData["dise_name"] = sick_name // 病种名称
- // inputData["birctrl_type"] = "" // 计划生育手术类别
- // inputData["birctrl_matn_date"] = "" // 计划生育手术或生育日期
- //
- // diseinfo_sun := make(map[string]interface{})
- // diseinfo_sun["diag_type"] = "1" // 诊断类别
- // diseinfo_sun["diag_srt_no"] = "1" // 诊断排序号
- // diseinfo_sun["diag_code"] = diag_code // 诊断代码
- // diseinfo_sun["diag_name"] = diag // 诊断名称
- // diseinfo_sun["diag_dept"] = department // 诊断科室
- // diseinfo_sun["dise_dor_no"] = doctor_id // 诊断医生编码
- // diseinfo_sun["dise_dor_name"] = doctor // 诊断医生姓名
- // diseinfo_sun["diag_time"] = timeFormatOne // 诊断时间
- // diseinfo_sun["vali_flag"] = "1" // 有效标志
- //
- // diseinfo = append(diseinfo, diseinfo_sun)
- // input["diseinfo"] = diseinfo
- // input["mdtrtinfo"] = inputData
- // inputMessage["input"] = input //交易输入
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- //
- // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/2203"
- //
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/2203"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", "sg03_prd")
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // str := string(respBytes)
- // fmt.Println(str)
- // return str
- //}
-
- func FJyb5301(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) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //tempTime := time.Unix(timestamp, 0)
- //timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- //timeFormatTwo := tempTime.Format("2006-01-02")
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "5301" // 交易编码
- inputData["psn_no"] = psnNo // 人员编号 (来自1101接口返回)
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/5301"
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "5301"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- func Fjyb4101(struct4101 Struct4101, params models.PublicParams) (string, string, string) {
- timestamp := time.Now().Unix()
- inputMessage := SetHnInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
- // 生成输入报文
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "4101A" // 交易编码
- year := time.Now().Format("2006")
- month := time.Now().Format("01")
- day := time.Now().Format("02")
-
- inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
- inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
- inputData["psn_no"] = struct4101.PsnNo // 结算 ID 必填
-
- inputData["fixmedins_name"] = params.FixmedinsName // 定点医药机构名称 必填
- inputData["fixmedins_code"] = params.FixmedinsCode // 定点医药机构编码 必填
- inputData["hi_setl_lv"] = "" // 医保结算等级
- inputData["hi_no"] = struct4101.PsnNo // 医保编号
- inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
- inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
- inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
- inputData["gend"] = struct4101.Gend // 性别 必填
- inputData["brdy"] = struct4101.Brdy // 出生日期 必填
- inputData["age"] = struct4101.Age // 年龄 必填
- inputData["ntly"] = struct4101.Ntly // 国籍 必填
-
- inputData["nwb_age"] = "" // 年龄 必填
- inputData["naty"] = struct4101.Naty // 民族 必填
- inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
- inputData["certno"] = struct4101.Certno // 证件号码 必填
- inputData["prfs"] = struct4101.Prfs // 职业 必填
- inputData["curr_addr"] = "" // 现住址 必填
- inputData["emp_name"] = "" // 单位名称 必填
- inputData["emp_addr"] = "" // 单位地址 必填
- inputData["emp_tel"] = "" // 单位电话 必填
- inputData["poscode"] = "" // 邮编 必填
- inputData["coner_name"] = "" // 联系人姓名 必填
- inputData["patn_rlts"] = "" // 与患者关系 必填
- inputData["coner_addr"] = "" // 联系人地址 必填
- inputData["coner_tel"] = "" // 联系人电话 必填
- inputData["hi_type"] = struct4101.HiType // 医保类型 必填
- inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
- inputData["sp_psn_type"] = "" // 特殊人员类型 必填
- inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
- inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
- inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
- inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
- inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
- inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
- inputData["adm_way"] = "" // 入院途径 必填
- inputData["trt_type"] = "" // 治疗类别 必填
- inputData["adm_time"] = struct4101.AdmTime // 入院时间 必填
- inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
- inputData["refldept_dept"] = "" // 转科科别 必填
- inputData["dscg_time"] = struct4101.AdmEndTime // 出院时间 必填
- inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
- inputData["act_ipt_days"] = "" // 实际住院天数 必填
- inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
- inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
- inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
- inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
- inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
- inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
- inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
- inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
- inputData["bld_cat"] = "" // 输血品种 必填
- inputData["bld_amt"] = "" // 输血量 必填
- inputData["bld_unt"] = "" // 输血计量单位 必填
- inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
- inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
- inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
- inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
- inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
- inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
- inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
- inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
- inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
- inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
- inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
- inputData["chfpdr_name"] = struct4101.DoctorName // 主诊医师姓名 必填
- inputData["chfpdr_code"] = struct4101.DoctorCode // 主诊医师代码 必填
- inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
- inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
- inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
- inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
- inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
- inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
- inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
- inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
- inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
- inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
- inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
-
- payinfo := make([]map[string]interface{}, 0) // 基金支付信息
- for _, item := range struct4101.CustomStruct {
- payinfotemp := make(map[string]interface{})
- 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" {
- payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
- payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
- payinfo = append(payinfo, payinfotemp)
- }
- }
- opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
-
- opspdiseinfotemp := make(map[string]interface{})
- opspdiseinfotemp["diag_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 诊断名称 必填
- opspdiseinfotemp["diag_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 诊断代码 必填
- opspdiseinfotemp["oprn_oprt_name"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagName // 手术操作名称 必填
- opspdiseinfotemp["oprn_oprt_code"] = struct4101.OpspdiseinfoStruct[len(struct4101.OpspdiseinfoStruct)-1].DiagCode // 手术操作代码 必填
- opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
-
- diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
- for _, item := range struct4101.Diseinfo {
- diseinfotemp := make(map[string]interface{})
- diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
- diseinfotemp["diag_type"] = item.DiagType // 诊断类别 必填
- diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
- diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
- diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
- diseinfo = append(diseinfo, diseinfotemp)
- }
-
- iteminfo := make([]map[string]interface{}, 0)
- for _, item := range struct4101.IteminfoStruct {
- iteminfotemp := make(map[string]interface{})
- iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
- iteminfotemp["amt"] = item.Amt // 金额 必填
- iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
- iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
- iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
- iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
- iteminfo = append(iteminfo, iteminfotemp)
- }
-
- oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
- oprninfotemp := make(map[string]interface{})
- oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
- oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
- oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
- oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
- oprninfotemp["anst_way"] = "" // 麻醉方式 必填
- oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
- oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
- oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
- oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
- oprninfo = append(oprninfo, oprninfotemp)
-
- icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
- icuinfotemp := make(map[string]interface{})
- icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
- icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
- icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
- icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
- icuinfo = append(icuinfo, icuinfotemp)
- input["setlinfo"] = inputData
- input["payinfo"] = payinfo
- input["opspdiseinfo"] = opspdiseinfo
- input["diseinfo"] = diseinfo
- input["iteminfo"] = iteminfo
-
- inputMessage["input"] = input //交易输入
- bytesData, _ := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- var requestLog string
- requestLog = string(bytesData)
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
- }
-
- func Fjyb4102(psn_no string, SetlId string, params models.PublicParams, stas_type string) (string, string, string) {
- timestamp := time.Now().Unix()
- inputMessage := SetHnInputMessage(timestamp, params.FixmedinsName, params.OpterName, params.FixmedinsCode, params.InsuplcAdmdvs, params.MdtrtareaAdmvs, params.Cainfo)
- // 生成输入报文
- input := make(map[string]interface{})
- input2 := make(map[string]interface{})
-
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "4102" // 交易编码
-
- inputData["setl_id"] = SetlId // 结算 ID 必填
- inputData["psn_no"] = psn_no // 结算 ID 必填
- inputData["stas_type"] = stas_type // 结算 ID 必填
- input2["stastinfo"] = inputData
- input["data"] = input2
- inputMessage["input"] = input //交易输入
- bytesData, _ := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- var requestLog string
- requestLog = string(bytesData)
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
- }
-
- //
- //func Hbyb4101(struct4101 Struct4101, secret_key string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, secret_key)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "4101" // 交易编码
- //
- // year := time.Now().Format("2006")
- // month := time.Now().Format("01")
- // day := time.Now().Format("02")
- //
- // inputData["mdtrt_id"] = struct4101.MdtrtId // 就诊 ID 必填(来自2201接口返回)
- // inputData["setl_id"] = struct4101.SetlId // 结算 ID 必填
- // inputData["fixmedins_name"] = org_name // 定点医药机构名称 必填
- // inputData["fixmedins_code"] = fixmedins_code // 定点医药机构编码 必填
- // inputData["hi_setl_lv"] = "" // 医保结算等级
- // inputData["hi_no"] = "" // 医保编号
- // inputData["medcasno"] = struct4101.PsnNo // 病案号 必填
- // inputData["dcla_time"] = year + "-" + month + "-" + day // 申报时间 必填
- // inputData["psn_name"] = struct4101.PsnName // 人员姓名 必填
- // inputData["gend"] = struct4101.Gend // 性别 必填
- // inputData["brdy"] = struct4101.Brdy // 出生日期 必填
- // inputData["age"] = struct4101.Age // 年龄 必填
- // inputData["ntly"] = struct4101.Ntly // 国籍 必填
- // inputData["nwb_age"] = "" // 年龄 必填
- // inputData["naty"] = struct4101.Naty // 民族 必填
- // inputData["patn_cert_type"] = struct4101.PatnCertType // 患者证件类别 必填
- // inputData["certno"] = struct4101.Certno // 证件号码 必填
- // inputData["prfs"] = struct4101.Prfs // 职业 必填
- // inputData["curr_addr"] = "" // 现住址 必填
- // inputData["emp_name"] = "" // 单位名称 必填
- // inputData["emp_addr"] = "" // 单位地址 必填
- // inputData["emp_tel"] = "" // 单位电话 必填
- // inputData["poscode"] = "" // 邮编 必填
- // inputData["coner_name"] = struct4101.ConerName // 联系人姓名 必填
- // inputData["patn_rlts"] = struct4101.PatnRlts // 与患者关系 必填
- // inputData["coner_addr"] = struct4101.ConerAddr // 联系人地址 必填
- // inputData["coner_tel"] = struct4101.ConerTel // 联系人电话 必填
- // inputData["hi_type"] = struct4101.HiType // 医保类型 必填
- // inputData["insuplc"] = struct4101.Insuplc // 参保地 必填
- // inputData["sp_psn_type"] = "" // 特殊人员类型 必填
- // inputData["nwb_adm_type"] = "" // 新生儿入院类型 必填
- // inputData["nwb_bir_wt"] = "" // 新生儿出生体重 必填
- // inputData["nwb_adm_wt"] = "" // 新生儿入院体重 必填
- // inputData["opsp_diag_caty"] = "" // 门诊慢特病诊断 必填
- // inputData["opsp_mdtrt_date"] = "" // 门诊慢特病就诊日期 必填
- // inputData["ipt_med_type"] = struct4101.IptMedType // 住院医疗类型 必填
- // inputData["adm_way"] = "" // 入院途径 必填
- // inputData["trt_type"] = "" // 治疗类别 必填
- // inputData["adm_time"] = "" // 入院时间 必填
- // inputData["adm_caty"] = struct4101.AdmCaty // 入院科别 必填
- // inputData["refldept_dept"] = "" // 转科科别 必填
- // inputData["dscg_time"] = "" // 出院时间 必填
- // inputData["dscg_caty"] = struct4101.AdmCaty // 出院科别 必填
- // inputData["act_ipt_days"] = "" // 实际住院天数 必填
- // inputData["otp_wm_dise"] = "" // 门(急) 诊西医诊断 必填
- // inputData["wm_dise_code"] = "" // 门(急) 诊中医诊断 必填
- // inputData["otp_tcm_dise"] = "" // 西医诊断疾病代码 必填
- // inputData["tcm_dise_code"] = "" // 中医诊断代码 必填
- // inputData["oprn_oprt_code_cnt"] = "" // 手术操作代码计数 必填
- // inputData["vent_used_dura"] = "" // 呼吸机使用时长 必填
- // inputData["pwcry_bfadm_coma_dura"] = "" // 颅脑损伤患者入院前昏迷时长 必填
- // inputData["pwcry_afadm_coma_dura"] = "" // 颅脑损伤患者入院后昏迷时长 必填
- // inputData["bld_cat"] = "" // 输血品种 必填
- // inputData["bld_amt"] = "" // 输血量 必填
- // inputData["bld_unt"] = "" // 输血计量单位 必填
- // inputData["spga_nurscare_days"] = "" // 特级护理天数 必填
- // inputData["lv1_nurscare_days"] = "" // 一级护理天数 必填
- // inputData["scd_nurscare_days"] = "" // 二级护理天数 必填
- // inputData["lv3_nurscare_days"] = "" // 三级护理天数 必填
- // inputData["acp_medins_name"] = "" // 拟接收机构名称 必填
- // inputData["acp_optins_code"] = "" // 拟接收机构代码 必填
- // inputData["bill_code"] = struct4101.BillCode // 票据代码 必填
- // inputData["bill_no"] = struct4101.BillNo // 票据号码 必填
- // inputData["biz_sn"] = struct4101.BizSn // 业务流水号 必填
- // inputData["days_rinp_flag_31"] = "" // 出院 31 天内再住院计划标志 必填
- // inputData["days_rinp_pup_31"] = "" // 出院 31 天内再住院目的 必填
- // inputData["chfpdr_name"] = "" // 主诊医师姓名 必填
- // inputData["chfpdr_code"] = "" // 主诊医师代码 必填
- // inputData["setl_begn_date"] = struct4101.SetlBegnDate // 结算开始日期 必填
- // inputData["setl_end_date"] = struct4101.SetlEndDate // 结算结束日期 必填
- // inputData["psn_selfpay"] = struct4101.PsnSelfPay // 个人自付 必填
- // inputData["psn_ownpay"] = struct4101.PsnOwnPay // 个人自费 必填
- // inputData["acct_pay"] = struct4101.AcctPay // 个人账户支出 必填
- // inputData["hi_paymtd"] = struct4101.HiPaymtd // 医保支付方式 必填
- // inputData["hsorg"] = struct4101.Hsorg // 医保机构 必填
- // inputData["hsorg_opter"] = struct4101.HsorgOpter // 医保机构经办人 必填
- // inputData["medins_fill_dept"] = struct4101.MedinsFillDept // 医疗机构填报部门 必填
- // inputData["medins_fill_psn"] = struct4101.MedinsFillPsn // 医疗机构填报人 必填
- // inputData["psn_cashpay"] = struct4101.PsnCashpay // 医疗机构填报人 必填
- //
- // payinfo := make([]map[string]interface{}, 0) // 基金支付信息
- // for _, item := range struct4101.CustomStruct {
- // payinfotemp := make(map[string]interface{})
- // 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" {
- // payinfotemp["fund_pay_type"] = item.FundPayType // 基金支付类型 必填
- // payinfotemp["fund_payamt"] = item.FundPayamt // 基金支付金额
- // payinfo = append(payinfo, payinfotemp)
- // }
- // }
- // opspdiseinfo := make([]map[string]interface{}, 0) // 门诊慢特病诊断信息
- // for _, item := range struct4101.OpspdiseinfoStruct {
- // opspdiseinfotemp := make(map[string]interface{})
- // opspdiseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
- // opspdiseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
- // opspdiseinfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
- // opspdiseinfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
- //
- // opspdiseinfo = append(opspdiseinfo, opspdiseinfotemp)
- // }
- //
- // diseinfo := make([]map[string]interface{}, 0) // 住院诊断信息
- // for _, item := range struct4101.OpspdiseinfoStruct {
- // fmt.Println(item.DiagName)
- // diseinfotemp := make(map[string]interface{})
- // diseinfotemp["maindiag_flag"] = item.MaindiagFlag // 手术操作代码 必填
- // diseinfotemp["diag_type"] = item.MaindiagFlag // 诊断类别 必填
- // diseinfotemp["diag_code"] = item.DiagCode // 诊断代码 必填
- // diseinfotemp["diag_name"] = item.DiagName // 诊断名称 必填
- // diseinfotemp["adm_cond_type"] = "3" // 入院病情类型 必填
- // diseinfo = append(diseinfo, diseinfotemp)
- // }
- //
- // iteminfo := make([]map[string]interface{}, 0) // 住院诊断信息
- // for _, item := range struct4101.IteminfoStruct {
- // iteminfotemp := make(map[string]interface{})
- // iteminfotemp["med_chrgitm"] = item.MedChrgitm // 医疗收费项目 必填
- // iteminfotemp["amt"] = item.Amt // 金额 必填
- // iteminfotemp["claa_sumfee"] = item.ClaaSumfee // 甲类费用合计 必填
- // iteminfotemp["clab_amt"] = item.ClabAmt // 乙类金额 必填
- // iteminfotemp["fulamt_ownpay_amt"] = item.FulamtOwnpayAmt // 全自费金额 必填
- // iteminfotemp["oth_amt"] = item.OthAmt // 其他金额 必填
- // iteminfo = append(iteminfo, iteminfotemp)
- // }
- //
- // oprninfo := make([]map[string]interface{}, 0) // 手术操作信息
- // oprninfotemp := make(map[string]interface{})
- // oprninfotemp["oprn_oprt_type"] = "" // 手术操作类别 必填
- // oprninfotemp["oprn_oprt_name"] = "" // 手术操作名称 必填
- // oprninfotemp["oprn_oprt_code"] = "" // 手术操作代码 必填
- // oprninfotemp["oprn_oprt_date"] = "" // 手术操作日期 必填
- // oprninfotemp["anst_way"] = "" // 麻醉方式 必填
- // oprninfotemp["oper_dr_name"] = "" // 术者医师姓名 必填
- // oprninfotemp["oper_dr_code"] = "" // 术者医师代码 必填
- // oprninfotemp["anst_dr_name"] = "" // 麻醉医师姓名 必填
- // oprninfotemp["anst_dr_code"] = "" // 麻醉医师代码 必填
- // oprninfo = append(oprninfo, oprninfotemp)
- //
- // icuinfo := make([]map[string]interface{}, 0) // 重症监护信息
- // icuinfotemp := make(map[string]interface{})
- // icuinfotemp["scs_cutd_ward_type"] = "" // 重症监护病房类型 必填
- // icuinfotemp["scs_cutd_inpool_time"] = "" // 重症监护进入时间 必填
- // icuinfotemp["scs_cutd_exit_time"] = "" // 重症监护退出时间 必填
- // icuinfotemp["scs_cutd_sum_dura"] = "" // 重症监护合计时长 必填
- // icuinfo = append(icuinfo, icuinfotemp)
- //
- // input["setlinfo"] = inputData
- // input["payinfo"] = payinfo
- // //input["opspdiseinfo"] = opspdiseinfo
- // input["diseinfo"] = diseinfo
- // input["iteminfo"] = iteminfo
- // //input["oprninfo"] = oprninfo
- // //input["icuinfo"] = icuinfo
- // inputMessage["input"] = input //交易输入
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- //
- // gdyb_url := beego.AppConfig.String("gdyb_url")
- // gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- // url := gdyb_url + "4101"
- //
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/4101"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", gdyb_paasid)
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // str := string(respBytes)
- // fmt.Println(str)
- // return str
- //}
-
- //func Gdyb1201(psnNo string, org_name string, doctor string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, "")
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "1201" // 交易编码
- // inputData["fixmedins_type"] = psnNo // 人员编号 (来自1101接口返回)
- // inputData["fixmedins_name"] = org_name // 人员编号 (来自1101接口返回)
- // inputData["fixmedins_code"] = "" // 人员编号 (来自1101接口返回)
- //
- // input["medinsinfo"] = inputData
- // inputMessage["input"] = input //交易输入
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- //
- // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", "test_hosp")
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // str := string(respBytes)
- // fmt.Println(str)
- // return str
- //}
-
- //func Gdyb5203(certNo string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
- // // 生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, secret_key)
- //
- // // 生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "5203" // 交易编码
- //
- // inputData["fixmedins_type"] = "1"
- // inputData["fixmedins_name"] = org_name
- // inputData["fixmedins_code"] = fixmedins_code
- // input["medinsinfo"] = inputData
- // inputMessage["input"] = input //交易输入
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1201"
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1201"
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", "sg03_prd")
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // fmt.Println(string(respBytes))
- // str := string(respBytes)
- // return str
- //}
-
- func FJyb2601(psnNo string, omsgid string, oinfno string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2601" // 交易编码
- inputData["psn_no"] = psnNo
- inputData["omsgid"] = omsgid
- inputData["oinfno"] = oinfno
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- url := gdyb_url + "2601"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- str := string(respBytes)
- fmt.Println(str)
- return str
- }
-
- // 人员信息版本3
- func FJyb1101B(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) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "01" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "1" // 人员证件类型
- }
- }
-
- inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- url := gdyb_url + "1101"
- fmt.Println(url)
- fmt.Println(gdyb_paasid)
- fmt.Println(secret_key)
- //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
-
- // 人员信息版本4
- func FJyb1101C(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) (string, string) {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "1101" // 交易编码
-
- if certificates == 3 {
- inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "99" // 人员证件类型
-
- } else {
- if id_card_type == 1 {
- inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = "" // 证件号码
- inputData["psn_cert_type"] = "" // 人员证件类型
-
- } else {
- inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- inputData["card_sn"] = "" // 卡识别码
- inputData["certno"] = certNo // 证件号码
- inputData["psn_cert_type"] = "1" // 人员证件类型
- }
- }
-
- inputData["mdtrt_cert_no"] = "" // 就诊凭证编号
- inputData["begntime"] = "" // 开始时间
- inputData["psn_name"] = "" // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
- fmt.Println(string(out))
- return string(out), string(bytesData)
- }
-
- func FJyb90991(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string, pwd string) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "90991" // 交易编码
-
- inputData["fixmedins_code"] = fixmedins_code // 就诊凭证编号
- inputData["psn_no"] = psn_no // 开始时间
- inputData["card_pwd"] = pwd // 人员姓名
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- url := gdyb_url + "90991"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
- func FJyb90100(psn_no string, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, secret_key string) string {
- //生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- signature := setSignature(timestamp, nonce, secret_key)
- //生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "90100" // 交易编码
- inputData["psn_no"] = psn_no // 开始时间
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- reader := bytes.NewReader(bytesData)
- gdyb_url := beego.AppConfig.String("gdyb_url")
- gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
-
- url := gdyb_url + "90100"
- request, err := http.NewRequest("POST", url, reader)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
-
- request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- request.Header.Set("x-tif-paasid", gdyb_paasid)
- request.Header.Set("x-tif-signature", signature)
- request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- request.Header.Set("x-tif-nonce", nonce)
-
- client := http.Client{}
- resp, err := client.Do(request)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- respBytes, err := ioutil.ReadAll(resp.Body)
- if err != nil {
- fmt.Println(err.Error())
- return err.Error()
- }
- fmt.Println(string(respBytes))
- str := string(respBytes)
- return str
- }
-
- //func StrPtr(s string) uintptr {
- // return uintptr(unsafe.Pointer(syscall.StringBytePtr(s)))
- //}
-
- func FJyb2001(secret_key string, org_name string, doctor_name string, code string, insuplcAdmdvs string, mdtrtareaAdmvs string, psn_no string, insutype string, med_type string) (string, string) {
- if med_type == "1111" || med_type == "1112" {
- med_type = "11"
- }
-
- // 生成签名
- nonce := GetRandomString(32)
- timestamp := time.Now().Unix()
- //signature := setSignature(timestamp, nonce, secret_key)
- tempTime := time.Unix(timestamp, 0)
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
-
- // 生成输入报文
- inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor_name, code, insuplcAdmdvs, mdtrtareaAdmvs)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "2001" // 交易编码
- inputData["psn_no"] = psn_no
- inputData["insutype"] = insutype
- inputData["med_type"] = med_type
- inputData["begntime"] = timeFormatOne
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), ""
- }
- var json2 string
- cmd := exec.Command("java", "-jar", "yh_hb_fat.jar", "1101", string(bytesData), json2)
- out, err := cmd.Output()
- if err != nil {
- fmt.Println("error:", err.Error())
- }
-
- return string(out), string(bytesData)
- }
-
- func SetFjInputMessage(nonce string, timestamp int64, org_name string, doctor string, fixmedins_code string, insuplc_admdvs string, mdtrtarea_admvs string, url string, app_id string, app_secret string, sign_key string, enc_key string) map[string]interface{} {
- // 生成签名
- tempTime := time.Unix(timestamp, 0)
- //timeFormat := tempTime.Format("20060102150405")
- timeFormatOne := tempTime.Format("2006-01-02 15:04:05")
- //randNum := rand.New(rand.NewSource(time.Now().UnixNano())).Int31n(10000)
-
- month := time.Unix(1557042972, 0).Format("1")
- year := time.Now().Format("2006")
- month = time.Now().Format("01")
- day := time.Now().Format("02")
-
- hour := time.Now().Format("15")
- min := time.Now().Format("04")
- sec := time.Now().Format("05")
-
- msec := time.Now().Format("000")
-
- // 生成输入报文
-
- inputMessage := make(map[string]interface{})
- inputMessage["msgid"] = fixmedins_code + year + month + day + hour + min + sec + msec + "0" // 发送方报文 ID
- inputMessage["mdtrtarea_admvs"] = mdtrtarea_admvs // 就医地医保区划
- inputMessage["insuplc_admdvs"] = insuplc_admdvs // 参保地医保区划
- inputMessage["recer_sys_code"] = "1" // 接收方系统代码
- inputMessage["dev_no"] = "" // 设备编号
- inputMessage["dev_safe_info"] = "" // 设备安全信息
- inputMessage["cainfo"] = "" // 数字签名信息
- inputMessage["signtype"] = "SM3" // 签名类型
- inputMessage["infver"] = "V1.0" // 接收方系统代码
- inputMessage["opter_type"] = "1" // 经办人类别
- inputMessage["opter"] = doctor // 经办人
- inputMessage["opter_name"] = doctor // 经办人姓名
- inputMessage["inf_time"] = timeFormatOne // 交易时间
- inputMessage["fixmedins_code"] = fixmedins_code // 定点医药机构编号
- inputMessage["fixmedins_name"] = org_name //定点医药机构名称
-
- inputMessage["url"] = url //定点医药机构名称
- inputMessage["app_id"] = app_id //定点医药机构名称
- inputMessage["app_secret"] = app_secret //定点医药机构名称
- inputMessage["sign_key"] = sign_key //定点医药机构名称
- inputMessage["enc_key"] = enc_key //定点医药机构名称
-
- if mdtrtarea_admvs == "440100" {
- inputMessage["sign_no"] = GetSignInInfo(fixmedins_code) //交易签到流水号
- } else {
- inputMessage["sign_no"] = "" //交易签到流水号
- }
- return inputMessage
- }
-
- //人员信息版本
- //func FjYB1101B(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) string {
- // //生成签名
- // nonce := GetRandomString(32)
- // timestamp := time.Now().Unix()
- // signature := setSignature(timestamp, nonce, secret_key)
- // //生成输入报文
- // inputMessage := SetInputMessage(nonce, timestamp, org_name, doctor, fixmedins_code, insuplc_admdvs, mdtrtarea_admvs)
- // input := make(map[string]interface{})
- // inputData := make(map[string]interface{})
- // inputMessage["infno"] = "1101" // 交易编码
- //
- // if certificates == 3 {
- // inputData["mdtrt_cert_type"] = "99" // 就诊凭证类型
- // inputData["certno"] = certNo // 证件号码
- // inputData["psn_cert_type"] = "99" // 人员证件类型
- //
- // } else {
- // if certificates == 1 {
- // if id_card_type == 1 {
- // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- // inputData["card_sn"] = "" // 卡识别码
- // inputData["certno"] = certNo // 证件号码
- // inputData["psn_cert_type"] = "01" // 人员证件类型
- // } else {
- // inputData["mdtrt_cert_type"] = "02" // 就诊凭证类型
- // inputData["card_sn"] = "" // 卡识别码
- // inputData["certno"] = certNo // 证件号码
- // inputData["psn_cert_type"] = "01" // 人员证件类型
- // }
- //
- // } else if certificates == 6 {
- // inputData["mdtrt_cert_type"] = "03" // 就诊凭证类型
- // inputData["card_sn"] = "" // 卡识别码
- // inputData["certno"] = certNo // 证件号码
- // inputData["psn_cert_type"] = "17" // 人员证件类型
- // }
- //
- // }
- //
- // inputData["mdtrt_cert_no"] = certNo // 就诊凭证编号
- // inputData["begntime"] = "" // 开始时间
- // inputData["psn_name"] = "" // 人员姓名
- // input["data"] = inputData
- // inputMessage["input"] = input //交易输入
- //
- // bytesData, err := json.Marshal(inputMessage)
- // fmt.Println(string(bytesData))
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // reader := bytes.NewReader(bytesData)
- // gdyb_url := beego.AppConfig.String("gdyb_url")
- // gdyb_paasid := beego.AppConfig.String("gdyb_paasid")
- //
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_api/prd/hsa/hgs/1101"
- // //url := gdyb_url + "1101"
- // var url string
- // if fixmedins_code == "H15049901371" {
- // url = gdyb_url
- // } else {
- // url = gdyb_url + "1101"
- // }
- //
- // fmt.Println(url)
- // fmt.Println(gdyb_paasid)
- // fmt.Println(secret_key)
- // //url := "http://igb.hsa.gdgov.cn/ebus/gdyb_inf/poc/hsa/hgs/1101"
- // request, err := http.NewRequest("POST", url, reader)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- //
- // request.Header.Set("Content-Type", "application/json;charset=UTF-8")
- // request.Header.Set("x-tif-paasid", gdyb_paasid)
- // request.Header.Set("x-tif-signature", signature)
- // request.Header.Set("x-tif-timestamp", strconv.FormatInt(timestamp, 10))
- // request.Header.Set("x-tif-nonce", nonce)
- //
- // client := http.Client{}
- // resp, err := client.Do(request)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // respBytes, err := ioutil.ReadAll(resp.Body)
- // if err != nil {
- // fmt.Println(err.Error())
- // return err.Error()
- // }
- // fmt.Println(string(respBytes))
- // str := string(respBytes)
- // return str
- //}
-
- func GetFjBusinessHandleInfo(inputStr []byte) (string, string) {
- DllDef := syscall.MustLoadDLL("chs_fjs_standard.dll")
- readCard := DllDef.MustFindProc("business_handle")
- if readCard == nil {
- fmt.Println("readcard is nil")
- readCard = DllDef.MustFindProc("read_cardinfo")
- }
- outputStr := make([]byte, 1002288)
- errMessageStr := make([]byte, 2048)
- ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&inputStr[0])), uintptr(20000), (uintptr)(unsafe.Pointer(&outputStr[0])), (uintptr)(unsafe.Pointer(&errMessageStr[0])))
-
- output_info := ConvertByte2String(outputStr, GB18030)
- error_info := ConvertByte2String(errMessageStr, GB18030)
- output_info = Remove0000(output_info)
- error_info = Remove0000(error_info)
-
- fmt.Println(output_info)
- fmt.Println(error_info)
-
- if ret2 != 0 {
- return "", ""
- }
- return DeleteExtraSpace(output_info), DeleteExtraSpace(error_info)
- }
-
- func GetFjAuthorizationInfo(org_id string) {
- DllDef := syscall.MustLoadDLL("chs_fjs_standard.dll")
- readCard := DllDef.MustFindProc("authorization")
- if readCard == nil {
- fmt.Println("readcard is nil")
- readCard = DllDef.MustFindProc("authorization")
- }
- errMessageStr := make([]byte, 2048)
- psw := org_id[len(org_id)-6 : len(org_id)]
- fmt.Println(psw)
- ret2, _, _ := readCard.Call(StrPtr(org_id), StrPtr(psw), (uintptr)(unsafe.Pointer(&errMessageStr[0])))
- fmt.Println(string(errMessageStr))
- if ret2 != 0 {
- }
- }
-
- func Remove0000(s string) string {
- str := make([]rune, 0, len(s))
- for _, v := range []rune(s) {
- if v == 0 {
- continue
- }
- str = append(str, v)
- }
- return string(str)
- }
-
- func ConvertByte2String(byte []byte, charset Charset) string {
-
- var str string
- switch charset {
- case GB18030:
- decodeBytes, _ := simplifiedchinese.GB18030.NewDecoder().Bytes(byte)
- str = string(decodeBytes)
- case UTF8:
- fallthrough
- default:
- str = string(byte)
- }
-
- return str
- }
-
- func DeleteExtraSpace(s string) string {
- //删除字符串中的多余空格,有多个空格时,仅保留一个空格
- s1 := strings.Replace(s, " ", " ", -1) //替换tab为空格
- regstr := "\\s{2,}" //两个及两个以上空格的正则表达式
- reg, _ := regexp.Compile(regstr) //编译正则表达式
- s2 := make([]byte, len(s1)) //定义字符数组切片
- copy(s2, s1) //将字符串复制到切片
- spc_index := reg.FindStringIndex(string(s2)) //在字符串中搜索
- for len(spc_index) > 0 { //找到适配项
- s2 = append(s2[:spc_index[0]+1], s2[spc_index[1]:]...) //删除多余空格
- spc_index = reg.FindStringIndex(string(s2)) //继续在字符串中搜索
- }
- return string(s2)
- }
-
- func ReadEleCard(code string) (string, string, string) {
- DllDef := syscall.MustLoadDLL("chs_fjs_standard.dll")
- readCard := DllDef.MustFindProc("ec_decode")
-
- //pCardInfo := make([]byte, 8192)
- pBusiCardInfo := make([]byte, 2048)
- pErrMsg := make([]byte, 2048)
-
- data := make(map[string]interface{})
-
- inputData := make(map[string]interface{})
- inputData["orgId"] = code
- inputData["businessType"] = "01101"
- inputData["operatorId"] = "1"
- inputData["operatorName"] = "admin"
- inputData["officeId"] = "101"
- inputData["officeName"] = "xt"
- inputData["deviceType"] = ""
-
- data["data"] = inputData
- data["transType"] = "ec.query"
- data["orgId"] = code
-
- bytesData, _ := json.Marshal(data)
- ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&bytesData[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])), (uintptr)(unsafe.Pointer(&pErrMsg[0])))
- fmt.Println(ConvertToString(DeleteExtraSpace(string(pErrMsg)), "gbk", "utf-8"))
- fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
- fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
- if ret2 != 0 {
- return "", "", ""
- }
- //readCard.Dll.Release()
- return ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"), ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"), ConvertToString(DeleteExtraSpace(string(pErrMsg)), "gbk", "utf-8")
-
- }
-
- func ReadEleCardForSettle(code string, user_name string, id int64) (string, string, string) {
- DllDef := syscall.MustLoadDLL("chs_fjs_standard.dll")
- readCard := DllDef.MustFindProc("ec_decode")
-
- pCardInfo := make([]byte, 8192)
- pBusiCardInfo := make([]byte, 8192)
- pErrMsg := make([]byte, 8192)
-
- data := make(map[string]interface{})
-
- inputData := make(map[string]interface{})
- inputData["orgId"] = code
- inputData["businessType"] = "01301"
- inputData["operatorId"] = id
- inputData["operatorName"] = user_name
- inputData["officeId"] = "001"
- inputData["officeName"] = "血透科"
- data["data"] = inputData
- data["transType"] = "ec.query"
- data["orgId"] = code
- bytesData, _ := json.Marshal(data)
- pCardInfo = bytesData
- pCardInfo = []byte(ConvertByte2String(pCardInfo, GB18030))
-
- ret2, _, _ := readCard.Call((uintptr)(unsafe.Pointer(&pCardInfo[0])), (uintptr)(unsafe.Pointer(&pBusiCardInfo[0])), (uintptr)(unsafe.Pointer(&pErrMsg[0])))
- fmt.Println(ret2)
- fmt.Println(":", ConvertToString(DeleteExtraSpace(string(bytesData)), "gbk", "utf-8"))
- fmt.Println(":", ConvertToString(DeleteExtraSpace(string(pBusiCardInfo)), "gbk", "utf-8"))
- if ret2 != 0 {
- return "", "", ""
- }
- return ConvertByte2String([]byte(DeleteExtraSpace(string(bytesData))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pBusiCardInfo))), GB18030), ConvertByte2String([]byte(DeleteExtraSpace(string(pErrMsg))), GB18030)
-
- }
-
- func FJyb3501(struct3501 models.Struct3501) (string, string, string) {
- timestamp := time.Now().Unix()
- nonce := GetRandomString(32)
-
- // 生成输入报文
- //SetFjInputMessage
- inputMessage := SetFjInputMessage(nonce, timestamp, struct3501.OrgName, struct3501.Opter, struct3501.FixmedinsHilistId, struct3501.InsuplcAdmdvs, struct3501.MdtrtareaAdmvs, struct3501.Url, struct3501.AppId, struct3501.AppSecret, struct3501.SignKey, struct3501.Enckey)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- druginputData := make(map[string]interface{})
- //druginputData2 := make(map[string]interface{})
-
- inputMessage["infno"] = "3501" // 交易编码
- inputData["med_list_codg"] = struct3501.MedListCodg // 定点医药机构目录编号
- inputData["fixmedins_hilist_id"] = struct3501.FixmedinsHilistId // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3501.OrgName // 定点医药机构目录名称
- inputData["rx_flag"] = struct3501.RxFlag //
- inputData["invdate"] = struct3501.Invdate // 人员编号 (来自1101接口返回)
- inputData["inv_cnt"] = struct3501.InvCnt // 人员编号 (来自1101接口返回)
- inputData["manu_lotnum"] = struct3501.ManuLotnum // 人员编号 (来自1101接口返回)
- inputData["fixmedins_bchno"] = struct3501.FixmedinsBchno // 人员编号 (来自1101接口返回)
- inputData["manu_date"] = struct3501.ManuDate // 人员编号 (来自1101接口返回)
- inputData["expy_end"] = struct3501.ExpyEnd // 人员编号 (来自1101接口返回)
- inputData["memo"] = "" // 人员编号 (来自1101接口返回)
- druginputData["drug_trac_codg"] = "123"
- //druginputData2["drugtracinfo"] = druginputData
- inputData["drug_trac_info"] = druginputData
- input["invinfo"] = inputData
- inputMessage["input"] = input //交易输入
- bytesData, err := json.Marshal(inputMessage)
- var requestLog string
- //bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
-
- return output, requestLog, err_msg
- }
-
- func FJyb3502(struct3502 models.Struct3502) (string, string, string) {
- timestamp := time.Now().Unix()
- nonce := GetRandomString(32)
- inputMessage := SetFjInputMessage(nonce, timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsHilistId, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Url, struct3502.AppId, struct3502.AppSecret, struct3502.SignKey, struct3502.Enckey)
-
- //inputMessage := SetInputMessag/**/e(nonce, timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsHilistId, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs)
-
- // 生成输入报文
- //inputMessage := SetJSInputMessage(timestamp, struct3502.OrgName, struct3502.Opter, struct3502.FixmedinsCode, struct3502.InsuplcAdmdvs, struct3502.MdtrtareaAdmvs, struct3502.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- druginputData := make(map[string]interface{})
- druginputData2 := make(map[string]interface{})
-
- inputMessage["infno"] = "3502" // 交易编码
- inputData["med_list_codg"] = struct3502.MedListCodg // 定点医药机构目录编号
- inputData["inv_chg_type"] = struct3502.InvChgType // 定点医药机构目录编号
-
- inputData["fixmedins_hilist_id"] = struct3502.FixmedinsCode // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3502.OrgName // 定点医药机构目录名称
- inputData["fixmedins_bchno"] = struct3502.FixmedinsBchno // 人员编号 (来自1101接口返回)
- inputData["pric"] = struct3502.Pric // 人员编号 (来自1101接口返回)
- inputData["cnt"] = struct3502.Cnt // 人员编号 (来自1101接口返回)
- inputData["rx_flag"] = struct3502.RxFlag //
-
- inputData["inv_chg_time"] = struct3502.InvChgTime // 人员编号 (来自1101接口返回)
- inputData["inv_chg_opter_name"] = "" // 人员编号 (来自1101接口返回)
- inputData["memo"] = struct3502.Memo // 人员编号 (来自1101接口返回)
- inputData["trdn_flag"] = "" // 人员编号 (来自1101接口返回)
-
- druginputData["drug_trac_codg"] = ""
- druginputData2["drugtracinfo"] = druginputData
- inputData["drug_trac_info"] = druginputData2
-
- input["invinfo"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- var requestLog string
- //bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
-
- }
-
- func FJyb3505(struct3505 models.Struct3505) (string, string, string) {
- timestamp := time.Now().Unix()
- nonce := GetRandomString(32)
- //inputMessage := SetInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs)
-
- inputMessage := SetFjInputMessage(nonce, timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Url, struct3505.AppId, struct3505.AppSecret, struct3505.SignKey, struct3505.Enckey)
-
- // 生成输入报文
- //inputMessage := SetJSInputMessage(timestamp, struct3505.OrgName, struct3505.Opter, struct3505.FixmedinsHilistId, struct3505.InsuplcAdmdvs, struct3505.MdtrtareaAdmvs, struct3505.Cainfo)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- druginputData := make(map[string]interface{})
- druginputData2 := make(map[string]interface{})
-
- inputMessage["infno"] = "3505" // 交易编码
- inputData["med_list_codg"] = struct3505.MedListCodg // 定点医药机构目录编号
- inputData["fixmedins_hilist_id"] = struct3505.FixmedinsHilistId // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3505.OrgName // 定点医药机构目录名称
- inputData["fixmedins_bchno"] = struct3505.FixmedinsBchno // 人员编号 (来自1101接口返回)
-
- inputData["prsc_dr_cert_type"] = struct3505.PrscDrCertType // 人员编号 (来自1101接口返回)
- inputData["prsc_dr_certno"] = struct3505.PrscDrCertno // 人员编号 (来自1101接口返回)
- inputData["prsc_dr_name"] = struct3505.PrscDrName // 人员编号 (来自1101接口返回)
- inputData["phar_cert_type"] = struct3505.PharCertType // 人员编号 (来自1101接口返回)
- inputData["phar_certno"] = struct3505.PharCertno // 人员编号 (来自1101接口返回)
-
- inputData["phar_name"] = struct3505.PharName // 人员编号 (来自1101接口返回)
- inputData["phar_prac_cert_no"] = struct3505.PharPracCertNo // 人员编号 (来自1101接口返回)
- //inputData["hi_feesetl_type"] = struct3505.HiFeesetlType // 人员编号 (来自1101接口返回)
- inputData["setl_id"] = struct3505.SetlId // 人员编号 (来自1101接口返回)
- inputData["mdtrt_sn"] = struct3505.MdtrtSn // 人员编号 (来自1101接口返回)
- inputData["psn_no"] = struct3505.PsnNo // 人员编号 (来自1101接口返回)
- inputData["psn_cert_type"] = struct3505.PsnCertType // 人员编号 (来自1101接口返回)
- inputData["certno"] = struct3505.CertNo // 人员编号 (来自1101接口返回)
- inputData["psn_name"] = struct3505.PsnName // 人员编号 (来自1101接口返回)
- inputData["manu_lotnum"] = struct3505.ManuLotnum // 人员编号 (来自1101接口返回)
- inputData["manu_date"] = struct3505.ManuDate // 人员编号 (来自1101接口返回)
- inputData["expy_end"] = struct3505.ExpyEnd // 人员编号 (来自1101接口返回)
-
- inputData["rx_flag"] = struct3505.RxFlag // 人员编号 (来自1101接口返回)
- inputData["trdn_flag"] = struct3505.TrdnFlag // 人员编号 (来自1101接口返回)
-
- inputData["finl_trns_pric"] = struct3505.FinlTrnsPric // 人员编号 (来自1101接口返回)
- inputData["rxno"] = struct3505.Rxno // 人员编号 (来自1101接口返回)
- inputData["rx_circ_flag"] = struct3505.RxCircFlag // 人员编号 (来自1101接口返回)
-
- inputData["rtal_docno"] = struct3505.RtalDocno // 人员编号 (来自1101接口返回)
- inputData["stoout_no"] = struct3505.StooutNo // 人员编号 (来自1101接口返回)
-
- inputData["bchno"] = struct3505.Bchno // 人员编号 (来自1101接口返回)
- //inputData["drug_trac_codg"] = struct3505.DrugTracCodg // 人员编号 (来自1101接口返回)
- inputData["drug_prod_barc"] = struct3505.DrugProdBarc // 人员编号 (来自1101接口返回)
- inputData["shelf_posi"] = struct3505.ShelfPosi // 人员编号 (来自1101接口返回)
- inputData["sel_retn_cnt"] = struct3505.SelRetnCnt // 人员编号 (来自1101接口返回)
- inputData["sel_retn_time"] = struct3505.SelRetnTime // 人员编号 (来自1101接口返回)
- inputData["sel_retn_opter_name"] = struct3505.SelRetnOpterName // 人员编号 (来自1101接口返回)
- inputData["memo"] = struct3505.Memo // 人员编号 (来自1101接口返回)
- druginputData["drug_trac_codg"] = ""
- druginputData2["drugtracinfo"] = druginputData
- inputData["drug_trac_info"] = druginputData2
-
- input["selinfo"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- var requestLog string
- //bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
-
- }
-
- func FJyb3506(struct3506 models.Struct3506) (string, string, string) {
- timestamp := time.Now().Unix()
- nonce := GetRandomString(32)
- //inputMessage := SetInputMessage(nonce, timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsHilistId, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs)
- inputMessage := SetFjInputMessage(nonce, timestamp, struct3506.OrgName, struct3506.Opter, struct3506.FixmedinsHilistId, struct3506.InsuplcAdmdvs, struct3506.MdtrtareaAdmvs, struct3506.Url, struct3506.AppId, struct3506.AppSecret, struct3506.SignKey, struct3506.Enckey)
-
- // 生成输入报文
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- druginputData := make(map[string]interface{})
- druginputData2 := make(map[string]interface{})
-
- inputMessage["infno"] = "3506" // 交易编码
- inputData["med_list_codg"] = struct3506.MedListCodg // 定点医药机构目录编号
- inputData["fixmedins_hilist_id"] = struct3506.FixmedinsHilistId // 定点医药机构目录编号
- inputData["fixmedins_hilist_name"] = struct3506.OrgName // 定点医药机构目录名称
- inputData["fixmedins_bchno"] = struct3506.FixmedinsBchno // 人员编号 (来自1101接口返回)
-
- inputData["setl_id"] = struct3506.SetlId // 人员编号 (来自1101接口返回)
- inputData["psn_no"] = struct3506.PsnNo // 人员编号 (来自1101接口返回)
- inputData["psn_cert_type"] = struct3506.PsnCertType // 人员编号 (来自1101接口返回)
- inputData["certno"] = struct3506.Certno // 人员编号 (来自1101接口返回)
- inputData["psn_name"] = struct3506.PsnName // 人员编号 (来自1101接口返回)
- inputData["manu_lotnum"] = struct3506.ManuLotnum // 人员编号 (来自1101接口返回)
- inputData["manu_date"] = struct3506.ManuDate // 人员编号 (来自1101接口返回)
- inputData["expy_end"] = struct3506.ExpyEnd // 人员编号 (来自1101接口返回)
- inputData["rx_flag"] = struct3506.RxFlag // 人员编号 (来自1101接口返回)
- inputData["trdn_flag"] = struct3506.TrdnFlag // 人员编号 (来自1101接口返回)
- inputData["finl_trns_pric"] = struct3506.FinlTrnsPric // 人员编号 (来自1101接口返回)
- inputData["sel_retn_cnt"] = struct3506.SelRetnCnt // 人员编号 (来自1101接口返回)
- inputData["sel_retn_time"] = struct3506.SelRetnTime // 人员编号 (来自1101接口返回)
- inputData["sel_retn_opter_name"] = struct3506.SelRetnOpterName // 人员编号 (来自1101接口返回)
- inputData["memo"] = "" // 人员编号 (来自1101接口返回)
- inputData["medins_prod_sel_no"] = "" // 人员编号 (来自1101接口返回)
- inputData["mdtrt_sn"] = "" // 人员编号 (来自1101接口返回)
-
- druginputData["drug_trac_codg"] = ""
- druginputData2["drugtracinfo"] = druginputData
- inputData["drug_trac_info"] = druginputData2
-
- input["selinfo"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- var requestLog string
- //bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
-
- }
-
- func FJyb3507(struct3507 models.Struct3507) (string, string, string) {
- timestamp := time.Now().Unix()
- nonce := GetRandomString(32)
- inputMessage := SetFjInputMessage(nonce, timestamp, struct3507.OrgName, struct3507.Opter, struct3507.FixmedinsCode, struct3507.InsuplcAdmdvs, struct3507.MdtrtareaAdmvs, struct3507.Url, struct3507.AppId, struct3507.AppSecret, struct3507.SignKey, struct3507.Enckey)
- input := make(map[string]interface{})
- inputData := make(map[string]interface{})
- inputMessage["infno"] = "3507" // 交易编码
- inputData["fixmedins_bchno"] = struct3507.FixmedinsCode // 人员编号 (来自1101接口返回)
- inputData["inv_data_type"] = struct3507.InvDataType // 人员编号 (来自1101接口返回)
-
- input["data"] = inputData
- inputMessage["input"] = input //交易输入
-
- bytesData, err := json.Marshal(inputMessage)
- var requestLog string
- //bytesData, err := json.Marshal(inputMessage)
- requestLog = string(bytesData)
- fmt.Println(string(bytesData))
- if err != nil {
- fmt.Println(err.Error())
- return err.Error(), "", ""
- }
-
- enc := mahonia.NewEncoder("gbk")
- output, err_msg := GetFjBusinessHandleInfo([]byte(enc.ConvertString(string(bytesData))))
- return output, requestLog, err_msg
-
- }
|