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

ADERVW1.m

Go to the documentation of this file.
ADERVW1 ; IHS/HQT/MJL  - DENTAL CHART REVIEW PT 3 ;  [ 03/24/1999   9:04 AM ]
 ;;6.0;ADE;;APRIL 1999
 ;Q:'$D(^ADEPCD("DATE",ADEPAT))
 ;X ADECKP Q:$D(APCHSQIT)  X:'APCHSNPG ADEBRK
 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-ADEDLM)-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>ADEDLM)!(ADENDMS<1)  S Y=-ADEDAT+9999999 X ADECVD S ADEDTD=Y S ADEDTU=0 D ONEDATE Q:$D(APCHSQIT)  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(APCHSQIT)  D NARR Q:$D(APCHSQIT)
 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
 X ADECKP Q:$D(APCHSQIT)  S:APCHSNPG 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=""
 X ADECKP Q:$D(APCHSQIT)  W:APCHSNPG !,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 X ADECKP Q:$D(APCHSQIT)  W:APCHSNPG !,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
 X ADECKP Q:$D(APCHSQIT)  W:APCHSNPG !,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