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

NURSCEP.m

Go to the documentation of this file.
  1. NURSCEP ;HIRMFO/JH/MH/MD-LIST STAFF (#210) FILE DISCREPANCIES ;7/15/97
  1. ;;4.0;NURSING SERVICE;**6**;Apr 25, 1997
  1. TXT ;;This option generates an exception report that identifies the
  1. ;;following discrepancies between the NURS Staff (#210) and the
  1. ;;NURS Position Control (#211.8) Files:
  1. ;;
  1. ;;a. Staff record has no corresponding New Person (#200) file entry.
  1. ;;b. Staff record contains missing/invalid data in the Name field .01.
  1. ;;c. Staff record has missing/invalid Status data in field 5.5.
  1. ;;d. Staff record missing the 'B' index entry.
  1. ;;e. Staff Employee has 'ACTIVE' status and no active file 211.8 assignment(s).
  1. ;;f. Staff Record has 'B' index entry and no data on zeroth node.
  1. ;;g. File (#211.8) contains duplicate assignment entries for an employee.
  1. ;;h. File (#211.8) contains assignments with no corresponding staff record.
  1. ;;i. File (#211.8) contains active assignments for inactive nursing locations.
  1. ;;
  1. EN1 I '$D(^NURSF(210,0))!('$D(^NURSF(211.8,0))) W !!,"*** MISSING NURSING FILE ***" Q
  1. S TXT=$T(TXT) W ! F I=0:1:12 S TXT=$T(TXT+I) W !,$P(TXT,";",3)
  1. ASK W !!,"Do you want the discrepancy report queued to a printer ?" S DIR(0)="Y",DIR("B")="NO" D ^DIR S NUROUT=+$G(DIRUT) G QUIT:NUROUT G START:Y=0
  1. W ! S ZTDESC="STAFF DISCREPANCIES",ZTRTN="START^NURSCEP" D QUEUE G:$D(ZTSK)!$G(POP) QUIT D:$D(ZTSK)#2 HOME^%ZIS
  1. START U IO D NOW^%DTC S NDATE=%I(1)_"/"_%I(2)_"/"_$E(%I(3),2,3),(NSW1,NURQUEUE,NURPAGE,NURQUIT,NUROUT)=0 W ! K ^TMP("NOSTAFF",$J),^TMP("NURS",$J),^TMP("NURP",$J),^TMP("NURPOS",$J)
  1. I $E(IOST)="C" W !,"Checking the NURS Staff (#210) File..."
  1. S (NUM,NURSDA)=0 F S NURSDA=$O(^NURSF(210,NURSDA)) Q:NURSDA'>0 S NPDA=+$G(^NURSF(210,NURSDA,0)),NSTAT=$P($G(^(0)),U,2),NAM=$S($G(^VA(200,+NPDA,0))'="":$P(^(0),U),1:"** INVALID NAME DATA **"),NUM=(NUM+1) D
  1. . W:$E(IOST)="C"&($R(2000)) "." I '$$EN1^NURSUT0(NPDA,DT),$P($G(^NURSF(210,NURSDA,0)),U,2)="A",$D(^VA(200,NPDA,0)) S SW=5 D SETSTF ;Active employee/no assignment(s)
  1. . I $P($G(^NURSF(210,NURSDA,0)),U)'>0 S SW=2 D SETSTF ;Emp. entry has missing/invalid data in name field
  1. . I '$D(^VA(200,NPDA,0)),'$D(^TMP("NURS",$J,NUM,3,NURSDA)) S SW=1 D SETSTF ;Employee not in New Person File.
  1. . I '$D(^NURSF(210,"B",NPDA)),'$D(^TMP("NURS",$J,NUM,3,NURSDA)) S SW=4 D SETSTF ;Emp. has missing B xrf in Nurstaff File.
  1. . I NSTAT'="A",NSTAT'="R",NSTAT'="I"!(NSTAT="") S SW=3 D SETSTF
  1. . Q
  1. S NPDA=0 F S NPDA=$O(^NURSF(210,"B",NPDA)) Q:NPDA'>0 S NURSDA=$O(^NURSF(210,"B",NPDA,0)) I +NURSDA,$G(^NURSF(210,+NURSDA,0))="" D
  1. . S NUM=(NUM+1),NAM=$S($G(^VA(200,+NPDA,0))'="":$P(^(0),U),1:"** INVALID NAME DATA **"),SW=6 D SETSTF ; 'B' xref no data on zeroth node
  1. . Q
  1. I $E(IOST)="C" W !,"Checking the NURS Position Control (#211.8) File..."
  1. S NOD=0 F S NOD=$O(^NURSF(211.8,NOD)) Q:NOD'>0 S NDA=0 F S NDA=$O(^NURSF(211.8,NOD,1,NDA)) Q:NDA'>0 I $G(^NURSF(211.8,NOD,1,NDA,0))'="",$P($G(^(0)),U,6)="" D
  1. . S NAM=+$P(^NURSF(211.8,NOD,1,NDA,0),U,2),NFTE=+$P($G(^(0)),U,4)
  1. . S Q=$G(^NURSF(211.8,NOD,1,NDA,0)) S STDAT=$P(Q,U),NPOS=$P(Q,U,3),NFT=$P(Q,U,4),ENDAT=$P(Q,U,6)
  1. . S NPOS(1)=$S($D(^NURSF(211.3,+NPOS,0)):$P(^(0),U,1),1:""),NSWRD=$P($G(^NURSF(211.8,NOD,0)),U),NWRD=$P($P(^SC(NSWRD,0),"NUR ",2),U)
  1. . S:STDAT'="" SDAT=$E(STDAT,4,5)_"/"_$E(STDAT,6,7)_"/"_$E(STDAT,2,3) S EDAT="" S:ENDAT'="" EDAT=$E(ENDAT,4,5)_"/"_$E(ENDAT,6,7)_"/"_$E(ENDAT,2,3)
  1. . I $$STAT^NURSCEP1(NOD) S ^TMP("INACT",$J,NAM,NOD,NDA)=NPOS(1)_U_NWRD_U_NFT_U_SDAT_U_EDAT
  1. . S:'$D(^NURSF(210,"B",NAM)) ^TMP("NOSTAFF",$J,NAM,NOD,NDA)=NPOS(1)_U_NWRD_U_NFT_U_SDAT_U_EDAT
  1. . I NFTE>0,$D(^TMP("NURPOS",$J,NAM,1)) S ^TMP("NURPOS",$J,NAM,1)=^TMP("NURPOS",$J,NAM,1)_NOD_";"_NDA_U F X=1:1 Q:$P(^TMP("NURPOS",$J,NAM,1),U,X)="" S Y=$P(^(1),U,X),NOD=$P(Y,";"),NDA=$P(Y,";",2) D GETDATA
  1. . S:'$D(^TMP("NURPOS",$J,NAM,NFTE)) ^(NFTE)=NOD_";"_NDA_U
  1. . Q
  1. I '$D(^TMP("NURS",$J)),'$D(^TMP("NURP",$J)),'$D(^TMP("NOSTAFF",$J)),'$D(^TMP("INACT",$J)) S NURTYPE="" D HDR^NURSCEP1 W !!,"No discrepancies were found between the 210 and 211.8 files." G QUIT
  1. D ^NURSCEP1
  1. QUIT ;
  1. Q K ^TMP("NOSTAFF",$J),^TMP("NURS",$J),^TMP("NURP",$J),^TMP("NURPOS",$J) D CLOSE^NURSUT1,^NURSKILL
  1. Q
  1. QUEUE ;
  1. S %ZIS="Q",IOP="Q" D ^%ZIS K %ZIS K:POP IO("Q") Q:POP
  1. I $D(IO("Q")) K IO("Q"),IO("C") S ZTIO=ION_";"_IOST_";"_IOM_";"_IOSL D ^%ZTLOAD S:'$D(ZTSK) POP=1
  1. Q
  1. GETDATA ;
  1. W:$E(IOST)="C"&($R(20000)) "."
  1. S:'$D(^TMP("NURP",$J,NAM,NOD,NDA)) ^(NDA)=NPOS(1)_U_NWRD_U_NFT_U_SDAT_U_EDAT
  1. Q
  1. SETSTF ;
  1. S:'$D(^TMP("NURS",$J,"L",NURSDA,NAM)) ^(NAM)=NUM
  1. S ^TMP("NURS",$J,"L1",NUM,SW)=""
  1. Q