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

SD53P566.m

Go to the documentation of this file.
SD53P566 ;ALB/RLC - POST-INIT TO IDENTIFY MISSING CLINICS IN 403.5; 7/27/07
 ;;5.3;SCHEDULING;**566**;Aug 13, 1993;Build 5
 ;
 ; THIS POST-INIT ROUTINE WILL READ THROUGH THE RECALL REMINDERS FILE
 ; #403.5 AND PROVIDE A REPORT IDENTIFYING ALL ACTIVE/OPEN RECALL
 ; REMINDERS THAT ARE MISSING A CLINIC.
 ;
 Q  ; must call at entry point
 ;
EN ; entry point
 K ^TMP("RR REPORT",$J)
 S IEN=0,(NODE,SDATE,PROV)=""
 F  S IEN=$O(^SD(403.5,IEN)) Q:'IEN  D
 .Q:'$D(^SD(403.5,IEN,0))  S NODE=^(0)
 .Q:$P(NODE,U,1)=""
 .Q:$P(NODE,U,2)'=""  ;quit - record contains clinic
 .S PAT=$P(^DPT($P(NODE,U,1),0),U,1)  ;get patient name
 .S PROV=$P(NODE,U,5) I PROV'="" S PROV=$P($G(^SD(403.54,PROV,0)),U,1) I PROV'="" S PROV=$$NAME^XUSER(PROV,"F")
 .S:PROV="" PROV="UNKNOWN"
 .S SDATE=$$FMTE^XLFDT($P(NODE,U,6),1)
 .S ^TMP("RR REPORT",$J,PAT,IEN)=SDATE_U_PROV
 D MSG
 K IEN,NODE,PAT,PROV,SDATE,^TMP("RR REPORT",$J)
 Q
 ;
MSG ;Send message containing list of recall reminders with missing clinic
 N DVPARAM,XMDUZ,XMSUB,XMTEXT,XMY,MSGTXT,CT,TAB,TAB1,SP,SP1
 S (SDATE,PROV)=""
 S CT=0
 I '$D(^TMP("RR REPORT",$J)) D NONE,MSG1 Q
 S CT=CT+1,MSGTXT(CT)="THE FOLLOWING PATIENTS HAVE ONE OR MORE ACTIVE RECORDS"
 S CT=CT+1,MSGTXT(CT)="IN THE RECALL REMINDERS FILE #403.5, THAT ARE MISSING"
 S CT=CT+1,MSGTXT(CT)="A REQUIRED CLINIC.  PLEASE UPDATE EACH OF THESE RECALL"
 S CT=CT+1,MSGTXT(CT)="REMINDERS WITH THE APPLICABLE CLINIC."
 S CT=CT+1,MSGTXT(CT)=""
 S CT=CT+1,MSGTXT(CT)=""
 S TAB=" " F I=1:1:26 S TAB=TAB_" "
 S TAB1=" " F I=1:1:12 S TAB1=TAB1_" "
 S CT=CT+1,MSGTXT(CT)="PATIENT"_TAB_"DATE"_TAB1_"PROVIDER"
 S CT=CT+1 F I=1:1:80 S MSGTXT(CT)="-"
 S PAT=""
 F  S PAT=$O(^TMP("RR REPORT",$J,PAT)) Q:PAT=""  D
 . S IEN=0,RCD=""
 . F  S IEN=$O(^TMP("RR REPORT",$J,PAT,IEN)) Q:'IEN  D
 ..S RCD=^(IEN),SDATE=$P(RCD,U,1),PROV=$P(RCD,U,2)
 ..S SP=" " F I=1:1:33-$L(PAT) S SP=SP_" "
 ..S SP1=" " F I=1:1:4 S SP1=SP1_" "
 ..S CT=CT+1,MSGTXT(CT)=PAT_SP_SDATE_SP1_PROV
 ..S CT=CT+1,MSGTXT(CT)=""
MSG1 S XMTEXT="MSGTXT"
 S DVPARAM("FROM")="RECALL REMINDERS REPORT FOR PATCH SD*5.3*566"
 S XMDUZ=DUZ,XMSUB="RECALL REMINDERS MISSING REQUIRED CLINIC",XMY(DUZ)=""
 D SENDMSG^XMXAPI(XMDUZ,XMSUB,XMTEXT,.XMY,.DVPARAM,"","")
 K XMDUZ,XMSUB,XMY,XMTEXT,DVPARAM,CT,MSGTXT,TAB,TAB1,SP,SP1,PAT,IEN
 K RCD,DATE,PROV,I
 Q
 ;
NONE ;No records found with missing clinic in file 403.5
 S CT=CT+1,MSGTXT(CT)="NO RECORDS WERE FOUND IN THE RECALL REMINDERS FILE #403.5"
 S CT=CT+1,MSGTXT(CT)="THAT ARE MISSING A REQUIRED CLINIC."
 Q
 ;