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

49 lines
3.3 KiB
Mathematica
Raw Normal View History

NURCPP1 ;HIRMFO/JH/RM-NURSING CARE PLAN DATA OUTPUT part 1 ;1/13/92
;;4.0;NURSING SERVICE;;Apr 25, 1997
; This is the Patient Problem Listing,Data Processor,Output Routine
EN1 ;
D NOW^%DTC S Y=% D D^DIQ S NURSDAT=$P(Y,":",1,2),NURSISW=1,NURSSP=0,NURSLIN("-")="",$P(NURSLIN("-"),"-",IOM)="-",NURSPAG=1,(NURSLCNT,NURSSW1)=0 D SPACES^NURCPP3
S NURSMED="Diagnosis: "_$E(NURSDIAG_NURSSS,1,37)_" "_"Physician: "_NURSPROV
S NURSHED=$E(NURSPNAM_NURSSS,1,20)_" "_NURSSSN_" "_NURAGE_" "_$E(NURSWD_NURSSS,1,8)_" "_$E(NURSRB_NURSSS,1,10)_" "_$E(NURSREL_NURSSS,1,4)_" "_NURSMAR
;
S NURSO=0,NURSP(1)="" F NURSX=0:0 S NURSP(1)=$O(NURSPRB(NURSP(1))) Q:NURSP(1)="" F NURSP=0:0 S NURSP=$O(NURSPRB(NURSP(1),NURSP)) Q:NURSP'>0 D PROB
F X=0:0 Q:$S('$D(^TMP($J,"NURSDATA",NURSO)):1,^(NURSO)'="":1,1:0) K ^(NURSO) S NURSO=NURSO-1
I NURSO'>0 U IO S NURSISW=0,ANS="" D HEADER^NURCPP3 W !!,"THERE IS NO DATA FOR THIS REPORT" S NURSISW=2,NURSLCNT=NURSLCNT+2 D HEADER^NURCPP3 Q
U IO D GETOUPT^NURCPP3
;
Q
;
PROB ; CHECK FOR PROBLEM AND EVALUATION DATE
K NURSLVD F X=1:1:2 S NURSO=NURSO+1,^TMP($J,"NURSDATA",NURSO)=""
S GMRGXPRT=$S($D(^GMRD(124.2,NURSP,0)):$P(^(0),"^"),1:""),NURSP(0)=$O(^GMR(124.3,GMRGPDA,1,"B",NURSP,0)),GMRGXPRT(0)=$S(NURSP(0)'>0:"",$D(^GMR(124.3,GMRGPDA,1,NURSP(0),0)):$P(^(0),"^",2),1:""),GMRGXPRT(1)="^^0^^1" D EN1^GMRGRUT2
S GMRGPLN=GMRGXPRT,GMRGLEN=50 D FITLINE^GMRGRUT1 S ^TMP($J,"NURSDATA",NURSO)=GMRGPLN(0)
F NURSE(0)=0:0 S NURSE(0)=$O(^TMP($J,"NURSDATE",NURSP,NURSE(0))) Q:NURSE(0)'>0 F NURSE=0:0 S NURSE=$O(^TMP($J,"NURSDATE",NURSP,NURSE(0),NURSE)) Q:NURSE'>0 D PROB1
I ^TMP($J,"NURSDATA",NURSO)'="" S NURSO=NURSO+1,^TMP($J,"NURSDATA",NURSO)=""
F NURSE=0:0 Q:GMRGPLN(1)="" S GMRGLEN=50,GMRGPLN=GMRGPLN(1) D FITLINE^GMRGRUT1 S ^TMP($J,"NURSDATA",NURSO)=GMRGPLN(0),NURSO=NURSO+1,^(NURSO)=""
G PROB3
;
PROB1 ;
S X=$S($D(^TMP($J,"NURSDATE",NURSP,NURSE(0),NURSE)):^(NURSE),1:"")
S Y=$P(X,"^",2) S:Y'="" Y=$E(Y,4,5)_"/"_$E(Y,6,7)_"/"_$E(Y,2,3) S NURSTAT=$S($L($P(X,"^",4)):"("_$P(X,"^",4)_")",1:" "),NURSRN=$E($S($D(^VA(200,+$P(X,"^",3),0)):$P($P(^(0),"^"),","),1:"")_" ",1,10)
I '$D(NURSLVD) S NURSLVD=("^R^S^U^"[("^"_$P(X,"^",4)_"^")) ; switch to determine if problem inactive
S X=^TMP($J,"NURSDATA",NURSO),^(NURSO)=X_$E(NURSSS,1,57-$L(X))_NURSH3_Y_NURSTAT_NURSP3_NURSRN,X=""
I GMRGPLN(1)'="" S GMRGPLN=GMRGPLN(1),GMRGLEN=50 D FITLINE^GMRGRUT1 S X=GMRGPLN(0)
S NURSO=NURSO+1,^TMP($J,"NURSDATA",NURSO)=X
Q
PROB3 F NURSOT=0:0 S NURSOT=$O(^TMP($J,"NURSOT",NURSP,NURSOT)) Q:NURSOT'>0 S NURSO=NURSO+1,^TMP($J,"NURSDATA",NURSO)="" D OTHER
;
I $D(^TMP($J,"NURSDATA",NURSO)),^(NURSO)'="" S NURSO=NURSO+1,^(NURSO)=""
S NURSO=NURSO+1,^TMP($J,"NURSDATA",NURSO)=""
K NURSB("G"),NURSB("I") F NURSE=0:0 S NURSE=$O(^GMRD(124.2,NURSP,1,"B",NURSE)) Q:NURSE'>0 S NURSE(0)=$S($D(^GMRD(124.2,NURSE,0)):$P(^(0),"^",4),1:"") S:NURSE(0)=NURSGCK NURSB("G",NURSE)="" S:NURSE(0)=NURSICK NURSB("I",NURSE)=""
D ^NURCPP2
S NURSP(0)=$O(^GMR(124.3,GMRGPDA,1,"B",NURSP,0)) I NURSP(0)>0,$D(^GMR(124.3,GMRGPDA,1,NURSP(0),"ADD")),^("ADD")]"" S NURSLGT=47,NURSADD=^("ADD"),NURSO=NURSO+1,^TMP($J,"NURSDATA",NURSO)="" D FORMAT^NURCPP4
Q
;
OTHER ; PRINT OTHER INFO ABOUT PROBLEM
F NURST=0:0 S NURST=$O(^TMP($J,"GMRGNAR","R",NURSOT,NURST)) Q:NURST'>0 D STOT
Q
STOT ;
S X=^TMP($J,"GMRGNAR","R",NURSOT,NURST)
S ^TMP($J,"NURSDATA",NURSO)=" "_X_$E(NURSSS,1,57-$L(X)),NURSO=NURSO+1,^TMP($J,"NURSDATA",NURSO)=""
Q