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

DVBACPR1.m

Go to the documentation of this file.
DVBACPR1 ;ALB/GAK - PATCH DVBA*2.7*189 introduced field utility RPCs;April 14, 2023 ; 5/16/23 11:59am
 ;;2.7;AMIE;**189,248**;Apr 10, 1995;Build 6
 ; This routine provides list, get and set features for several CAPRI RPCs
 Q
 ;
LSTCT(RTRN) ;
 ;LIST VALID CLAIM TYPES
 ;RPC: DVBA CAPRI LISTCLAIMTYPE
 N CTIEN,CODE,CTR
 K ^TEMP($J,"LSTCT")
 S CTIEN=0
 F  S CTIEN=$O(^DVB(396.27,CTIEN)) Q:CTIEN=""!('CTIEN)  D
 . Q:$G(^DVB(396.27,CTIEN,0))=""
 . S ^TEMP($J,"LSTCT",$P(^DVB(396.27,CTIEN,0),"^",1))=CTIEN
 S CODE="",CTR=0
 F  S CODE=$O(^TEMP($J,"LSTCT",CODE)) Q:CODE=""  D
 . S CTR=CTR+1
 . S RTRN(CTR)=CODE_"^"_^TEMP($J,"LSTCT",CODE)
 K ^TEMP($J,"LSTCT")
 Q
 ;
GETCT(RTRN,REQIEN) ;
 ;GET CLAIM TYPE
 ;RPC: DVBA CAPRI GETCLAIMTYPE
 I $G(REQIEN)="" S RTRN(1)="INVALID REQUEST IEN" Q
 I '$D(^DVB(396.3,$G(REQIEN))) S RTRN(1)="INVALID REQUEST IEN" Q
 N MSG,ERR,CTR,MSGIEN,FIND,OUT
 D GETS^DIQ(396.3,REQIEN_",","9.1*","E","MSG","ERR")
 I $D(ERR)>1 S RTRN(1)="NO CLAIM TYPE ON FILE" Q
 S CTR=0
 S MSGIEN="" F  S MSGIEN=$O(MSG(396.32,MSGIEN)) Q:MSGIEN=""  D
 . S CTR=CTR+1
 . K FIND,OUT
 . S FIND=MSG(396.32,MSGIEN,.01,"E")
 . D FIND^DIC(396.27,"",.01,"",.FIND,"","","","","OUT")
 . S RTRN(CTR)=MSG(396.32,MSGIEN,.01,"E")_"^"_$G(OUT("DILIST",2,1))
 Q
 ;
SETCT(RTRN,REQIEN,ARRAYCT) ;
 ;SET CLAIM TYPE
 ;RPC: DVBA CAPRI SETCLAIMTYPE
 ;
 N VAL,SUB,DA,DIK
 S VAL="" F  S VAL=$O(^DVB(396.3,REQIEN,9,"B",VAL)) Q:VAL=""  D
 . S SUB="" F  S SUB=$O(^DVB(396.3,REQIEN,9,"B",VAL,SUB)) Q:SUB=""  D 
 .. K DA,DIK
 .. S DA(1)=REQIEN
 .. S DA=SUB
 .. S DIK="^DVB(396.3,"_DA(1)_",""9"","
 .. D ^DIK
 ;
 I $G(REQIEN)="" S RTRN(1)="INVALID REQUEST IEN" Q
 I '$D(^DVB(396.3,$G(REQIEN))) S RTRN(1)="INVALID EXAM IEN" Q
 N ARYIEN,CTR,FDA,ERR,KEYIEN,FIND
 S CTR=0
 S ARYIEN="" F  S ARYIEN=$O(ARRAYCT(ARYIEN)) Q:ARYIEN=""  D
 . S CTR=CTR+1
 . K FIND,OUT
 . S FIND=ARRAYCT(ARYIEN)
 . D FIND^DIC(396.27,"",.01,"",.FIND,"","","","","OUT")
 . I $G(OUT("DILIST",2,1))="" S RTRN(CTR)=FIND_"^"_"NOT A VALID CLAIM TYPE" Q
 . K FDA,ERR,KEYIEN
 . S KEYIEN=OUT("DILIST",2,1)
 . S FDA(396.32,"+2,"_REQIEN_",",.01)=KEYIEN
 . D UPDATE^DIE("","FDA","KEYIEN","ERR")
 . I $D(ERR)>1 S RTRN(CTR)=FIND_"^"_"COULD NOT BE FILED" Q
 . S RTRN(CTR)=FIND_"^"_"FILED"
 ;
 Q
 ;
LSTSC(RTRN) ;
 ;LIST SPECIAL CONSIDERATION
 ;RPC: DVBA CAPRI LISTSPCLCONSID
 N SCIEN,CTR,CODE
 K ^TEMP($J,"LSTSC")
 S SCIEN=0
 F  S SCIEN=$O(^DVB(396.25,SCIEN)) Q:SCIEN=""!('SCIEN)  D
 . Q:$G(^DVB(396.25,SCIEN,0))=""
 . Q:$P($G(^DVB(396.25,SCIEN,0)),U,2)'=1
 . S ^TEMP($J,"LSTSC",$P(^DVB(396.25,SCIEN,0),"^",1))=SCIEN
 S CODE="",CTR=0
 F  S CODE=$O(^TEMP($J,"LSTSC",CODE)) Q:CODE=""  D
 . S CTR=CTR+1
 . S RTRN(CTR)=CODE_"^"_^TEMP($J,"LSTSC",CODE)
 K ^TEMP($J,"LSTSC")
 Q
 ;
GETSC(RTRN,REQIEN) ;
 ;GET SPECIAL CONSIDERATION
 ;RPC: DVBA CAPRI GETSPCLCONSID
 I $G(REQIEN)="" S RTRN(1)="INVALID REQUEST IEN" Q
 I '$D(^DVB(396.3,$G(REQIEN))) S RTRN(1)="INVALID REQUEST IEN" Q
 N MSG,ERR,CTR,MSGIEN,FIND,OUT
 D GETS^DIQ(396.3,REQIEN_",","50*","E","MSG","ERR")
 I $D(ERR)>1 S RTRN(1)="NO SPECIAL CONSIDERATIONS ON FILE" Q
 S CTR=0
 S MSGIEN="" F  S MSGIEN=$O(MSG(396.31,MSGIEN)) Q:MSGIEN=""  D
 . S CTR=CTR+1
 . K FIND,OUT
 . S FIND=MSG(396.31,MSGIEN,.01,"E")
 . D FIND^DIC(396.25,"",.01,"",.FIND,"","","","","OUT")
 . S RTRN(CTR)=MSG(396.31,MSGIEN,.01,"E")_"^"_$G(OUT("DILIST",2,1))
 Q
 ;
SETSC(RTRN,REQIEN,ARRAYSC) ;
 ;SET SPECIAL CONSIDERATION
 ;RPC: DVBA CAPRI SETSPCLCONSID
 ;
 N VAL,SUB,DA,DIK
 S VAL="" F  S VAL=$O(^DVB(396.3,REQIEN,8,"B",VAL)) Q:VAL=""  D
 . S SUB="" F  S SUB=$O(^DVB(396.3,REQIEN,8,"B",VAL,SUB)) Q:SUB=""  D 
 .. K DA,DIK
 .. S DA(1)=REQIEN
 .. S DA=SUB
 .. S DIK="^DVB(396.3,"_DA(1)_",""8"","
 .. D ^DIK
 ;
 I $G(REQIEN)="" S RTRN(1)="INVALID REQUEST IEN" Q
 I '$D(^DVB(396.3,$G(REQIEN))) S RTRN(1)="INVALID REQUEST IEN" Q
 N ARYIEN,CTR,FDA,ERR,KEYIEN,FIND
 S CTR=0
 S ARYIEN="" F  S ARYIEN=$O(ARRAYSC(ARYIEN)) Q:ARYIEN=""  D
 . S CTR=CTR+1
 . K FIND,OUT
 . S FIND=ARRAYSC(ARYIEN)
 . D FIND^DIC(396.25,"",.01,"",.FIND,"","","","","OUT")
 . I $G(OUT("DILIST",2,1))="" S RTRN(CTR)=FIND_"^"_"NOT A VALID SPECIAL CONSIDERATION" Q
 . K FDA,ERR,KEYIEN
 . S KEYIEN=OUT("DILIST",2,1)
 . S FDA(396.31,"+2,"_REQIEN_",",.01)=KEYIEN
 . D UPDATE^DIE("","FDA","KEYIEN","ERR")
 . I $D(ERR)>1 S RTRN(CTR)=FIND_"^"_"COULD NOT BE FILED" Q
 . S RTRN(CTR)=FIND_"^"_"FILED"
 ;
 Q
 ;
LSTIR(RTRN) ;
 ;LIST INSUFFICIENT REASON
 ;RPC: DVBA CAPRI LISTINSUFRSN
 ;FILE #396.4 FIELD .11 --> FILE #396.94
 ;BUILD LIST OF VALID (ACTIVE) REASONS
 N IRIEN,CTR,CODE
 K ^TEMP($J,"LSTIR")
 S IRIEN=0
 F  S IRIEN=$O(^DVB(396.94,IRIEN)) Q:IRIEN=""!('IRIEN)  D
 . Q:$G(^DVB(396.94,IRIEN,0))=""
 . Q:$P(^DVB(396.94,IRIEN,0),"^",4)="Y"
 . S ^TEMP($J,"LSTIR",$P(^DVB(396.94,IRIEN,0),"^",1))=IRIEN
 S CODE="",CTR=0
 F  S CODE=$O(^TEMP($J,"LSTIR",CODE)) Q:CODE=""  D
 . S CTR=CTR+1
 . S RTRN(CTR)=CODE_"^"_^TEMP($J,"LSTIR",CODE)
 Q
 ;