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

SDESEDITNEEDPREF.m

Go to the documentation of this file.
  1. SDESEDITNEEDPREF ;ALB/BLB - SDES EDIT SPEC NEEDS PREFS; MAY 08, 2023@6:10pm
  1. ;;5.3;Scheduling;**845**;Aug 13, 1993;Build 8
  1. ;;Per VHA Directive 6402, this routine should not be modified
  1. ;
  1. Q
  1. ;
  1. EDITNEEDSPREFS(JSON,NEEDSPREFS) ;
  1. N ERRORS,RETURN
  1. ;
  1. D VALIDATEDFN^SDESCRTNEEDPREFS(.ERRORS,$G(NEEDSPREFS("PATIENT DFN")))
  1. I $D(ERRORS) M RETURN=ERRORS D BUILDJSON(.JSON,.RETURN) Q
  1. ;
  1. S NEEDSPREFS("IEN")=0,NEEDSPREFS("IEN")=$O(^SDEC(409.845,"B",NEEDSPREFS("PATIENT DFN"),NEEDSPREFS("IEN")))
  1. I '$G(NEEDSPREFS("IEN")) D ERRLOG^SDESJSON(.ERRORS,436)
  1. I $D(ERRORS) M RETURN=ERRORS D BUILDJSON(.JSON,.RETURN) Q
  1. ;
  1. D VALIDATENEEDPREF(.ERRORS,.NEEDSPREFS)
  1. I $D(ERRORS) M RETURN=ERRORS D BUILDJSON(.JSON,.RETURN) Q
  1. ;
  1. D BUILD(.NEEDSPREFS)
  1. S RETURN(1)=1 D BUILDJSON(.JSON,.RETURN) Q
  1. Q
  1. ;
  1. BUILD(NEEDSPREFS) ;
  1. N PATIENTFDA,PATIENTFDAERR,NEEDSPREFSFDAERR,RETURNIEN,COUNT,RETURNPREFIEN,IENS,PREFNAME,NOPREF,INTERNALPREF
  1. S COUNT=0,NOPREF=0
  1. F S COUNT=$O(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT)) Q:'COUNT D
  1. .S PREFERENCE=""
  1. .F S PREFERENCE=$O(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE)) Q:PREFERENCE="" D
  1. ..N NEEDSPREFSFDA,RETURNPREFIEN,REMARK,SUBIEN
  1. ..;
  1. ..S INTERNALPREF=$$SOCEXT2INT^SDESUTIL(409.8451,.01,PREFERENCE)
  1. ..S SUBIEN=0,SUBIEN=$O(^SDEC(409.845,NEEDSPREFS("IEN"),1,"B",INTERNALPREF,SUBIEN))
  1. ..S IENS=SUBIEN_","_$G(NEEDSPREFS("IEN"))_","
  1. ..I $G(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE))="@" D
  1. ...S NEEDSPREFSFDA(409.8451,IENS,.01)=$G(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE))
  1. ...D FILE^DIE(,"NEEDSPREFSFDA","NEEDSPREFSFDAERR") K FDA
  1. ..;
  1. ..; sub level word processing entry
  1. ..I $D(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE,"REMARKS")) D
  1. ...S REMARK(COUNT)=NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE,"REMARKS")
  1. ...D WP^DIE(409.8451,SUBIEN_","_NEEDSPREFS("IEN")_",",6,,"REMARK")
  1. Q
  1. ;
  1. VALIDATENEEDPREF(ERRORS,NEEDSPREFS) ;
  1. N COUNT,PREFERENCE,NOPREF,INTERNALPREF
  1. S COUNT=0,NOPREF=0,INTERNALPREF=""
  1. F S COUNT=$O(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT)) Q:'COUNT!(NOPREF=1) D
  1. .S PREFERENCE=""
  1. .F S PREFERENCE=$O(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE)) Q:PREFERENCE=""!(NOPREF=1) D
  1. ..D VALSETOFCODES^SDESCRTNEEDPREFS(.ERRORS,PREFERENCE,409.8451,.01,"Invalid special need or preference") I $D(ERRORS) S NOPREF=1 Q
  1. ..I $G(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE))="",'$L($G(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE,"REMARKS"))) D ERRLOG^SDESJSON(.ERRORS,439) S NOPREF=1 Q
  1. ..I $G(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE))'="@",'$L($G(NEEDSPREFS("SPECIAL NEEDS AND PREFERENCES",COUNT,PREFERENCE,"REMARKS"))) D ERRLOG^SDESJSON(.ERRORS,440) S NOPREF=1 Q
  1. ..S INTERNALPREF=$$SOCEXT2INT^SDESUTIL(409.8451,.01,PREFERENCE)
  1. ..I '$D(^SDEC(409.845,NEEDSPREFS("IEN"),1,"B",INTERNALPREF)) D ERRLOG^SDESJSON(.ERRORS,437) S NOPREF=1 Q
  1. Q
  1. ;
  1. BUILDJSON(JSONRETURN,RETURN) ;
  1. N JSONERROR
  1. D ENCODE^XLFJSON("RETURN","JSONRETURN")
  1. Q
  1. ;