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

PXRMREDT.m

Go to the documentation of this file.
  1. PXRMREDT ;SLC/PKR,PJH - Edit PXRM reminder definition. ;01/30/2013
  1. ;;2.0;CLINICAL REMINDERS;**4,6,12,18,26**;Feb 04, 2005;Build 404
  1. ;
  1. ;=======================================================
  1. EEDIT ;Entry point for PXRM DEFINITION EDIT option.
  1. ;Build list of finding file definitions.
  1. N DEF,DEF1,DEF2,NEW
  1. D DEF^PXRMRUTL("811.902",.DEF,.DEF1,.DEF2)
  1. ;
  1. N DA,DIC,DLAYGO,DTOUT,DUOUT,Y
  1. S DIC="^PXD(811.9,"
  1. S DIC(0)="AEMQL"
  1. S DIC("A")="Select Reminder Definition: "
  1. S DLAYGO=811.9
  1. GETNAME ;Get the name of the reminder definition to edit.
  1. ;Set the starting place for additions.
  1. D SETSTART^PXRMCOPY(DIC)
  1. W !
  1. S DIC("W")="W $$LUDISP^PXRMREDT(Y)"
  1. D ^DIC
  1. I ($D(DTOUT))!($D(DUOUT)) Q
  1. I Y=-1 G END
  1. S DA=$P(Y,U,1)
  1. S NEW=$P(Y,U,3)
  1. D ALL(DIC,DA,.DEF1,NEW)
  1. G GETNAME
  1. END ;
  1. Q
  1. ;
  1. ;=======================================================
  1. ;Select section of reminder to edit, also called at ALL by PXRMEDIT.
  1. ;----------------------------------
  1. ALL(DIC,DA,DEF1,NEW) ;
  1. ;Get list of findings/terms for reminder
  1. N BLDLOGIC,CS1,CS2,DTOUT,DUOUT,LIST,NODE,OPTION,TYPE
  1. ;Save the original checksum.
  1. S CS1=$$FILE^PXRMEXCS(811.9,DA)
  1. STRTEDIT S BLDLOGIC=0
  1. ;Build finding list
  1. S NODE="^PXD(811.9)"
  1. D LIST(NODE,DA,.DEF1,.LIST)
  1. ;If this is a new reminder enter all fields
  1. I $G(NEW) D EDIT(DIC,DA) Q
  1. ;National reminder allows editing of term findings only
  1. I '$$VEDIT^PXRMUTIL(DIC,DA) D Q:$D(DUOUT)!$D(DTOUT)
  1. .S TYPE=""
  1. .F S TYPE=$O(LIST(TYPE)) Q:TYPE="" D
  1. .. I TYPE="RT" Q
  1. .. K LIST(TYPE)
  1. .I '$D(LIST) S DUOUT=1 Q
  1. .S BLDLOGIC=1
  1. .D TFIND(DA,.LIST)
  1. .I $D(Y) S DUOUT=1
  1. ;Otherwise choose fields to edit
  1. I $$VEDIT^PXRMUTIL(DIC,DA) F D Q:($G(OPTION)="^")!$D(DUOUT)!$D(DTOUT)
  1. .S OPTION=$$OPTION^PXRMREDT Q:(OPTION="^")!$D(DUOUT)!$D(DTOUT)
  1. .;All details
  1. .I OPTION="A" D
  1. .. S BLDLOGIC=1
  1. .. D EDIT(DIC,DA)
  1. .;Set up local variables
  1. .N DIE,DR S DIE=DIC N DIC
  1. .;Descriptions
  1. .I OPTION="G" D
  1. ..D GEN
  1. .;Baseline Frequency
  1. .I OPTION="B" D
  1. ..S BLDLOGIC=1
  1. ..D BASE
  1. .;Findings
  1. .I OPTION="F" D
  1. ..S BLDLOGIC=1
  1. ..D FIND(.LIST)
  1. .;Function findings
  1. .I OPTION="FF" D
  1. ..S BLDLOGIC=1
  1. ..D FFIND
  1. .;Logic
  1. .I OPTION="L" D
  1. ..S BLDLOGIC=1
  1. ..D LOGIC
  1. .;Custom date due
  1. . I OPTION="C" D
  1. ..S BLDLOGIC=1
  1. ..D CDUE
  1. .;Dialog
  1. .I OPTION="D" D
  1. ..D DIALOG
  1. .;Web addresses
  1. .I OPTION="W" D
  1. ..D WEB
  1. .;If necessary build the internal logic strings.
  1. .I BLDLOGIC D BLDALL^PXRMLOGX(DA,"","")
  1. ;See if any changes have been made.
  1. S CS2=$$FILE^PXRMEXCS(811.9,DA)
  1. I CS2=0 Q
  1. ;If the file has been edited, do an integrity check.
  1. I CS2'=CS1 D
  1. . ;I OPTION="^" Q
  1. . W !,"Checking integrity of the definition ...",#
  1. . I OPTION'="^",'$$DEF^PXRMICHK(DA) G STRTEDIT
  1. .;If it passes the integrity check save the edit history.
  1. . D SEHIST^PXRMUTIL(811.9,DIC,DA)
  1. Q
  1. ;
  1. ;Reminder Edit
  1. ;-------------
  1. EDIT(ROOT,DA) ;
  1. N DIC,DIDEL,DIE,DR,RESULT
  1. S DIE=ROOT,DIDEL=811.9
  1. ;Edit the fields in the same order they are printed by a reminder
  1. ;inquiry.
  1. ;Reminder name
  1. W !!
  1. S DR=".01"
  1. D ^DIE
  1. ;If DA is undefined then the entry was deleted and we are done.
  1. I '$D(DA) S DTOUT=1 Q
  1. I $D(Y) S DTOUT=1 Q
  1. ;
  1. ;Other fields
  1. D GEN Q:$D(Y)
  1. D BASE Q:$D(Y)
  1. D FIND(.LIST) Q:$D(Y)
  1. D FFIND Q:$D(Y)
  1. D LOGIC Q:$D(Y)
  1. D DIALOG Q:$D(Y)
  1. D WEB Q:$D(Y)
  1. W #
  1. I '$$DEF^PXRMICHK(DA) G STRTEDIT
  1. ;If it passes the integrity check save the edit history.
  1. D SEHIST^PXRMUTIL(811.9,DIC,DA)
  1. Q
  1. ;
  1. GEN ;Print name
  1. W !!
  1. S DR="1.2"
  1. D ^DIE
  1. I $D(Y) Q
  1. ;
  1. CLASS ;
  1. ;Class
  1. W !!
  1. S DR="100"
  1. D ^DIE
  1. I $D(Y) Q
  1. ;Sponsor
  1. S DR="101"
  1. D ^DIE
  1. I $D(Y) Q
  1. ;Make sure Class and Sponsor Class are in synch.
  1. S RESULT=$$VSPONSOR^PXRMINTR(X)
  1. I RESULT=0 G CLASS
  1. ;Review date, Usage
  1. S DR="102;103"
  1. D ^DIE
  1. I $D(Y) Q
  1. ;
  1. ;Related VA-* reminder
  1. W !!
  1. S DR="1.4"
  1. D ^DIE
  1. I $D(Y) Q
  1. ;
  1. ;Inactive flag
  1. W !!
  1. S DR="1.6"
  1. D ^DIE
  1. I $D(Y) Q
  1. ;Ignore on N/A
  1. S DR=1.8
  1. D ^DIE
  1. I $D(Y) Q
  1. ;
  1. ;Recision Date
  1. S DR="69"
  1. D ^DIE
  1. I $D(Y) Q
  1. ;
  1. ;Reminder description
  1. W !!
  1. S DR="2"
  1. D ^DIE
  1. I $D(Y) Q
  1. ;
  1. ;Technical description
  1. W !!
  1. S DR="3"
  1. D ^DIE
  1. ;
  1. ;Priority
  1. W !!
  1. S DR="1.91"
  1. D ^DIE
  1. Q
  1. ;
  1. BASE W !!,"Baseline Frequency"
  1. ;Do in advance time frame
  1. S DR=1.3
  1. D ^DIE
  1. I $D(Y) Q
  1. ;
  1. ;Sex specific
  1. S DR=1.9
  1. D ^DIE
  1. I $D(Y) Q
  1. FARS ;
  1. W !!,"Baseline frequency age range set"
  1. S DR="7"
  1. S DR(2,811.97)=".01;1;2;3;4"
  1. D ^DIE
  1. I $$OVLAP^PXRMAGE G FARS
  1. D SNMLA^PXRMFNFT(DA)
  1. Q
  1. ;
  1. FIND(LIST) ;Edit findings (multiple)
  1. D FIND^PXRMREDF(.LIST)
  1. D SNMLF^PXRMFNFT(DA,20)
  1. Q
  1. ;
  1. FFIND W !!,"Function Findings"
  1. D FFIND^PXRMREDF
  1. D SNMLF^PXRMFNFT(DA,25)
  1. Q
  1. ;
  1. LOGIC W !!,"Patient Cohort and Resolution Logic"
  1. S DR="30T;60T;61T;70T;71T;34T;65T;66T;75T;76T"
  1. D ^DIE
  1. ;Make sure the Patient Cohort Logic at least contains the default.
  1. I $G(^PXD(811.9,DA,31))="" D
  1. . S ^PXD(811.9,DA,31)="(SEX)&(AGE)"
  1. . S ^PXD(811.9,DA,32)="2"_U_"SEX;AGE"
  1. D SNMLL^PXRMFNFT(DA)
  1. Q
  1. CDUE W !!,"Custom Date Due"
  1. S DR=45
  1. D ^DIE
  1. Q
  1. ;
  1. DIALOG W !!,"Reminder Dialog"
  1. S DR="51"
  1. D ^DIE
  1. Q
  1. ;
  1. WEB W !!,"Web Addresses for Reminder Information"
  1. S DR="50"
  1. D ^DIE
  1. Q
  1. ;
  1. ;Get full list of findings
  1. ;-------------------------
  1. LIST(GBL,DA,DEF1,ARRAY) ;
  1. N CNT,DATA,GLOB,IEN,NAME,NODE,SUB,TYPE
  1. ;Clear passed arrays
  1. K ARRAY
  1. S CNT=0
  1. ;Build cross reference global to file number
  1. ;Get each finding
  1. S SUB=0 F S SUB=$O(@GBL@(DA,20,SUB)) Q:'SUB D
  1. .S DATA=$G(@GBL@(DA,20,SUB,0)) I DATA="" Q
  1. .;Determine global and global ien
  1. .S NODE=$P(DATA,U),GLOB=$P(NODE,";",2),IEN=$P(NODE,";")
  1. .;Ignore null entries
  1. .I (GLOB="")!(IEN="") Q
  1. .;Work out the file type
  1. .S TYPE=$G(DEF1(GLOB)) Q:TYPE=""
  1. .S CNT=CNT+1
  1. .I $P($G(@(U_GLOB_IEN_",0)")),U)="" D
  1. ..W !,"**WARNING** Finding #"_SUB_" does not exist, select finding `"_SUB_" to edit it." Q
  1. .E S NAME=$P($G(@(U_GLOB_IEN_",0)")),U) S ARRAY(TYPE,NAME,SUB)=IEN
  1. Q
  1. ;
  1. ;Choose which part of Reminder to edit
  1. ;-------------------------------------
  1. OPTION() ;
  1. N DIR,X,Y
  1. ;Display warning message if un-mapped terms exist
  1. K DIROUT,DIRUT
  1. S DIR(0)="SO"_U
  1. S DIR(0)=DIR(0)_"A:All reminder details;"
  1. S DIR(0)=DIR(0)_"G:General;"
  1. S DIR(0)=DIR(0)_"B:Baseline Frequency;"
  1. S DIR(0)=DIR(0)_"F:Findings;"
  1. S DIR(0)=DIR(0)_"FF:Function Findings;"
  1. S DIR(0)=DIR(0)_"L:Logic;"
  1. S DIR(0)=DIR(0)_"C:Custom date due;"
  1. S DIR(0)=DIR(0)_"D:Reminder Dialog;"
  1. S DIR(0)=DIR(0)_"W:Web Addresses;"
  1. S DIR("A",1)="Select a section to edit; press ENTER when you are done editing."
  1. S DIR("A")="To quit and exit type '^'"
  1. S DIR("?")="Select which section of the reminder you wish to edit."
  1. S DIR("??")="^D HELP^PXRMREDF(2)"
  1. D ^DIR K DIR
  1. I (Y="")!(Y="^") S DUOUT=1
  1. Q Y
  1. ;
  1. ;-------------------------------------
  1. LUDISP(IEN) ;Use for DIC("W") to augment look-up display.
  1. N CLASS,EM,INACTIVE,TEXT
  1. S INACTIVE=$P(^PXD(811.9,IEN,0),U,6)
  1. S CLASS=$P(^PXD(811.9,IEN,100),U,1)
  1. I INACTIVE'="" S INACTIVE="("_$$EXTERNAL^DILFD(811.9,1.6,"",INACTIVE,.EM)_")"
  1. S CLASS=$$EXTERNAL^DILFD(811.9,100,"",CLASS,.EM)
  1. S TEXT=" "_CLASS_" "_INACTIVE
  1. Q TEXT
  1. ;
  1. ;-------------------------------------
  1. TFIND(DA,LIST) ;Allow edit of term findings for national reminders.
  1. N DIR,IENLIST,IND,JND,NAME,NAMELIST,SUB,X,Y
  1. S IND=0,NAME=""
  1. F S NAME=$O(LIST("RT",NAME)) Q:NAME="" D
  1. . S IND=IND+1
  1. . S NAMELIST(IND)=$$RJ^XLFSTR(IND,3)_" "_NAME
  1. . S SUB=$O(LIST("RT",NAME,""))
  1. . S IENLIST(IND)=LIST("RT",NAME,SUB)
  1. M DIR("A")=NAMELIST
  1. S DIR("A")="Enter your list"
  1. S DIR(0)="LO^1:"_IND
  1. W !!,"Select term(s) for finding edit:"
  1. D ^DIR
  1. I $D(DIROUT)!$D(DIRUT) S LIST="" Q
  1. I $D(DUOUT)!$D(DTOUT) S LIST="" Q
  1. F IND=1:1:$L(Y,",")-1 D
  1. . S JND=$P(Y,",",IND)
  1. . S NAME=$P(NAMELIST(JND),JND,2)
  1. . W !!,"Reminder Term:",NAME
  1. . D TMAP^PXRMREDF(DA,IENLIST(JND))
  1. Q
  1. ;