云南省医疗保障信息平台定点医药机构第三方程序调用接口、通用交易报文示例代码、移动支付交易调用说明.docx
第三方程序调用接口示例代码PB程序调用示例K pb9接口函数声明接口初始化输入参数说明:医疗服务机构端号(f i Xmd i ns_cOdC)输入参数说明:服务商识代码(i nfosyscode)输入参数说明:服务商识别码(inf。SySSiKn)怆人参数说明:极务器地址(UrD输出多数说明:错谡信息(PErrMsg)FliNCTION int Init (string fixinedins_codc, strin inf。SySeode. strin infosyssign, string url, ref string PErrMSg) LIBRARY *CHSInterfaceYn. dll*修改社保卡密码输入参数说明:医疗服芬机构编号(fixmedinsfode)输入参数说明:服务商识代码(inf。SySCOdQ/输入参数说明:极务商识别码(i nfosyssin)输入多数说明:输入报文(inpuU>ata)输出参数说明:输出报文(OUIPUIDaia)怆出参数说明:错误信息(pErMsg)FliNCTION int MOdifyCardPiD(String fixmedins_code, string infosyscode, string infosyssign, string iputDat , ref string OutputData , ref string pErrMsg) LIBRARY ""CIISInterf aceYn. dl 1 *通用业务交易输入咨数说明:医疗眠务机构编号(fixmedins,code)输入冬救说明:服务商识代码(infosyscode)输入参数说明:服务商识别码(i nfosyss i gn)输入多数说明:输入报文(inpulDa<a)输出参数说明:输出报文(OUtpUtDatEI)输出参数说明:错误信忠(PErrMsg)RINCTION ini BUSineSSHandIe(Stritw fixmedins_code, strin infosysco<le, string infos)ssig, string iputl)ata, ref string OUtPUtData, ref string pErrMsg) LIBRARY "CHSInierfaceYn. dl通用下教交易输入多数说明:医疗服务机构编号(fixmedins”Ode)始人参数说明:极务商识代码(inf。SySCode)怆入参数说明:服务商识别码(i nfosyssin)输入参数说明:输入报文(MpulDala)输出参数说明:输出报文(OUtPUtDatfl)输出多数说明:错误信息(PErrMSg)FIINCTIW ini DOnIoadFilc (SIrinil fixmed ins code, string infosyscode, string infosyssign, string inputl)ata, ref string outputl)ata. ref string pErrMsg) 1.1BRARY "CHSInterfaceYn. dl通用上传交易输入参数说明:医疗眼务机构端号(fixmedins/UdQ输入参数说明:极务商识代码(infosyscode)输入多数说明:限务商识别码(i nfosySSiBQ输入参数说明:上传文件路径(f i 1 CNamC)输入参数说明:输入报文(inputmta)输出参数说明:输出报文(OUlPUtData)獭出参数说明:错误信息(pErMsg)FUNCTION int IJploadFilestring fixmedins_code, string infosyscode, string infosyssign, string CileNaae, string inputData, ref string OutputData, rof string pErrMsg) LIBRARY -CIISlnterfaceYn.dll*2、PBII接口商数声明接口初始化输入参数说明:医疗服务机构编号(fix>edinsode)输入参数说明:服务商识代码(infosyscode)输入参数说明I服务商识别码(i nfosy ss i n)输入参数说明:服务器地址(UrD输出参数说明:精谀信息(PErrMsg)FUNCTION intInitCstring fixmedins_code, string infosyscode, stringinfosyssign, string url, ref string PErrXSg) LIBRARY *CHSInterfaceYn.dll* alias for "Inil;Ansi.修l社保卡甫码输入参数说明:医疗服务机构编号(fixmedins code)输入参数说明:服务商识代码(infosyscode)输入参数说明:服务商识别码(infosyss i gn)输入参数说明:输入报文(inputData)输出参数说明:输出报文(OUtPUtData)输出金数说明:播谀信息(PErrMSB)FUNCTION int Mf>difyCardPBD(string fixedins-code, string infosyscode, string infosyssign, string inputData , ref string OutputData , ref string PErrMSg) LIBRARY XHSInterfaceYn. dl alias for "ModifyCardPttDiAnsi"通用业务交步输入参数说明:医疗服务机构编号(fix>edinsode)输入参数说明:服务商识代码(infosyscode)输入参数说明I服务商识别码(i nfosy SS i n)输入参数说明:输入报文(inputData)/输出多数说明:输出报文(OUtputPata)输出参数说明:错误信息(PEIdsg)FUNCTION int BUSineSSHandle(String fixn»edins_cnde, string infosyscode, string infosyssin, string inut,Data, ref string OutputData1 ref string pErrMsg) LIBRARY vGISInterfaceYn.dll, lias for "BusinessHandleiAnsi”通用下载交易/输入参数说明:医疗服务机内编 (fixnedins.code)/输入舂数说明:服务商识代码(infosyscode)输入参数说明:t务商识别码(infosyssign)输入参数说明:输入报文(inputData)输出参数说明:输出报文(OUIPUIDala)/输出参数说明:借误信息(PEnlsg)FUNCTION int DownloadFile(string fixmedins code, string infosyscode, string infosyssignl string iputData,ref string outputDaia, ref string pErrMsg) LIBRARY "CHSInterfaceYiLdll" alias for ,DoWnlOadFile;AnSi”通用上传交易输入参数说明:医疗服务机构编(fixmedinsode)输入参数说明:服务商识代码(inf。SySCode)输入参数说明:极务商识别码Gnfosyssign)/输入卷数说明:上传文件路径(filename)输入参数说明:输入报文GnPUUtata)输出参数说明:/出报文(OUtPUtData)/输出参数说明:错误信息(pErrMsg)FUNCTION int UPlOadFiIe(String fixmedins_code, string infosyscode, string infosyssign, string fi IeNaae, string inputl)ata, ref string outputl>ata, ref string pErrMsg) LIBRARY vCHSInterfaceYn.dll* alias for vUploadFile;Ansi*3、接口函数调用初始化代码:String ls_pEri-Bsgstring ls_urlstring ls_infosyscode = *cll*string ls_infosyssign = *sl* int li.rtis_fixmedins code = sle hoscode. textIS-PErnnSg space(128)ls.url= sle_url.textILrtInit(is_fixmcdins-code. ls_infosyscode, ls_infosyssign. Is url, 1s_pErrmsg) if 1i_rt = O thenst_2. text ="成功”elsesi_2, text ="错误信息:* end iftext - ISjErnnSg逋用业务交易代码:String ls.outputString Is_pEn-Bsgint 1i_rtstring ls_infosyscode = *clstring ls-infosyssign = *sl*is_fixmedins_co<Je = sle_hoscode. text ls_input = le_bh,input. text1s_ouipul = space(4096) ls_pErnnsg = space(128)1 i_rtBusinessllandIc(is f ixrnedins code, 1 s_infosyscode, ls_infosyssign> Is Jnpul, ls_o utput. 1 s_pErrmsg) if li_rt = 0 thenst_bh_2. text ="成功”mle_bh_output. text = ls-outputelsest_bh_2. text 二"tft误信息:"m!e_bh_output. text = ls_pErrmsg end if修改社保卡密码代码String ls_pErrBsgint IiJlstring ls_inputstring ls_OMtputstring ls_infosyscode = *cll*string ls_infosyssign = *sl*is.fixmedins_code = sle.hoscode. textIsjiErnnsg = space (128) ls.output = space(40960) li.rtModifyCardPWD(is_fixme<Jins_code. ls_infosyscode, ls_infosyssign, ls_input, ls_ou tut> ISjErrBSR) if 1 i_rt = 0 then st_mp. text 一成功”elseSt mp. text ="拙误信息:" end iftext = ls-pErrms文件上传代码String IsJnputString ls_outputString IsjjErrBSRstring ls_fiIename int li_rtstring ls_infosyscode = *clstring ls_infosyssign = *sl* is_fixmedins_code = sle_hoscodc. text15.1 nput = mle_bh_input. textls_fiIename = sle-uf. textls_output = space (4(K)(K)0)ISj)ErnnSg = space (128)li-rtUPlOadFiIe(isjixmedins code, ls-infosyscode, ls_infosyssign, ls-filenac, ls_in put. ls_output. ls_pErrmsg) if li_rt = O thenst_bh_2. text =*成功"elsest_bh_2. text 二"楙误信息:"mle_bh_output. text = ls_pErrmsg end if文件下新代码String ls_inputString ls,oututString ls_pEn-asgint 1i_rtstring ls_fiIenamcstring ls_inCosyscode = "clstring ls-infosyssign = *sl*is_fixmedins code = sle_hoscode. textls_input = mle_bh_input. textls_output = space(409600)IS-PErESg = space (128)ls.fiIename = space(128)li.rtDownloadFiixmedins code, ls_infosyscode, ls_infosyssign, ls_input, ls_out put, ls_pErrmsg) if ILrt = O thensl_bh_2. text ="成功"elsest_bh_2. text -错误信息:”mle_bh_output. text - ls_pErrmsgsle_df. text = ls_fiIenaee end ifJS调用示例控件id:object id=*chsinterfaceynocxA,CIaSSid二°cls id :5209E1FCTFP8TDEE-A25A-E843906F95*><object>/加载控件 tryZ/var Chsinterfaceynocx = document. getElementByldC*chsinterfaceynocx*): var Chsinterfaccynocx new ActivexObjectrchsinlerfaceyn. chsdll*);catch(e)alert Cocx j 调用异卷");)Chsinterfaceynocx. SetDirC D: Chsinterfaceyn '):/动态库的存放地址初始化var fixmedins.code =*H100013120*;var infosyscode -*cl*;var infosyssign =*sl*;var url ="var fi xned ins-code =""varinit.output=chsinterCaceynocx. Inil (f ixnedins_codc, infosyscode> infosyssigrl url);修改社保卡密码var f ixmedins_code =*II100013120*;var infosyscode =*cl*;var infsyssi ="sl”;var inputvar fixmedins,code =*;varMod i f yCardPU'D_output=chsinterfaceynocx.ModifyCardPBD(fixmedins code, infosyscode. infosyssignt input);通用业务交易var fixmedins_code =*H100013120*;var infosyscode -*cl*;var Infosyssign =*s;var input =""var fixmedins_code =""varIkisi nessllandl e.output=chsinterfaceynocx. BusinessHnnd1e(fixmedins code, infosyscode. infosyssign, inpu通用下载交易var fixmedins.code =*H100013120*;var infosyscode -*cl*;var infosyssign =*sl*;var input =*;var fi xned ins-code =""varDown 1OadFile.output=chsinlerCaceynocx. Down1oadFi1e(f ixmedins_codc, infosyscode, infosyssign, input)通用上传交易var f ix(Dodins-code =4rH100013120*;var infosyscode 二*cl”;var Lnfosyssign =*sl*;var inputvar fiIeName=*:var fixmedins.code =""varUploadFile_output=chsinterfaceynocx. UpladEiIe(f ixmedins_code, infosyscode, infosyssign. fiIeName .input);C#调用UnieOde通用业务函数代码示例函数声明IJH1 Import (*GiS IntcrfaccYn. dll,EntryPoEl* Bus i ncssHad 1 c *lCharSet. Unicode)ChtirSct -static extern int Businesslland 1 ef(string fixn«?dins_code.string infosyscode.string inf<>syssigr. string innDala. Strirtgiiuihltr oululData. CSg);St rhdot Ider函数调用public int Chs businessHandlcW(string fixncdins_cxxic, string infosyscodc, string infosyssinl string inputbata. ref string OIHPUtnata, ref string ennsg)Slringfiutlder t* rnsgSb = new StringHui<k*r( Q;StringfixiiIdcr otSbcv SfrEg伙"Ider(AQ96。);it rt = RuNinrsslLindleM(! imdins c(×ie, irifosyscudi*. inf<>syssigr, inputData, otSb, crrsgSb);if (rt < 0)crrsg crmsgSb. ToStringO : return -1;)else(OutputDaU = outSb. ToStringO : return rt;)JAVA实现下羲交易示例代码import java. 10. File;import java. io. FileOutputStream;import java. io. IOException:import java. io. InputStreaa;import java. io. UnsupportedEncodingException:import org. apache, http. Header;import org. apache, http. HttpEntity;import org. apache, http. IIttpResponse:imxrt org. apache, http. IIttpStatus;import org. apache, htlp. client. ClicntProtocolExccption;import org. apache, http, client. HttpClient;import org. apache, http, client, config. RequestConfig:import org. apache, http, client, methods. C1oseabIdlttpResponse;import org. apache, http, cl ient. methexis. HttpPost;import org. apache, http, entity. ByteArrayEntity:import org. apache, http, impl. client. IIttpCl ients;import org. apache, http. util. Entitylti Is;import sun. nio. cs. StandardCharsets;public class httptutiI (新医保/bapi文件下载示例public static void main(String args) *设置请求url*/String url =*http:/172. 16. 11. 123:7030/eapdo<nain/cal !Service*;HtlpCIient htlpcIient = HllpClients. CrcatcDcfault();HttpPost httppost - new HttpPost (url);RequestConfierequestConfig=RequestConfig. custom(). SetConnectTimcout(10000). SetSocketTimeout(10000). bui1 d():httppost. setC>nfi(requestCorfi):*设置请求头*/httppost, addlleader (*fixmedins_code*, II53O11200683);httppost, add>leader(*infosyscode*1 *deocasel*):httppost. addHeader (-hsf-nonce, ,635B907BE96fyJC6990C9A6614A518A2): httppost, ddlleader(*hsf_tiiM?st;unp*, *2021717154012217-):httppost, addllcader(,hsf_signature, "f9d<193bca 1148384b42269f 1 d62ac840aef5 054428c30e47f097b97cb62723e2,):*设置请求报文*/Stringdown Input=""infno”:*9102*, *msgid*:F530H 200683202107211758385113 "mdlrlarea_admvs":*53058l*, "insuplc_adndvs*:"", "recer_sys_code":Vrmbs_lOCaI","dev_noV:* "dev_safe_info":"V,"cainfo”:VW *signtypc*:, *infver*:V1.04*, *opter_type*:l,opter,: 8S8, Vopter,name": "工程师"."injtie”: 2O21-O7- 19 09:40:22", Vfixmedins-COdeL "H53011200683”, VfiNinedinsjameV: Vziifi 有笫一人民医院", "sig n<": "161", "inpui”: (VfsDownloadInV: (*vrV: ,1, *fi le_qury no*:M000000rBMAEUT)u5jaAY GRAAAE-Irsc8pY0751056, fi lenae": *202107148402093128866328681. txt. zip. *fixmedins-code: VI53011200683H;ByteArrayEntity entity = null:try (entity 二 new ByterrayEntity(downInput. getBytes(*utf 8*); catch (VnsupportedEncodingException el) / TODO Auto-Kencrated catch blockel. printStackTrace();Ientity. sotContentType(*appIication/json:charset-utf 8*);httppost. setEtity(entity):IIttpResponse response = nul 1;try (response - httpclient, execute(httppost);int StatusCode = response. getStatsLine O. getStatusCode O;if (statusCode != HttpStatus. SC_OK) ISystem. Oln. print ln("错误代码/slatusCode);return;)*获取响应头,判断是否有filename*/Header heade!'Array = response. getl IHeadersO ;boolean b = false;for(Header header : IwaderArray)(if(header. gotValue O. contains("filename")(如果有说明是文件流跳出循不后而按流保存文件b = true;break;)/System, out. print In (* Key: * * header. getName () * - RawValue: " header. getValue();)String result:IlttpEntity responseEnt i ty - response. getEnt i ty();i f (responseEntity != nul1) if(b)(InputStreani content responseEntity. RetConlent O;返回文件流这里的文件是压缩后的File file = neu File(*dtestl)ownload. zip*);FileOutputStream fi IeOutputStream = new FileOutputStream(file);ini temp;while (temp : content. read O) != 1) fi IeOutputStream. write(temp):)fi IeOutputStream. close();System. OUl. priniln('文件下我成功!”):)else(返I可字符中这里一段是错误信恩result = EnlityUtiIs. IoString(responseEntity» "UTF-8");Systen. out. println(result);J catch (ClientProtocolException e)( / TODO Auto-generated catch block e. printStckTrace(); catch (K)Exception e)(/ TODO Auto-generated catch block e. printStackTrace();1)附录B(资料性附录)通用交易报文示例代码B.1报文输入示例-人员信息获取*infno": "01*,"n歌 i(T : "I xoooooooo i 202001 (M 1235391234'.*isup)c dndvx*:*IOWXIO*,*dtrtarea ads*:*100000".*rt>ee! >ys,c<xie*: "MBS IjOCAl二dev,no :,*dev safe info*:*, ” . . * * cnnta :.*infver*: *V).0*,*opter_lyp*- T,* optcr*: *01*.*opter nene?*:“张三”* inttine*: *20204)1 HM 12:35:39*.* fixe<Jins code": *lMW0l*,*fixwe<iins nan。":'第,人民族院,QdS no*: *79faf82271941 fc:Wc4f)d99br71lx:9c".* input*:(*data*:(*pxn cert type*: *2*."certno*:飞】MOo202001010000:%"nane":"李四二 gndme*: *2020 01 01B.2报文,出示例-人员信息获取Tnfctxh/: T.*inf refmsgid": *O<X>O<XI2<>2O<>10i 1235391234567890".,refSi,tine*: *20200201133411352*.,respond ti>e": '2020020213373M56*. rerr.msg :,*output*:(*bax<inf*: |*psn,no*: “13100020200】O(H 二*psn_cort type*: *2*.*c<rtno*:飞IM00202001(Io(XK.*psn nane*:-MdZT.,I,*brdy*: *2020-.g: 18),*insuinfo*: I*pxn inxu.rlts.id*: '13324152附XHOOl二* blc*: 5000»* Insutype*: *310*.* psn,type*': *IOO,* cvlserv flag*: *0*.* inxu ndfdvN*: *131O(>2*,"呻即“:"测试电位.*idet info*:*psnjdet type*: T,* pxn_typr_lv*: *1*. r ncfn :,* begntie*: '202(Yl-Ol 00:WkOo二',rndtirec*:").I"psn.idet.type*: “2,* psn_type_lv-: >.* . , ncfn :,"beentine”: *2020-01-01 00:00:DO".“endW: *)1附录C(资料性附录)移动支付交易调用说明接口规则表I接”规则规则规则描述传9方式为保证交易安全性.枭榜hps他Kt货交方式采用MSr方法找女航搭格式提先为迟日败据,为JSON格式字符%码一采用ITF-8字符编国接名It法31 也算法 SM2 <SM3withSM2)加番算法国窗算法SMi券名要求- - 和需要忒«*«.详好方法请与学安会现范TU笆算法先判斫怖议字收返回,再判所北分类回,最后判断交易状态安全规范筌名算法(SM2)雌根据SM2舞法(SiRnature的alorilhm选择SM3wihSM2J签名报文。通过时报文数据筛 选、排序和拼接,组成待签名报文数据.交易说明请求签名 算选获取所有请求多数,不包括字节类型参数,如文件、字节流,剔除sign)ata, encata.排序将筛选的多数按照第个字符的键值ASCII码遨增排序(字母升序排序,如果遇到 相同字符则按照第二个字符的犍值ASCII眄递增排序.以此类推.雌将排序后的参数与其对应值.组合成“参数-参数侪”的格式.并且把这些参数用 字符连接起来,最后拼接上应用密切appSecret在“参数=参数值”后,此时生成的字 符串为特签名字符率,将恃签名字符申SM2运算,即是签名(SiRnDaIa)的值SiKnDaIa二-encData"参数不参与签名).JOS对象器名规范(如daiaJ内部按字母顺序升序排列空俯不参与签名将整理好的JSQN 内容输HJS(W字符串后拼接参与签名,data内所有数据按照字符进行处理,例如下面的示例 请求报文,参数值都是示例,开发者仅参考报文格式即可.加签报文示例:(ap>Id:"13AF017BBA17FC8A1AE8EFB232BDBeCB*,"data”: (*appId':*43FO47BB17FC' 1AE8EFB232BDBBCB", *appliserId":*o8z4C5avQXqC0a >FPMzu6I)71CQJxl idNo,<350181199011193519, idType-0, *phoneNuber-ri3 763873033”, “userName”:" 溯试"),“encTypeTSM",*,signData*liRVQNdVNn5mz2EhKZhLTlXNwAUTSncFoSe8Ilx7jhn81eB,J46sdRRNlZiiQjPUTixG9bwq