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

VENPCCYR.m

Go to the documentation of this file.
VENPCCYR ; IHS/OIT/GIS - COMPONENT FRAMEWORK ; PROCESS ALL CF RPCs  [ 03/05/09   4:39 PM ]
 ;;2.6;PCC+;**1,3,4**;APR 03, 2012;Build 24
 ; 
 ;
 ; 
DEMOPT(OUT,IN) ; EP - RPC: VEN CF GET DEMO PT DFN ; RETRUN THE DEMO PATIENT'S DFN
 ; RETRUN STRING: DFN;NAME;LOCAL CHART NUMBER
 N HRN,DFN
 S OUT=""
 I $G(IN)="OB" S DFN=$O(^DPT("B","DEMO,OB PATIENT",0))
 I $G(IN)="WC" S DFN=$O(^DPT("B","DEMO,WELL CHILD",0))
 I $G(IN)="AM" S DFN=$O(^DPT("B","DEMO,ADULT MALE",0))
 I $G(IN)="AF" S DFN=$O(^DPT("B","DEMO,ADULT FEMALE",0))
 I 'DFN  Q
 S HRN=$P($G(^AUPNPAT(+DFN,41,DUZ(2),0)),U,2) I 'HRN Q
 D PATIENT^VENPCCUR(.OUT,HRN)
 Q
 ;
MOD(OUT,IN) ; EP - RPC: VEN CF TG STG GET MODULES
 S OUT="BMX ADO SS^VEN CF LIST MODULES^^B~~~~"
 Q
 ; 
CMP(OUT,IN) ; EP - RPC: VEN CF TG STG SHOW COMPONENTS
 S OUT="BMX ADO SS^VEN CF LIST COMPONENTS^^B~~~~"
 Q
 ;
PRVLKUP(OUT,IN) ; EP - RPC: VEN CF LIST PROVIDERS
 S OUT="BMX ADO SS^VEN CF CHECKIN PROVIDERS^^~~~~~APRV~BMXADOV2"
 Q
 ;
TX(OUT,IN) ; EP - RPC: VEN CF GET TX STG
 ; IN = COMPONENT IEN;DFN;VISIT_IEN;MODULE_IEN;FORM_IEN;USER_IEN   The VISIT IEN and DFN CAN BE SET TO 0 FOR DEMO MODE.
 ; OUT = Tx STRING
 Q
 ; 
SUBMIT(OUT,IN) ; EP - RPC: VEN CF SUBMIT TX STRING
 ; SUBMIT THE UPDATED STRING FROM THE TRANSACTION
 ; A VERIFICATION STRING WILL BE RETURNED
 S OUT="",IN=$$STG(.IN)
 I '$L($G(IN)) Q
 Q
 ; 
ABORT(OUT,IN) ; EP - RPC: VEN CR ABORT A TRANSACTION
 ; IN = TXIEN, OUT = TXIEN IF TX WAS SUCCESSFULLY DELETED
 S OUT=""
 N DA,DIK,DIC,DIE,DR,X,Y
 S DA=+$G(IN) I 'DA Q
 S DIK="^VEN(7.66,",OUT=DA
 D ^DIK
 Q
 ; 
VALV(OUT,IN) ; EP - VEN CF LIST VISITS
 ; RETURN THE TX STRING FOR A LIST OF VALID VISITS
 S OUT=""
 I '$D(^DPT(+$G(IN),0)) Q
 S OUT="BMX ADO SS^VEN CF VISIT LIST^^~"_$$FMADD^XLFDT(DT,-3)_"~~20~~VALV~VENPCCYV~"_IN
 Q
 ; 
NEWV(OUT,IN) ; EP - VEN CF CREATE TEST VISIT
 ; GIVEN SOURCE VISIT IEN AND NEW TIMESTAMP (VIEN;TS), CLONE A VISIT STUB AND PRIMARY V PRV & V POV ENTRIES
 N TS,%DT,X,Y,Z,VIEN,VDT,NVIEN
 S (VDT,OUT)=""
 S VIEN=+$G(IN) I '$D(^AUPNVSIT(VIEN,0)) Q
 S TS=$P($G(IN),";",2) I '$L(TS) Q
 S X=TS,%DT="T" D ^%DT I Y=-1 Q
 S VDT=Y
 I 'VDT Q
 D NEWV^VENPCCYV(VIEN,VDT,.NVIEN)
 I NVIEN S OUT=NVIEN
 Q
 ;
FLUSH(OUT,IN) ; EP - RPC: VEN CF FLUSH TX FILE
 ; IN = TXIEN;FILE
 I '$L($G(IN)) S OUT="MISSING TRANSACTION ID" Q
 N TXIEN,CIEN,XDA,X,Y,Z,%,GBL,VIEN,DFN,TXFILE,MODIEN,TFILE,OWNER
 S OUT="INVALID TRANSACTION PARAMETER"
 S TXIEN=+IN I 'TXIEN Q
 S TXFILE=+$P(IN,";",2) I 'TXFILE S TXFILE=19707.66
 S OWNER=$P(IN,"|",2)
 S GBL=$G(^DIC(TXFILE,0,"GL")) I GBL="" Q
 S %=$G(@(GBL_TXIEN_",0)")) I %="" Q
 S DFN=+% I 'DFN Q
 S MODIEN=$P(%,U,3) I 'MODIEN Q
 S VIEN=$P(%,U,2) I 'VIEN Q
 S TFILE=0
 I $L($T(XDAF^VENPCCYP)) F  S TFILE=$O(^VEN(7.69,MODIEN,3,"B",TFILE)) Q:'TFILE  D XDAF^VENPCCYP(TFILE,TXIEN,VIEN,DFN,.XDA) ; LOOP THROUGH ALL THE LINKED FILES & MAKE XDA ARRAY
 I '$O(XDA(0)) Q
 S OUT=""
 I $L($T(FLUSH^VENPCCYF)) D FLUSH^VENPCCYF(TXFILE,TXIEN,.XDA,.OUT,OWNER) ; FILE THE DATA, DELETE THE TX ROW
 Q
 ; 
MODEF(OUT,IN) ; EP - RPC: VEN CF GET MODULE DEFINITION ; RETRUN THE MODULE DEFINITION STRING (MODULE/FORM/COMPONENT)
 Q
 ;
MODXML(OUT,IN) ; EP RPC: VEN CF GET MODULE DEF XML ; RETURN MODULE DEFINITION AS AN XML ARRAY
 Q
 ;
STG(IN) ; EP - CONVERT AN ARRAY TO A STRING
 N X,STG
 I '$O(IN(0)) Q $G(IN)
 S STG="",X=0
 F  S X=$O(IN(X)) Q:'X  S STG=STG_IN(X)
 Q STG
 ; 
MAP(OUT,IN) ; EP - MAP GUI HEADERS AND COMPONENTS ; RPC = VEN CF GET HEADER MAP
 ; IN = FORM IEN
 ; OUT = HEADER NAME^COMPONENT NAME|COMPONENT IEN~COMPONENT NAME|COMPONENT IEN...
 Q
 ; 
TRIGGER(OUT,IN) ; EP - RPC: VEN CF TRIGGER
 ; IF A FIELD IN THE TX FILE IS A TRIGGER, SEND THAT QUAD HERE.
 ; RETURNS UPDATED QUAD STRING WITH ALL TRIGGERED ELEMENTS (INCLUDING TRIGGERED ELEMENTS IN OTHER COMPONENTS)
 Q
 ; 
CKTX(OUT,IN) ; EP - RPC: VEN CF CHECK TX ; CHECKS TO SEE IF THERE ALREADY IS AN ENTRY IN THE TX FILE FOR THIS PT
 ; INPUT: DFN|FORM_IEN|VISIT_IEN  ; OUTUT = 1 OR 0
 S OUT=0
 I '$G(IN) Q
 N FIEN,VIEN,DFN,TXIEN,V,F,P,PIEN,TXUID,DATA
 S DFN=$P(IN,"|"),FIEN=$P(IN,"|",2),VIEN=$P(IN,"|",3),PIEN=$P(IN,"|",4)
 I FIEN,VIEN
 E  Q
 S %=VIEN_";"_FIEN
 S TXIEN=$O(^VEN(7.66,"AU",%,0)) I 'TXIEN S OUT="0|" Q
 S DATA=$G(^VEN(7.66,TXIEN,0)) I DATA="" K ^VEN(7.66,TXIEN),^VEN(7.66,"AU",%) Q "0|"
 I $P(DATA,U,9) S OUT="2|" Q
 S P=$P(DATA,U,7)
 I P S P=P_"|"_$P($G(^VA(200,P,0)),U)
 S OUT="1|"_P
 Q
 ;
DELTX(OUT,IN) ; EP - RPC: VEN CF DELETE TX ; DELETES AN ABORTED TX
 ; INPUT: DFN|FORM_IEN|VISIT_IEN  ; OUTUT = 1 OR 0
 S OUT=0
 I '$G(IN) Q
 N DA,DIK,DIC,DIE,DR,X,Y,FIEN,VIEN,F,V,EDD,GBL,%
 S DFN=$P(IN,"|"),FIEN=$P(IN,"|",2),VIEN=$P(IN,"|",3)
 I DFN,FIEN,VIEN
 E  Q
TXCLEAN S DA=$O(^VEN(7.66,"AU",VIEN_";"_FIEN,0)) I 'DA Q
 I $P($G(^VEN(7.66,DA,0)),U,9) D  Q  ; TX CLOSED.  DONT DELETE. JUST CREATE A STUB
 . S %=^VEN(7.66,DA,0)
 . S EDD=$P($G(^VEN(7.66,DA,101)),U)
 . S $P(%,U,6)="",$P(%,U,9)=1 ; CLEAR STUBS CREATED AND SET TX STATUS = "CLOSED"
 . S GBL=$NA(^VEN(7.66))
 . K @GBL@(DA)
 . I EDD K @GBL@("AEW",EDD,DA) ; KILL OFF EVERYTHING EXCEPT 0 NODE & 0 NODE INDICES
 . S @GBL@(DA,0)=%
 . Q
 S DIK="^VEN(7.66,"
 D ^DIK
 D ^XBFMK
 Q
 ; 
USER(OUT,IN) ; EP - RPC: VEN CF CURRENT USER
 ; IN = VIEN|FIEN|PRVIEN ; OUT = 1 IF REQUEST WAS SUCCESSFUL.  IF NOT, OUT = 0
 ; IF  PRVIEN IS DEFINED, TX IS ASSIGNED TO THAT PROVIDER.  IF NOT, TX IS CLEARED OF ITS USER
 S OUT=0
 I $G(IN)="" Q
 N VIEN,PRVIEN,FIEN,X,Y,Z,%,TXIEN
 S VIEN=$P(IN,"|"),FIEN=$P(IN,"|",2),PRVIEN=$P(IN,"|",3)
 I VIEN,FIEN
 E  Q
 S %=VIEN_";"_FIEN,TXIEN=+$O(^VEN(7.66,"AU",%,0)) I '$D(^VEN(7.66,TXIEN,0)) Q
 S OUT=1
 S $P(^VEN(7.66,TXIEN,0),U,7)=$S(PRVIEN:PRVIEN,1:"")
 Q
 ; 
AV(OUT,IN) ; EP - RPC: VEN CF AV CODES
 S OUT="",IN=""
 Q
 ; 
TVAL(OUT,IN) ; EP - RPC: VEN CF VALIDATION TEST
 S OUT=""
 I $G(IN)="" Q
 N FILE,FLD,VAL,X,Y,Z,%,RESULT
 S Z=$P(IN,"|",3) I Z'["~RPC" Q
 S VAL=$P($P(IN,"|",2),"~") I VAL="" Q
 S %=$P(IN,"|",4)
 S FILE=$P(%,"~") I 'FILE Q
 S FLD=$P(%,"~",2) I 'FLD Q
 D CHK^DIE(FILE,FLD,"",VAL,.RESULT)
 I RESULT'=U S OUT="OK" Q
 S OUT=$G(^DD(FILE,FLD,3))
 Q
 ;
VAL(OUT,IN) ; EP - RPC: VEN CF VALIDATION MSG
 S OUT=""
 I $G(IN)="" S OUT=0 Q
 N X,Y,Z,%,PCE,MAX
 S MAX=$L(IN,"|")
 F PCE=1:1:MAX D
 . S X=$P(IN,"|",PCE),Z=""
 . D VAL1(.Z,X)
 . I Z="" S Z=0
 . I $L(OUT) S OUT=OUT_"|"
 . S OUT=OUT_Z
 . Q
 I OUT="" S OUT=0
 Q
 ; 
VAL1(OUT,IN) ; NEW CODE SUPPORTS MULTIPLE VALIDATION MESSAGES
 S OUT=""
 I $G(IN)="" Q
 N FILE,FLD,X,Y,Z,%,CIEN,FMT
 S FILE=$P(IN,"~") I 'FILE Q
 S FLD=$P(IN,"~",2) I 'FLD Q
 S CIEN=$P(IN,"~",3) I 'CIEN Q
 S FMT=$P($G(^VEN(7.68,CIEN,0)),U,4)
 I FMT="F",$E(FILE,9) S FMT="S"
 I FMT="S" D  Q
 . I $P($G(^DD(FILE,FLD,0)),U,2)["S" S OUT="Pick a code from the list" Q
 . I $P($G(^DD(FILE,FLD,0)),U,2)["D",$G(^DD(FILE,FLD,3))="" S OUT="Enter a date (MM/DD/YYYY)" Q
 . S OUT=$G(^DD(FILE,FLD,3))
 . Q
 I FMT="M" S OUT="Add (or append) a note here" Q
 I FMT="C" S OUT="Select an item by checking it" Q
 I FMT="P" S OUT="Enter status:  'P' (Positive) or 'N' (Negative). Optionally check prompted items.  If a prompted item is checked, the status will automatically be set to 'P'." Q
 I FMT="R" S OUT="Only one item can be selected from this list." Q
 I FMT="W" S OUT="If an item has no current value, you may type a value next to the item." Q
 I FMT="T"!(FMT="G") S OUT="This component can not be edited" Q
 I FMT="F" D  Q
 . S %=$G(^VEN(7.68,CIEN,0)) I %="" S OUT=0 Q
 . I $P(%,U,16) S OUT="This flowchart can not be edited" Q
 . I $P(%,U,14) S OUT="You may add a new row to this flowchart.  "
 . E  S OUT="You may not add a new row to this flowchart.  "
 . I $P(%,U,13) S OUT=OUT_"You may edit past flowchart entries." Q
 . S OUT=OUT_"You may not edit past entries."
 . Q
 Q
 ; 
CLTX(OUT,IN) ; EP - RPC: VEN CF TX SCRUB
 ; CLEAN OUT ENTIRE TX FILE
 S OUT=0
 N DA,X,DIK
 S DIK="^VEN(7.66,",DA=0
 F  S DA=$O(^VEN(7.66,DA)) Q:'DA  D ^DIK
 S X=""
 F  S X=$O(^VEN(7.66,X)) Q:X=""  I X'=0 K ^VEN(7.66,X)
 D ^XBFMK
 S OUT=1
 Q
 ; 
KBSEC(OUT,USER) ; EP - RPC: VEN KB PRIVILEGES
 S OUT=0
 I $G(USER)
 E  Q
 I $D(^XUSEC("VENZKBEDIT",USER)) S OUT=1 Q
 I $D(^XUSEC("VENZMGUI",USER)) S OUT=1 Q
 Q
 ;
GUISEC(OUT,USER) ; EP - RPC:VEN WCM GUI PRIVILEGES
 S OUT=0
 I $G(USER)
 E  Q
 I $D(^XUSEC("VENZDESKTOP",USER)) S OUT=1 Q
 I $D(^XUSEC("VENZPRINT",USER)) S OUT=1 Q
 I $D(^XUSEC("PROVIDER",USER)) S OUT=1 Q
 I $D(^XUSEC("VENZMGUI",USER)) S OUT=1 Q
 Q
 ; 
IEN(X) ; EP - BMX CALL, GENERIC IEN
 Q +$G(X)
 ;
VIEN(OUT,IN) ; EP - RPC: VEN EHR VISIT STUB ; CONVERT EHR ENCOUNTER STUB TO RPMS VISIT STUB ; IN = DFN|"HLIEN;VDT;A"|PRVIEN ; IF PERFECT MATCH '> 1 HR, OLD VIEN WILL BE RETURNED
 S OUT=""
 I $L($T(VSTR2VIS^BEHOENCX)),$L($G(IN))
 E  Q
 N X,Y,Z,VSTG,DFN,HLIEN,VDT,PRVIEN,VIEN
 S DFN=+IN I '$D(^DPT(DFN,0)) Q
 S %=$P(IN,"|",2) I %="" Q
 I '$D(^DIC(40.7,+%,0)) Q
 I $P(%,";",3)'="A" Q
 S VDT=$P(%,";",2) I (VDT\1)'?7N Q
 S PRVIEN=$P(IN,"|",3) I PRVIEN,'$D(^VA(200,PRVIEN,0)) Q
 S OUT=$$VSTR2VIS^BEHOENCX(DFN,%,1,PRVIEN)
 Q
 ;