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

BDWDDR2.m

Go to the documentation of this file.
BDWDDR2 ; IHS/CMI/LAB - reexport in date range ;
 ;;1.0;IHS DATA WAREHOUSE;;JAN 23, 2006
 ;
 ;
GENREC ;
DELSTAT ;generate new delimited format of the statistical record
 S BDWUSED=BDWUSED+1 ;total number of visits used
 S BDW("X")=$$VREC(BDWVIEN,"DATA WAREHOUSE RECORD 1")
 D SETTMP
 S BDW("X")=$$VREC(BDWVIEN,"DATA WAREHOUSE RECORD 2")
 D SETTMP
 S BDW("X")=$$VREC(BDWVIEN,"DATA WAREHOUSE RECORD 3")
 D SETTMP
 ;cpt records
 K AUPNCPT S X=$$CPT^AUPNCPT(BDWVIEN)
 I $D(AUPNCPT) D
 .S (X,BDWV("CPT COUNT"))=0 F  S X=$O(AUPNCPT(X)) Q:X'=+X  S BDWV("CPT COUNT")=BDWV("CPT COUNT")+1
 .S BDWV("CPT RECS")=$S(BDWV("CPT COUNT")#25=0:BDWV("CPT COUNT")/25,1:(BDWV("CPT COUNT")\25)+1) ;IHS/CMI/LAB
 .F BDWV("CPT X")=1:1:BDWV("CPT RECS") D
 ..S P=1,Y=(BDWV("CPT X")*25)-25 K BDWV("CPT SET") F  S Y=$O(AUPNCPT(Y)) Q:Y=""!(Y>(BDWV("CPT X")*25))  S $P(BDWV("CPT SET"),U,P)=$P(AUPNCPT(Y),U)_"^" D  S P=P+2
 ...;Q:$P(AUPNCPT(Y),U,4)'=9000010.18
 ...I $P(AUPNCPT(Y),U,4)=9000010.18 S E=$P(AUPNCPT(Y),U,5) S $P(BDWV("CPT SET"),U,(P+1))=$P($G(^AUPNVCPT(E,0)),U,16)
 ..S BDW("X")=$$VREC(BDWVIEN,"DATA WAREHOUSE RECORD 4",BDWV("CPT SET"),BDWV("CPT X"))
 ..D SETTMP
 K AUPNCPT
 S ^TMP($J,"BDW",BDWVIEN)=BDW("MAIN TX DATE")
 Q
 ;
SETTMP ;
 S BDWTOTR=BDWTOTR+1
 S ^BDWPDATA(BDWTOTR)=BDW("X")
 Q
VREC(BDWVIEN,BDWRTYP,BDWVAR1,BDWVAR2,BDWVAR3,BDWVAR4,BDWVAR5,BDWVAR6) ;generate 1 record delimited format
 S BDWVREC=^AUPNVSIT(BDWVIEN,0)
 S DFN=$P(^AUPNVSIT(BDWVIEN,0),U,5)
 NEW BDWRIEN S BDWRIEN=$O(^BDWREC("B",BDWRTYP,0))
 I 'BDWRIEN Q ""
 NEW BDWY,BDWT S BDWY=0,BDWT="" F  S BDWY=$O(^BDWREC(BDWRIEN,11,"B",BDWY)) Q:BDWY'=+BDWY  D
 .S X=""
 .NEW BDWZ S BDWZ=$O(^BDWREC(BDWRIEN,11,"B",BDWY,0))
 .Q:'$D(^BDWREC(BDWRIEN,11,BDWZ,1))
 .X ^BDWREC(BDWRIEN,11,BDWZ,1)
 .S $P(BDWT,U,BDWY)=X
 .;S LORICNT=LORICNT+1,^LORITEST(LORICNT)=BDWVIEN_"^"_$P(^BDWREC(BDWRIEN,11,BDWZ,0),U,1)_"^"_$P(^BDWREC(BDWRIEN,11,BDWZ,0),U,2)_"^"_X
 Q BDWT