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

BWMDE5.m

Go to the documentation of this file.
BWMDE5 ;IHS/ANMC/MWR - AUTOEDIT OF DATE ENROLLED;12-Feb-2003 10:32;PLS
 ;;2.0;WOMEN'S HEALTH;**8**;MAY 16, 1996
 ;;* MICHAEL REMILLARD, DDS * ALASKA NATIVE MEDICAL CENTER *
 ;;  LOOP THROUGH BW PATIENT FILE, IF DATE ENROLLED IS NULL, STUFF
 ;;  DATE OF FIRST PROCEDURE OR DATE FUNDING BEGAN.
 ;;  ALSO EXAMINE EXPORTED RECORDS.
 ;
 ;---> USE THIS LOOP TO STUFF DATE ENROLLED FOR ALL PATIENTS.
 D SETVARS^BWUTL5
 S N=0,BWSTART=$P(^BWSITE(DUZ(2),0),U,17)
 F  S N=$O(^BWP(N)) Q:'N  D ENROL(N,BWSTART) W "."
 W !!?5,"Done."
 Q
 ;
ENROL(DFN,BWSTART,BWY) ;EP
 ;---> BWSTART=DATE CDC FUNDING PROGRAM BEGAN.
 ;---> SET CDC ENROLLMENT DATE FOR THIS PATIENT.
 ;---> REQUIRED VARIABLES: DFN=PATIENT DFN
 ;                         BWSTART=START DATE OF CDC FUNDING
 ;                         BWY=RETURNED AS ENROL DATE FOR THIS PATIENT
 N BWTMP,IEN,Y S BWY=0
 Q:'$D(^BWP(DFN,0))
 S Y=^BWP(DFN,0)
 ;---> QUIT IF THIS PATIENT ALREADY HAS A DATE ENROLLED.
 Q:$P(Y,U,21)
 ;---> QUIT IF THIS PATIENT HAS NO PROCEDURES ON RECORD.
 I '$D(^BWPCD("C",DFN)) S $P(^BWP(DFN,0),U,21)="" Q
 ;---> GATHER THIS PATIENT'S PROCEDURES IN BWTMP BY DATE.
 S IEN=0
 F  S IEN=$O(^BWPCD("C",DFN,IEN)) Q:'IEN  D
 .S BWTMP($P(^BWPCD(IEN,0),U,12))=""
 ;---> NOW GET EARLIEST PROCEDURE.  IF THAT POST-DATES CDC FUNDING
 ;---> START DATE FOR THIS SITE, SET ENROLLMENT DATE EQUAL TO IT.
 ;---> IF EARLIEST PROCEDURE PRE-DATES CDC START DATE, THEN SET
 ;---> ENROLLMENT DATE EQUAL TO CDC START DATE.
 I $D(BWTMP) D  Q
 .N X S X=$O(BWTMP(BWSTART))
 .I 'X D EDIT(DFN,BWSTART,.BWY) Q
 .D EDIT(DFN,X,.BWY)
 Q
 ;
EDIT(DFN,DATE,BWY) ;EP
 ;---> ENTER DATE INTO FIELD #.21 DATE ENROLLED.
 N (BWY,DATE,DFN,DT,DTIME,DUZ,U) D SETVARS^BWUTL5
 S:$E(DATE,6,7)="00" $E(DATE,6,7)="01"
 S DR=".21////"_DATE,BWY=DATE
 D DIE^BWFMAN(9002086,DR,DFN,.BWPOP)
 Q
 ;
 ;
EXAMINE ;EP
 ;---> PROGRAMMER UTILITY; NOT CALLED BY ANY USER OPTION.
 ;---> EXAMINE FIXED BWLENGTH MDE RECORDS TO BE EXPORTED TO CDC,
 ;---> STORE IN ^BWTMP.
 ;
 N DFN,I,J,N,Y
 D SETVARS^BWUTL5 S BWPOP=0
 R:DTIME !!,"$J: ",J
 Q:'J
 F  D  Q:BWPOP
 .R:DTIME !!,"DFN: ",DFN
 .I DFN="" S BWPOP=1 Q
 .I '$D(^BWTMP(J,DFN)) W !,"DOES NOT EXIST",! Q
 .S N=0
 .F  S N=$O(^BWTMP(J,DFN,N)) Q:'N  D  Q:BWPOP
 ..S BWY=^BWTMP(J,DFN,N)
 ..W !!,"RECORD ($J,DFN,IEN): ^BWTMP(",J,",",DFN,",",N
 ..W "   PATIENT: ",$$NAME^BWUTL1(DFN)
 ..W !,"-------------------------------------------------------------"
 ..S Y=0,I=0
 ..F  S Y=$O(^BWMDE(Y)) D:'Y DIRZ^BWUTL3 Q:'Y  D  Q:BWPOP
 ...;S DIC(0)="QEMA",DIC=9002086.91,DIC("A")="   Select FIELD: "
 ...;D ^DIC K DIC
 ...;I Y<0 S BWPOP1=1 Q
 ...S NODE=^BWMDE(+Y,0)
 ...I I>15 D DIRZ^BWUTL3 S I=0
 ...Q:BWPOP
 ...S BWCOLEN=$P(NODE,U,3)
 ...S BWCOL=$P(BWCOLEN,","),BWLEN=$P(BWCOLEN,",",2)
 ...S BWVAL=$E(BWY,BWCOL,BWCOL+(BWLEN-1))
 ...I BWVAL?.N.A&(BWVAL]"") W !,$P(NODE,U),?40,BWVAL S I=I+1
 D KILLALL^BWUTL8
 Q