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

SCAPMC27.m

Go to the documentation of this file.
  1. SCAPMC27 ;ALB/REW - PTST Patients with a Stop Code ; JUN 30, 1995
  1. ;;5.3;Scheduling;**41,140,1015**;AUG 13, 1993;Build 21
  1. ;;1.0
  1. PTST(SCST,SCDATES,SCMAXCNT,SCLIST,SCERR,MORE) ; -- list of patients with a IEN of 40.7
  1. ; USE $$PTSTEXT(below) if you have stop code (e.g. 301)
  1. ; input:
  1. ; SCST = stop code
  1. ; SCDATES("BEGIN") = begin date to search (inclusive)
  1. ; [default: TODAY]
  1. ; ("END") = end date to search (inclusive)
  1. ; [default: TODAY]
  1. ; ("INCL") = 1: only use patients who were assigned to
  1. ; team for entire date range
  1. ; 0: anytime in date range
  1. ; [default: 1]
  1. ; SCMAXCNT = Maximum Number to Return - Default=99
  1. ; SCLIST -array name to store list
  1. ; [ex. ^TMP("SCPT",$J)]
  1. ;
  1. ; SCERR = array NAME to store error messages.
  1. ; [ex. ^TMP("ORXX",$J)]
  1. ; MORE - For continuing lists (see scapmc28)
  1. ;Note: Don't Return DFNs where $D(^TMP("SCMC",$J,"EXCLUDE PT","SCPTA",+DFN)) is true
  1. ; Output:
  1. ; SCLIST() = array of patients
  1. ; Format:
  1. ; Subscript: Sequential # from 1 to n
  1. ; Piece Description
  1. ; 1 IEN of PATIENT file entry
  1. ; 2 Name of patient
  1. ; 3 ien to 40.7 - Not Stop Code!! stp=$$intstp
  1. ; 4 AMIS reporting stop code
  1. ;
  1. ; SCEFFDT - negative of effective date
  1. ; SCN - current subscript (counter) 1->n
  1. ; SCPTA0 is 0 node of Patient Team Assignment file 1st piece is DFN
  1. ; SCERR() = Array of DIALOG file messages(errors) .
  1. ; @SCERR@(0)=number of errors, undefined if none
  1. ; Foramt:
  1. ; Subscript: Sequential # from 1 to n
  1. ; Piece Description
  1. ; 1 IEN of DIALOG file
  1. ;
  1. ; Returned: 1 if ok, 0 if error^More?
  1. ;
  1. ;
  1. ST N SCDT,SCEND,SCCL,SCNODE,SCX
  1. N SCLSEQ,SCN,SCESEQ,SCPARM,SCP,SCBEGIN,SCEND,SCINCL,SCDTS
  1. S SCX=0
  1. G:'$$OKDATA STQ ;check/setup variables
  1. ; -- loop file#44
  1. LP S SCDT=SCBEGIN
  1. S:'$P(SCEND,".",2) SCEND=$$FMADD^XLFDT(SCEND,1) ;ending is end of day
  1. IF $G(MORE) D
  1. .S SCSTART=+$P($G(@SCLIST@(0)),U,2)
  1. .S SCBEGIN=+$P($G(@SCLIST@(0)),U,3)
  1. .S SCCL=+$P($G(@SCLIST@(0)),U,4)
  1. .K @SCLIST
  1. ELSE D
  1. .S SCSTART=0
  1. .S SCCL=0
  1. ; go thru clinics with stop code=SCST
  1. F S:'$G(MORE) SCCL=$O(^SC(SCCL)) Q:'SCCL S:$P($G(^SC(SCCL,0)),U,7)=SCST SCX=$$PTAPX^SCAPMC28(.SCCL,.SCBEGIN,.SCEND,.SCMAXCNT,.SCLIST,.SCERR,.SCSTART) S MORE=0
  1. STQ Q SCX
  1. ;
  1. OKDATA() ;check/setup variables
  1. N SCOK
  1. S SCOK=1
  1. S SCMAXCNT=$G(SCMAXCNT,99)
  1. D INIT^SCAPMCU1(.SCOK) ; set default dates & error array (if undefined)
  1. IF '$D(^DIC(40.7,+$G(SCST),0)) D S SCOK=0
  1. . S SCPARM("STOP")=$G(SCST,"Undefined")
  1. . D ERR^SCAPMCU1(.SCESEQ,4045101,.SCPARM,"",.SCERR)
  1. ; -- is it a valid TEAM ien passed (Error # 4045101 in DIALOG file)
  1. Q SCOK
  1. ;
  1. INTST(STOP) ;given stop code return ient
  1. Q +$O(^DIC(40.7,"C",+$G(STOP),0))
  1. ;
  1. PTSTEXT(SCSTOP,SCDATES,SCMAXCNT,SCLIST,SCERR) ; -- list of patients with AMIS REPORTING STOP CODE
  1. ; For variables see: PTST (above)
  1. ; Returned: 1 if ok, 0 if error^More?
  1. N SCST
  1. S SCST=$$INTST(.SCSTOP)
  1. Q $$PTST(.SCST,.SCDATES,.SCMAXCNT,.SCLIST,.SCERR,.MORE)