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

ANSUCK.m

Go to the documentation of this file.
  1. ANSUCK ;IHS/OIRM/DSD/CSC - UTILITY TO CHECK ADMISSION; [ 02/25/98 10:32 AM ]
  1. ;;3.0;NURSING PATIENT ACUITY;;APR 01, 1996
  1. ;;UTILITY TO CHECK ADMISSION
  1. ANEW S L=0,N=$O(^ANSR("AA",ANSDFN,0)),H=DT_".9"
  1. I N S N=$O(^ANSR("AA",ANSDFN,N,0)) D DC
  1. I X'>L W !!," Can't Be Prior To The Last Discharge." G NO
  1. I X>H W !!," Can't Be Greater Than Today." G NO
  1. G OK
  1. AOLD S L=0,H=$O(^ANSR(A,"AT",0)),D=9999998-^ANSR(A,0)
  1. I 'H S H=DT_".9"
  1. A1 S D=$O(^ANSR("AA",ANSDFN,D)),N=0 G A3:D=""
  1. S N=""
  1. A2 S N=$O(^ANSR("AA",ANSDFN,D,N)) G A1:N="",A1:N=A
  1. A3 D DC
  1. I X'>L W !!," Must Be After The Prior Discharge." G NO
  1. I X>H W !!," Must Be Before The Date Of The First Care Level Record." G NO
  1. G OK
  1. DNEW S H=DT_".9",L=0 D LI
  1. I X<L W !!," Can't Be Prior To The Date Of The Last Care Level Record." G NO
  1. I X>H W *7," Can't Be Greater Than Today." G NO
  1. G OK
  1. DOLD D LI S H=DT_"."_9,P=0
  1. G D3:'$D(^ANSR(A,0)) S C=9999999-^(0),N=0,D=0
  1. D1 S D=$O(^ANSR("AA",ANSDFN,D)) G D3:D="",D3:D>C
  1. S N=0
  1. D2 S N=$O(^ANSR("AA",ANSDFN,D,N)) G D1:N="",D1:N=A
  1. S P=N
  1. G D2
  1. D3 I P,$D(^ANSR(P,0)) S H=$P(^ANSR(P,0),U)_"."_$P(^ANSR(P,0),U,2)
  1. I X<L W !!," Can't Be Less Than The Date Of The Last Care Level Record." G NO
  1. I X'<H W !!," Can't Be After The Next Admission." G NO
  1. G OK
  1. NO K Y
  1. W *7
  1. D PAUSE^ANSDIC
  1. OK Q
  1. DC I N,$D(^ANSR(N,"DX")) S N=$P(^ANSR(N,"DX"),U,5) I N,$D(^ANSR(N,0)) S L=$P(^ANSR(N,0),U)_"."_$P(^ANSR(N,0),U,2)
  1. Q
  1. LI I $D(^ANSR(A,0)) S L=$P(^ANSR(A,0),U)_"."_$P(^ANSR(A,0),U,2)
  1. S N="" F I=1:1 S N=$O(^ANSR(A,"AT",N)) Q:N="" S L=N
  1. Q