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

SCRPV1.m

Go to the documentation of this file.
  1. SCRPV1 ; bp/djb - PCMM Inconsistency Rpt - Main ; 8/25/99 9:52am
  1. ;;5.3;Scheduling;**177**;AUG 13, 1993
  1. ;
  1. ;This routine is part of Patch 177 (PCMM Phase II). It prompts for
  1. ;those Team and Position Assignments to be validated according to
  1. ;the business rules that have been established for PCMM and the
  1. ;relationship between Associate Provider and Preceptor.
  1. ;
  1. ;See tag IEN to include 404.43 IEN in printout.
  1. ;
  1. EN ;
  1. NEW QUIT,RESULT,SCMODE,SCPOS,SCTM,SCTYPE
  1. TOP ;
  1. KILL SCMODE,SCTM,SCTYPE
  1. S QUIT=0
  1. ;
  1. ;Get teams to include in report.
  1. S SCTYPE("TM")=$$ASKTM() G:SCTYPE("TM")=0 EXIT
  1. I SCTYPE("TM")="S" D GETTM G:SCTM=0 TOP
  1. ;
  1. ;Get MODE: Brief/Detail
  1. I SCTYPE("TM")'="I" S SCMODE=$$ASKMODE() G:SCMODE=0 TOP
  1. ;
  1. S RESULT=$$DEVICE()
  1. ;
  1. EXIT ; Cleanup and Exit
  1. Q
  1. ;
  1. RUN ;Gather the data and print the report.
  1. ;
  1. KILL ^TMP("PCMM PATIENT",$J)
  1. KILL ^TMP("PCMM POSITION",$J)
  1. ;
  1. I SCTYPE("TM")="I" D LIST^SCRPV1B1 Q
  1. I '$D(ZTQUEUED),'(IOST["P-"&(IOST["MESSAGE")) W "Please wait..."
  1. ;
  1. D ^SCRPV1A ;............Gather data
  1. D ^SCRPV1B ;............Print report
  1. ;
  1. KILL ^TMP("PCMM PATIENT",$J)
  1. KILL ^TMP("PCMM POSITION",$J)
  1. Q
  1. ;
  1. DEVICE() ; Select output device.
  1. NEW POP,SCX,ZTDESC,ZTRTN,ZTSAVE
  1. NEW %XX,%ZHFN,QUE
  1. ;
  1. W ! I SCTYPE("TM")'="I" D ;
  1. . W !,"This report may take a long time to run."
  1. . W !,"Queuing is recommended.",!
  1. ;
  1. S ZTRTN="RUN^SCRPV1"
  1. S ZTDESC="PCMM Inconsistency Report"
  1. S ZTSAVE("SC*")=""
  1. S ZTSAVE("SCTYPE(")=""
  1. S ZTSAVE("SCTM(")=""
  1. D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE)
  1. Q POP
  1. ;
  1. ASKTM() ; Ask user to select teams.
  1. ; A = All Teams
  1. ; S = Select Teams
  1. ; Return: 0,A, or S.
  1. ;
  1. NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. NEW COL,LINE
  1. ;
  1. S $P(LINE,"-",IOM)=""
  1. S COL=(IOM/2-12)
  1. W @IOF,!?COL,"PCMM INCONSISTENCY REPORT"
  1. W !,LINE
  1. W !!,"T E A M S"
  1. S DIR(0)="SMO^A:All Teams;S:Specific Teams;I:Inconsistency Descriptions"
  1. S DIR("A")=" Select TEAMS"
  1. S DIR("?")="Select I for a list of inconsistency descriptions"
  1. S DIR("?",1)="Select A for a report of All Teams"
  1. S DIR("?",2)="Select S for a report of Specific Teams"
  1. D ^DIR
  1. Q $S($D(DIRUT):0,1:Y)
  1. ;
  1. GETTM ;Allow the user to select multiple teams.
  1. ;Set up SCTM array in format:
  1. ; SCTM(TeamName,TeamIEN)=""
  1. ;
  1. NEW CNT,ND,TMI,TMN
  1. NEW %,%Y,%Y1,C,DDH,X,SCESEQ,SCLSEQ,SCN
  1. ;
  1. KILL SCTM
  1. S SCTM=0
  1. F W ! S TMI=$$TEAM^SCMCMU(DT) Q:TMI<0 D ;
  1. . S ND=$G(^SCTM(404.51,TMI,0))
  1. . S TMN=$P(ND,U,1)
  1. . Q:TMN']""
  1. . Q:$D(SCTM(TMI))
  1. . S SCTM(TMI)=""
  1. . S SCTM=SCTM+1
  1. Q
  1. ;
  1. ASKMODE() ; Which report type to run: BRIEF or DETAIL.
  1. ; B = Brief
  1. ; DP = Detailed by PATIENT
  1. ; DT = Detailed by TEAM
  1. ; Return: 0,B, or D.
  1. ;
  1. NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. ;
  1. W !!,"R E P O R T T Y P E"
  1. S DIR(0)="SMO^B:Brief;DP:Detailed by PATIENT;DT:Detailed by TEAM"
  1. S DIR("A")=" Select REPORT TYPE"
  1. S DIR("B")="DP"
  1. S DIR("?")="Select DT for a detailed report by team"
  1. S DIR("?",1)="Select B for a brief summary report"
  1. S DIR("?",2)="Select DP for a detailed report by patient"
  1. D ^DIR
  1. Q $S($D(DIRUT):0,1:Y)
  1. ;
  1. IEN ;Call here to include the 404.43 IEN on the right side of the
  1. ;printout for all type 8 inconsistencies. You can use this number
  1. ;to find the problem entry in Fileman. This feature only works
  1. ;with the DP print option.
  1. ;
  1. NEW SCIEN
  1. S SCIEN=1
  1. G EN
  1. ;
  1. MAIL(SCDUZ) ; Queue report as a MailMan Message.
  1. NEW CNT,QUIT,RESULT,SCTYPE
  1. NEW XMY,XMDUZ,XMSUB,XMTEXT
  1. ;
  1. KILL ^TMP("PCMM PATIENT",$J)
  1. KILL ^TMP("PCMM POSITION",$J)
  1. KILL ^TMP("SCMSG",$J)
  1. ;
  1. S CNT=1
  1. D SET("This message was automatically generated by PCMM patch SD*5.3*177.")
  1. ;
  1. S SCTYPE("TM")="A" ;All Teams & Positions
  1. D ^SCRPV1A ;..Gather data
  1. D MAILPOS ;...Build position inconsistency array
  1. D MAILPT ;....Build patient inconsistency array
  1. ;
  1. S XMDUZ=.5
  1. S XMY(XMDUZ)=""
  1. I $G(SCDUZ) S XMY(SCDUZ)=""
  1. S XMSUB="PCMM INCONSISTENCY REPORT"
  1. S XMTEXT="^TMP(""SCMSG"",$J,"
  1. D ^XMD
  1. ;
  1. KILL ^TMP("PCMM PATIENT",$J)
  1. KILL ^TMP("PCMM POSITION",$J)
  1. KILL ^TMP("SCMSG",$J)
  1. Q
  1. MAILPOS ;Print POSITION error counts only.
  1. NEW ERROR,NUM,NUM1,POS,TM,TXT
  1. ;
  1. S NUM=0
  1. F S NUM=$O(^TMP("PCMM POSITION",$J,NUM)) Q:'NUM D ;
  1. . S TM=""
  1. . F S TM=$O(^TMP("PCMM POSITION",$J,NUM,TM)) Q:TM="" D ;
  1. .. S POS=""
  1. .. F S POS=$O(^TMP("PCMM POSITION",$J,NUM,TM,POS)) Q:POS="" D ;
  1. ... S ERROR(NUM\1)=($G(ERROR(NUM\1))+1)
  1. ;
  1. D SET(" ")
  1. D SET("POSITION INCONSISTENCIES")
  1. D SET("------------------------")
  1. D SET(" ")
  1. I '$D(^TMP("PCMM POSITION",$J)) D Q
  1. . D SET("No inconsistencies found.")
  1. ;
  1. D SET("Total teams/positions per inconsistency type:")
  1. S NUM=0
  1. F S NUM=$O(ERROR(NUM)) Q:'NUM D ;
  1. . S NUM1=(NUM\1)
  1. . S TXT=$T(TXT+NUM1^SCRPV1B)
  1. . ;W !?3,$P(TXT,";",3)_". "
  1. . S TXT=$P(TXT,";",4)
  1. . I TXT["[]" D ;
  1. .. S TXT=$P(TXT,"[]",1)_"Team Assign/Team/Position"_$P(TXT,"[]",2)
  1. . D SET(TXT_" - "_ERROR(NUM1))
  1. Q
  1. ;
  1. MAILPT ;Print PATIENT error counts only.
  1. NEW DFN,DFNNAM,ERROR,NUM
  1. ;
  1. S DFNNAM=""
  1. F S DFNNAM=$O(^TMP("PCMM PATIENT",$J,DFNNAM)) Q:DFNNAM="" D ;
  1. . S DFN=0
  1. . F S DFN=$O(^TMP("PCMM PATIENT",$J,DFNNAM,DFN)) Q:'DFN D ;
  1. .. S NUM=0
  1. .. F S NUM=$O(^TMP("PCMM PATIENT",$J,DFNNAM,DFN,NUM)) Q:'NUM D ;
  1. ... S ERROR("PT",NUM\1)=($G(ERROR("PT",NUM\1))+1)
  1. ;
  1. D SET(" ")
  1. D SET("PATIENT INCONSISTENCIES")
  1. D SET("-----------------------")
  1. D SET(" ")
  1. I '$D(^TMP("PCMM PATIENT",$J)) D Q
  1. . D SET("No inconsistencies found.")
  1. ;
  1. D SET("Total patients per inconsistency type:")
  1. S NUM=0
  1. F S NUM=$O(ERROR("PT",NUM)) Q:'NUM D ;
  1. . S NUM=NUM\1
  1. . S TXT=$T(TXT+NUM^SCRPV1B)
  1. . ;W !?3,$P(TXT,";",3)_". "
  1. . S TXT=$P(TXT,";",4)
  1. . I TXT["[]" D ;
  1. .. S TXT=$P(TXT,"[]",1)_"Team Assign/Team/Position"_$P(TXT,"[]",2)
  1. . D SET(TXT_" - "_ERROR("PT",NUM))
  1. Q
  1. ;
  1. SET(TXT) ;Build message array
  1. S ^TMP("SCMSG",$J,CNT)=TXT
  1. S CNT=CNT+1
  1. Q