Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.openmrs.module.basicmodule.web.controller;
- import java.util.HashMap;
- import java.util.Map;
- import javax.servlet.http.HttpServletRequest;
- import org.apache.commons.logging.Log;
- import org.apache.commons.logging.LogFactory;
- import org.openmrs.module.basicmodule.HL7PIXPDQService;
- import org.springframework.stereotype.Controller;
- import org.springframework.web.bind.annotation.RequestMapping;
- import ca.uhn.hl7v2.HL7Exception;
- import ca.uhn.hl7v2.model.Message;
- import ca.uhn.hl7v2.parser.GenericParser;
- import ca.uhn.hl7v2.parser.Parser;
- @Controller
- public class PDQResponseController {
- private String submit = null;
- /** Logger for this class and subclasses */
- protected final Log log = LogFactory.getLog(getClass());
- /** Success form view name */
- private final String SUCCESS_FORM_VIEW = "module/pixpdq/responseofpdqform.form";
- /**
- * Initially called after the formBackingObject method to get the landing
- * form name
- *
- * @return String form view name
- */
- /**
- * This class returns the form backing object. This can be a string, a
- * boolean, or a normal java pojo. The bean name defined in the
- * ModelAttribute annotation and the type can be just defined by the return
- * type of this method
- */
- // @Override
- // protected Map<String, Object> referenceData(HttpServletRequest req)
- // throws Exception {
- // Map<String, Object> map = new HashMap<String, Object>();
- //
- // String resp;
- //
- // String Message = req.getParameter("messageInput");
- //
- // HL7PIXPDQService hl7serv = org.openmrs.api.context.Context
- // .getService(HL7PIXPDQService.class);
- //
- // Message m3 = null;
- //
- // m3 = hl7serv.processMessage(Message);
- //
- // Parser p2 = new GenericParser();
- //
- // resp = p2.encode(m3);
- //
- // map.put("msg", resp);
- //
- // return map;
- // }
- @RequestMapping(value = "module/pixpdq/responseofpdqform.form")
- public Map<String, Object> onSubmit(HttpServletRequest request) throws HL7Exception{
- Map<String, Object> map = new HashMap<String, Object>();
- String resp;
- String Message = request.getParameter("messageInput");
- HL7PIXPDQService hl7serv = org.openmrs.api.context.Context
- .getService(HL7PIXPDQService.class);
- Message m3 = null;
- m3 = hl7serv.processMessage(Message);
- Parser p2 = new GenericParser();
- resp = p2.encode(m3);
- map.put("msg", resp);
- return map;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement