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

PXRMDG.m

Go to the documentation of this file.
PXRMDG ;SLC/AGP - Clincial Reminders Updates to DG ;Oct 06, 2022@14:58:56
 ;;2.0;CLINICAL REMINDERS;**78,83**;Feb 4, 2005;Build 14
 ;
 ;DBIA   USED
 ;7323   $$SOGI^VAFCAPI
 ;10061  DEM^VADPT
 ;main entry point for updating DG data
EN(RESULT,INPUTS) ;
 N DFN,NOTE,VISIT
 S DFN=+$G(INPUTS("DFN")) I DFN=0 S RESULT(1)="-1^No DFN"
 S NOTE=+$G(INPUTS("DOCUMENT")) I NOTE=0 S RESULT(0)="-1^No Note passed in"
 I $D(INPUTS("DATA",2.025)) D SEXORUP(.RESULT,.INPUTS,DFN,NOTE)
 Q
 ;
 ;build array to send DG package to update Sexual Orientation
BLDSEXOR(RESULTS,INPUTS,DFN,NOTE) ;
 N ARRAY,CNT,DESC,ID,TCNT,VALUE
 D BLDEXSEX(DFN,.ARRAY)
 S ID="" F  S ID=$O(INPUTS("DATA",2.025,ID)) Q:ID=""  D
 .S CNT=0
 .S VALUE=$G(INPUTS("DATA",2.025,ID,.01)) I VALUE="" Q
 .I '$D(ARRAY("INDEXES")) S CNT=+ID
 .I CNT=0,$D(ARRAY(VALUE)) S CNT=+ARRAY(VALUE) K ARRAY(VALUE)
 .I CNT=0,$D(ARRAY("INDEXES",+ID)) D
 ..S TCNT=+$O(ARRAY("INDEXES",""),-1)+1
 ..I $D(RESULTS("SexOr",TCNT)) S TCNT=+$O(RESULTS("SexOr",""),-1)+1
 ..S CNT=TCNT
 .S RESULTS("SexOr",CNT)=VALUE_U_"A"_U_NOTE
 I $D(INPUTS("DATA",2)) D
 .S DESC=""
 .S ID="" F  S ID=$O(INPUTS("DATA",2,ID)) Q:ID=""!(DESC'="")  D
 ..S DESC=$G(INPUTS("DATA",2,ID,.0251))
 .I DESC'="" S RESULTS("SexOrDes")=DESC
 S VALUE="" F  S VALUE=$O(ARRAY(VALUE)) Q:VALUE=""  D
 .I $G(ARRAY(VALUE))="" Q
 .S ID=$P(ARRAY(VALUE),U)
 .I $P(ARRAY(VALUE),U,2)="I" S RESULTS("SexOr",ID)=VALUE_U_$P(ARRAY(VALUE),U,2,3) Q
 .I $P(ARRAY(VALUE),U,2)="E" S RESULTS("SexOr",ID)=VALUE_U_$P(ARRAY(VALUE),U,2,3) Q
 .S RESULTS("SexOr",ID)=VALUE_U_"I"_U_NOTE
 Q
 ;
 ;collect Sexual Orientations already on file
BLDEXSEX(DFN,RESULTS) ;
 N IDX,TEMP,TYP,VADM
 D DEM^VADPT
 S IDX=0 F  S IDX=$O(VADM(14,1,IDX)) Q:IDX'>0  D
 .S TEMP=IDX_U_$P($G(VADM(14,1,IDX,1)),U,2)_U_$P($G(VADM(14,1,IDX,4)),U,2)_U_$P($G(VADM(14,1,IDX,2)),U,2)_U_$P($G(VADM(14,1,IDX,3)),U,2)
 .S RESULTS($P(VADM(14,1,IDX),U,2))=TEMP
 .S RESULTS("INDEXES",IDX)=""
 Q
 ;
NOTEACT(PXRMDOCINFO) ;
 N DFN,IDX,NOTEIEN,NOTENAME,PXRMARR,PXRMINPUTS,TEMP,TMPARR,VALUE
 I '$D(PXRMDOCINFO("OLD")) Q
 S DFN=+$G(PXRMDOCINFO("OLD","DFN")) I DFN=0 Q
 S NOTEIEN=+$G(PXRMDOCINFO("OLD","NOTE IEN")) I NOTEIEN=0 Q
 S PXRMINPUTS("Note")=NOTEIEN
 S TEMP=$$SOGI^VAFCAPI(DFN,.PXRMINPUTS,1)
 Q
 ;
 ;call to update/add Sexual Orientation on file
SEXORUP(RESULT,INPUTS,DFN,NOTE) ;
 N PXRMARR,TEMP
 D BLDSEXOR(.PXRMARR,.INPUTS,DFN,NOTE)
 S TEMP=$$SOGI^VAFCAPI(DFN,.PXRMARR,1)
 S RESULT(1)=$S(+$P(TEMP,U)=-1:TEMP,1:1)
 Q
 ;
 ;call to verified Sexual Orientation updates coming in from the GUI
VERDATA(RESULTS,INPUTS) ;
 N DFN,PXRMARR,TEMP
 S RESULTS(0)=1
 S DFN=+$G(INPUTS("DFN")) I DFN=0 S RESULTS(1)="-1^No DFN"
 D BLDSEXOR(.PXRMARR,.INPUTS,DFN,"")
 S TEMP=$$SOGI^VAFCAPI(DFN,.PXRMARR)
 I +$P(TEMP,U)=-1 S RESULTS(0)=-1,RESULTS(1)=$P(TEMP,U,2)
 Q
 ;
 ;call to return data that was entered via a notes in CPRS
GETFINDS(SUB,DFN,VISIT,NOTE) ;
 N CNT,ERROR,FIELD,FILE,IDX,PKG,X1,X4,VADM
 S PKG=+$$FIND1^DIC(9.4,,,"REGISTRATION",,"I $P($G(^(0)),U,2)=""DG""","ERROR")
 I $D(ERROR) Q
 S FIELD=.01,FILE=2.025
 D DEM^VADPT
 S IDX=0,CNT=0 F  S IDX=$O(VADM(14,1,IDX)) Q:IDX'>0  D
 .S X4=$G(VADM(14,1,IDX,4)) I $P(X4,U,2)'=NOTE Q
 .S X1=$G(VADM(14,1,IDX))
 .S ^TMP(SUB,$J,PKG,FILE,FIELD,IDX)=$P(X1,U),CNT=CNT+1
 S ^TMP(SUB,$J)=CNT
 Q
 ;