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

SDEC781P.m

Go to the documentation of this file.
SDEC781P ;ALB/DR/MGD - SD*5.3*781 Post Init routine ; Mar 29, 2021@19:00
 ;;5.3;SCHEDULING;**781**;AUG 13, 1993;Build 11
 ;
FIND ;FIND THE IEN FOR "VS GUI NATIONAL"
 N SDECDA,SDECDA1
 W !!?3,"Updating SDEC SETTINGS file (#409.98)",!!
 S SDECDA=0,SDECDA=$O(^SDEC(409.98,"B","VS GUI NATIONAL",SDECDA)) G:$G(SDECDA)="" NOFIND
 D VERSION   ;update GUI version number and date
 D ENTER ; Original 778 Functionality
 D SRD ; Original 781 Functionality
 D POST ; Original 781 Functionality
 D EXIT ; Combined 778 & 781 Functionality
 Q
VERSION ;SET THE NEW VERSION UPDATE IN SDEC SETTING FILE #409.98 TO 1.7.5
 S DA=SDECDA,DIE=409.98,DR="2///1.7.5;3///"_DT D ^DIE  ;update VS GUI NATIONAL
 K DIE,DR,DA
 S SDECDA1=0,SDECDA1=$O(^SDEC(409.98,"B","VS GUI LOCAL",SDECDA1)) Q:$G(SDECDA1)=""    ;get DA for the VS GUI LOCAL
 S DA=SDECDA1,DIE=409.98,DR="2///1.7.5;3///"_DT D ^DIE  ;update VS GUI LOCAL
 K DIE,DR,DA
 Q
 ;
NOFIND ;"VS GUI NATIONAL" NOT FOUND
 W !!?3,"VS GUI NATIONAL not found in the SDEC SETTINGS file (#409.98)"
 Q
 ;
 ; Original 778 functionality
 ;
 ; SDEC CONTACT (#409.86) file "B" indexed by PATIENT (#.01)
ENTER ;
 S (DFN,CC,PDT,CLN,SER,REQT,PID)=""
 S DFN="" F  S DFN=$O(^SDEC(409.86,"B",DFN)) Q:DFN=""  D
 .S CC="" F  S CC=$O(^SDEC(409.86,"B",DFN,CC)) Q:CC=""  D
 ..S REC="" S REC=^SDEC(409.86,CC,0)
 ..S PDT=$P($G(REC),"^",3)
 ..I PDT[".24" D
 ...S X1=PDT,X2=1 D C^%DTC S PDT=X
 ...S PID=$P(PDT,".")
 ...S $P(^SDEC(409.86,CC,0),"^",3)=PID ; PREFERRED DATE
 ..S CLN=$P($G(REC),"^",2) ; CLINIC
 ..S SER=$P($G(REC),"^",6) ; SERVICE
 ..S REQT=$P($G(REC),"^",4) ; REQUEST TYPE
 ..I REQT="A"!(REQT="RTC") D AR40985 Q
 ..I REQT="C"!(REQT="P") D CONSULT Q
 ..I REQT="R" D RECALL Q
 Q
 ; 
 ; SDEC APPT REQUEST (#409.85) "B" indexed by PATIENT (#.01)
 ;^SDEC(409.85,"B",23,143611)=""
 ;                    143612)=""
 ;                    143987)=""
AR40985 ;
 S (CCC,TYPE)=""
 F  S CCC=$O(^SDEC(409.85,"B",DFN,CCC)) Q:CCC=""  D
 .S REC1="" S REC1=^SDEC(409.85,CCC,0)
 .S TYPE=$P(REC1,"^",5)
 .Q:TYPE'="APPT"&(TYPE'="RTC")
 .Q:$P(REC1,"^",16)'=$E(PDT,1,7)
 .Q:CLN'=""&($P(REC1,"^",9)'=CLN)
 .Q:SER'=""&($P(REC1,"^",6)'=SER)
 .S $P(^SDEC(409.86,CC,0),"^",7)=CCC_";"_"SDEC(409.85,"
 Q
 ;
CONSULT ;
 S (IEN,PAT)=""
 S PAT=DFN
 F  S IEN=$O(^GMR(123,"F",PAT,IEN)) Q:IEN=""  D
 .Q:$P(^GMR(123,IEN,0),U,2)'=DFN
 .Q:$P(^GMR(123,IEN,0),U,17)'=REQT
 .S $P(^SDEC(409.86,CC,0),"^",7)=IEN_";"_"GMR(123,"
 Q
 ;
RECALL ;
 S (IEN,PAT)=""
 S PAT=DFN
 F  S IEN=$O(^SD(403.5,"B",PAT,IEN)) Q:IEN=""  D
 .Q:$P(^SD(403.5,IEN,0),U,1)'=DFN
 .Q:$P(^SD(403.5,IEN,0),U,2)'=CLN
 .Q:REQT'="R"
 .S $P(^SDEC(409.86,CC,0),"^",7)=IEN_";"_"SD(403.5,"
 Q
 ;
 ; Original 781 functionality
 ;
SRD ; Populate SRD x-ref for all existing entries
 N DIK
 S DIK="^SDEC(409.86,"
 S DIK(1)="2.3^SRD"
 D ENALL^DIK
 Q
POST ; REPAIR INACTIVATE/REACTIVATE DATES IN FILE 44 AND 409.83
 N SDFDA,SDIEN,SDIENS,CLINSDIEN,HINACDATE,HREACDATE,CLINSDIENS,RINACDATE,RREACDATE
 S SDIEN=0
 F  S SDIEN=$O(^SC(SDIEN)) Q:'SDIEN  D
 .S SDIENS=SDIEN_","
 .S CLINSDIENS=$$GETRES^SDECUTL(SDIEN,1)
 .Q:CLINSDIENS=""
 .Q:$$GET1^DIQ(409.831,CLINSDIENS_",",.012)'="CLINIC"
 .S HINACDATE=$$GET1^DIQ(44,SDIENS,2505,"I")
 .S HREACDATE=$$GET1^DIQ(44,SDIENS,2506,"I")
 .S RINACDATE=$$GET1^DIQ(409.831,CLINSDIENS_",",.021,"I")
 .S RREACDATE=$$GET1^DIQ(409.831,CLINSDIENS_",",.025,"I")
 .I RINACDATE'=HINACDATE D
 ..S SDFDA(409.831,CLINSDIENS_",",.021)=HINACDATE,SDFDA(409.831,CLINSDIENS_",",.022)=.5
 ..I HINACDATE="",RINACDATE'="" D
 ...S SDFDA(409.831,CLINSDIENS_",",.021)="@"
 ...S SDFDA(409.831,CLINSDIENS_",",.022)="@"
 .I RREACDATE'=HREACDATE D
 ..S SDFDA(409.831,CLINSDIENS_",",.025)=HREACDATE,SDFDA(409.831,CLINSDIENS_",",.026)=.5
 ..I HREACDATE="",RREACDATE'="" D
 ...S SDFDA(409.831,CLINSDIENS_",",.025)="@"
 ...S SDFDA(409.831,CLINSDIENS_",",.026)="@"
 .I $D(SDFDA)  D FILE^DIE(,"SDFDA","ERR") K SDFDA
 Q
 ;
EXIT ;
 W !,"POST-INIT Routine Complete!"
 K CC,CCC,CLN,DFN,PAT,PDT,REC,REC1,REQT,IEN,PAT,TYPE,SER,PID,X,X1,X2
 Q