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

BHSDEN1.m

Go to the documentation of this file.
BHSDEN1 ;IHS/CIA/MGH - Health Summary for Dental ;17-Mar-2006 10:36;MGH
 ;;1.0;HEALTH SUMMARY COMPONENTS;;March 17, 2006
 ;===================================================================
 ;Taken from ADERVW1
 ; IHS/HQT/MJL  - DENTAL CHART REVIEW PT 3 ;  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;Dental health summary; list procedures - continuation of BHSDEN
 ;
DO ; EP
 I '$D(^ADEPCD("DATE",ADEPAT)) S ADETXT="<No Services on Record>",ADENRQ="",ADEICL=0 X ADEPRT Q
 S ADETXT="SERVICES PROVIDED: ",ADENRQ="",ADEICL=20 X ADEPRT
 K ^ADEUTL("DENTAA",$J)
 S ADEDAT=(9999999-GMTSDLM)-1
 F ADEQ=0:0 S ADEDAT=$O(^ADEPCD("DATE",ADEPAT,ADEDAT)) Q:'ADEDAT  S ADEDFN="" F ADEQ=0:0 S ADEDFN=$O(^ADEPCD("DATE",ADEPAT,ADEDAT,ADEDFN)) Q:'ADEDFN  S ^ADEUTL("DENTAA",$J,ADEPAT,9999999-(ADEDAT\1),ADEDFN)=""
 S ADENDMS=ADENDM
 S ADEDAT="" F ADEQ=0:0 S ADEDAT=$O(^ADEUTL("DENTAA",$J,ADEPAT,ADEDAT)) Q:ADEDAT=""!(ADEDAT>GMTSDLM)!(ADENDMS<1)  S X=-ADEDAT+9999999 D REGDT4^GMTSU S ADEDTD=X S ADEDTU=0 D ONEDATE Q:$D(GMTSQIT)  S ADENDMS=ADENDMS-1
DENTALX K ADEDAT,ADEDAT,ADEDTU,ADEDTD,ADEDFN,ADEY,ADEX,ADEDFN,ADESVD,ADEFO,ADESFN,ADEADA,ADEOP,ADENDN
 K ADENSH,ADESITE
 K ADETXT,ADENRQ,ADEICL
 Q
ONEDATE S ADEDFN="" F ADEQ=0:0 S ADEDFN=$O(^ADEUTL("DENTAA",$J,ADEPAT,ADEDAT,ADEDFN)) Q:ADEDFN=""  D DNTCHK Q:$D(GMTSQIT)  D NARR Q:$D(GMTSQIT)
 Q
DNTCHK ;
 S ADESITE="" S ADESITE=$P(^ADEPCD(ADEDFN,0),U,3),ADEREP=$P(^(0),U,4),ADEPRV=$P(^(0),U,5),ADENOT=$P(^(0),U,7) X ADESITX
 D CKP^GMTSUP Q:$D(GMTSQIT)  S:GMTSNPG ADEDTU=0
 I 'ADEDTU W ADEDTD S ADEFO=""
 I ADENSH=ADEFO S ADESFN=""
 E  S (ADESFN,ADEFO)=ADENSH W ?10,ADESFN
 I ADEREP]"",$D(^DIC(16,ADEREP,0)) W " --",$P(^DIC(16,ADEREP,0),U),"--"
 I ADEPRV]"",ADEPRV'=ADEREP,$D(^DIC(16,ADEPRV,0)) W " (Provider: ",$P(^DIC(16,ADEPRV,0),U),")"
 W !
 S ADEDTU=1
 D DSVC
 I $D(ADENFLG) S ADETXT="*=Not reportable",ADEICL=4,ADENRQ="" X ADEPRT K ADENFLG
 D NOTE
 Q
 ;
NOTE ;DENTAL NOTE
 Q:ADENOT=""
 D CKP^GMTSUP Q:$D(GMTSQIT)  W:GMTSNPG !,ADEDTD,?10,ADESFN," (Cont'd)",!
 S ADENOT="NOTE: "_ADENOT
 I $L(ADENOT)>70 S ADETXT=$E(ADENOT,1,70),ADEICL=4,ADENRQ="" X ADEPRT S ADETXT=$E(ADENOT,71,99),ADEICL=10,ADENRQ="" X ADEPRT Q
 S ADETXT=ADENOT,ADEICL=4,ADENRQ="" X ADEPRT
 Q
NARR ;DENTAL NARRATIVE
 Q:'$D(^ADEPCD(ADEDFN,"NAR",0))
 S ADETXT="",ADEX=0 F ADEQ=0:0 S ADEX=$O(^ADEPCD(ADEDFN,"NAR",ADEX)) Q:'ADEX  S ADEY=^(ADEX,0) D NARR1
 I ADETXT'="" S ADENRQ="",ADEICL=25 X ADEPRT
 W !
 Q
NARR1 ;CHECK TEXT LENGTH, IF > 241, PRINT TEXT
 I $L(ADETXT_ADEY)<241 S ADETXT=ADETXT_" "_ADEY
 E  S ADENRQ="",ADEICL=25 X ADEPRT S ADETXT=ADEY
 Q
DSVC D CKP^GMTSUP Q:$D(GMTSQIT)  W:GMTSNPG !,ADEDTD,?10,ADESFN," (Cont'd)",!
 D MOD0
 D LINE
 Q
MOD0 N ADENONR,ADEZ,ADEJ
 S ADEJ=0,ADEOP="" K ADEV,ADEDES
MOD1 S ADEJ=$O(^ADEPCD(ADEDFN,"ADA","B",ADEJ)) I ADEJ="" K ADECNT,ADEK,ADEOP Q
 G:'$D(^AUTTADA(ADEJ)) MOD1
 S (ADECNT,ADEK)=0,ADEOP="",ADESFC="",ADENONR=""
MOD2 S ADEK=$O(^ADEPCD(ADEDFN,"ADA","B",ADEJ,ADEK))
 I ADEK="" S ADEK=$P(^AUTTADA(ADEJ,0),U),ADEV(ADEK)=ADECNT_U_ADEOP_U_U_ADESFC_U_ADENONR,ADEDES(ADEK)=$P(^AUTTADA(ADEJ,0),U,6) G MOD1
 S ADECNT=ADECNT+1
 S X=$P(^ADEPCD(ADEDFN,"ADA",ADEK,0),U,2),ADEY=$P(^(0),U,4),ADEZ=$P(^(0),U,5) S:ADEZ["y" ADENFLG=1 I X="" S ADENONR=ADEZ G MOD2
 G:'$D(^ADEOPS(X,88)) MOD2 S ADEPC=^ADEOPS(X,88),$P(ADEOP,",",ADECNT)=ADEPC,$P(ADESFC,",",ADECNT)=ADEY,$P(ADENONR,",",ADECNT)=ADEZ G MOD2
 ;
LINE N ADEJ,ADEFLG,ADEK,ADEPC,ADECNT
 S ADEJ=0,ADEFLG=0
L1 S ADEJ=$O(ADEV(ADEJ)),ADEFLG=0 G:ADEJ="" L2
 D CKP^GMTSUP Q:$D(GMTSQIT)  W:GMTSNPG !,ADEDTD,?10,ADESFN," (Cont'd)",!
 S ADETXT=ADEJ
 I $P(ADEV(ADEJ),U,5)="y",$P(ADEV(ADEJ),U,2)="" S ADETXT=ADETXT_"* "
 E  S ADETXT=ADETXT_"  "
 S ADETXT=ADETXT_"("_$J($P(ADEV(ADEJ),U),2)_")"_" "_$E(ADEDES(ADEJ)_"                    ",1,20)
 S ADECNT=0 F ADEK=1:1:$L($P(ADEV(ADEJ),U,2),",") D
 . S ADEPC=$P($P(ADEV(ADEJ),U,2),",",ADEK)
 . S ADEPC=ADEPC_$S($P($P(ADEV(ADEJ),U,4),",",ADEK)]"":"["_$P($P(ADEV(ADEJ),U,4),",",ADEK)_"]",1:"")
 . S ADEPC=ADEPC_$S(($P($P(ADEV(ADEJ),U,5),",",ADEK)]"")&($P(ADEV(ADEJ),U,2)'=""):"*",1:"")
 . S ADECNT=$L(ADEPC)+ADECNT+1
 . D L3
 S ADEICL=$S(ADEFLG:35,1:4),ADENRQ="" X ADEPRT
 G L1
L2 K ADEJ Q
L3 I ADECNT>30 S ADECNT=0,ADETXT=ADETXT_" "_ADEPC,ADEICL=$S(ADEFLG:35,1:4),ADENRQ="" X ADEPRT S ADETXT="",ADEFLG=1 Q
 S ADETXT=ADETXT_" "_ADEPC Q