- EDPGLOB ;SLC/BWF - Controller for ED Lab Retrieval ;4/25/12 12:51pm
- ;;2.0;EMERGENCY DEPARTMENT;**6**;May 2, 2012;Build 200
- ;
- RPC(EDPXML,PARAMS,PARAMS2) ; Process request via RPC instead of CSP
- N X,REQ,EDPSITE,EDPUSER,EDPDBUG
- K EDPXML
- S EDPUSER=DUZ,EDPSITE=DUZ(2),EDPSTA=$$STA^XUAF4(DUZ(2))
- S X="" F S X=$O(PARAMS(X)) Q:X="" D
- . I $D(PARAMS(X))>9 M REQ(X)=PARAMS(X)
- . E S REQ(X,1)=PARAMS(X)
- ; params2 will not be converted the same way as params. It is still unclear why params was converted.
- ; There seems to be no reason to do this.
- S EDPDBUG=$$DEBUG^EDPCDBG($G(PARAMS("swfID")))
- I EDPDBUG D PUTREQ^EDPCDBG(EDPDBUG,.PARAMS)
- ; parameters missing or invalid
- ;I $G(REQ("patient",1))<1 D G OUT
- ;. D XML^EDPX("<error msg='"_$$MSG^EDPX(2300018)_"' />")
- ;
- COMMON ; Come here for both CSP and RPC Mode
- ;
- N EDPFAIL,CMD
- S CMD=$G(REQ("command",1))
- S EDPXML=$NA(^TMP("EDPGLOB",$J)) K @EDPXML
- ;
- ; switch on command
- ;
- ; ---------------------------------
- ;
- ; getLabs = return lab results
- I CMD="getLabs" D G OUT
- . I $G(REQ("patient",1))<1 D XML^EDPX("<error msg='"_$$MSG^EDPX(2300018)_"' />") Q
- . D EN^EDPLAB(EDPXML,.REQ)
- ;
- ; ---------------------------------
- ; getReportList - return adhoc reports (list or full definition)
- I CMD="getReportList" D G OUT
- . D GETREPL^EDPARPT(EDPXML,.PARAMS)
- ; ---------------------------------
- ; saveReportDef - save adhoc report template/definition
- I CMD="saveReportDef" D G OUT
- . D SAVE^EDPARPT(EDPXML,.PARAMS,.PARAMS2)
- ; ---------------------------------
- ; getReportElements - return adhoc report data elements
- I CMD="getReportElements" D G OUT
- . D GETELM^EDPARPT(EDPXML,.PARAMS,.PARAMS2)
- ; ---------------------------------
- ; executeReport - execute adhoc report
- I CMD="executeReport" D G OUT
- . D EXE^EDPARPT(EDPXML,.PARAMS,.PARAMS2)
- ; ---------------------------------
- ;
- ; else
- D XML^EDPX("<error msg='"_$$MSG^EDPX(2300010)_CMD_"' />")
- ; end switch
- ;
- OUT ; output the XML
- I EDPDBUG D PUTXML^EDPCDBG(EDPDBUG,.EDPXML)
- I $L($G(EDPHTTP)) D ; if in CSP mode
- . U EDPHTTP
- . W "<results>",!
- . N I S I=0 F S I=$O(EDPXML(I)) Q:'I W EDPXML(I),!
- . W "</results>",!
- K EDPHTTP
- END Q
- ;
- VAL(X) ; return value from request
- Q $G(REQ(X,1))
- --- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEDPGLOB 2293 printed Mar 13, 2025@20:56:36 Page 2
- EDPGLOB ;SLC/BWF - Controller for ED Lab Retrieval ;4/25/12 12:51pm
- +1 ;;2.0;EMERGENCY DEPARTMENT;**6**;May 2, 2012;Build 200
- +2 ;
- RPC(EDPXML,PARAMS,PARAMS2) ; Process request via RPC instead of CSP
- +1 NEW X,REQ,EDPSITE,EDPUSER,EDPDBUG
- +2 KILL EDPXML
- +3 SET EDPUSER=DUZ
- SET EDPSITE=DUZ(2)
- SET EDPSTA=$$STA^XUAF4(DUZ(2))
- +4 SET X=""
- FOR
- SET X=$ORDER(PARAMS(X))
- if X=""
- QUIT
- Begin DoDot:1
- +5 IF $DATA(PARAMS(X))>9
- MERGE REQ(X)=PARAMS(X)
- +6 IF '$TEST
- SET REQ(X,1)=PARAMS(X)
- End DoDot:1
- +7 ; params2 will not be converted the same way as params. It is still unclear why params was converted.
- +8 ; There seems to be no reason to do this.
- +9 SET EDPDBUG=$$DEBUG^EDPCDBG($GET(PARAMS("swfID")))
- +10 IF EDPDBUG
- DO PUTREQ^EDPCDBG(EDPDBUG,.PARAMS)
- +11 ; parameters missing or invalid
- +12 ;I $G(REQ("patient",1))<1 D G OUT
- +13 ;. D XML^EDPX("<error msg='"_$$MSG^EDPX(2300018)_"' />")
- +14 ;
- COMMON ; Come here for both CSP and RPC Mode
- +1 ;
- +2 NEW EDPFAIL,CMD
- +3 SET CMD=$GET(REQ("command",1))
- +4 SET EDPXML=$NAME(^TMP("EDPGLOB",$JOB))
- KILL @EDPXML
- +5 ;
- +6 ; switch on command
- +7 ;
- +8 ; ---------------------------------
- +9 ;
- +10 ; getLabs = return lab results
- +11 IF CMD="getLabs"
- Begin DoDot:1
- +12 IF $GET(REQ("patient",1))<1
- DO XML^EDPX("<error msg='"_$$MSG^EDPX(2300018)_"' />")
- QUIT
- +13 DO EN^EDPLAB(EDPXML,.REQ)
- End DoDot:1
- GOTO OUT
- +14 ;
- +15 ; ---------------------------------
- +16 ; getReportList - return adhoc reports (list or full definition)
- +17 IF CMD="getReportList"
- Begin DoDot:1
- +18 DO GETREPL^EDPARPT(EDPXML,.PARAMS)
- End DoDot:1
- GOTO OUT
- +19 ; ---------------------------------
- +20 ; saveReportDef - save adhoc report template/definition
- +21 IF CMD="saveReportDef"
- Begin DoDot:1
- +22 DO SAVE^EDPARPT(EDPXML,.PARAMS,.PARAMS2)
- End DoDot:1
- GOTO OUT
- +23 ; ---------------------------------
- +24 ; getReportElements - return adhoc report data elements
- +25 IF CMD="getReportElements"
- Begin DoDot:1
- +26 DO GETELM^EDPARPT(EDPXML,.PARAMS,.PARAMS2)
- End DoDot:1
- GOTO OUT
- +27 ; ---------------------------------
- +28 ; executeReport - execute adhoc report
- +29 IF CMD="executeReport"
- Begin DoDot:1
- +30 DO EXE^EDPARPT(EDPXML,.PARAMS,.PARAMS2)
- End DoDot:1
- GOTO OUT
- +31 ; ---------------------------------
- +32 ;
- +33 ; else
- +34 DO XML^EDPX("<error msg='"_$$MSG^EDPX(2300010)_CMD_"' />")
- +35 ; end switch
- +36 ;
- OUT ; output the XML
- +1 IF EDPDBUG
- DO PUTXML^EDPCDBG(EDPDBUG,.EDPXML)
- +2 ; if in CSP mode
- IF $LENGTH($GET(EDPHTTP))
- Begin DoDot:1
- +3 USE EDPHTTP
- +4 WRITE "<results>",!
- +5 NEW I
- SET I=0
- FOR
- SET I=$ORDER(EDPXML(I))
- if 'I
- QUIT
- WRITE EDPXML(I),!
- +6 WRITE "</results>",!
- End DoDot:1
- +7 KILL EDPHTTP
- END QUIT
- +1 ;
- VAL(X) ; return value from request
- +1 QUIT $GET(REQ(X,1))