[613] | 1 | VAQCON97 ;ALB/JRP - MESSAGE CONSTRUCTION;19-APR-93
|
---|
| 2 | ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
|
---|
| 3 | DATA10(TRANPTR,ROOT,MESSNUM,ARRAY,OFFSET) ;BUILD DATA BLOCK FOR VERSION 1.0
|
---|
| 4 | ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
|
---|
| 5 | ; ROOT - Location of Extraction Arrays (full global reference)
|
---|
| 6 | ; MESSNUM - Message number to place message into
|
---|
| 7 | ; (if 0, message will be placed in ARRAY)
|
---|
| 8 | ; ARRAY - Array to store message in (full global reference)
|
---|
| 9 | ; OFFSET - Where to begin placing information (defaults to 0)
|
---|
| 10 | ;OUTPUT : N - Number of lines in message
|
---|
| 11 | ; -1^Error_Text - Error
|
---|
| 12 | ;NOTES : If MESSNUM=0, then the message will be placed into
|
---|
| 13 | ; ARRAY(LineNumber)=Line_of_info
|
---|
| 14 | ; If MESSNUM>0 then the message will be placed into
|
---|
| 15 | ; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
|
---|
| 16 | ; : The first subscript in ROOT must be the segment abbreviation
|
---|
| 17 | ; (i.e. ROOT(SegmentAbbreviation)). This is required to
|
---|
| 18 | ; identify the segments.
|
---|
| 19 | ;
|
---|
| 20 | ;CHECK INPUT
|
---|
| 21 | S TRANPTR=+$G(TRANPTR)
|
---|
| 22 | Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid pointer to VAQ - TRANSACTION file"
|
---|
| 23 | S ROOT=$G(ROOT)
|
---|
| 24 | S MESSNUM=+$G(MESSNUM)
|
---|
| 25 | I (('MESSNUM)&($G(ARRAY)="")) Q "-1^Did not pass message number or reference to array"
|
---|
| 26 | I (MESSNUM) Q:('$D(^XMB(3.9,MESSNUM))) "-1^Valid message number not passed"
|
---|
| 27 | S OFFSET=+$G(OFFSET)
|
---|
| 28 | ;DECLARE VARIABLES
|
---|
| 29 | N TMP,X,LINE,STATUS,TYPE,SEGABB,FILE,FIELD,SEQ,INFO,VALUE,SEQFIELD
|
---|
| 30 | S LINE=OFFSET
|
---|
| 31 | ;DETERMINE STATUS & TYPE
|
---|
| 32 | S TMP=$$STATYPE^VAQCON1(TRANPTR)
|
---|
| 33 | Q:($P(TMP,"^",1)="-1") TMP
|
---|
| 34 | S STATUS=$P(TMP,"^",1)
|
---|
| 35 | S TYPE=$P(TMP,"^",2)
|
---|
| 36 | ;MAKE SURE MESSAGE SHOULD CONTAIN DATA
|
---|
| 37 | Q:((TYPE'="RES")&(TYPE'="UNS")) "-1^Message type does not return data"
|
---|
| 38 | Q:((STATUS'="VAQ-RSLT")&(STATUS'="VAQ-UNSOL")) "-1^Message type does not return data"
|
---|
| 39 | Q:(TYPE="REC") "-1^Transaction is being received, not transmitted"
|
---|
| 40 | ;PLACE MINIMUM INFORMATION INTO MESSAGE
|
---|
| 41 | D MIN10^VAQCON98
|
---|
| 42 | ;PLACE MAS INFORMATION INTO MESSAGE
|
---|
| 43 | D MAS10^VAQCON96
|
---|
| 44 | ;PLACE PHARMACY INFORMATION INTO MESSAGE
|
---|
| 45 | D PHA10^VAQCON95
|
---|
| 46 | Q (LINE-OFFSET)
|
---|