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

VENPCCF.m

Go to the documentation of this file.
VENPCCF ; IHS/FCS/GIS - VEN FLOWCHART UTILITIES ;    
 ;;1.1;PCC+;;MAY 30, 2001
 ;
 ; COPYRITE FULL CIRCLE SOFTWARE, 2001
 ;
KEY(DA) ; POPULATE THE KEY FIELD OF THE VEN EHP EF TEMPLATE FILE
 N X,Y,%,DFN,FCIEN,INST
 S X=$G(^VEN(7.3,DA,0)) I '$L(X) Q ""
 S DFN=+X I '$D(^DPT(DFN,0)) Q ""
 S FCIEN=+$P(X,U,2) I '$D(^VEN(7.3,FCIEN,0)) Q ""
 S INST=$P(X,U,3) I 'INST Q ""
 Q (DFN_";"_FCIEN_";"_INST)
 ; 
ORD(FIEN) ; RETURN COMPONENT ORDER STRING FOR A FLOWCHART (COMPONENT IENS)
 N CIEN,X,Y,%,ATN,ORD,STG
 S CIEN=0 F  S CIEN=$O(^VEN(7.31,FIEN,2,CIEN)) Q:'CIEN  S X=^(CIEN,0) I $L(X) D
 . S ATN=+X,ORD=$P(X,U,4) I 'ORD S ORD=ATN+1000
 . S Y(ORD)=CIEN
 . Q
 S STG="",ORD=0 F  S ORD=$O(Y(ORD)) Q:'ORD  S:STG'="" STG=STG_U S STG=STG_Y(ORD)
 Q STG
 ; 
INST(DFN,FIEN) ; RETURN THE MOST RECENT INSTANCE OF A FLOWCHART FOR A PATIENT
 N X,Y
 S X=DFN_";"_FIEN_";"_9999
 S Y=$O(^VEN(7.3,"AKEY",X),-1)
 Q $P(Y,";",3)
 ; 
EFFC(EIEN) ; GIVEN EF IEN RETURN STRING LISTING ALL ASSOCIATED FLOWCHART IENS
 N FIEN,X,Y,STG
 S STG="",FIEN=0
 F  S FIEN=$O(^VEN(7.41,EIEN,4,"B",FIEN)) Q:'FIEN  S:STG'="" STG=STG_U S STG=STG_FIEN
 Q STG
 ; 
ENT(DFN,FIEN,INST,MAX) ; GIVEN PAT,FLOWCHART IEN AND INSTANCE RETURN THE FLOWCHART ENTRY IENS IN REVERSE CHRONOLOGICAL ORDER UP TO MAX IENS
 I $D(^DPT(+$G(DFN),0)),$D(^VEN(7.31,+$G(FIEN),0))
 E  Q
 S INST=$G(INST,1),MAX=$G(MAX,999)
 N KEY,PFIEN,X,Y,STG,DATE,TOT
 S KEY=DFN_";"_FIEN_";"_INST
 S PFIEN=0 F TOT=1:1:MAX S PFIEN=$O(^VEN(7.3,"AKEY",KEY,PFIEN)) Q:'PFIEN  S DATE=$P($G(^VEN(7.3,PFIEN,0)),U,4) S X(DATE,PFIEN)=""
 S STG="",DATE=0 F  S DATE=$O(X(DATE)) Q:'DATE  S:$L(STG) STG=STG_U S STG=STG_$O(X(DATE,0))
 Q STG
 ; 
HDR(FIEN) ; GIVEN A FLOWCHART AND COMPOMENT ORDER STRING RETURN A HEADER STRING
 I '$D(^VEN(7.31,+$G(FIEN),0)) Q ""
 N ATT,X,Y,HED,UNIT,AIEN,CIEN,STG,CSTG
 S CSTG=$$ORD(FIEN) I '$L(CSTG) Q ""
 S STG=""
 F ATT=1:1:$L(CSTG,U) S AIEN=$P(CSTG,U,ATT) D  S:$L(STG) STG=STG_U S STG=STG_$G(HDR)
 . S HDR=$P($G(^VEN(7.31,FIEN,2,AIEN,0)),U,3)
 . S CIEN=+$P($G(^VEN(7.31,FIEN,2,AIEN,0)),U,2)
 . I HDR="" S HDR=$P($G(^VEN(7.32,CIEN,0)),U,2)
 . I HDR="" S HDR=$P($G(^VEN(7.32,CIEN,0)),U)
 . S UNIT=$P($G(^VEN(7.32,CIEN,0)),U,3)
 . I $L(HDR),$L(UNIT) S HDR=HDR_" ("_UNIT_")"
 . Q
 Q STG
 ; 
VAL(DFN,FIEN,INST,MAX) ; GIVEN DFN, FLOWCHART IEN, INSTANCE, AND MAX VALS, RETURN VAL STG
 N STG,X,Y,%,ATT,FESTG,OSTG,FEIEN,ENT,VSTG
 I $D(^DPT(+$G(DFN),0)),$D(^VEN(7.31,+$G(FIEN),0))
 E  Q ""
 I '$G(INST) S INST=1
 I '$G(MAX) S MAX=999
 S FESTG=$$ENT(DFN,FIEN,INST,MAX) I '$L(FESTG) Q ""
 S STG="",OSTG=$$ORD(FIEN) I '$L(OSTG) Q ""
 F ENT=1:1:$L(FESTG,U) S FEIEN=+$P(FESTG,U,ENT) D  S:$L(STG) STG=STG_"|" S STG=STG_VSTG
 . S VSTG=$P($G(^VEN(7.3,FEIEN,0)),U,4) I 'VSTG Q
 . S VSTG=$$DATE(VSTG)
 . F ATT=1:1:$L(OSTG,U) S AIEN=+$P(OSTG,U,ATT) D
 .. S X=$G(^VEN(7.3,FEIEN,1,AIEN,1))
 .. S CIEN=+$P($G(^VEN(7.31,FIEN,2,AIEN,0)),U,2)
 .. S X=$$OT(CIEN,X)
 .. S VSTG=VSTG_U_X
 .. Q
 . Q
 Q STG
 ; 
TEST W $$VAL(1,1,1,99) Q
DATE(Y) X ^DD("DD") Q Y
 ; 
OT(CIEN,VAL) ; GIVEN A COMPONENT IEN AND VALUE, RETURN THE TRANSFORMED VALUE
 I '$D(^VEN(7.32,+$G(CIEN),0)) Q ""
 I $G(VAL)="" Q ""
 S OT=$G(^VEN(7.32,CIEN,2))
 I '$L(OT) Q VAL
 X ("S VAL=$$"_OT_"(VAL)") Q VAL
 ; 
SYMP(X) ; SYMPTOM SCORE
 N Y
 S Y="FREQUENCY: +"_+X_", THIRST: +"_$P(X,";",2)_",APPETITE: +"_$P(X,";",3)_",FATIGUE: +"_$P(X,";",4)
 Q Y
 ;