VistA-FOIAVistA/r/NURSING_SERVICE-NUR/NURCAS1.m

41 lines
3.3 KiB
Mathematica
Raw Normal View History

NURCAS1 ;HIRMFO/MD/RM/MD-PATIENT PROBLEM/NURSING INTERVENTION PRINT ;10/2/95
;;4.0;NURSING SERVICE;;Apr 25, 1997
S GMRGRT=$O(^GMRD(124.2,"AA","NURSC",2,"Nursing Care Plan",1,0)),GMRGPDA=0
F REVDAT=0:0 S REVDAT=$O(^GMR(124.3,"AA",DFN,GMRGRT,REVDAT)) Q:'REVDAT S GMRGPDA=$O(^GMR(124.3,"AA",DFN,GMRGRT,REVDAT,0)) I GMRGPDA Q:'$S('$D(^GMR(124.3,GMRGPDA,5)):0,1:+^(5)) S GMRGPDA=0
Q:'GMRGPDA S NURSCPE=+$O(^NURSC(216.8,"B",GMRGPDA,0))
K NURSPROB,NURSORD,^TMP($J,"GMRGNAR"),^TMP($J,"NURPROB")
F PROB=0:0 S PROB=$O(^NURSC(216.8,NURSCPE,"EVAL","AA",PROB)) Q:PROB'>0 S REVDATE=+$O(^(PROB,0)),DA=+$O(^(REVDATE,0)) I $D(^NURSC(216.8,NURSCPE,"EVAL",DA,0)),'$P(^(0),"^",4) D PROB
D NOW^%DTC S GMRGPDT=% F INTER=0:0 S INTER=$O(^NURSC(216.8,NURSCPE,"ORD","AA",INTER)) Q:INTER'>0 S REVDATE=+$O(^(INTER,0)),DA=+$O(^(REVDATE,0)) I $D(^NURSC(216.8,NURSCPE,"ORD",DA,0)),'$P(^(0),"^",3) D INTER
S (ISW,PSW)=0,(ISW(0),PSW(0))=1,(INTER,PROB)="" D AR F NX=1:1 S INTER=$S(NX=1!(NX'=1&(INTER'="")&'ISW):$O(NURSORD(INTER)),1:INTER),PROB=$S(NX=1!(NX'=1&(PROB'="")&'PSW):$O(NURSPROB(PROB)),1:PROB) Q:INTER=""&(PROB="") D FORMAT Q:NURQUIT
K ^TMP($J,"GMRGNAR"),^TMP($J,"NURPROB")
Q
PROB ;PATIENT PROBLEM ARRAY
S NURPROB=$P($G(^GMRD(124.2,PROB,0)),"^") Q:'$L(NURPROB)!'$D(^GMR(124.3,GMRGPDA,1,"ALIST",PROB))
S P=+$O(^GMR(124.3,GMRGPDA,1,"B",PROB,0)),GMRGXPRT=NURPROB,GMRGXPRT(0)=$S($D(^GMR(124.3,GMRGPDA,1,P,0)):$P(^(0),"^",2),1:""),GMRGXPRT(1)="^^0^^1" D EN1^GMRGRUT2 S PRPROB=GMRGXPRT K GMRGXPRT
S NURSPROB(PRPROB)=PROB
F NX=1:1 S GMRGLEN=$S(NX=1:38,1:36),GMRGPLN=PRPROB D FITLINE^GMRGRUT1 S ^TMP($J,"NURPROB",PROB,NX)=GMRGPLN(0),PRPROB=GMRGPLN(1) Q:PRPROB=""
Q
INTER ;NURSING INTERVENTION ARRAY
S NURORD=$P($G(^GMRD(124.2,INTER,0)),"^") Q:'$L(NURORD)!'$D(^GMR(124.3,GMRGPDA,1,"ALIST",INTER))
S P=+$O(^GMR(124.3,GMRGPDA,1,"B",INTER,0)),GMRGXPRT=NURORD,GMRGXPRT(0)=$S($D(^GMR(124.3,GMRGPDA,1,P,0)):$P(^(0),"^",2),1:""),GMRGXPRT(1)="^^0^^1" D EN1^GMRGRUT2 S NURORD=GMRGXPRT K GMRGXPRT
S NURSORD(NURORD)=INTER
S GMRGPAR=INTER,GMRGPAR(0)="0^"_(IOM-34)_"^2^NURORD" D EN1^GMRGPNBL
Q
FORMAT ;PATIENT PROBLEM/NURSING INTERVENTION DISPLAY
D:PROB'=""
. F RVDT=0:0 S RVDT=$O(^NURSC(216.8,NURSCPE,"EVAL","AA",NURSPROB(PROB),RVDT)) Q:RVDT'>0 S IEN=$O(^NURSC(216.8,NURSCPE,"EVAL","AA",NURSPROB(PROB),RVDT,0)) I IEN>0 D Q
. . S XX=$G(^NURSC(216.8,NURSCPE,"EVAL",IEN,0)),Y=$P(XX,U,5) D DD^%DT S NURSEVDT=Y
. . Q
. Q
I PROB'="",'PSW S PRPROB=$G(^TMP($J,"NURPROB",+NURSPROB(PROB),2)),NURPLN=$G(^TMP($J,"NURPROB",+NURSPROB(PROB),1))_"^"_NURSEVDT,(PSW(0),PSW,PSW(1))=1
E I PROB'="" S PSW(1)=PSW(1)+1,PRPROB=$G(^TMP($J,"NURPROB",+NURSPROB(PROB),PSW(1)+1)),NURPLN=$G(^TMP($J,"NURPROB",+NURSPROB(PROB),PSW(1)))_"^"_NURSEVDT
I INTER'="",'ISW S PRORD=$G(^TMP($J,"GMRGNAR","NURORD",+NURSORD(INTER),2)),NURPLN(0)=$E($G(^TMP($J,"GMRGNAR","NURORD",+NURSORD(INTER),1)),3,38),(ISW(0),ISW,ISW(1))=1
B E I INTER'="" S ISW(1)=ISW(1)+1,PRORD=$G(^TMP($J,"GMRGNAR","NURORD",+NURSORD(INTER),ISW(1)+1)),NURPLN(0)=$G(^TMP($J,"GMRGNAR","NURORD",+NURSORD(INTER),ISW(1)))
I $G(PRPROB)="" S PSW=0
I $G(PRORD)="" S ISW=0
I ($Y>(IOSL-6)) D HEADER^NURCAS0 Q:NURQUIT D HEADER1^NURCAS0,AR
W ! W:($D(NURPLN)#2) ?$S('PSW(0):2,1:0),$E($P(NURPLN,U),1,28) W ?30,$G(NURSEVDT) S NURSEVDT=" " W:$D(NURPLN(0)) ?47,NURPLN(0) S (ISW(0),PSW(0))=0 K NURPLN
Q
AR W !,"PATIENT PROBLEMS",?30,"EVALUATION DATE",?47,"NURSING INTERVENTIONS"
Q