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

SDESGETMHCODE.m

Go to the documentation of this file.
SDESGETMHCODE ;ALB/CGP - VISTA SCHEDULING CHECKING MENTAL HEALTH STOP CODE ;Jan 12,2023@09:53
 ;;5.3;Scheduling;**835**;Aug 13, 1993;Build 4
 ;;Per VHA Directive 6402, this routine should not be modified
 Q
 ;
STOPCODE(MHCDJSON,SPIEN) ;check if IEN is a Mental Health Stop Code from CLINIC STOP file #40.7
 ; INPUT:
 ;  SPIEN - Clinic Stop Code
 ;
 N AMISCODE,ERRFLG,RETURN
 S (AMISCODE,ERRFLG,RETURN)=""
 ;
 D VALIDATE(.RETURN,.SPIEN,.AMISCODE,.ERRFLG)
 I ERRFLG'="" S RETURN("Flag")=0 D BLDJSON(.MHCDJSON,.RETURN) Q
 ;
 D MENTALHEALTHCHK(.RETURN,.AMISCODE)
 ;
 D BLDJSON(.MHCDJSON,.RETURN)
 Q
 ;
VALIDATE(RETURN,SPIEN,AMISCODE,ERRFLG) ;
 N INACTIVE
 S INACTIVE=""
 I SPIEN="" S ERRFLG=1 D ERRLOG^SDESJSON(.RETURN,413) Q
 I $G(^DIC(40.7,SPIEN,0))="" S ERRFLG=1 D ERRLOG^SDESJSON(.RETURN,414) Q
 ;
 S INACTIVE=$$GET1^DIQ(40.7,SPIEN,2)
 I INACTIVE'="",INACTIVE<DT S ERRFLG=1 D ERRLOG^SDESJSON(.RETURN,415) Q
 ;
 S AMISCODE=$$GET1^DIQ(40.7,SPIEN,1)
 I AMISCODE="" S ERRFLG=1 D ERRLOG^SDESJSON(.RETURN,416) Q
 Q
 ;
MENTALHEALTHCHK(RETURN,AMISCODE) ;
 I AMISCODE>599 S RETURN("Flag")=0
 I AMISCODE<500 S RETURN("Flag")=0
 I AMISCODE>500,AMISCODE<599 S RETURN("Flag")=1
 Q
 ;
BLDJSON(MHCDJSON,RETURN) ; Build JSON format
 D BUILDJSON^SDESBUILDJSON(.MHCDJSON,.RETURN)
 Q
 ;