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

ADEGRL2.m

Go to the documentation of this file.
  1. ADEGRL2 ; IHS/HQT/MJL - DENTAL ENTRY PART 3 ; [ 03/24/1999 9:04 AM ]
  1. ;;6.0;ADE;**26**;APRIL 1999;Build 13
  1. ;;IHS/OIT/GAB 10.2014 Modified for 2015 Code Updates - PATCH 26
  1. ;
  1. ; RETURNS ADENEWVS=1 AND ADEVDATE (IF A NEW VISIT),
  1. ; ADENEWVS=0 AND ADEDFN (IF OLD VISIT)
  1. ; Y=1 IF SUCCESSFUL, OTHERWISE Y=0
  1. ; IF NO TIME ENTERED, DEFAULTS TO 0800 ***TODO: Parameterize
  1. ;------->GET VISIT DATE
  1. CTRL D VSLOOK
  1. G:'Y END
  1. ;------->CHECK DATE OF DEATH
  1. D DOD G:'Y CTRL
  1. ;------->CHECK DELIVERY MODE
  1. I 'ADENEWVS D DELIV G:'Y CTRL
  1. END Q
  1. DELIV I ADECON,$P(^ADEPCD(ADEDFN,0),U,9)'="c" W !?5,"***Only CONTRACT Visits may be edited in this mode***" S Y=0 Q
  1. I ADEDIR,$P(^ADEPCD(ADEDFN,0),U,9)="c" W !?5,"***CONTRACT Visits cannot be selected in this option***" S Y=0 Q
  1. Q
  1. DOD S X=ADEVDATE,%DT="T" D ^%DT
  1. I $D(^DPT(ADEPAT,.35)),$P(^(.35),U),$P(^(.35),U)<Y S Y=0 W !?5,"***PATIENT DIED BEFORE THIS DATE***",*7 Q
  1. I Y<2840101 S Y=0 W !?5,"***MUST BE AFTER 1 JANUARY 84***",*7 Q
  1. S Y=1
  1. Q
  1. VSLOOK ;EP
  1. S ADENEWVS=0 K ADEDFN,ADEVDATE
  1. N ADETIMEE
  1. S ADETIMEE="08" ;***TODO: Replace with site parameter
  1. R !!,"Date of Visit: ",X:DTIME
  1. I '$T!(X["^")!(X="") S Y=0 Q
  1. ;------->FORCED NEW VISIT WITH QUOTES
  1. I X[$C(34) S X=$P(X,$C(34),2),%DT="TEP",%DT(0)=-(DT+.235959) D ^%DT K %DT G:Y<1 VSLOOK X ^DD("DD") S ADENEWVS=1,ADEVDATE=Y,Y=1 Q
  1. I X["?" D VSHELP G VSLOOK
  1. S %DT="TEP",%DT(0)=-(DT+.235959) D ^%DT K %DT G:Y<1 VSLOOK
  1. ;I '$D(^ADEPCD("DATE",ADEPAT,Y)) S ADENEWVS=1 S:$P(Y,".",2)="" $P(Y,".",2)=$S(ADETIMEE]"":ADETIMEE,1:"09") X ^DD("DD") S ADEVDATE=Y,Y=1 Q
  1. I '$D(^ADEPCD("DATE",ADEPAT,Y)) S:$P(Y,".",2)="" $P(Y,".",2)=$S(ADETIMEE]"":ADETIMEE,1:"09") I '$D(^ADEPCD("DATE",ADEPAT,Y)) S ADENEWVS=1 X ^DD("DD") S ADEVDATE=Y,Y=1 Q
  1. ;------->AT LEAST ONE VISIT ALREADY EXISTS FOR DATE
  1. S ADEVFM=Y X ^DD("DD") S ADEVDATE=Y
  1. S ADEVCNT=0,ADEDFN=0
  1. F ADE=0:0 S ADEDFN=$O(^ADEPCD("DATE",ADEPAT,ADEVFM,ADEDFN)) Q:ADEDFN="" D VSLOOK4
  1. I ADEVCNT=1 S ADEDFN=ADEVDFN(1) S ADENEWVS=0,Y=1 K ADEVDFN Q
  1. I ADEVCNT=0 S ADENEWVS=1,Y=1 Q
  1. ;------->MORE THAN ONE VISIT FOR DATE
  1. F ADE=1:1:ADEVCNT S ADEDFN=ADEVDFN(ADE) D VSHELP1
  1. W !,"Select Visit Number 1-",ADE,": "
  1. R ADEX:DTIME
  1. I '$T!(ADEX="") S Y=0 K ADEVDFN,ADEVCNT,ADEVFM,ADE,ADEVDATE G VSLOOK
  1. I +ADEX<1!(+ADEX>ADEVCNT) W *7," ??" K ADEVDFN,ADEVCNT,ADEVFM,ADE,ADEVDATE G VSLOOK
  1. S ADEDFN=ADEVDFN(ADEX) S Y=1,ADENEWVS=0
  1. K ADEVDFN,ADEX,ADE,ADEVCNT Q
  1. VSLOOK4 Q:'$D(^ADEPCD(ADEDFN,0))
  1. I '$D(ADEDIR) S ADEVCNT=ADEVCNT+1,ADEVDFN(ADEVCNT)=ADEDFN Q
  1. I ADEDIR,$P(^ADEPCD(ADEDFN,0),U,9)'="c" S ADEVCNT=ADEVCNT+1,ADEVDFN(ADEVCNT)=ADEDFN Q
  1. I ADECON,$P(^ADEPCD(ADEDFN,0),U,9)="c" S ADEVCNT=ADEVCNT+1,ADEVDFN(ADEVCNT)=ADEDFN Q
  1. Q
  1. VSHELP I X'="?" S XQH="ADE-DVIS-DATE" D EN^XQH K XQH D ^ADECLS Q
  1. W !,"You may enter a new visit if you wish."
  1. W !,"Enter two question marks `??' for general help on entering dates, or"
  1. W !,"Enter the Date of an old Visit"
  1. Q:'$D(^ADEPCD("DATE",ADEPAT))
  1. W !,"Choose from:"
  1. S ADEVFM=0 F ADE=0:0 S ADEVFM=$O(^ADEPCD("DATE",ADEPAT,ADEVFM)) Q:'+ADEVFM S ADEDFN=0 S Y=ADEVFM X ^DD("DD") F ADEQ=0:0 S ADEDFN=$O(^ADEPCD("DATE",ADEPAT,ADEVFM,ADEDFN)) Q:'+ADEDFN D VSHELP1
  1. VSHELP0 K ADEQ Q
  1. VSHELP1 Q:'$D(^ADEPCD(ADEDFN,0))
  1. I $D(ADECON),ADECON,$P(^ADEPCD(ADEDFN,0),U,9)'="c" Q
  1. I $D(ADEDIR),ADEDIR,$P(^ADEPCD(ADEDFN,0),U,9)="c" Q
  1. W ! W:+ADE ADE,". " W Y
  1. W ?20," ",$S($P(^ADEPCD(ADEDFN,0),U,9)="c":"CONTRACT",1:"DIRECT")
  1. I $P(^ADEPCD(ADEDFN,0),U,4)]"",$D(^DIC(16,$P(^ADEPCD(ADEDFN,0),U,4),0)) W ?30," ",$P(^(0),U) ;IHS/HMW 1-4-90
  1. I $D(^AUTTADA("B","9140")),$O(^AUTTADA("B","9140",0)),$D(^ADEPCD(ADEDFN,"ADA","B",$O(^AUTTADA("B","9140",0)))) W ?60,"<CANCELLATION>"
  1. I $D(^AUTTADA("B","9130")),$O(^AUTTADA("B","9130",0)),$D(^ADEPCD(ADEDFN,"ADA","B",$O(^AUTTADA("B","9130",0)))) W ?60,"<BROKEN APPT.>"
  1. ;/IHS/OIT/GAB Patch #26 Added below two lines for 2015 codes, will be replacing 9130 & 9140 (don't remove old codes yet)
  1. I $D(^AUTTADA("B","9987")),$O(^AUTTADA("B","9987",0)),$D(^ADEPCD(ADEDFN,"ADA","B",$O(^AUTTADA("B","9987",0)))) W ?60,"<CANCELLATION>"
  1. I $D(^AUTTADA("B","9986")),$O(^AUTTADA("B","9986",0)),$D(^ADEPCD(ADEDFN,"ADA","B",$O(^AUTTADA("B","9986",0)))) W ?60,"<MISSED APPT.>"
  1. Q