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

SDES2GETSNAPS.m

Go to the documentation of this file.
SDES2GETSNAPS  ;ALB/BLB - GET SPECIAL NEEDS PREFS; Feb 13, 2023@6:10pm
 ;;5.3;Scheduling;**864,877**;Aug 13, 1993;Build 14
 ;;Per VHA Directive 6402, this routine should not be modified
 ;
 Q
 ;
GETNEEDSPREFS(JSON,SDCONTEXT,NEEDSPREFS) ;
 N RETURN,ERRORS,NEEDSANDPREFS,VALRETURN
 ;
 D VALFILEIEN^SDES2VALUTIL(.VALRETURN,.ERRORS,2,$G(NEEDSPREFS("PATIENT DFN")),1,,1,2)
 D VALCONTEXT^SDES2VALCONTEXT(.ERRORS,.SDCONTEXT)
 I $D(ERRORS) S ERRORS("SpecialNeedsAndPreferences",1)="" M RETURN=ERRORS D BUILDJSON^SDES2JSON(.JSON,.RETURN) Q
 ;
 D BUILD(.NEEDSANDPREFS,NEEDSPREFS("PATIENT DFN"))
 I '$D(NEEDSANDPREFS) S NEEDSANDPREFS("SpecialNeedsAndPreferences",1)=""
 ;
 M RETURN=NEEDSANDPREFS D BUILDJSON^SDES2JSON(.JSON,.RETURN)
 Q
 ;
BUILD(NEEDSANDPREFS,DFN) ;
 N NEEDSPREFSIEN,COUNT,IENS,NUM,NEEDSPREFSSUBIEN,REMARKSIEN
 ;
 I '$D(^SDEC(409.845,"B",DFN)) Q
 ;
 S NEEDSPREFSIEN=0,NEEDSPREFSIEN=$O(^SDEC(409.845,"B",DFN,NEEDSPREFSIEN))
 ;
 S NEEDSPREFSSUBIEN=0,COUNT=0
 F  S NEEDSPREFSSUBIEN=$O(^SDEC(409.845,NEEDSPREFSIEN,1,NEEDSPREFSSUBIEN)) Q:'NEEDSPREFSSUBIEN  D
 .S IENS=NEEDSPREFSSUBIEN_","_NEEDSPREFSIEN_",",COUNT=COUNT+1
 .I $$GET1^DIQ(409.8451,NEEDSPREFSSUBIEN_","_NEEDSPREFSIEN_",",5,"I") Q
 .S NEEDSANDPREFS("SpecialNeedsAndPreferences",COUNT,"Preference")=$$GET1^DIQ(409.8451,IENS,.01,"E")
 .S NEEDSANDPREFS("SpecialNeedsAndPreferences",COUNT,"DateTimeAdded")=$$FMTISO^SDAMUTDT($$GET1^DIQ(409.8451,IENS,2,"I"))
 .S NEEDSANDPREFS("SpecialNeedsAndPreferences",COUNT,"EnteredByName")=$$GET1^DIQ(409.8451,IENS,3,"E")
 .S NEEDSANDPREFS("SpecialNeedsAndPreferences",COUNT,"EnteredByIEN")=$$GET1^DIQ(409.8451,IENS,3,"I")
 .;
 .S REMARKSIEN=0
 .F  S REMARKSIEN=$O(^SDEC(409.845,NEEDSPREFSIEN,1,NEEDSPREFSSUBIEN,1,REMARKSIEN)) Q:'REMARKSIEN  D
 ..S NEEDSANDPREFS("SpecialNeedsAndPreferences",COUNT,"Remarks",REMARKSIEN)=$$GET1^DIQ(409.84516,REMARKSIEN_","_IENS,.01,"E")
 Q
 ;