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

PXRMDLNK.m

Go to the documentation of this file.
PXRMDLNK ;SLC/AGP - Dialog Link Functions ;Jan 12, 2023@19:16
 ;;2.0;CLINICAL REMINDERS;**45,84**;Feb 04, 2005;Build 2
 ;
SUBCHK(IEN,VALUE) ;INPUT TRANSFORMS For file 801.48
 N FUNC
 S FUNC=$P($G(^PXRMD(801.48,IEN,0)),U,4) I FUNC'>0 Q 0
 I '$D(^PXRMD(801.48,IEN,"B",VALUE)) Q 0
 Q 1
 ;
FINDCHK(DA,VALUE) ;
 N CNT,FAIL,FUNC,NODE,NUM,PAT,PATTENS,PATTEN,SUB
 S FUNC=$P($G(^PXRMD(801.48,DA(1),0)),U,4) I FUNC'>0 Q 0
 S CNT=0 F  S CNT=$O(^PXRMD(801.47,FUNC,2,CNT)) Q:CNT'>0  D
 .S NODE=$G(^PXRMD(801.47,FUNC,2,CNT,0))
 .S SUB=$P(NODE,U),PATTEN=$P(NODE,U,2)
 .Q:SUB=""  Q:PATTEN=""
 .S PATTENS(SUB)=PATTEN
 I '$D(PATTENS) Q 0
 ;
 S SUB=$P($G(^PXRMD(801.48,DA(1),2,DA,0)),U)
 I SUB="" Q 0
 S FAIL=1,PATTEN=$G(PATTENS(SUB))
 I PATTEN="" Q 1
 S NUM=$L(PATTEN,"~")
 F CNT=1:1:NUM D  I FAIL=0 Q
 .S PAT=$P(PATTEN,"~",CNT)
 .I VALUE?@PAT S FAIL=0
 I FAIL=1 Q 0
 Q 1
 ;
DATEDIFF(RESULT,PAT,NVALUE,OVALUE,INPUTS) ;FUNCTIONS FROM FILE 801.47
 I $G(INPUTS("OLD DATE IS SPECIFC"))=1,OVALUE=-1 S RESULT=1 Q 1
 I $G(INPUTS("OLD DATE IS SPECIFC"))=1,$$ISFULDTE^PXRMDATE(OVALUE)=0 Q 0
 I $G(INPUTS("NEW DATE IS SPECIFC"))=1,$$ISFULDTE^PXRMDATE(NVALUE)=0 Q 0
 S RESULT=$$FMDIFF^XLFDT(NVALUE,OVALUE,1)
 I RESULT=0 Q 0
 Q 1
 ;
DATEOFF(RESULT,PAT,NVALUE,OVALUE,INPUTS) ;
 I $G(INPUTS("STARTING DATE"))=1,$$ISFULDTE^PXRMDATE(NVALUE)=0 Q 0
 S RESULT=$$FMADD^XLFDT(NVALUE,$G(INPUTS("OFFSET")))
 Q 1
 ;
DATEHIST(RESULT,PAT,NVALUE,OVALUE,INPUTS) ;
 I $G(INPUTS("NEW DATE IS SPECIFC"))=2,$$ISFULDTE^PXRMDATE(NVALUE)=0 Q 0
 I $G(INPUTS("USE TODAY DATE"))=1 D  Q 1
 .;S OVALUE=DT
 .S RESULT=$$FMDIFF^XLFDT(NVALUE,DT,1) I RESULT<0 S RESULT=NVALUE Q
 .S RESULT=""
 S RESULT=NVALUE
 Q 1
 ;
REMEVAL(RESULT,PAT,NVALUE,OVALUE,INPUTS) ;
 I '$D(INPUTS("DEFINITION")) Q 0
 I '$D(INPUTS("STATUS")) Q 0
 N NAME,NODE,RIEN,RNAME,RSTAT,STATUS
 S RESULT=0
 S NAME=INPUTS("DEFINITION")
 S RSTAT=INPUTS("STATUS")
 S RIEN=$O(^PXD(811.9,"B",NAME,"")) I RIEN'>0 Q 0
 S NODE=$G(^PXD(811.9,RIEN,0))
 S RNAME=$S($P(NODE,U,3)'="":$P(NODE,U,3),1:$P(NODE,U))
 K ^TMP("PXRHM",$J)
 D MAIN^PXRM(PAT,RIEN,55,1)
 S STATUS=$P($G(^TMP("PXRHM",$J,RIEN,RNAME)),U)
 K ^TMP("PXRHM",$J)
 S RESULT=$$STATMTCH^PXRMORCH(STATUS,RSTAT)
 Q 1
 ;
TERMEVAL(RESULT,PAT,NVALUE,OVALUE,INPUTS) ;
 I '$D(INPUTS("TERM")) Q 0
 I '$D(INPUTS("STATUS")) Q 0
 N FIEVAL,NAME,NODE,TIEN,TSTAT,STATUS
 S RESULT=0
 S NAME=INPUTS("TERM")
 S TSTAT=INPUTS("STATUS")
 S TIEN=$O(^PXRMD(811.5,"B",NAME,"")) I TIEN'>0 Q 0
 S STATUS=$$TERM^PXRMDLLB(TIEN,PAT,TIEN,"O",.FIEVAL)
 S RESULT=$S(TSTAT=STATUS:1,1:0)
 Q 1
 ;