Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: MPIFXMLG

MPIFXMLG.m

Go to the documentation of this file.
MPIFXMLG ;ALB/CKN - MPIF GET CORRESPONDING IDS ; 5/21/15 11:59pm
 ;;1.0;MASTER PATIENT INDEX VISTA;**61**;30 Apr 99;Build 3
 Q
TEST ;Test one patient data
 N ICN K MPIIDS
 R !,"ICN: ",ICN
 I ICN'="" D GETIDS(.MPIIDS,ICN)
 Q
GETIDS(MPIIDS,ICN) ; GetCorrespondingIDs for ICN
 N MPIXML,MPIXMLR
 K MPIIDS
 S MPIXML=$$XMLBLD(ICN)
 D POST^MPIFHWSC(MPIXML,.MPIXMLR)
 I '$D(MPIXMLR) S MPIIDS="-1^No corresponding IDs found." Q
 D PARSE(.MPIIDS,.MPIXMLR)
 Q
 ;
XMLBLD(ICN) ; setup xml to get corresponding Ids
 ; ICN - Integration Control Numer
 ;    Returns XML for the search
 N MPIXML,MPISITE,QUOTE,MPITHRES,MPIDT,MPIDUZ,MPIPRID
 S QUOTE=""""
 S MPISITE=$P($$SITE^VASITE,"^",3)
 S MPIPRID=$P($$PARAM^HLCS2,"^",3)
 S MPIDT=$$FMTHL7^XLFDT($$NOW^XLFDT)
 S MPIDUZ=$P(^VA(200,DUZ,0),"^") D STDNAME^XLFNAME(.MPIDUZ,"C")
 S MPITHRES=80
 ;
 S MPIXML="<IDM_REQUEST type="_QUOTE_"GET_CORRESPONDING_IDS"_QUOTE_"><METADATA>"
 S MPIXML=MPIXML_"<FIELD name="_QUOTE_"includeHistory"_QUOTE_" value="
 S MPIXML=MPIXML_QUOTE_"false"_QUOTE_"/><FIELD name="_QUOTE_"useSurvivingIcn"
 S MPIXML=MPIXML_QUOTE_" value="_QUOTE_"true"_QUOTE_"/><FIELD name="_QUOTE
 S MPIXML=MPIXML_"returnSurvivingCorrelation"_QUOTE_" value="_QUOTE_"false"_QUOTE
 S MPIXML=MPIXML_"/></METADATA>"
 S MPIXML=MPIXML_"<ARGUMENTS><ARGUMENT name="_QUOTE
 S MPIXML=MPIXML_"sourceId"_QUOTE_"><IDENTIFIER type="_QUOTE_"NI"_QUOTE
 S MPIXML=MPIXML_" subtype="_QUOTE_"IDM"_QUOTE_"><ID>"_ICN
 S MPIXML=MPIXML_"</ID></IDENTIFIER></ARGUMENT><ARGUMENT name="_QUOTE
 S MPIXML=MPIXML_"statusList"_QUOTE_"><VALUE>A</VALUE></ARGUMENT>"
 S MPIXML=MPIXML_"</ARGUMENTS></IDM_REQUEST>"
 ;W XCKN
 Q MPIXML
 ;
PARSE(MPIDATA,MPIXML) ;Parse XML for results
 ;
 ; EN^MXMLPRSE - #4149
 ;
 K ^TMP($J,"MPIFXMLG")
 N MPICB,MPIUSE,MPIVAR,MPIIDN,MPILOC
 S MPIIDN=0
 S MPICB("STARTELEMENT")="SE^MPIFXMLG"
 S MPICB("CHARACTERS")="VALUE^MPIFXMLG"
 S ^TMP($J,"MPIFXMLG",1)=MPIXML
 D EN^MXMLPRSE($NA(^TMP($J,"MPIFXMLG")),.MPICB)
 K ^TMP($J,"MPIFXMLG")
 Q
 ;
SE(MPIN,MPIA) ; - used for the parser to call back with STARTELEMENT
 ;
 ; just to protect the process
 S MPIN=$G(MPIN)
 S MPIA("type")=$G(MPIA("type"))
 ;S MPIA("subtype")=$G(MPIA("subtype"))
 S MPIA("name")=$G(MPIA("name"))
 ;S MPIA("value")=$G(MPIA("value"))
 S MPIUSE=$G(MPIUSE)
 ;
 ;No need for these tags
 I MPIN="IDM_RESPONSE"!(MPIN="METADATA")!(MPIN="RESULT") Q
 I MPIN="RESULT"!(MPIN="IDATTR") Q
 ;
 I MPIN="IDENTIFIER" S MPIIDN=MPIIDN+1,MPILOC="MPIDATA("_MPIIDN D  K MPIUSE Q
 . S MPIUSE="IDType",MPIVAR=","""_MPIUSE_""")"
 . S:$D(MPIVAR) @(MPILOC_MPIVAR)=MPIA("type") K MPIVAR
 I MPIN="ID" D  K MPIUSE Q
 . S MPIUSE="ID",MPIVAR=","""_MPIUSE_""")"
 I MPIN="SOURCE" D  K MPIUSE Q
 . S MPIUSE="Source",MPIVAR=","""_MPIUSE_""")"
 I MPIN="ISSUER" D  K MPIUSE Q
 . S MPIUSE="Issuer",MPIVAR=","""_MPIUSE_""")"
 I MPIN="STATUS" D  K MPIUSE Q
 . S MPIUSE="Status",MPIVAR=","""_MPIUSE_""")"
 Q
 ;
VALUE(MPIT) ;used by the parser to call back with CHARACTERS
 S:$D(MPIVAR) @(MPILOC_MPIVAR)=MPIT K MPIVAR Q
 Q