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

WVRPCGF2.m

Go to the documentation of this file.
WVRPCGF2 ;ISP/AGP - APIs for Clinical Reminders ;04/15/2021
 ;;1.0;WOMEN'S HEALTH;**26**;Sep 30, 1998;Build 624
 ;
 ;
CASCADE(RESULT,INPUTS,ID,PAT) ;
 N EPISODE
 ;close reminder episode TODO: needs to be replace with sometype of file driver eventually
 S EPISODE("DFN")=PAT
 S EPISODE("NAME")=INPUTS("DATA",790.1,ID,"NAME")
 ;S EPISODE("STATUS")="CLOSED"
 D CLOSE^PXRMEOC(.RESULT,.EPISODE)
 Q
 ;
CHECKDAT(WVNODE,PAT,WVFUDATE) ;
 I $P(WVNODE,U)'["START AGE" Q
 D TERMEVAL(PAT,.WVFUDATE)
 Q
 ;
 ;set array of future procedure dates and types
GETDATES(WVTRMTS,WVPURP,PAT,WVFUDATE,WVPDATE) ;
 N BRDD,BRDD,CRTX,CRDD,DATE,ISMAM,WVNODE
 S WVNODE=$G(^WV(790.404,WVPURP,0))
 S BRTX=$S($P(WVNODE,U,7)]"":$P(WVNODE,U,7),1:"") ;breast tx need
 S BRDD=$S($P(WVNODE,U,8)]"":$P(WVNODE,U,8),1:"") ;breast tx due date
 S CRTX=$S($P(WVNODE,U,9)]"":$P(WVNODE,U,9),1:"") ;cervical tx need
 S CRDD=$S($P(WVNODE,U,10)]"":$P(WVNODE,U,10),1:"") ;cervical tx due date
 S:'$G(WVPDATE) WVPDATE=DT
 I BRTX'="" D
 .I BRDD="",+$G(WVFUDATE)=0 D CHECKDAT(WVNODE,PAT,.WVFUDATE)
 .I BRDD'="",+$G(WVFUDATE)'>0 S DATE=$$FMADD^WVUTL3(BRDD,WVPDATE)
 .I $G(WVFUDATE)>0 S DATE=WVFUDATE
 .I $D(WVTRMTS("BR",+$G(DATE))) D  Q
 ..I $$ISMAMMO(WVTRMTS("BR",+$G(DATE))) Q
 .S WVTRMTS("BR",+$G(DATE))=BRTX
 I CRTX'="" D
 .I CRDD'="",$G(WVFUDATE)'>0 S DATE=$$FMADD^WVUTL3(BRDD,WVPDATE)
 .I $G(WVFUDATE)>0 S DATE=WVFUDATE
 .S WVTRMTS("CR",+$G(DATE))=BRTX
 Q
 ;
ISMAMMO(BRTX) ;
 Q $S($P($G(^WV(790.51,BRTX,0)),U)["Mammo":1,1:0)
 ;set the actual future procedure and next treatment dates
 ;to file 790.
SETDATES(RESULT,WVTRMTS,WVDFN,CLEARNXT) ;
 N BRTX,BRDD,CRTX,CRDD,NUM,WVERR,WVFDA
 S (BRDD,BRTX,CRDD,CRTX)=""
 I $D(WVTRMTS("BR")) D
 .S BRDD=$O(WVTRMTS("BR","")) Q:BRDD=""
 .S BRTX=$G(WVTRMTS("BR",BRDD)) I BRTX="" S BRDD="" Q
 I $D(WVTRMTS("CR")) D
 .S CRDD=$O(WVTRMTS("CR","")) Q:CRDD=""
 .S CRTX=$G(WVTRMTS("CR",BRDD)) I CRTX="" S CRDD="" Q
 I BRDD'="",BRTX'="" D
 .I BRDD=0 S BRDD=""
 .S WVFDA(790,WVDFN_",",.18)=BRTX
 .S WVFDA(790,WVDFN_",",.19)=BRDD
 I CRDD'="",CRTX'="" D
 .S WVFDA(790,WVDFN_",",.11)=CRTX
 .S WVFDA(790,WVDFN_",",.12)=CRDD
 I CLEARNXT=1 D
 .S WVFDA(790,WVDFN_",",.18)="@"
 .S WVFDA(790,WVDFN_",",.19)="@"
 I $D(WVFDA) D FILE^DIE("","WVFDA","WVERR")
 I $D(WVERR) D
 .S RESULT(1)="-1^Error updating the patient future needs"
 .S NUM=0
 .S NUM=NUM+1,^TMP("PXRMXMZ",$J,NUM,0)="Error adding PATIENT Future needs to the WV PATIENT FILE."
 .D BLDMSG^WVRPCGF1(PAT,"Error updating PATIENT Future needs",.NUM)
 Q
 ;
TERMEVAL(PAT,WVFUDATE) ;
 N FIEVAL,TERMARR
 D TERM^PXRMLDR("VA-WH MAMMOGRAM START DATE",.TERMARR)
 D IEVALTER^PXRMTERM(PAT,.TERMARR,.TERMARR,1,.FIEVAL)
 I $G(FIEVAL(1))'=1 Q
 I $G(FIEVAL(1,"VALUE"))>0 S WVFUDATE=FIEVAL(1,"VALUE")
 Q
 ;