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

BGPDB.m

Go to the documentation of this file.
BGPDB ; IHS/CMI/LAB - indicator B ;
 ;;7.0;IHS CLINICAL REPORTING;;JAN 24, 2007
 ;
IB ;EP ;EP - indicator B
 ;Q:'$D(BGPIND(28))
 Q:BGPAGEB<51
 S BGPSEX=$P(^DPT(DFN,0),U,2),BGPSEX=$S(BGPSEX="M":1,1:2)
 D SAGE(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),19,BGPSEX,1)
 S BGPFOB=$$FOB(DFN,BGPEDATE)
 I BGPFOB]"" D SAGE(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),20,BGPSEX,1)
 S BGPRECT=$$RECT(DFN,BGPEDATE)
 I BGPRECT]"" D SAGE(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),23,BGPSEX,1)
 S BGPDRE=$$DRE(DFN,BGPEDATE)
 S BGPSIG=$$SIG(DFN,BGPEDATE)
 S BGPCOLO=$$COLO(DFN,BGPEDATE)
 I BGPDRE]"",BGPSIG]"" D SAGE(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),21,BGPSEX,1)
 I BGPDRE]"",BGPCOLO]"" D SAGE(BGPRPT,$S(BGPTIME=1:15,BGPTIME=0:45,BGPTIME=8:85,1:999),22,BGPSEX,1)
 I $D(BGPLIST(28)),BGPTIME=1 S ^XTMP("BGPD",BGPJ,BGPH,"LIST",28,$S($P($G(^AUPNPAT(DFN,11)),U,18)]"":$P(^AUPNPAT(DFN,11),U,18),1:"UNKNOWN"),$P(^DPT(DFN,0),U,2),BGPAGEE,DFN)=BGPFOB_" "_BGPDRE_" "_BGPSIG_" "_BGPCOLO
 Q
SAGE(R,N,P,S,V) ;set age into file
 I 'V Q  ;no value
 NEW X,Y
 S X=$P($G(^BGPD(R,N)),U,P)
 S $P(X,"!",S)=$P(X,"!",S)+V
 S $P(^BGPD(R,N),U,P)=X
 Q
S(R,N,P,V) ;
 I 'V Q  ;no value to add
 S $P(^BGPD(R,N),U,P)=$P($G(^BGPD(R,N)),U,P)+V
 Q
SIG(P,EDATE) ;
 NEW BGPG,X,%,E,R,V,BDATE
 K BGPG
 S BDATE=$$FMADD^XLFDT(EDATE,5*(-365))
 K BGPG S %=P_"^LAST PROCEDURE 45.24;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "SIG"
 K BGPG S R="" F %=1:1 S T=$T(SIGCPTS+%^BGPDU) Q:$P(T,";;",2)=""!(R)  S T=$P(T,";;",2),T=+$$CODEN^ICPTCOD(T) I T S E=$$CPTI^BGPDU(P,BDATE,EDATE,T) I E S R=1
 Q $S(R:"SIG",1:"")
COLO(P,EDATE) ;
 NEW BGPG,X,%,E,R,V,BDATE
 K BGPG
 S BDATE=$$FMADD^XLFDT(EDATE,10*(-365))
 K BGPG S %=P_"^LAST PROCEDURE 45.21;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "COLO"
 K BGPG S %=P_"^LAST PROCEDURE 45.22;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "COLO"
 K BGPG S %=P_"^LAST PROCEDURE 45.23;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "COLO"
 K BGPG S %=P_"^LAST PROCEDURE 45.25;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "COLO"
 K BGPG S R="" F %=1:1 S T=$T(SIGCPTS+%^BGPDU) Q:$P(T,";;",2)=""!(R)  S T=$P(T,";;",2),T=+$$CODEN^ICPTCOD(T) I T S E=$$CPTI^BGPDU(P,BDATE,EDATE,T) I E S R=1
 Q $S(R:"SIG",1:"")
DRE(P,EDATE) ;
 NEW BGPG,X,%,E,R,V,BDATE
 K BGPG
 S BDATE=$$FMADD^XLFDT(EDATE,(5*-365))
 K BGPG S %=P_"^LAST PROCEDURE 89.34;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "DRE"
 S %=P_"^LAST EXAM RECTAL;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "DRE"
 Q ""
RECT(P,EDATE) ;
 NEW BGPG,X,%,E,R,V,BDATE
 K BGPG
 S BDATE=$$FMADD^XLFDT(EDATE,(1*-365))
 K BGPG S %=P_"^LAST PROCEDURE 89.34;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "DRE"
 S %=P_"^LAST EXAM RECTAL;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "RECTAL EXAM"
 Q ""
FOB(P,EDATE) ;
 NEW BGPG,X,%,E,R,V,BDATE
 K BGPG
 S BDATE=$$FMADD^XLFDT(EDATE,-365)
 S %=P_"^LAST LAB [BGP GPRA FOB TESTS;DURING "_$$FMTE^XLFDT(BDATE)_"-"_$$FMTE^XLFDT(EDATE),E=$$START1^APCLDF(%,"BGPG(")
 I $D(BGPG(1)) Q "FOB"
 S E=+$$CODEN^ICPTCOD(82270) I E,$$CPTI^BGPDU(P,BDATE,EDATE,E) Q "FOB"
 Q ""