PJ3定点医疗机构门诊业务API嵌入式接口技术方案(3)

2019-06-11 15:24

Pj3定点医疗机构门诊门慢API接口技术方案

newinterface()或者newinterfacewithinit的返回值。

2.1.20 long set_ic_commport(Interface *p_inter, int comm)

该函数用来设置IC卡设备的串口号。返回值小于零, 表示没有成功,返回值大于

等于零, 表示调用成功。参数p_inter为函数newinterface()或者newinterfacewithinit的返回值。参数comm为与IC卡连接的串口号,com1表示1,com2表示2?。

2.1.21

long encode64(char *pSrc, int nSize, char *pDest)

该函数用来将数据按base64格式编码;返回值小于零, 表示没有成功,返回值大

于等于零, 表示为编码后的字节数。参数pSrc为源数据,nSize为源数据长度,pDest为编码后的数据。

2.1.22

long decode64(char *pSrc, int nSize, char *pDest)

该函数用来将数据按base64格式解码;返回值小于零, 表示没有成功,返回值大

于等于零, 表示为解码后的字节数。参数pSrc为源数据,nSize为源数据长度,pDest为解码后的数据。

2.1.23

long encodesize( int nSize)

该函数用来将数据按base64格式编码时,用源数据长度来获得编码后的数据长度;

返回值小于零, 表示没有成功,返回值大于等于零, 表示为编码后的字节数。参数nSize为源数据长度。

2.1.24

long decodesize( int nSize)

该函数用来将数据按base64格式解码时,用源数据长度来获得解码后的数据长度;

返回值小于零, 表示没有成功,返回值大于等于零, 表示为解码后的字节数。参数nSize为源数据长度。

2.1.25

long decode64_tofile(char *pSrc, int nSize, char *filename)

该函数用来将数据按base64格式解码,并将解码后的数据存到filename文件里;

返回值小于零, 表示没有成功,返回值大于等于零, 表示为解码后的字节数。参数pSrc

Powerise?创智

5

Pj3定点医疗机构门诊门慢API接口技术方案

为源数据,nSize为源数据长度,filename为解码后的数据要保存的文件名。

2.1.26

int setdebug(Interface *pinter,integer flag,char * direct)

该函数用来设置接口的运行模式,当flag为1时将产生调试信息并且写入指定目

录direct下的日志文件中。返回值小于零, 表示没有成功,返回值大于等于零, 表示成功。参数pinter为函数newinterface()或者newinterfacewithinit的返回值,flag 为调试标志,0表示不作调试,其它为可调试,direct为存放调试信息日志文件的目录,注意此目录必须是存在的。

2.2 函数调用说明 2.2.1

接口函数调用顺序

1.

接口初始化调用newinterface()或者newinterfacewithinit,这二个函数的区别在于,前者仅进行接口初始化,而后者还要建立与服务器的连接。要注意另一个与初始化有关的函数init,它的作用是建立与服务器的连接,它在二种情况下用,一个是用newinterface()初始化时,调用它建立与服务器连接,而另一个是程序将要与二个服务器连接时,使用它,而不必调destoryinterface后,重新初始化接口。

2.

调用功能号0登录到前置服务器,不同的定点医疗机构使用不同的登陆工号。

3. 4.

执行其他功能。

每个功能的执行顺序如下: 1) 调start启动接口。

2) 多次调put或者putcol将参数传入接口。

3) 如果有记录集,调setresultset设置记录集名,多次调put或者putcol

将记录集的各域值传入接口。 4) 调run将数据送入后台。

5) 多次调get将后台传回的数据取回,有多行记录时用nexrow, prevrow,

firstrow, lastrow来移动行号。当返回的数据存在多个记录集时,可用setresultset函数设置当前取数据的记录集。

Powerise?创智 6

Pj3定点医疗机构门诊门慢API接口技术方案

2.2.2 接口函数调用时指针的用法说明

在接口中有很多指针参数,这些参数在传入时,pb都可以用字符串来代替,但必

须先赋值来定义其空间,delphi中可直接用指针,然后用StrAlloc或者StrNew来定义空间,但一定要用StrDispose来释放空间。

2.2.3 接口函数调用时数据类型的说明

接口指针Interface *p_inter可以用long型变量替代。

接口能识别的数据类型都是字符串,因此在输入数据或是输出数据时候都必须转换成字符串,也就是说数值型和时间型的数据需要做字符串转换。时间的格式:\YYYY-MM-DD HH:MI:SS \ (24小时);数值的格式:\########.## \。

2.3 程序中接口函数定义 2.3.1

在PB中定义函数程序

FUNCTION long newinterface() LIBRARY \

FUNCTION long init(long pint, string Addr, long port, string Servlet ) LIBRARY \

FUNCTION long newinterfacewithinit(string Addr, long port, string Servlet ) LIBRARY \

SUBROUTINE destoryinterface( long pint ) LIBRARY \FUNCTION long start( long pint, string id ) LIBRARY \

FUNCTION long put( long pint, long row, string pname, string pvalue ) LIBRARY \

FUNCTION long putcol( long pint, string pname, string pvalue ) LIBRARY \FUNCTION long run( long pint ) LIBRARY \

FUNCTION long runxml( long pint, string xml ) LIBRARY \

FUNCTION long getxmlstr_t(long pint, ref string xml) LIBRARY \FUNCTION long getxmlstr(long pint, ref string xml) LIBRARY \

FUNCTION long getbyname ( long pint,string pname, ref string pvalue ) LIBRARY \

FUNCTION long getbyindex ( long pint,long index, ref string pvalue ) LIBRARY \

FUNCTION Long getmessage ( long pint, ref string msg ) LIBRARY \FUNCTION Long getexception ( long pint, ref string msg ) LIBRARY \

FUNCTION long getrowcount(long pint) LIBRARY \FUNCTION int firstrow(long pint) LIBRARY \

7

Powerise?创智

Pj3定点医疗机构门诊门慢API接口技术方案

FUNCTION int nextrow(long pint) LIBRARY \FUNCTION int prevrow(long pint) LIBRARY \FUNCTION int lastrow(long pint) LIBRARY \

FUNCTION int setresultset(long pint,string result_name) LIBRARY \FUNCTION int setdebug(Long pint,integer flag,String direct) LIBRARY \FUNCTION long set_ic_commport(long pint, int comm) LIBRARY \

FUNCTION Long getcode ( long pint, ref string msg ) LIBRARY \FUNCTION Long geterrtype ( long pint) LIBRARY \

2.3.2 在Delphi中定义函数程序

FUNCTION newinterface ( ):pointer; stdcall;external 'HG_interface.dll';

FUNCTION newinterfacewithinit (Addr:char *; port:integer; Servlet:char * ):Pointer; stdcall;external 'HG_interface.dll';

FUNCTION init(pint:Pointer;Addr:char *; port:integer; Servlet:char * ):integer; stdcall;external 'HG_interface.dll';

Procedure destoryinterface ( pint:Pointer ); stdcall;external 'HG_interface.dll';

FUNCTION start ( pint:Pointer; func_id:char * ):integer; stdcall;external 'HG_interface.dll'; FUNCTION put ( pint:Pointer; row:integer; pname:char *; pvalue:char * ):integer; stdcall;external 'HG_interface.dll';

FUNCTION putcol ( pint:Pointer; pname:char *; pvalue:char * ):integer; stdcall;external 'HG_interface.dll';

FUNCTION run ( pint:Pointer ):integer; stdcall;external 'HG_interface.dll';

FUNCTION getbyname ( pint:Pointer; pname:char *; {ref char *} pvalue:pchar):integer; stdcall;external 'HG_interface.dll';

FUNCTION getbyindex ( pint:Pointer; index:integer; {ref char *} pname:pchar; {ref char *} pvalue:pchar ):integer; stdcall;external 'HG_interface.dll';

FUNCTION getmessage ( pint:Pointer; {ref char *} msg:pchar ):integer; stdcall;external 'HG_interface.dll';

FUNCTION getexception ( pint:Pointer; {ref char *} msg:pchar ):integer; stdcall;external 'HG_interface.dll';

FUNCTION getresultnamebyindex(pint:Pointer;ndex:integer; {ref char *} resultname:pchar ):integer; stdcall;external 'HG_interface.dll';

FUNCTION getrowcount ( pint:Pointer ):integer; stdcall;external 'HG_interface.dll';

FUNCTION setresultset(pint:Pointer; result_set:char *):integer;stdcall;external 'HG_interface.dll'; FUNCTION nextrow(pint:Pointer):integer;stdcall;external 'HG_interface.dll'; FUNCTION firstrow(pint:Pointer):integer;stdcall;external 'HG_interface.dll';

Powerise?创智

8

Pj3定点医疗机构门诊门慢API接口技术方案

FUNCTION lastrow(pint:Pointer):integer;stdcall;external 'HG_interface.dll'; FUNCTION prevrow(pint:Pointer):integer;stdcall;external 'HG_interface.dll';

FUNCTION set_ic_commport(pint:Pointer;comm:integer ):integer; stdcall;external 'HG_interface.dll';

2.3.3 在VB中定义函数程序

Public Declare Function newinterface Lib \

Public Declare Function init Lib \port As Long, ByVal servlet As Char *) As Long

Public Declare Function start Lib \Long

Public Declare Function dataput Lib \Long, ByVal pname As Char *, ByVal pvalue As Char *) As Long

Public Declare Function run Lib \

Public Declare Function setdebug Lib \ByVal in_direct As Char *) As Long

Public Declare Function getbyname Lib \ByVal pvalue As Char *) As Long

Public Declare Function getbyindex Lib \ByVal pvalue As Char *) As Long

Public Declare Function getmessage Lib \As Long

Public Declare Function getexception Lib \As Long

Public Declare Sub destoryinterface Lib \Public Declare Function firstrow Lib \Public Declare Function nextrow Lib \Public Declare Function prevrow Lib \Public Declare Function lastrow Lib \

Public Declare Function setresultset Lib \Char *) As Integer

Public Declare Function set_ic_commport Lib \Integer) As Long

Powerise?创智 9


PJ3定点医疗机构门诊业务API嵌入式接口技术方案(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:电大金融学2017年形考答案

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: