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

PXRMDGFC.m

Go to the documentation of this file.
PXRMDGFC ;SLC/AGP - Reminder General Finding Checker;04/13/2021
 ;;2.0;CLINICAL REMINDERS;**71**;Feb 04, 2005;Build 43
 ;
 ;SACC EXEMPTIONS SECTION
 ;2.3.1.10.1 and 2.3.1.10.2
 ;
ALL ;
 N IEN
 S IEN=0 F  S IEN=$O(^PXRMD(801.46,IEN)) Q:IEN'>0  D
 .D GFENT(IEN)
 W !!,"  Done"
 Q
 ;
BLDSET(SET,OUTPUT) ;
 N CNT,PIECE,STR
 S PIECE=0
 F CNT=1:1:$L(SET) I $E(SET,CNT)=";" S PIECE=PIECE+1 I PIECE>0 D
 . S STR=$P($G(SET),";",PIECE)
 . S OUTPUT($$UP^XLFSTR($P(STR,":")))=""
 . S OUTPUT($$UP^XLFSTR($P(STR,":",2)))=""
 Q
 ;
EN ;
 N ARRAY,DARRAY,DCNT,DIEN
 S DIEN=$$SELECT()
 I DIEN=-1 Q
 S DCNT=0
 W !,"Checking dialog: "_$P(DIEN,U,2)
 D DITEMAR^PXRMDUTL(+DIEN,.ARRAY,.DARRAY,.DCNT)
 D PROCESS(.DARRAY)
 W !,"  Done"
 Q
 ;
GETFINDS(FINDINGS,DIEN) ;
 N FIND
 I $P($G(^PXRMD(801.41,DIEN,1)),U,5)'="" S FINDINGS($P(^PXRMD(801.41,DIEN,1),U,5))=""
 S FIND="" F  S FIND=$O(^PXRMD(801.41,DIEN,3,"B",FIND)) Q:FIND=""  D
 .S FINDINGS(FIND)=""
 Q
 ;
GFENT(IEN) ;
 N FILENUM,FIELD,NAME,PKG,RESULT,VALUE,X0,X1,X2,X3
 S X0=$G(^PXRMD(801.46,IEN,0))
 S NAME=$P(X0,U)
 S PKG=$P(X0,U,2),FILENUM=$P(X0,U,3)
 I +PKG=0 S RESULT=-1 G GFENTX
 I FILENUM="" S RESULT=-1 G GFENTX
 I FILENUM=100.9 Q
 S X1=$G(^PXRMD(801.46,IEN,1))
 S X2=$G(^PXRMD(801.46,IEN,2))
 S X3=$G(^PXRMD(801.46,IEN,3))
 S VALUE=$P(X1,U)
 S FIELD=$P(X1,U,2)
 I VALUE="" D  G GFENTX
 .I NAME="WV DIAGNOSIS" S RESULT=1 Q
 .I $P(X2,U)'="" S RESULT=1 Q
 .I $P(X3,U,3)=1 S RESULT=1 Q
 .S RESULT=-1
 I +FIELD=0 D  G GFENTX
 .I $P(X2,U,2)'="" S RESULT=1 Q
 .I FIELD'="" S RESULT=1 Q
 .S RESULT=-1
 ;if used for IEN prompt it is valid
 I FIELD=.01,VALUE="",$P(X3,U,3)=1 S RESULT=1 G GFENTX
 ;used as a placeholder to insert the patient DFN
 I VALUE="PATIENT" S RESULT=1 G GFENTX
 ;used to delete values out of file 790
 I FILENUM=790&(VALUE="DELETE")&(FIELD=.18!(FIELD=.19)) S RESULT=1 G GFENTX
 ;used to set patient next due date based off the patient age
 I FILENUM=790,VALUE="AGE",FIELD=.19 S RESULT=1 G GFENTX
 ;used to delete values out of pregnancy/lactation log
 I FILENUM=790.9&(FIELD=.01)&(VALUE["P"!(VALUE["L")) S RESULT=1 G GFENTX
 ;all other validation
 S RESULT=$$VALIDATE(IEN,FILENUM,FIELD,VALUE)
GFENTX ;
 I RESULT=-1 W !,IEN_": "_NAME_" not setup correctly"
 I RESULT=0 W !,IEN_": "_NAME_" failed validation"
 Q 
 ;
PROCESS(DARRAY) ;
 N DIEN,FIND,FINDINGS
 S DIEN=0 F  S DIEN=$O(DARRAY(DIEN)) Q:DIEN'>0  D
 .K FINDINGS
 .D GETFINDS(.FINDINGS,DIEN)
 .S FIND="" F  S FIND=$O(FINDINGS(FIND)) Q:FIND=""  D
 ..I FIND["PXRMD(801.46" D GFENT(+FIND)
 Q
 ;
SELECT() ;
 N DIC,DTOUT,DUOUT,Y
 S DIC="^PXRMD(801.41,"
 S DIC(0)="AEMQ"
 S DIC("A")="Select Reminder Dialog Item: "
 S DIC("S")="I $P(^PXRMD(801.41,Y,0),U,4)=""R"""
 D ^DIC
 I $D(DTOUT)!($D(DUOUT)) S Y=-1
 Q Y
 ;
VALIDATE(IEN,FILENUM,FIELD,VALUE) ;
 N ATTR,CODE,MSG,PFILE,RESULT,SETS,TYPE,X
 S RESULT=1
 S TYPE="FIELD LENGTH;INPUT TRANSFORM;POINTER;SPECIFIER;TYPE"
 D FIELD^DID(FILENUM,FIELD,"",TYPE,"ATTR","MSG")
 I $D(MSG) W !,"IEN: "_IEN D AWRITE^PXRMUTIL("MSG") Q RESULT
 ;pointer
 I ATTR("TYPE")="POINTER" D  Q RESULT
 .S PFILE=+$P(ATTR("SPECIFIER"),"P",2)
 .;I PFILE=790.404,VALUE'="",+VALUE=0 Q
 .I '$$EXISTS^PXRMEXIU(PFILE,VALUE) S RESULT=0
 ;set of code
 I ATTR("TYPE")="SET" D  Q RESULT
 .D BLDSET(ATTR("POINTER"),.SETS)
 .I '$D(SETS($$UP^XLFSTR(VALUE))) S RESULT=0
 ;free text and date
 I ATTR("TYPE")="FREE TEXT"!(ATTR("TYPE")="DATE/TIME") D  Q RESULT
 .S X=VALUE
 .S CODE=ATTR("INPUT TRANSFORM")
 .X CODE
 .I $G(X)="" S RESULT=0
 Q RESULT
 ;