diff --git a/p/GPLALER2.m b/p/GPLALER2.m new file mode 100644 index 0000000..4c98e9b --- /dev/null +++ b/p/GPLALER2.m @@ -0,0 +1,70 @@ +GPLALERT ; CCDCCR/CKU - CCR/CCD PROCESSING FOR ALERTS ; 09/11/08 + ;;0.1;CCDCCR;;SEP 11,2008; + ;Copyright 2008 WorldVistA. Licensed under the terms of the GNU + ;General Public License See attached copy of the License. + ; + ;This program is free software; you can redistribute it and/or modify + ;it under the terms of the GNU General Public License as published by + ;the Free Software Foundation; either version 2 of the License, or + ;(at your option) any later version. + ; + ;This program is distributed in the hope that it will be useful, + ;but WITHOUT ANY WARRANTY; without even the implied warranty of + ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ;GNU General Public License for more details. + ; + ;You should have received a copy of the GNU General Public License along + ;with this program; if not, write to the Free Software Foundation, Inc., + ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + ; + W "NO ENTRY FROM TOP",! + Q + ; +EXTRACT(ALTXML,DFN,ALTOUTXML) ; EXTRACT ALERTS INTO PROVIDED XML TEMPLATE + ; + ; ALTXML AND ALTOUTXML ARE PASSED BY NAME SO GLOBALS CAN BE USED + ; + ; GET ADVERSE REACTIONS AND ALLERGIES + ; N GMRA,GMRAL ; FOR DEBUGGING, DON'T NEW THESE VARIABLES + S GMRA="0^0^111" + D EN1^GMRADPT + I $G(GMRAL)'=1 D Q ; NO ALLERGIES FOUND THUS *QUIT* + . S @ALTOUTXML@(0)=0 + ; DEFINE MAPPING + N ALTTVMAP,ALTVMAP,ALTTARYTMP,ALTARYTMP + S ALTTVMAP=$NA(^TMP("GPLALERT",$J,"ALERTS")) + S ALTTARYTMP=$NA(^TMP("GPLALERT",$J,"ALERTSARYTMP")) + K @ALTTVMAP,@ALTTARYTMP + N ALTTMP,ALTCNT S ALTG=$NA(GMRAL),ALTCNT=1 + S ALTTMP="" ; + F S ALTTMP=$O(@ALTG@(ALTTMP)) Q:ALTTMP="" D ; CHANGED TO $O BY GPL + . W "ALTTMP="_ALTTMP,! + . ; I $QS(ALTTMP,2)="S" W !,"S FOUND",! Q + . S ALTVMAP=$NA(@ALTTVMAP@(ALTCNT)) + . K @ALTVMAP + . S @ALTVMAP@("ALERTOBJECTID")="ALERT"_ALTCNT + . N ADT S ADT="Patient has an " ; X $ZINT H 5 + . S ADT=ADT_$S($P(@ALTG@(ALTTMP),U,4)=1:"ADVERSE",$P(@ALTG@(ALTTMP),U,5)=1:"ALLERGIC",1:"UNKNOWN") + . S ADT=ADT_" reaction to "_$P(@ALTG@(ALTTMP),U,2)_"." + . S @ALTVMAP@("ALERTDESCRIPTIONTEXT")=ADT + . S @ALTVMAP@("ALERTCODEVALUE")="ALERT CODE VALUE" + . S @ALTVMAP@("ALERTCODESYSTEM")="ALERT CODE SYSTEM" + . S @ALTVMAP@("ALERTSTATUSTEXT")="ALERT STATUS TEXT" + . S @ALTVMAP@("ALERTSOURCEID")="ACTORPROVIDER_"_$P(^GMR(120.8,ALTTMP,0),U,5) + . W "RUNNING ALERTS, PROVIDER: ",@ALTVMAP@("ALERTSOURCEID"),! + . S @ALTVMAP@("ALERTAGENTPRODUCTOBJECTID")="PRODUCTOBJID" + . S @ALTVMAP@("ALERTAGENTPRODUCTSOURCEID")="A" + . S @ALTVMAP@("ALERTAGENTPRODUCTNAMETEXT")="B" + . S @ALTVMAP@("ALERTAGENTPRODUCTCODEVALUE")="C" + . S @ALTVMAP@("ALERTAGENTPRODUCTCODESYSTEM")="D" + . S @ALTVMAP@("ALERTREACTIOINDESCRIPTIONTEXT")="E" + . S @ALTVMAP@("ALERTREACTIONCODEVALUE")="F" + . S @ALTVMAP@("ALERTREACTIONCODESYSTEM")="G" + . S ALTARYTMP=$NA(@ALTTARYTMP@(ALTCNT)) + . K @ALTARYTMP + . D MAP^GPLXPATH(ALTXML,ALTVMAP,ALTARYTMP) + . I ALTCNT=1 D CP^GPLXPATH(ALTARYTMP,ALTOUTXML) + . I ALTCNT>1 D INSINNER^GPLXPATH(ALTOUTXML,ALTARYTMP) + . S ALTCNT=ALTCNT+1 + Q + diff --git a/p/GPLCCR.m b/p/GPLCCR.m index 51dde30..2388520 100644 --- a/p/GPLCCR.m +++ b/p/GPLCCR.m @@ -74,7 +74,7 @@ CCRRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY) ;RPC ENTRY POINT FOR CCR OUTPUT I '$D(DEBUG) S DEBUG=0 S CCD=0 ; NEED THIS FLAG TO DISTINGUISH FROM CCD I '$D(TESTLAB) S TESTLAB=0 ; FLAG FOR TESTING RESULTS SECTION - I '$D(TESTALERT) S TESTALERT=0 ; FLAG FOR TESTING ALERTS SECTION + I '$D(TESTALERT) S TESTALERT=1 ; FLAG FOR TESTING ALERTS SECTION I '$D(TESTMEDS) S TESTMEDS=0 ; FLAG FOR TESTING CCRMEDS SECTION S TGLOBAL=$NA(^TMP("GPLCCR",$J,"TEMPLATE")) ; GLOBAL FOR STORING TEMPLATE S CCRGLO=$NA(^TMP("GPLCCR",$J,DFN,"CCR")) ; GLOBAL FOR BUILDING THE CCR @@ -108,7 +108,7 @@ CCRRPC(CCRGRTN,DFN,CCRPART,TIME1,TIME2,HDRARY) ;RPC ENTRY POINT FOR CCR OUTPUT . ; K @OXML ; KILL EXPECTED OUTPUT ARRAY . ; W OXML,! . S CALL="D "_TAG_"^"_RTN_"(IXML,DFN,OXML)" ; SETUP THE CALL - . I DEBUG W "RUNNING ",CALL,! + . W "RUNNING ",CALL,! . X CALL . ; NOW INSERT THE RESULTS IN THE CCR BUFFER . I @OXML@(0)'=0 D ; THERE IS A RESULT @@ -135,7 +135,7 @@ INITSTPS(TAB) ; INITIALIZE CCR PROCESSING STEPS I 'TESTMEDS D PUSH^GPLXPATH(TAB,"EXTRACT;CCRMEDS;//ContinuityOfCareRecord/Body/Medications;^TMP(""GPLCCR"",$J,DFN,""MEDICATIONS"")") D PUSH^GPLXPATH(TAB,"EXTRACT;GPLVITAL;//ContinuityOfCareRecord/Body/VitalSigns;^TMP(""GPLCCR"",$J,DFN,""VITALS"")") I TESTLAB D PUSH^GPLXPATH(TAB,"EXTRACT;GPLLABS;//ContinuityOfCareRecord/Body/Results;^TMP(""GPLCCR"",$J,DFN,""RESULTS"")") - I TESTALERT D PUSH^GPLXPATH(TAB,"EXTRACT;GPLALERT;//ContinuityOfCareRecord/Body/Alerts;^TMP(""GPLCCR"",$J,DFN,""ALERTS"")") + I TESTALERT D PUSH^GPLXPATH(TAB,"EXTRACT;GPLALER2;//ContinuityOfCareRecord/Body/Alerts;^TMP(""GPLCCR"",$J,DFN,""ALERTS"")") Q ; HDRMAP(CXML,DFN,IHDR) ; MAP HEADER VARIABLES: FROM, TO ECT