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

SDOQMP0.m

Go to the documentation of this file.
  1. SDOQMP0 ;ALB/SCK - Appointment Monitoring / Performance Measure Rpt. ; [07/23/96]
  1. ;;5.3;SCHEDULING;**47,1015**;AUG 13, 1993;Build 21
  1. ;
  1. Q
  1. SELECT() ; Selection method for clinic selection.
  1. ; Returns:
  1. ; Y = S, D, or C for Stop Code, Division, or Clinic.
  1. ; Y = Null for up-arrow or timeout
  1. ;
  1. N Y
  1. S DIR(0)="SM^D:Division;S:Stop Code;C:Clinic"
  1. S DIR("A")="Select clinics by: "
  1. S DIR("?")="Select by either: Stop Code, Division, or Clinic"
  1. S DIR("?",1)="The method by which clinics are selected for this report."
  1. S DIR("B")="S"
  1. D ^DIR K DIR
  1. S:$D(DIRUT) Y=""
  1. SELQ Q $G(Y)
  1. ;
  1. CLINIC() ; One-Many-All clinic selection
  1. ; Output
  1. ; CLINIC(IEN)=""
  1. ;
  1. W !!,"Clinic Selection"
  1. S DIC="^SC(",VAUTSTR="Clinic",VAUTVB="CLINIC",VAUTNI=2,DIC("S")="I $P(^(0),U,3)[""C"""
  1. D FIRST^VAUTOMA
  1. I Y<0 K CLINIC
  1. Q $D(CLINIC)>0
  1. ;
  1. STOP() ; -- get stop code data
  1. ; output: VAUTC := stop codes selected (VAUTC=1 for all)
  1. ; return: was selection made [ 1|yes 0|no]
  1. ;
  1. W !!,"Stop Code Selection"
  1. S DIC="^DIC(40.7,",VAUTSTR="Stop Code",VAUTVB="VAUTC",VAUTNI=2
  1. D FIRST^VAUTOMA
  1. I Y<0 K VAUTC
  1. STOPQ Q $D(VAUTC)>0
  1. ;
  1. DIV() ; -- get division data
  1. ; input: none
  1. ; output: VAUTD := divs selected (VAUTD=1 for all)
  1. ; return: was selection made [ 1|yes 0|no]
  1. ;
  1. W:$P($G(^DG(43,1,"GL")),U,2) !!,"Division Selection"
  1. D ASK2^SDDIV
  1. I Y<0 K VAUTD
  1. Q $D(VAUTD)>0
  1. ;
  1. STOPCDE(PMIEN) ; Get associated stop code number for clinic
  1. ; Input
  1. ; PMIEN - Ien of clinic in the Hospital location file
  1. ;
  1. ; Output
  1. ; Either Stop code number, or 0 if no stop code is found
  1. ;
  1. N PMSC
  1. S PMSC=+$P($G(^DIC(40.7,$P($G(^SC(PMIEN,0)),U,7),0)),U,2)
  1. Q $S(+PMSC>0:PMSC,1:0)
  1. ;
  1. CLNOK(PMSC) ; Checks associated stop code for clinic.
  1. ; Input
  1. ; PMSC - Associated stop code for current clinic
  1. ;
  1. ; Output
  1. ; PMOK - Returns 1 if stop code is on the list
  1. ; Returns 0 if it's not on the list.
  1. ;
  1. N PMOK,CNT,PMSTCD
  1. S PMOK=0
  1. F CNT=1:1 S PMSTCD=$P($T(STOPS+CNT^SDOQMPL),";;",2) Q:PMSTCD="$$END" D Q:PMOK
  1. . Q:'$D(^DIC(40.7,PMSC,0))
  1. . I $P($G(^DIC(40.7,PMSC,0)),U,2)=PMSTCD S PMOK=1
  1. Q PMOK
  1. ;
  1. DIVISION(PMIEN) ; Returns the name of the division the clinic as assigned to.
  1. ; Input:
  1. ; Ien of clinic in the Hospital location file.
  1. ;
  1. ; Output:
  1. ; Division name in external format.
  1. ;
  1. N PMDIEN,PDIV
  1. S PMDIV=""
  1. S PMDIEN=+$P($G(^SC(PMIEN,0)),U,15)
  1. G:PMDIEN'>0 DIVQ
  1. S PMDIV=$P($G(^DG(40.8,PMDIEN,0)),U)
  1. DIVQ Q PMDIV
  1. ;
  1. LOOPSC ; Loops through all clinics in the Hospital location file, and selects clinics that are
  1. ; associated with one of the selected stop codes, adding them to the "SDAMMS" TMP global.
  1. ; If VAUTC=1, then select clinics for all Stop codes.
  1. ; If VAUTC=0, then select only those clinics for the Stop codes in the
  1. ; VAUTC(StopCode Ien) local array.
  1. ;
  1. N PMSC,AMMSD0
  1. S AMMSD0=0
  1. ;
  1. ; *** Select all
  1. I VAUTC=1 D
  1. . F S AMMSD0=$O(^SC("AC","C",AMMSD0)) Q:'AMMSD0 D
  1. .. Q:'$P($G(^SC(AMMSD0,0)),"^",7)
  1. .. Q:$G(^TMP("SDAMMS",$J,"Q"))=1
  1. .. F X1=1:1:3 D AMMSCNT^SDOQMP1 Q:AMMSLAST=0
  1. ;
  1. ; *** Select only clinics with a selected associated stop code
  1. I VAUTC=0&($D(VAUTC)) D
  1. . F S AMMSD0=$O(^SC("AC","C",AMMSD0)) Q:'AMMSD0 D
  1. .. Q:'$P($G(^SC(AMMSD0,0)),"^",7)
  1. .. S PMSC=$P($G(^SC(AMMSD0,0)),"^",7)
  1. .. Q:'$D(VAUTC(PMSC))
  1. .. Q:$G(^TMP("SDAMMS",$J,"Q"))=1
  1. .. F X1=1:1:3 D AMMSCNT^SDOQMP1 Q:AMMSLAST=0
  1. Q
  1. ;
  1. LOOPD ; Loops through all clinics in the Hospital location file, and select clinics that are
  1. ; in one of the selected divisions, adding them to the "SDAMMS" TMP global.
  1. ; If VAUTD=1, then select clinics for all Divisions.
  1. ; If VAUTD=0, then select only those clinics for the Divisions in the
  1. ; VAUTC(StopCode Ien) local array.
  1. ;
  1. N PMDIV,AMMSD0
  1. ;
  1. S AMMSD0=0
  1. ; Select all
  1. I VAUTD=1 D
  1. . F S AMMSD0=$O(^SC("AC","C",AMMSD0)) Q:'AMMSD0 D
  1. .. Q:'$P($G(^SC(AMMSD0,0)),"^",7)
  1. .. Q:$G(^TMP("SDAMMS",$J,"Q"))=1
  1. .. F X1=1:1:3 D AMMSCNT^SDOQMP1 Q:AMMSLAST=0
  1. ;
  1. I VAUTD=0&($D(VAUTD)) D
  1. . F S AMMSD0=$O(^SC("AC","C",AMMSD0)) Q:'AMMSD0 D
  1. .. Q:'$P($G(^SC(AMMSD0,0)),"^",7)
  1. .. S PMDIV=$P($G(^SC(AMMSD0,0)),"^",15)
  1. .. Q:PMDIV']""
  1. .. Q:'$D(VAUTD(PMDIV))
  1. .. Q:$G(^TMP("SDAMMS",$J,"Q"))=1
  1. .. F X1=1:1:3 D AMMSCNT^SDOQMP1 Q:AMMSLAST=0
  1. Q
  1. ;
  1. CHKTASK() ; Checks if the expiration date has been reached. If it has, delete the option
  1. ; scheduling run time field to turn off the reschedule option
  1. ;
  1. N OIEN,OSIEN,PMTEXT,EXPDT,SDOPT,SDWHN,SDFRQ,SDOK
  1. ;
  1. S SDOK=0
  1. S EXPDT=$P($T(EXPIRE+1^SDOQMPL),";;",2)
  1. D NOW^%DTC
  1. G:$P(%,".")<EXPDT CHKQ
  1. S OIEN="",OIEN=$O(^DIC(19,"B","SDOQM PM NIGHTLY JOB",OIEN))
  1. Q:OIEN']""
  1. S OSIEN="",OSIEN=$O(^DIC(19.2,"B",OIEN,OSIEN))
  1. Q:OSIEN']""
  1. ;
  1. S SDWHN="@",SDFRQ="@",SDOPT="SDOQM PM NIGHTLY JOB"
  1. D RESCH^XUTMOPT(SDOPT,SDWHN,"",SDFRQ,"",.SCERR)
  1. ;
  1. S PMTEXT(1)="The Access Performance Measure data collection job"
  1. S PMTEXT(2)="has expired, and the background server has been unscheduled"
  1. S PMTEXT(3)=""
  1. S PMTEXT(4)="The entry in the SCHEDULING OPTION file should be removed"
  1. S PMTEXT(5)="by your IRM staff"
  1. S XMSUB="PM EXTRACT EXPIRATION",XMN=0
  1. S XMTEXT="PMTEXT("
  1. S XMDUZ=.5,XMY("G.SD PM NOTIFICATION")=""
  1. D ^XMD
  1. S SDOK=1
  1. CHKQ Q SDOK
  1. ;
  1. LOOPS ; Use appropriate loop for building the clinic global.
  1. ;
  1. I $D(CLINIC) D LOOPC^SDOQMP Q
  1. I $D(VAUTC) D LOOPSC Q
  1. I $D(VAUTD) D LOOPD Q
  1. Q