- MHV7R5 ;WAS/DLF/MJK/KUM - HL7 RECEIVER FOR ADMIN QUERIES ; 6/7/10 10:34am
- ;;1.0;My HealtheVet;**6,10,11**;Aug 23, 2005;Build 61
- ;;Per VHA Directive 2004-038, this routine should not be modified.
- ;
- ; Integration Agreements:
- ; 10104 : $$UP^XLFSTR
- Q
- ;
- QBPQ11 ;Process QBP^Q11 messages from the MHVSM QBP-Q11 Subscriber protocol
- ;
- ; This routine and subroutines assume that all VistA HL7 environment
- ; variables are properly initialized and will produce a fatal error
- ; if they are missing.
- ;
- ; The message will be checked to see if it is a valid query.
- ; If not a negative acknowledgement will be sent. If the query is an
- ; immediate mode or synchronous query, the realtime request manager
- ; is called to handle the query. This means the query will be
- ; processed and a response generated immediately.
- ; In the future deferred mode queries may be filed in a database for
- ; later processing, or transmission.
- ;
- ; Input:
- ; HL7 environment variables
- ;
- ; Output:
- ; Processed query or negative acknowledgement
- ; If handled real-time the query response is generated
- ;
- ; Integration Agreements
- ;
- ; 10104 UP^XLFSTR
- ;
- N MSGROOT,QRY,XMT,ERR,RNAME
- S (QRY,XMT,ERR)=""
- ; Inbound query messages are small enough to be held in a local.
- ; The following lines commented out support use of global and are
- ; left in case use a global becomes necessary.
- ;S MSGROOT="^TMP(""MHV7"",$J)"
- ;K @MSGROOT
- S MSGROOT="MHV7MSG"
- N MHV7MSG
- D LOADXMT^MHV7U(.XMT) ;Load inbound message information
- ;
- S RNAME=XMT("MESSAGE TYPE")_"-"_XMT("EVENT TYPE")_" RECEIVER"
- D LOG^MHVUL2(RNAME,"BEGIN","S","TRACE")
- ;
- D LOADMSG^MHV7U(MSGROOT)
- D LOG^MHVUL2("LOAD",MSGROOT,"I","DEBUG")
- ;
- D PARSEMSG^MHV7U(MSGROOT,.HL)
- D LOG^MHVUL2("PARSE",MSGROOT,"I","DEBUG")
- ;
- I '$$VALIDMSG(MSGROOT,.QRY,.XMT,.ERR) D Q
- . D LOG^MHVUL2("MSG CHECK","INVALID^"_ERR,"S","ERROR")
- . D XMIT^MHV7T(.QRY,.XMT,ERR,"",.HL)
- D LOG^MHVUL2("MSG CHECK","VALID","S","TRACE")
- ;
- ; Immediate Mode
- ; Deferred mode queries are not supported at this time
- D REALTIME^MHVRQI(.QRY,.XMT,.HL)
- ;
- D LOG^MHVUL2(RNAME,"END","S","TRACE")
- D RESET^MHVUL2 ;Clean up TMP used by logging
- ;K @MSGROOT
- ;
- Q
- ;
- VALIDMSG(MSGROOT,QRY,XMT,ERR) ;Validate message
- ;
- ; Messages handled: QBP^Q11
- ;
- ; QBP query messages must contain QPD and RCP segments
- ; Any additional segments are ignored
- ;
- ; Input:
- ; MSGROOT - Root of array holding message
- ; XMT - Transmission parameters
- ;
- ; Output:
- ; QRY - Query Array
- ; XMT - Transmission parameters
- ; ERR - segment^sequence^field^code^ACK type^error text
- ;
- N MSH,PID,STF,QPD,RCP,REQFLDS,REQID,REQTYPE,FROMDT,TODT,PRI,QTAG,QNAME,MHVCSIE
- N SEGTYPE,CNT,OCNT,RXNUM,QTY,UNIT,REQFLDS,CHKSEG
- K QRY,ERR
- S MHVCSIE=""
- S ERR=""
- ;
- ; Set up basics for responding to message.
- ;-----------------------------------------
- S QRY("MID")=XMT("MID") ;Message ID
- S QRY("QPD")=""
- ;
- ; Validate message is a well-formed QBP query message.
- ;-----------------------------------------------------------
- ; Must have MSH first, followed by QPD,RCP in any order
- ; PID and STF are optional. All other segments are ignored.
- ;
- I $G(@MSGROOT@(1,0))="MSH" M MSH=@MSGROOT@(1)
- E S ERR="MSH^1^^100^AE^Missing MSH segment" Q 0
- ;
- S CNT=2,OCNT=0
- F Q:'$D(@MSGROOT@(CNT)) D S CNT=CNT+1
- . S SEGTYPE=$G(@MSGROOT@(CNT,0))
- . I SEGTYPE="PID" M PID=@MSGROOT@(CNT),QRY("PID")=PID Q
- . I SEGTYPE="STF" M STF=@MSGROOT@(CNT),QRY("STF")=STF Q
- . I SEGTYPE="QPD" M QPD=@MSGROOT@(CNT),QRY("QPD")=QPD Q
- . I SEGTYPE="RCP" M RCP=@MSGROOT@(CNT),QRY("RCP")=RCP Q
- . Q
- ;
- I '$D(QPD) S ERR="QPD^1^^100^AE^Missing QPD segment" Q 0
- ;
- S QTAG=$G(QPD(1,1,2)) ;Query Tag
- S REQID=$G(QPD(2)) ;Request ID
- S REQTYPE=$G(QPD(3,1,1)) ;Request Type
- S PRI=$G(RCP(1)) ;Query Priority
- S QTY=$G(RCP(2,1,1)) ;Quantity Limited
- S UNIT=$G(RCP(2,1,2)) ;Quantity units
- S:REQTYPE="" REQTYPE=$G(QPD(3)) ;Request Type if no other params
- ;
- ; Validate required fields and query parameters
- ;------------------------------------------------------
- ;
- ; Check for missing/invalid fields
- ;
- I '$D(QPD(1)) S ERR="QPD^1^1^101^AE^Missing Message Query Name" Q 0
- M QNAME=QPD(1) ;Message Query Name
- ;
- I QTAG="" S ERR="QPD^1^2^101^AE^Missing Query Tag" Q 0
- I REQID="" S ERR="QPD^1^2^101^AE^Missing Request ID" Q 0
- S (QRY("IEN"),QRY("LNAME"),QRY("FNAME"),QRY("DFN"))=""
- S QRY("REQID")=REQID
- ;
- I REQTYPE="" S ERR="QPD^1^3^101^AE^Missing Request Type" Q 0
- I '$$VALRTYPE^MHV7RU(REQTYPE,.QRY,.ERR) S ERR="QPD^1^3^"_ERR Q 0
- ;
- ; If we have a PID, validate it and populate query parameters
- ; from the PID.
- ;
- I $D(PID) D VALIDPID
- ;
- ; If we have a STF, validate it and populate query parameters
- ; from the STF.
- ;
- I $D(STF) D VALIDSTF
- ;
- I ERR Q 0
- ;
- ; If no PID or STF segment sent, Populate parameters 1-3 with the
- ; QPD segment data
- ;
- I '$D(PID),'$D(STF) D
- .S QRY("IEN")=$G(QPD(3,1,2)) ;ien
- .S QRY("LNAME")=$$UP^XLFSTR($G(QPD(3,1,3))) ;Last Name
- .S QRY("FNAME")=$$UP^XLFSTR($G(QPD(3,1,4))) ;First Name
- .S QRY("PICN")=$$UP^XLFSTR($G(QPD(3,1,2))) ;Patient ICN
- .S QRY("DSSI")=$$UP^XLFSTR($G(QPD(3,1,3))) ;DSS Unit IEN
- .S QRY("PRDT")=DT ;Procedure Date and Time
- .S QRY("DSRCH")=$$UP^XLFSTR($G(QPD(3,1,3))) ;Diagnoses Search String
- .S QRY("FROMDT")=$$UP^XLFSTR($G(QPD(3,1,5))) ;From Date
- .S QRY("TODT")=$$UP^XLFSTR($G(QPD(3,1,6))) ;To Date
- ;
- ;Added for MHV*1.0*10 - Validations for SMClinicsByStopCode query Input parameters
- I (REQTYPE="SMClinicsByStopCode")&($D(QPD)) D
- . I $G(QRY("FNAME"))="" S ERR="QPD^1^6^101^AE^Clinic Secondary(Credit) Stop Code cannot be null" Q
- . I ((+$G(QRY("FNAME"))<1)&(+$G(QRY("FNAME"))>999)) S ERR="QPD^1^6^102^AE^Clinic Secondary(Credit) Stop Code "_$G(QRY("FNAME"))_" should be a numeric value in the range 1 to 999." Q
- . S MHVCSIE=$$SCIEN^MHVXCLN($G(QRY("FNAME")))
- . I $G(MHVCSIE)="" S ERR="QPD^1^6^102^AE^Clinic Secondary(Credit) Stop Code "_$G(QRY("FNAME"))_" Unknown."
- ;
- ;Added for MHV*1.0*11 - Validations for SMPCMMPatientsForClinic query Input parameters
- I (REQTYPE="SMPCMMPatientsForClinic")&($D(QPD)) D
- . I $G(QRY("IEN"))="" S ERR="QPD^1^6^101^AE^Clinic IEN cannot be null" Q
- ;
- ;Added for MHV*1.0*11 - Validations for SMPATEligClassification query Input parameters
- I (REQTYPE="SMPatientEClass")&($D(QPD)) D
- . I $G(QRY("PICN"))="" S ERR="QPD^1^6^101^AE^Patient ICN cannot be null" Q
- . I $G(QRY("DSSI"))="" S ERR="QPD^1^6^102^AE^DSS Unit IEN cannot be null" Q
- . I $G(QRY("PRDT"))="" S ERR="QPD^1^6^103^AE^Procedure Date and Time cannot be null" Q
- ;
- ;Added for MHV*1.0*11 - Validations for SMPatientProblems input parameters
- I (REQTYPE="SMPatientProblems")&($D(QPD)) D
- . I $G(QRY("PICN"))="" S ERR="QPD^1^6^101^AE^Patient ICN cannot be null" Q
- ;
- ;Added for MHV*1.0*11 - Validations for SMDiagnoses input parameters
- I (REQTYPE="SMDiagnoses")&($D(QPD)) D
- . I $G(QRY("DSRCH"))="" S ERR="QPD^1^6^101^AE^Diagnoses Search String cannot be null" Q
- I ERR Q 0
- ;
- S FROMDT=$G(QPD(3,1,5)) ;From Date
- S TODT=$G(QPD(3,1,6)) ;To Date
- ;
- ; Validate from and to date if present
- ;
- I FROMDT]"" D
- .I '$$VALIDDT^MHV7RU(.FROMDT) S ERR="QPD^1^7^102^AE^Invalid From Date"
- I TODT]"" D
- .I '$$VALIDDT^MHV7RU(.TODT) S ERR="QPD^1^8^102^AE^Invalid To Date"
- .I TODT'="",TODT<FROMDT D
- ..S ERR="QPD^1^6^102^AE^To Date precedes From Date"
- S QRY("FROMDT")=FROMDT,QRY("TODT")=TODT
- I ERR'="" Q 0
- ;
- I PRI="" S ERR="RCP^1^1^101^AE^Missing Query Priority" Q 0
- I ",D,I,"'[(","_PRI_",") S ERR="RCP^1^1^102^AE^Invalid Query Priority" Q 0
- S QRY("PRI")=PRI
- Q:ERR'="" 0
- ;
- Q 1
- ;
- VALIDPID ;
- ;
- ; If the IEN was sent, call the validation utility for
- ; PID segments
- ;
- I $D(PID(3,1,1)) D
- .S CHKSEG=$$VALIDPID^MHV7RUS(.PID,.QRY,.ERR)
- .S QRY("IEN")=QRY("DFN")
- ;
- ; If no IEN, populate parameters for name
- ;
- I QRY("IEN")="",ERR="" D
- .S QRY("LNAME")=$$UP^XLFSTR(PID(5,1,1))
- .S:$D(PID(5,1,2)) QRY("FNAME")=$$UP^XLFSTR(PID(5,1,2))
- Q
- VALIDSTF ;
- ;
- ; If the IEN was sent, call the validation utility for
- ; STF segments
- ;
- I $D(STF(2)) D Q
- .S QRY("IEN")=$G(STF(2,1,1))
- ;
- ; If no IEN, populate parameters for name
- ;
- I $G(STF(3))]"" S QRY("LNAME")=$$UP^XLFSTR($TR(STF(3),"^",""))
- I $G(STF(3,1,1))'="" S QRY("LNAME")=$$UP^XLFSTR(STF(3,1,1))
- I $G(STF(3,1,2))'="" S QRY("FNAME")=$$UP^XLFSTR(STF(3,1,2))
- Q
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMHV7R5 8786 printed Dec 13, 2024@02:15:57 Page 2
- MHV7R5 ;WAS/DLF/MJK/KUM - HL7 RECEIVER FOR ADMIN QUERIES ; 6/7/10 10:34am
- +1 ;;1.0;My HealtheVet;**6,10,11**;Aug 23, 2005;Build 61
- +2 ;;Per VHA Directive 2004-038, this routine should not be modified.
- +3 ;
- +4 ; Integration Agreements:
- +5 ; 10104 : $$UP^XLFSTR
- +6 QUIT
- +7 ;
- QBPQ11 ;Process QBP^Q11 messages from the MHVSM QBP-Q11 Subscriber protocol
- +1 ;
- +2 ; This routine and subroutines assume that all VistA HL7 environment
- +3 ; variables are properly initialized and will produce a fatal error
- +4 ; if they are missing.
- +5 ;
- +6 ; The message will be checked to see if it is a valid query.
- +7 ; If not a negative acknowledgement will be sent. If the query is an
- +8 ; immediate mode or synchronous query, the realtime request manager
- +9 ; is called to handle the query. This means the query will be
- +10 ; processed and a response generated immediately.
- +11 ; In the future deferred mode queries may be filed in a database for
- +12 ; later processing, or transmission.
- +13 ;
- +14 ; Input:
- +15 ; HL7 environment variables
- +16 ;
- +17 ; Output:
- +18 ; Processed query or negative acknowledgement
- +19 ; If handled real-time the query response is generated
- +20 ;
- +21 ; Integration Agreements
- +22 ;
- +23 ; 10104 UP^XLFSTR
- +24 ;
- +25 NEW MSGROOT,QRY,XMT,ERR,RNAME
- +26 SET (QRY,XMT,ERR)=""
- +27 ; Inbound query messages are small enough to be held in a local.
- +28 ; The following lines commented out support use of global and are
- +29 ; left in case use a global becomes necessary.
- +30 ;S MSGROOT="^TMP(""MHV7"",$J)"
- +31 ;K @MSGROOT
- +32 SET MSGROOT="MHV7MSG"
- +33 NEW MHV7MSG
- +34 ;Load inbound message information
- DO LOADXMT^MHV7U(.XMT)
- +35 ;
- +36 SET RNAME=XMT("MESSAGE TYPE")_"-"_XMT("EVENT TYPE")_" RECEIVER"
- +37 DO LOG^MHVUL2(RNAME,"BEGIN","S","TRACE")
- +38 ;
- +39 DO LOADMSG^MHV7U(MSGROOT)
- +40 DO LOG^MHVUL2("LOAD",MSGROOT,"I","DEBUG")
- +41 ;
- +42 DO PARSEMSG^MHV7U(MSGROOT,.HL)
- +43 DO LOG^MHVUL2("PARSE",MSGROOT,"I","DEBUG")
- +44 ;
- +45 IF '$$VALIDMSG(MSGROOT,.QRY,.XMT,.ERR)
- Begin DoDot:1
- +46 DO LOG^MHVUL2("MSG CHECK","INVALID^"_ERR,"S","ERROR")
- +47 DO XMIT^MHV7T(.QRY,.XMT,ERR,"",.HL)
- End DoDot:1
- QUIT
- +48 DO LOG^MHVUL2("MSG CHECK","VALID","S","TRACE")
- +49 ;
- +50 ; Immediate Mode
- +51 ; Deferred mode queries are not supported at this time
- +52 DO REALTIME^MHVRQI(.QRY,.XMT,.HL)
- +53 ;
- +54 DO LOG^MHVUL2(RNAME,"END","S","TRACE")
- +55 ;Clean up TMP used by logging
- DO RESET^MHVUL2
- +56 ;K @MSGROOT
- +57 ;
- +58 QUIT
- +59 ;
- VALIDMSG(MSGROOT,QRY,XMT,ERR) ;Validate message
- +1 ;
- +2 ; Messages handled: QBP^Q11
- +3 ;
- +4 ; QBP query messages must contain QPD and RCP segments
- +5 ; Any additional segments are ignored
- +6 ;
- +7 ; Input:
- +8 ; MSGROOT - Root of array holding message
- +9 ; XMT - Transmission parameters
- +10 ;
- +11 ; Output:
- +12 ; QRY - Query Array
- +13 ; XMT - Transmission parameters
- +14 ; ERR - segment^sequence^field^code^ACK type^error text
- +15 ;
- +16 NEW MSH,PID,STF,QPD,RCP,REQFLDS,REQID,REQTYPE,FROMDT,TODT,PRI,QTAG,QNAME,MHVCSIE
- +17 NEW SEGTYPE,CNT,OCNT,RXNUM,QTY,UNIT,REQFLDS,CHKSEG
- +18 KILL QRY,ERR
- +19 SET MHVCSIE=""
- +20 SET ERR=""
- +21 ;
- +22 ; Set up basics for responding to message.
- +23 ;-----------------------------------------
- +24 ;Message ID
- SET QRY("MID")=XMT("MID")
- +25 SET QRY("QPD")=""
- +26 ;
- +27 ; Validate message is a well-formed QBP query message.
- +28 ;-----------------------------------------------------------
- +29 ; Must have MSH first, followed by QPD,RCP in any order
- +30 ; PID and STF are optional. All other segments are ignored.
- +31 ;
- +32 IF $GET(@MSGROOT@(1,0))="MSH"
- MERGE MSH=@MSGROOT@(1)
- +33 IF '$TEST
- SET ERR="MSH^1^^100^AE^Missing MSH segment"
- QUIT 0
- +34 ;
- +35 SET CNT=2
- SET OCNT=0
- +36 FOR
- if '$DATA(@MSGROOT@(CNT))
- QUIT
- Begin DoDot:1
- +37 SET SEGTYPE=$GET(@MSGROOT@(CNT,0))
- +38 IF SEGTYPE="PID"
- MERGE PID=@MSGROOT@(CNT),QRY("PID")=PID
- QUIT
- +39 IF SEGTYPE="STF"
- MERGE STF=@MSGROOT@(CNT),QRY("STF")=STF
- QUIT
- +40 IF SEGTYPE="QPD"
- MERGE QPD=@MSGROOT@(CNT),QRY("QPD")=QPD
- QUIT
- +41 IF SEGTYPE="RCP"
- MERGE RCP=@MSGROOT@(CNT),QRY("RCP")=RCP
- QUIT
- +42 QUIT
- End DoDot:1
- SET CNT=CNT+1
- +43 ;
- +44 IF '$DATA(QPD)
- SET ERR="QPD^1^^100^AE^Missing QPD segment"
- QUIT 0
- +45 ;
- +46 ;Query Tag
- SET QTAG=$GET(QPD(1,1,2))
- +47 ;Request ID
- SET REQID=$GET(QPD(2))
- +48 ;Request Type
- SET REQTYPE=$GET(QPD(3,1,1))
- +49 ;Query Priority
- SET PRI=$GET(RCP(1))
- +50 ;Quantity Limited
- SET QTY=$GET(RCP(2,1,1))
- +51 ;Quantity units
- SET UNIT=$GET(RCP(2,1,2))
- +52 ;Request Type if no other params
- if REQTYPE=""
- SET REQTYPE=$GET(QPD(3))
- +53 ;
- +54 ; Validate required fields and query parameters
- +55 ;------------------------------------------------------
- +56 ;
- +57 ; Check for missing/invalid fields
- +58 ;
- +59 IF '$DATA(QPD(1))
- SET ERR="QPD^1^1^101^AE^Missing Message Query Name"
- QUIT 0
- +60 ;Message Query Name
- MERGE QNAME=QPD(1)
- +61 ;
- +62 IF QTAG=""
- SET ERR="QPD^1^2^101^AE^Missing Query Tag"
- QUIT 0
- +63 IF REQID=""
- SET ERR="QPD^1^2^101^AE^Missing Request ID"
- QUIT 0
- +64 SET (QRY("IEN"),QRY("LNAME"),QRY("FNAME"),QRY("DFN"))=""
- +65 SET QRY("REQID")=REQID
- +66 ;
- +67 IF REQTYPE=""
- SET ERR="QPD^1^3^101^AE^Missing Request Type"
- QUIT 0
- +68 IF '$$VALRTYPE^MHV7RU(REQTYPE,.QRY,.ERR)
- SET ERR="QPD^1^3^"_ERR
- QUIT 0
- +69 ;
- +70 ; If we have a PID, validate it and populate query parameters
- +71 ; from the PID.
- +72 ;
- +73 IF $DATA(PID)
- DO VALIDPID
- +74 ;
- +75 ; If we have a STF, validate it and populate query parameters
- +76 ; from the STF.
- +77 ;
- +78 IF $DATA(STF)
- DO VALIDSTF
- +79 ;
- +80 IF ERR
- QUIT 0
- +81 ;
- +82 ; If no PID or STF segment sent, Populate parameters 1-3 with the
- +83 ; QPD segment data
- +84 ;
- +85 IF '$DATA(PID)
- IF '$DATA(STF)
- Begin DoDot:1
- +86 ;ien
- SET QRY("IEN")=$GET(QPD(3,1,2))
- +87 ;Last Name
- SET QRY("LNAME")=$$UP^XLFSTR($GET(QPD(3,1,3)))
- +88 ;First Name
- SET QRY("FNAME")=$$UP^XLFSTR($GET(QPD(3,1,4)))
- +89 ;Patient ICN
- SET QRY("PICN")=$$UP^XLFSTR($GET(QPD(3,1,2)))
- +90 ;DSS Unit IEN
- SET QRY("DSSI")=$$UP^XLFSTR($GET(QPD(3,1,3)))
- +91 ;Procedure Date and Time
- SET QRY("PRDT")=DT
- +92 ;Diagnoses Search String
- SET QRY("DSRCH")=$$UP^XLFSTR($GET(QPD(3,1,3)))
- +93 ;From Date
- SET QRY("FROMDT")=$$UP^XLFSTR($GET(QPD(3,1,5)))
- +94 ;To Date
- SET QRY("TODT")=$$UP^XLFSTR($GET(QPD(3,1,6)))
- End DoDot:1
- +95 ;
- +96 ;Added for MHV*1.0*10 - Validations for SMClinicsByStopCode query Input parameters
- +97 IF (REQTYPE="SMClinicsByStopCode")&($DATA(QPD))
- Begin DoDot:1
- +98 IF $GET(QRY("FNAME"))=""
- SET ERR="QPD^1^6^101^AE^Clinic Secondary(Credit) Stop Code cannot be null"
- QUIT
- +99 IF ((+$GET(QRY("FNAME"))<1)&(+$GET(QRY("FNAME"))>999))
- SET ERR="QPD^1^6^102^AE^Clinic Secondary(Credit) Stop Code "_$GET(QRY("FNAME"))_" should be a numeric value in the range 1 to 999."
- QUIT
- +100 SET MHVCSIE=$$SCIEN^MHVXCLN($GET(QRY("FNAME")))
- +101 IF $GET(MHVCSIE)=""
- SET ERR="QPD^1^6^102^AE^Clinic Secondary(Credit) Stop Code "_$GET(QRY("FNAME"))_" Unknown."
- End DoDot:1
- +102 ;
- +103 ;Added for MHV*1.0*11 - Validations for SMPCMMPatientsForClinic query Input parameters
- +104 IF (REQTYPE="SMPCMMPatientsForClinic")&($DATA(QPD))
- Begin DoDot:1
- +105 IF $GET(QRY("IEN"))=""
- SET ERR="QPD^1^6^101^AE^Clinic IEN cannot be null"
- QUIT
- End DoDot:1
- +106 ;
- +107 ;Added for MHV*1.0*11 - Validations for SMPATEligClassification query Input parameters
- +108 IF (REQTYPE="SMPatientEClass")&($DATA(QPD))
- Begin DoDot:1
- +109 IF $GET(QRY("PICN"))=""
- SET ERR="QPD^1^6^101^AE^Patient ICN cannot be null"
- QUIT
- +110 IF $GET(QRY("DSSI"))=""
- SET ERR="QPD^1^6^102^AE^DSS Unit IEN cannot be null"
- QUIT
- +111 IF $GET(QRY("PRDT"))=""
- SET ERR="QPD^1^6^103^AE^Procedure Date and Time cannot be null"
- QUIT
- End DoDot:1
- +112 ;
- +113 ;Added for MHV*1.0*11 - Validations for SMPatientProblems input parameters
- +114 IF (REQTYPE="SMPatientProblems")&($DATA(QPD))
- Begin DoDot:1
- +115 IF $GET(QRY("PICN"))=""
- SET ERR="QPD^1^6^101^AE^Patient ICN cannot be null"
- QUIT
- End DoDot:1
- +116 ;
- +117 ;Added for MHV*1.0*11 - Validations for SMDiagnoses input parameters
- +118 IF (REQTYPE="SMDiagnoses")&($DATA(QPD))
- Begin DoDot:1
- +119 IF $GET(QRY("DSRCH"))=""
- SET ERR="QPD^1^6^101^AE^Diagnoses Search String cannot be null"
- QUIT
- End DoDot:1
- +120 IF ERR
- QUIT 0
- +121 ;
- +122 ;From Date
- SET FROMDT=$GET(QPD(3,1,5))
- +123 ;To Date
- SET TODT=$GET(QPD(3,1,6))
- +124 ;
- +125 ; Validate from and to date if present
- +126 ;
- +127 IF FROMDT]""
- Begin DoDot:1
- +128 IF '$$VALIDDT^MHV7RU(.FROMDT)
- SET ERR="QPD^1^7^102^AE^Invalid From Date"
- End DoDot:1
- +129 IF TODT]""
- Begin DoDot:1
- +130 IF '$$VALIDDT^MHV7RU(.TODT)
- SET ERR="QPD^1^8^102^AE^Invalid To Date"
- +131 IF TODT'=""
- IF TODT<FROMDT
- Begin DoDot:2
- +132 SET ERR="QPD^1^6^102^AE^To Date precedes From Date"
- End DoDot:2
- End DoDot:1
- +133 SET QRY("FROMDT")=FROMDT
- SET QRY("TODT")=TODT
- +134 IF ERR'=""
- QUIT 0
- +135 ;
- +136 IF PRI=""
- SET ERR="RCP^1^1^101^AE^Missing Query Priority"
- QUIT 0
- +137 IF ",D,I,"'[(","_PRI_",")
- SET ERR="RCP^1^1^102^AE^Invalid Query Priority"
- QUIT 0
- +138 SET QRY("PRI")=PRI
- +139 if ERR'=""
- QUIT 0
- +140 ;
- +141 QUIT 1
- +142 ;
- VALIDPID ;
- +1 ;
- +2 ; If the IEN was sent, call the validation utility for
- +3 ; PID segments
- +4 ;
- +5 IF $DATA(PID(3,1,1))
- Begin DoDot:1
- +6 SET CHKSEG=$$VALIDPID^MHV7RUS(.PID,.QRY,.ERR)
- +7 SET QRY("IEN")=QRY("DFN")
- End DoDot:1
- +8 ;
- +9 ; If no IEN, populate parameters for name
- +10 ;
- +11 IF QRY("IEN")=""
- IF ERR=""
- Begin DoDot:1
- +12 SET QRY("LNAME")=$$UP^XLFSTR(PID(5,1,1))
- +13 if $DATA(PID(5,1,2))
- SET QRY("FNAME")=$$UP^XLFSTR(PID(5,1,2))
- End DoDot:1
- +14 QUIT
- VALIDSTF ;
- +1 ;
- +2 ; If the IEN was sent, call the validation utility for
- +3 ; STF segments
- +4 ;
- +5 IF $DATA(STF(2))
- Begin DoDot:1
- +6 SET QRY("IEN")=$GET(STF(2,1,1))
- End DoDot:1
- QUIT
- +7 ;
- +8 ; If no IEN, populate parameters for name
- +9 ;
- +10 IF $GET(STF(3))]""
- SET QRY("LNAME")=$$UP^XLFSTR($TRANSLATE(STF(3),"^",""))
- +11 IF $GET(STF(3,1,1))'=""
- SET QRY("LNAME")=$$UP^XLFSTR(STF(3,1,1))
- +12 IF $GET(STF(3,1,2))'=""
- SET QRY("FNAME")=$$UP^XLFSTR(STF(3,1,2))
- +13 QUIT