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