VistA-WorldVistAEHR/r/NURSING_SERVICE-NUR/NURSEP3I.m

73 lines
4.0 KiB
Mathematica

NURSEP3I ;HIRMFO/GLB,JH,FT-INDIVIDUAL NURSING MANDATORY INSERVICE CLASS DATA FOR THE LAST THREE YEARS ;2/27/98 14:26
;;4.0;NURSING SERVICE;**9**;Apr 25, 1997
EN1 S X=$G(^PRSE(452.7,1,"OFF")) Q:X=""!(X=1)
S Y=$G(^DIC(213.9,1,"OFF")) Q:X=""!(X=1)
S (NUSW,NSP,NURQUEUE,NUROUT)=0,YRSW=1
S DATSEL="NS^N+" D DATSEL^NURSAGP2 G QUIT:NUROUT W ! D INS^NURSAGP2 G QUIT:NUROUT D:NURSEL'="A" EN5^NURSAGP1 G QUIT:NUROUT
D EN1^NURSAUTL G QUIT:NUROUT D EN10^NURSUT3($G(DUZ)) I $G(NURSZAP)>7 S DA=$O(^NURSF(210,"B",DUZ,0)),DA(1)=DUZ G A1
S DIC("S")="I +$$EN6^NURSUT3($G(Y))"
D EN3^NURSAGP1 G QUIT:NUROUT S DA=+Y,DA(1)=+$G(^NURSF(210,DA,0))
A1 W ! S ZTRTN="START^NURSEP3I" D EN7^NURSUT0 G:POP!($D(ZTSK)) QUIT
START ;
K ^TMP("NURE",$J) S NURS132=$S(IOM'<132:1,1:0),$P(HH,"-",$S(NURS132:133,1:81))="",(CLASS,NURPAGE)=0,(NOIEN,NOLOC,NOMIC1,NYR,SLOC,SNM,SIEN,SMC)="",FSW=1
S X=YRST D COMPARE S YR=Y F Y=0:1:2 S YR(Y)=YR-(Y*10000),YR0(YR-(Y*10000))=""
K NYR D SORT
S LOC=""
F S LOC=$O(^TMP("NURE",$J,"L",LOC)) Q:LOC=""!NUROUT S NM="" F S NM=$O(^TMP("NURE",$J,"L",LOC,NM)) Q:NM=""!NUROUT S NURSORT=$G(^TMP("NURE",$J,"L",LOC,NM)) I NURSORT F IEN=0:0 S IEN=$O(^TMP("NURE",$J,"L1",NURSORT,IEN)) Q:IEN'>0!NUROUT D FIN
I 'NURPAGE D HDR W !!,"THERE IS NO SELECTED INSERVICE DATA."
QUIT ;
K ^TMP("NURE",$J) D CLOSE^NURSUT1,^NURSKILL
Q
FIN S MC="" F S MC=$O(^TMP("NURE",$J,"L1",NURSORT,IEN,MC)) Q:MC=""!NUROUT D FIN1
Q
FIN1 S SP=$P(^TMP("NURE",$J,"L1",NURSORT,IEN,MC),"^")
I $Y>(IOSL-4)!(FSW) D HDR Q:NUROUT
I NOIEN'=IEN D PHDR
I NOMIC1'=MC D CHDR
F X=0:1:2 S NYR(YR(X))=0
F I=0:0 D FIN2 W ! Q:NYR(YR(1))="E"&(NYR(YR(0))="E")&(NYR(YR(2))="E") I ($Y>(IOSL-4)) D HDR Q:NUROUT
Q
FIN2 F NX=2:-1:0 I NYR(YR(NX))'="E" S NYR(YR(NX))=$O(^TMP("NURE",$J,2,IEN,MC,YR(NX),NYR(YR(NX)))) S:NYR(YR(NX))'>0 NYR(YR(NX))="E" I NYR(YR(NX))'="E" D FIN3
Q
FIN3 S Y=$E(^TMP("NURE",$J,2,IEN,MC,YR(NX),NYR(YR(NX))),1,7),X=$O(^(NYR(YR(NX)))) D D^DIQ S YY=$P(Y,",") W ?($S(NURS132:88,1:52)+((2-NX)*9)),YY S:X'>0 NYR(YR(NX))="E"
Q
HDR I 'NUROUT I 'FSW,$E(IOST)="C" D ENDPG^NURSUT1 Q:$G(NUROUT)
S FSW=0,NOLOC=LOC,NURPAGE=NURPAGE+1
W:$E(IOST)="C"!(NURPAGE>1) @IOF
W !,"3 "_$S(TYP="C":"CY ",1:"FY ")_"INDIVIDUAL "_$S(NURSEL="M":"MANDATORY",NURSEL="O":"OTHER",NURSEL="W":"WARD",NURSEL="C":"C.E.",1:"COMPLETE")_" TRAINING REPORT",?$S(NURS132:100,1:52)," "
S Y=DT D DT^DIQ
W ?$S(NURS132:121,1:69),"PAGE: ",NURPAGE,!!,"CLASS"
I NURS132 W ?82," "
I 'NURS132 W ?46," "
F X=2:-1:0 S Z=1700+$E(YR(X),1,3) W " ",Z
W !,HH Q:NUROUT!($G(IEN)="")
PHDR S NOIEN=IEN W !,"Employee Name: "_NM_" "_SP,!!
CHDR S NOMIC1=MC W $S(NURS132:MC,1:$E(MC,1,50))
Q
SORT S NAM=" BLANK" I $D(^VA(200,DA(1),0)),$P(^(0),"^",1)'="" S NAM=$P(^(0),"^",1)
D EN3^NURSUT0 S LOC=$S('$D(^NURSF(211.8,+NOD1,0)):" BLANK",'+$P(^(0),U):" BLANK",1:$P(^(0),U))
S NPWARD=LOC D EN7^NURSAUTL S LOC1=$S(NPWARD'="":NPWARD,1:" BLANK")
D EN2^NURSUT0 S SP=NPSPOS(1),SP=$S(SP="R":"RN",SP="L":"LPN",SP="N":"NA",SP="C":"CK",SP="S":"SE",SP="A":"AO",SP="O":"OT",1:" ")
S NIC2="" F S NIC2=$O(^PRSE(452,"AA",NIC2)) Q:NIC2="" S MIC="" F S MIC=$O(^PRSE(452,"AA",NIC2,DA(1),MIC)) Q:MIC="" W:$E(IOST)="C" "." D A
Q
A F MIC(0)=0:0 S MIC(0)=$O(^PRSE(452,"AA",NIC2,DA(1),MIC,MIC(0))) Q:MIC(0)'>0 F MIC(1)=0:0 S MIC(1)=$O(^PRSE(452,"AA",NIC2,DA(1),MIC,MIC(0),MIC(1))) Q:MIC(1)'>0 D SORT2
Q
SORT2 ;
S:$G(NURSORT)="" NURSORT=1
I NURSEL'="A"&(NURSEL'=NIC2) Q
S MICD=9999999-MIC(0),X=MICD S:NURSEL="A" NSPC=MIC D COMPARE S MICY=Y
Q:'$D(YR0(MICY)) I 'NSP,NSPC'=MIC Q
S NYR(MIC,MICY)=$S('$D(NYR(MIC,MICY)):0,1:NYR(MIC,MICY))+1
N X S X=$G(^TMP("NURE",$J,"L",LOC1,NAM))
I X="" S X=NURSORT,NURSORT=NURSORT+1,^TMP("NURE",$J,"L",LOC1,NAM)=X
S ^TMP("NURE",$J,"L1",X,DA,MIC)=SP
S ^TMP("NURE",$J,2,DA,MIC,MICY,NYR(MIC,MICY))=MICD
Q
COMPARE ;CHECK FOR NEW FISCAL YEAR
S Y=$E(X,1,3)_"0000" I X'<($E(X,1,3)_"1000"),TYP="F" S Y=Y+10000
Q
EN4 ; SCREEN OUT UNAUTHORIZED LOCATION DATA
S X="" F Y=0:0 S X=$O(^TMP("NURE",$J,1,X)) Q:X="" S Z="" F Y=0:0 S Z=$O(^SC("B",$S(X'?1"NUR ":"NUR ",1:"")_X,Z)) Q:Z'>0 S Y=$O(^NURSF(211.4,"B",Z,"")) K:$S(Y'>0:0,'$D(NURSZLO(Y)):1,1:0) ^TMP("NURE",$J,1,X)
K X,Y
Q