Summary
Il existe encore des systèmes dans le secteur de la santé qui utilisent PB9, Delphi7 et d'autres langages. Pour accélérer le processus de développement et permettre aux applications tierces d'invoquer built-in le service web HL7 V2 intégré fourni par Ensemble ou IRIS, nous présentons ici plusieurs exemples d'invocations de l'interface SOAP HL7 V2 d'Ensemble en utilisant Java, PB9 et Delphi7.
En supposant que EnsLib.HL7.Service.SOAPService.CLS, qui est un built-in Service métier intégré, est ajouté à Production et nommé PeiXunHl7SoapIn, le système externe peut accéder au service Web HL7 V2 SOAP SOAP webservice par le biais du point de terminaison suivant.
http://localhost:57772/csp/peixunpro/EnsLib.HL7.Service.SOAPService.CLS?CfgItem=PeiXunHl7SoapIn
CfgItem=PeiXunHl7SoapIn
est un paramètre important, PeiXunHl7SoapIn est le nom de votre BS.
Avec le paramètre CfgItem, vous pouvez accéder aux interfaces SOAP qui sont déployées par la même classe de Service métier, mais exposées sous des noms différents. Par exemple, en ajoutant un autre Service métier SOAP avec le même nom V2Service, puis en accédant via le point de terminaison
http://localhost:57772/csp/peixunpro/EnsLib.HL7.Service.SOAPService.CLS?CfgItem=V2Service
mènera au Service métier nouvellement ajouté.
Des exemples d'accès à cette interface SOAP à l'aide de Java, PB9 et Delphi7 sont présentés dans la section suivante. D'autres langages sans exemples peuvent également appeler le Webservice SOAP V2 via un tel point de terminaison.
Conseil : Faites attention à la définition du séparateur de Segment HL7 V2 dans les différents langages, qui est indiquée dans les exemples de code suivants. Par exemple, PB utilise char(13)+char(10) comme retour chariot, et Delphi utilise #13+#10 pour le saut de ligne.
Samples
Java
package hl7.send;
import java.rmi.RemoteException;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
import org.apache.axis.encoding.XMLType;
public class SendHl7MSG{
public String invokeRemoteFuc() {
String endpoint ="http://localhost:57772/csp/peixunpro/EnsLib.HL7.Service.SOAPService.CLS?CfgItem=PeiXunHl7SoapIn";
String result = "no result!";
Service service = new Service();
Call call;
Object[] object = new Object[1];
// Notice the line break
String s1 = "\r\n";
String str="MSH|^~\\&|HIS|MediInfo|MediII|MediInfo|20150118162159||SIU^S12|145d03160de54b29a74eefa761ae4e05|P|2.4"+s1+"SCH||A1002||||(原因)正常预约|||||^^^07:11~07:22^^^^07:11~07:22|||||||||||||||112211522"+s1+"RGS|||";
object[0]= str;
try {
call = (Call) service.createCall();
call.setTargetEndpointAddress(endpoint);// Remote call path
call.setOperationName("Send");// Method to be invoked
// Set the parameters
call.addParameter("Input", // Parameter name
XMLType.XSD_STRING,// Parameter type:String
ParameterMode.IN);// Parameter mode:'IN' or 'OUT'
// Set the return value type:
call.setReturnType(XMLType.XSD_STRING);// Return type:String
result = (String) call.invoke(object);// Remote call
} catch (ServiceException e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
}
return result;
}
public static void main(String[] args) {
SendHl7MSG t = new SendHl7MSG();
String result=null;
result = t.invokeRemoteFuc();
System.out.println(result);
}
}
JavaJava
PB 9
String endPoint="http://192.168.2.64:57772/csp/jhip/EnsLib.HL7.Service.SOAPService.cls?CfgItem=HISHL7SoapIn"
soapconnection lsc_conn //Obtain the SOAP class
hl7v2servicesoap lsrv_obj //Get wsdl
lsc_conn =create soapconnection
// Instantiating with the EndPoint provided by Ensemble,
// i.e., adding the name of the CfgItem configuration
lsc_conn.createinstance(lsrv_obj,"hl7v2servicesoap",endPoint)
//PB使用char(13)+char(10) as a line break
// Also notice that the ~ character is an escape character in PB and is also a separator in HL7, so two ~'s are used in PB to represent one singe HL7 V2 separator
string msg=""
msg="MSH|^~~\&|HIS||JHIP||20150119163230||ADT^A01^ADT_A01|8E64C7FE-7750-482E-BC58-DC358FF0A05|P|2.4||||||UTF8"+char(13)+char(10)
msg+="EVN||20150119163230|||2341^张医生|20150119163230"
msg+=char(13)+char(10)+"PID|1||685923^^^^PI~~2^^^^VN||张三^^ZhangSan||19610524000000|M||AB|开拓路^海淀区^北京^ 北京市^100085^^B||^^^^^^13868108756|^^^^^^13868108756||M^已婚||||||12^汉族||||CHN^中国|||||||||||||北京信息技术有限公司|软件工程师NK1|1||BRO||||||||||电业局|||||||||||||||||李四^^lisi|^^^^^^13723412432|四季青路7号^海淀区^北京^北京市^100097"
msg+=char(13)+char(10)+"PV1|1|I|A30600^^306007^10108&内分泌专科|U|||225^郭四|||||||7||Y|225^郭四四|84|10030791|||||||||||||||||||||||10108||20150119162910|||8000||7000DG1|1||E11.900^2型糖尿病||20160728170353|A"
mle_2.text=lsrv_obj.send(msg) // Method call
Delphi 7
procedure TForm1.Button1Click(Sender: TObject);
var
mHttpRIO: THTTPRIO;
mServiceSoap: HL7v2ServiceSoap;
msg: String;
result:String;
begin
mHttpRIO := THTTPRIO.Create(nil);
try
// Set the URL with the CfgItem configuration item to EndPoint
mHttpRIO.URL := 'http://192.168.2.64:57772/csp/jhip/EnsLib.HL7.Service.SOAPService.cls?CfgItem=HISHL7SoapIn';
mHttpRIO.HTTPWebNode.UseUTF8InHeader := true; // Add this line to specify that UTF-8 code transmission is used
mHttpRIO.Converter.Encoding:='UTF-8';
mServiceSoap := mHttpRIO as HL7v2ServiceSoap
// The line break in Delphi is #13+#10
msg:='MSH|^~\&|HIS||JHIP||20150119163230||ADT^A01^ADT_A01|8E64C7FE-7750-482E-BC58-DC358FF0A05|P|2.4||||||UTF8'+#13+#10;
msg:=msg+'EVN||20150119163230|||2341^张医生|20150119163230';
msg:=msg+#13+#10+'PID|1||685923^^^^PI~~2^^^^VN||张三^^ZhangSan||19610524000000|M||AB|开拓路^海淀区^北京^ 北京市^100085^^B|';
msg:=msg+'|^^^^^^13868108756|^^^^^^13868108756||M^已婚||||||12^汉族||||CHN^中国|||||||||||||北京信息技术有限公司|软件工程师NK1|1||BRO||||||||||电业局|||||||||||||||||李四^^lisi|^^^^^^13723412432|四季青路7号^海淀区^北京^北京市^100097';
msg:=msg+#13+#10+'PV1|1|I|A30600^^306007^10108&内分泌专科|U|||225^郭四|||||||7||Y|225^郭四四si|84|10030791|||||||||||||||||||||||10108||20150119162910|||8000||7000DG1|1||E11.900^2型糖尿病||20160728170353|A';
result:=mServiceSoap.Send(msg);// Calling methods in the webService
showmessage(result) ;
Memo2.Text:=result;
except
end;
JavaScriptJavaScript