PXINUSE ;SLC/PKR - PCE data dictionary utilities. ;04/28/2017
;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
;
;=========================================
EDINUSE(IEN,DELMSG) ;
N INUSE
S INUSE=$S(+$O(^PXRMINDX(9000010.16,"IP",IEN,""))>0:1,1:0)
I INUSE,DELMSG D EN^DDIOL("This education topic is in use and it cannot be deleted.")
Q INUSE
;
;=========================================
EDNINUSE ;Build a list of education topics that are not in use.
N IEN,INUSE,NAME,NEDU,NL,NOTINUSE,TEXT
S NAME="",(NEDU,NL,NOTINUSE)=0
F S NAME=$O(^AUTTEDT("B",NAME)) Q:NAME="" D
. S IEN=$O(^AUTTEDT("B",NAME,""))
. S NEDU=NEDU+1
. S INUSE=$$EDINUSE(IEN,0)
. I INUSE Q
. S NL=NL+1,TEXT(NL)=NAME_" (IEN="_IEN_")"
S NOTINUSE=NL
S NL=NL+1,TEXT(NL)=""
S NL=NL+1,TEXT(NL)="There are "_NEDU_" education topics."
S NL=NL+1,TEXT(NL)=" "_(NEDU-NOTINUSE)_" of them are in use."
S NL=NL+1,TEXT(NL)=" "_NOTINUSE_" of them are not in use."
D BROWSE^DDBR("TEXT","NR","Education Topics that are NOT IN USE")
Q
;
;=========================================
EXINUSE(IEN,DELMSG) ;
N INUSE
S INUSE=$S(+$O(^PXRMINDX(9000010.13,"IP",IEN,""))>0:1,1:0)
I INUSE,DELMSG D EN^DDIOL("This exam is in use and it cannot be deleted.")
Q INUSE
;
;=========================================
EXNINUSE ;Build a list of exams that are not in use.
N IEN,INUSE,NAME,NEX,NL,NOTINUSE,TEXT
S NAME="",(NEX,NL,NOTINUSE)=0
F S NAME=$O(^AUTTEXAM("B",NAME)) Q:NAME="" D
. S IEN=$O(^AUTTEXAM("B",NAME,""))
. S NEX=NEX+1
. S INUSE=$$EXINUSE(IEN,0)
. I INUSE Q
. S NL=NL+1,TEXT(NL)=NAME_" (IEN="_IEN_")"
S NOTINUSE=NL
S NL=NL+1,TEXT(NL)=""
S NL=NL+1,TEXT(NL)="There are "_NEX_" exams."
S NL=NL+1,TEXT(NL)=" "_(NEX-NOTINUSE)_" of them are in use."
S NL=NL+1,TEXT(NL)=" "_NOTINUSE_" of them are not in use."
D BROWSE^DDBR("TEXT","NR","Exams that are NOT IN USE")
Q
;
;=========================================
HFINUSE(IEN,DELMSG) ;
N ETYPE,INUSE
S ETYPE=$P(^AUTTHF(IEN,0),U,10)
I ETYPE="C" S INUSE=$S(+$O(^AUTTHF("AC",IEN,""))>0:1,1:0)
I ETYPE="F" S INUSE=$S(+$O(^PXRMINDX(9000010.23,"IP",IEN,""))>0:1,1:0)
I INUSE,DELMSG D EN^DDIOL("This health factor is in use and it cannot be deleted.")
Q INUSE
;
;=========================================
HFNINUSE ;Determine which health factors are in use and which are not.
N ETYPE,IEN,INUSE,NAME,NHF,NL,NOTINUSE,TEXT
S NAME="",(NHF,NL,NOTINUSE)=0
F S NAME=$O(^AUTTHF("B",NAME)) Q:NAME="" D
. S IEN=$O(^AUTTHF("B",NAME,""))
. S NHF=NHF+1
. S INUSE=$$HFINUSE(IEN,0)
. I INUSE Q
. S ETYPE=$P(^AUTTHF(IEN,0),U,10)
. S ETYPE=$S(ETYPE="C":"Category",ETYPE="F":"Factor",1:"Missing")
. S NL=NL+1,TEXT(NL)=ETYPE_": "_NAME_" (IEN="_IEN_")"
S NOTINUSE=NL
S NL=NL+1,TEXT(NL)=""
S NL=NL+1,TEXT(NL)="There are "_NHF_" health factors."
S NL=NL+1,TEXT(NL)=" "_(NHF-NOTINUSE)_" of them are in use."
S NL=NL+1,TEXT(NL)=" "_NOTINUSE_" of them are not in use."
D BROWSE^DDBR("TEXT","NR","Health Factors that are NOT IN USE")
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXINUSE 3059 printed Dec 13, 2024@02:29:03 Page 2
PXINUSE ;SLC/PKR - PCE data dictionary utilities. ;04/28/2017
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
+2 ;
+3 ;=========================================
EDINUSE(IEN,DELMSG) ;
+1 NEW INUSE
+2 SET INUSE=$SELECT(+$ORDER(^PXRMINDX(9000010.16,"IP",IEN,""))>0:1,1:0)
+3 IF INUSE
IF DELMSG
DO EN^DDIOL("This education topic is in use and it cannot be deleted.")
+4 QUIT INUSE
+5 ;
+6 ;=========================================
EDNINUSE ;Build a list of education topics that are not in use.
+1 NEW IEN,INUSE,NAME,NEDU,NL,NOTINUSE,TEXT
+2 SET NAME=""
SET (NEDU,NL,NOTINUSE)=0
+3 FOR
SET NAME=$ORDER(^AUTTEDT("B",NAME))
if NAME=""
QUIT
Begin DoDot:1
+4 SET IEN=$ORDER(^AUTTEDT("B",NAME,""))
+5 SET NEDU=NEDU+1
+6 SET INUSE=$$EDINUSE(IEN,0)
+7 IF INUSE
QUIT
+8 SET NL=NL+1
SET TEXT(NL)=NAME_" (IEN="_IEN_")"
End DoDot:1
+9 SET NOTINUSE=NL
+10 SET NL=NL+1
SET TEXT(NL)=""
+11 SET NL=NL+1
SET TEXT(NL)="There are "_NEDU_" education topics."
+12 SET NL=NL+1
SET TEXT(NL)=" "_(NEDU-NOTINUSE)_" of them are in use."
+13 SET NL=NL+1
SET TEXT(NL)=" "_NOTINUSE_" of them are not in use."
+14 DO BROWSE^DDBR("TEXT","NR","Education Topics that are NOT IN USE")
+15 QUIT
+16 ;
+17 ;=========================================
EXINUSE(IEN,DELMSG) ;
+1 NEW INUSE
+2 SET INUSE=$SELECT(+$ORDER(^PXRMINDX(9000010.13,"IP",IEN,""))>0:1,1:0)
+3 IF INUSE
IF DELMSG
DO EN^DDIOL("This exam is in use and it cannot be deleted.")
+4 QUIT INUSE
+5 ;
+6 ;=========================================
EXNINUSE ;Build a list of exams that are not in use.
+1 NEW IEN,INUSE,NAME,NEX,NL,NOTINUSE,TEXT
+2 SET NAME=""
SET (NEX,NL,NOTINUSE)=0
+3 FOR
SET NAME=$ORDER(^AUTTEXAM("B",NAME))
if NAME=""
QUIT
Begin DoDot:1
+4 SET IEN=$ORDER(^AUTTEXAM("B",NAME,""))
+5 SET NEX=NEX+1
+6 SET INUSE=$$EXINUSE(IEN,0)
+7 IF INUSE
QUIT
+8 SET NL=NL+1
SET TEXT(NL)=NAME_" (IEN="_IEN_")"
End DoDot:1
+9 SET NOTINUSE=NL
+10 SET NL=NL+1
SET TEXT(NL)=""
+11 SET NL=NL+1
SET TEXT(NL)="There are "_NEX_" exams."
+12 SET NL=NL+1
SET TEXT(NL)=" "_(NEX-NOTINUSE)_" of them are in use."
+13 SET NL=NL+1
SET TEXT(NL)=" "_NOTINUSE_" of them are not in use."
+14 DO BROWSE^DDBR("TEXT","NR","Exams that are NOT IN USE")
+15 QUIT
+16 ;
+17 ;=========================================
HFINUSE(IEN,DELMSG) ;
+1 NEW ETYPE,INUSE
+2 SET ETYPE=$PIECE(^AUTTHF(IEN,0),U,10)
+3 IF ETYPE="C"
SET INUSE=$SELECT(+$ORDER(^AUTTHF("AC",IEN,""))>0:1,1:0)
+4 IF ETYPE="F"
SET INUSE=$SELECT(+$ORDER(^PXRMINDX(9000010.23,"IP",IEN,""))>0:1,1:0)
+5 IF INUSE
IF DELMSG
DO EN^DDIOL("This health factor is in use and it cannot be deleted.")
+6 QUIT INUSE
+7 ;
+8 ;=========================================
HFNINUSE ;Determine which health factors are in use and which are not.
+1 NEW ETYPE,IEN,INUSE,NAME,NHF,NL,NOTINUSE,TEXT
+2 SET NAME=""
SET (NHF,NL,NOTINUSE)=0
+3 FOR
SET NAME=$ORDER(^AUTTHF("B",NAME))
if NAME=""
QUIT
Begin DoDot:1
+4 SET IEN=$ORDER(^AUTTHF("B",NAME,""))
+5 SET NHF=NHF+1
+6 SET INUSE=$$HFINUSE(IEN,0)
+7 IF INUSE
QUIT
+8 SET ETYPE=$PIECE(^AUTTHF(IEN,0),U,10)
+9 SET ETYPE=$SELECT(ETYPE="C":"Category",ETYPE="F":"Factor",1:"Missing")
+10 SET NL=NL+1
SET TEXT(NL)=ETYPE_": "_NAME_" (IEN="_IEN_")"
End DoDot:1
+11 SET NOTINUSE=NL
+12 SET NL=NL+1
SET TEXT(NL)=""
+13 SET NL=NL+1
SET TEXT(NL)="There are "_NHF_" health factors."
+14 SET NL=NL+1
SET TEXT(NL)=" "_(NHF-NOTINUSE)_" of them are in use."
+15 SET NL=NL+1
SET TEXT(NL)=" "_NOTINUSE_" of them are not in use."
+16 DO BROWSE^DDBR("TEXT","NR","Health Factors that are NOT IN USE")
+17 QUIT
+18 ;