SDESGETSTOPCD ;ALB/ANU,BWF - VISTA SCHEDULING RPCS - SDES GET CLINIC STOPCD ;JAN 24, 2023
;;5.3;Scheduling;**836,880**;Aug 13, 1993;Build 5
;;Per VHA Directive 6402, this routine should not be modified
;
;External References
;-------------------
; Reference to $$GET1^DIQ in ICR #2056
;
Q
;
GETSTOPCD(JSONRETURN,SDP) ;return entries from the SDEC CLINIC STOP FILE (#40.7)
;INPUT:
; SDP - (Optional) Partial Text
;RETURN:
; List of entries from the CLINIC STOP file (#40.7)
; - IEN
; - Code
; - Name
; - Restriction Type
; - Restriction Date
;
N RETURN,ERRORS,HASFIELDS,RETURN,ELGFIELDSARRARY
;
S HASFIELDS=$$CLINSTOP(.ELGFIELDSARRAY,$G(SDP))
I HASFIELDS M RETURN=ELGFIELDSARRAY
I '$D(RETURN("ClinicStopCodes")) S RETURN("ClinicStopCodes",1)=""
;
D BUILDJSON^SDESBUILDJSON(.JSONRETURN,.RETURN)
D CLEANUP
Q
;
CLINSTOP(ELGARRAY,SDP) ;SDES GET CLINIC STOPCD remote procedure
;return entries from the CLINIC STOP file (#40.7)
N SDESC,SDESI,SDIEN,SDINACTDT,SDESN,HASDATA,RESTRICTIONDT
;
S SDESI=0
S SDP=$G(SDP)
S SDESN=$S(SDP'="":$$GETSUB^SDECU(SDP),1:"") ;set SDESN to partial name
F S SDESN=$O(^DIC(40.7,"B",SDESN)) Q:SDESN="" Q:(SDP'="")&(SDESN'[SDP) D ;check if within partial name bounds
.S SDESC="" F S SDESC=$O(^DIC(40.7,"B",SDESN,SDESC)) Q:SDESC="" D
..S SDINACTDT=$$GET1^DIQ(40.7,SDESC_",",2,"I")
..I SDINACTDT'="",$P(SDINACTDT,".",1)'>$P($$NOW^XLFDT,".",1) Q
..S SDESI=SDESI+1
..S ELGARRAY("ClinicStopCodes",SDESI,"IEN")=SDESC
..S ELGARRAY("ClinicStopCodes",SDESI,"Code")=$$GET1^DIQ(40.7,SDESC_",",1,"E")
..S ELGARRAY("ClinicStopCodes",SDESI,"Name")=$$GET1^DIQ(40.7,SDESC_",",.01,"E")
..S ELGARRAY("ClinicStopCodes",SDESI,"RestrictionType")=$$GET1^DIQ(40.7,SDESC,5,"E")
..S RESTRICTIONDT=$$GET1^DIQ(40.7,SDESI,6,"I")
..S RESTRICTIONDT=$$FMTISO^SDAMUTDT(RESTRICTIONDT)
..S ELGARRAY("ClinicStopCodes",SDESI,"RestrictionDate")=RESTRICTIONDT
S HASDATA=($D(ELGARRAY)>1)
Q HASDATA
;
CLEANUP ;
K RETURN,HASFIELDS,ELGFIELDSARRAY
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HSDESGETSTOPCD 2053 printed Oct 16, 2024@18:57:32 Page 2
SDESGETSTOPCD ;ALB/ANU,BWF - VISTA SCHEDULING RPCS - SDES GET CLINIC STOPCD ;JAN 24, 2023
+1 ;;5.3;Scheduling;**836,880**;Aug 13, 1993;Build 5
+2 ;;Per VHA Directive 6402, this routine should not be modified
+3 ;
+4 ;External References
+5 ;-------------------
+6 ; Reference to $$GET1^DIQ in ICR #2056
+7 ;
+8 QUIT
+9 ;
GETSTOPCD(JSONRETURN,SDP) ;return entries from the SDEC CLINIC STOP FILE (#40.7)
+1 ;INPUT:
+2 ; SDP - (Optional) Partial Text
+3 ;RETURN:
+4 ; List of entries from the CLINIC STOP file (#40.7)
+5 ; - IEN
+6 ; - Code
+7 ; - Name
+8 ; - Restriction Type
+9 ; - Restriction Date
+10 ;
+11 NEW RETURN,ERRORS,HASFIELDS,RETURN,ELGFIELDSARRARY
+12 ;
+13 SET HASFIELDS=$$CLINSTOP(.ELGFIELDSARRAY,$GET(SDP))
+14 IF HASFIELDS
MERGE RETURN=ELGFIELDSARRAY
+15 IF '$DATA(RETURN("ClinicStopCodes"))
SET RETURN("ClinicStopCodes",1)=""
+16 ;
+17 DO BUILDJSON^SDESBUILDJSON(.JSONRETURN,.RETURN)
+18 DO CLEANUP
+19 QUIT
+20 ;
CLINSTOP(ELGARRAY,SDP) ;SDES GET CLINIC STOPCD remote procedure
+1 ;return entries from the CLINIC STOP file (#40.7)
+2 NEW SDESC,SDESI,SDIEN,SDINACTDT,SDESN,HASDATA,RESTRICTIONDT
+3 ;
+4 SET SDESI=0
+5 SET SDP=$GET(SDP)
+6 ;set SDESN to partial name
SET SDESN=$SELECT(SDP'="":$$GETSUB^SDECU(SDP),1:"")
+7 ;check if within partial name bounds
FOR
SET SDESN=$ORDER(^DIC(40.7,"B",SDESN))
if SDESN=""
QUIT
if (SDP'="")&(SDESN'[SDP)
QUIT
Begin DoDot:1
+8 SET SDESC=""
FOR
SET SDESC=$ORDER(^DIC(40.7,"B",SDESN,SDESC))
if SDESC=""
QUIT
Begin DoDot:2
+9 SET SDINACTDT=$$GET1^DIQ(40.7,SDESC_",",2,"I")
+10 IF SDINACTDT'=""
IF $PIECE(SDINACTDT,".",1)'>$PIECE($$NOW^XLFDT,".",1)
QUIT
+11 SET SDESI=SDESI+1
+12 SET ELGARRAY("ClinicStopCodes",SDESI,"IEN")=SDESC
+13 SET ELGARRAY("ClinicStopCodes",SDESI,"Code")=$$GET1^DIQ(40.7,SDESC_",",1,"E")
+14 SET ELGARRAY("ClinicStopCodes",SDESI,"Name")=$$GET1^DIQ(40.7,SDESC_",",.01,"E")
+15 SET ELGARRAY("ClinicStopCodes",SDESI,"RestrictionType")=$$GET1^DIQ(40.7,SDESC,5,"E")
+16 SET RESTRICTIONDT=$$GET1^DIQ(40.7,SDESI,6,"I")
+17 SET RESTRICTIONDT=$$FMTISO^SDAMUTDT(RESTRICTIONDT)
+18 SET ELGARRAY("ClinicStopCodes",SDESI,"RestrictionDate")=RESTRICTIONDT
End DoDot:2
End DoDot:1
+19 SET HASDATA=($DATA(ELGARRAY)>1)
+20 QUIT HASDATA
+21 ;
CLEANUP ;
+1 KILL RETURN,HASFIELDS,ELGFIELDSARRAY
+2 QUIT
+3 ;