@SuppressWarnings("unused")
  public ActionForward manage(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    request.setAttribute("lookupLists", lookupListManager.findAllActiveLookupLists(loggedInInfo));

    return mapping.findForward("success");
  }
Exemple #2
0
  public ActionForward save(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);

    DynaActionForm dform = (DynaActionForm) form;
    Episode episode = (Episode) dform.get("episode");
    Integer id = null;
    try {
      id = Integer.parseInt(request.getParameter("episode.id"));
    } catch (NumberFormatException e) {
      /*empty*/
    }
    Episode e = null;
    if (id != null && id.intValue() > 0) {
      e = episodeDao.find(Integer.valueOf(id));
    } else {
      e = new Episode();
    }
    BeanUtils.copyProperties(episode, e, new String[] {"id", "lastUpdateTime", "lastUpdateUser"});
    e.setLastUpdateUser(loggedInInfo.getLoggedInProviderNo());

    if (!securityInfoManager.hasPrivilege(
        LoggedInInfo.getLoggedInInfoFromSession(request),
        "_demographic",
        "w",
        e.getDemographicNo())) {
      throw new SecurityException("missing required security object (_demographic)");
    }

    if (id != null && id.intValue() > 0) {
      episodeDao.merge(e);
    } else {
      episodeDao.persist(e);
    }
    request.setAttribute("parentAjaxId", "episode");
    return mapping.findForward("success");
  }
  public ActionForward getTickler(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);

    if (!securityInfoManager.hasPrivilege(
        LoggedInInfo.getLoggedInInfoFromSession(request), "_tickler", "r", null)) {
      throw new SecurityException("missing required security object (_demographic)");
    }

    Tickler t =
        ticklerManager.getTickler(
            loggedInInfo, Integer.parseInt(request.getParameter("tickler_no")));

    HashMap<String, HashMap<String, Object>> hashMap =
        new HashMap<String, HashMap<String, Object>>();
    HashMap<String, Object> ticklerMap = new HashMap<String, Object>();

    ticklerMap.put("message", t.getMessage());
    ticklerMap.put("updateDate", t.getUpdateDate());
    ticklerMap.put("provider", t.getProvider().getFormattedName());
    ticklerMap.put("providerNo", t.getProvider().getProviderNo());
    ticklerMap.put("toProvider", t.getAssignee().getFormattedName());
    ticklerMap.put("toProviderNo", t.getAssignee().getProviderNo());

    hashMap.put("tickler", ticklerMap);

    JsonConfig config = new JsonConfig();
    config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor());

    JSONObject json = JSONObject.fromObject(hashMap, config);
    response.getOutputStream().write(json.toString().getBytes());

    return null;
  }
  @SuppressWarnings("unused")
  public ActionForward manageSingle(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    String listName = request.getParameter("listName");
    if (listName != null && !listName.isEmpty()) {
      request.setAttribute(
          "lookupListSingle", lookupListManager.findLookupListByName(loggedInInfo, listName));
    }

    return mapping.findForward("success");
  }
Exemple #5
0
  public ActionForward list(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    Integer demographicNo = Integer.parseInt(request.getParameter("demographicNo"));

    if (!securityInfoManager.hasPrivilege(
        LoggedInInfo.getLoggedInInfoFromSession(request), "_demographic", "r", demographicNo)) {
      throw new SecurityException("missing required security object (_demographic)");
    }

    List<Episode> episodes = episodeDao.findAll(demographicNo);
    request.setAttribute("episodes", episodes);
    return mapping.findForward("list");
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws ServletException, IOException {
    String providerNo = LoggedInInfo.getLoggedInInfoFromSession(request).getLoggedInProviderNo();
    if (providerNo == null) return mapping.findForward("eject");

    ProEditSignatureForm frm = (ProEditSignatureForm) form;

    ProSignatureData sigData = new ProSignatureData();
    String sig = frm.getSignature();
    sigData.enterSignature(providerNo, sig);

    return mapping.findForward("success");
  }
  @SuppressWarnings("unused")
  public ActionForward add(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    String lookupListItemLabel = request.getParameter("lookupListItemLabel");
    String lookupListId = request.getParameter("lookupListId");
    String user = (String) request.getSession().getAttribute("user");
    LookupListItem lookupListItem;
    int lookupListIdInteger;
    List<LookupListItem> lookupListItems;

    if (user == null) {
      user = "";
    }

    if (lookupListItemLabel != null
        && !lookupListItemLabel.isEmpty()
        && lookupListId != null
        && !lookupListId.isEmpty()) {

      lookupListIdInteger = Integer.parseInt(lookupListId);
      lookupListItems =
          lookupListManager.findLookupListItemsByLookupListId(loggedInInfo, lookupListIdInteger);
      lookupListItem = new LookupListItem();
      lookupListItem.setActive(true);
      lookupListItem.setCreatedBy(user);
      lookupListItem.setDisplayOrder(
          lookupListItems.get(lookupListItems.size() - 1).getDisplayOrder() + 1);
      lookupListItem.setLabel(lookupListItemLabel);
      lookupListItem.setLookupListId(lookupListIdInteger);
      lookupListItem.setValue(UUID.randomUUID().toString());

      lookupListManager.addLookupListItem(loggedInInfo, lookupListItem);
    }

    request.setAttribute("lookupLists", lookupListManager.findAllActiveLookupLists(loggedInInfo));

    return mapping.findForward("success");
  }
  @SuppressWarnings("unused")
  public ActionForward remove(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    String lookupListItemId = request.getParameter("lookupListItemId");
    int id = 0;

    if (lookupListItemId != null && !lookupListItemId.isEmpty()) {
      id = Integer.parseInt(lookupListItemId);
    }

    if (id > 0) {
      lookupListManager.removeLookupListItem(loggedInInfo, id);
    }

    request.setAttribute("lookupLists", lookupListManager.findAllActiveLookupLists(loggedInInfo));

    return mapping.findForward("success");
  }
  public ActionForward sendPlan(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    HashMap<String, Object> hashMap = new HashMap<String, Object>();

    ProviderDao providerDao = (ProviderDao) SpringUtils.getBean("providerDao");
    SecUserRoleDao secUserRoleDao = (SecUserRoleDao) SpringUtils.getBean("secUserRoleDao");

    List<Provider> activeReceptionists = new ArrayList<Provider>();
    for (SecUserRole sur : secUserRoleDao.getSecUserRolesByRoleName("receptionist")) {
      Provider p = providerDao.getProvider(sur.getProviderNo());
      if (p != null && p.getStatus().equals("1")) {
        activeReceptionists.add(p);
      }
    }

    TicklerCreator tc = new TicklerCreator();
    String demographicNo = request.getParameter("demographicNo");

    String message = request.getParameter("value");

    if (demographicNo != null
        && message != null
        && message.trim().length() > 0
        && activeReceptionists != null) {
      for (Provider p : activeReceptionists) {
        tc.createTickler(loggedInInfo, demographicNo, p.getProviderNo(), message);
      }

      hashMap.put("sentToReceptionists", activeReceptionists.size());
    }

    return null;
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    if (!securityInfoManager.hasPrivilege(
        LoggedInInfo.getLoggedInInfoFromSession(request), "_con", "r", null)) {
      throw new SecurityException("missing required security object (_con)");
    }

    String reqId = request.getParameter("reqId");
    String demoNo = request.getParameter("demographicNo");
    // ArrayList docs = EDocUtil.listDocs( demoNo, reqId, EDocUtil.ATTACHED);
    String[] docs = request.getParameterValues("docNo");
    ArrayList alist = new ArrayList();
    String path = OscarProperties.getInstance().getProperty("DOCUMENT_DIR");

    for (int i = 0; i < docs.length; i++) alist.add(path + docs[i]);

    if (alist.size() > 0) {
      response.setContentType("application/pdf"); // octet-stream
      response.setHeader(
          "Content-Disposition",
          "attachment; filename=\"combinedPDF-"
              + UtilDateUtilities.getToday("yyyy-mm-dd.hh.mm.ss")
              + ".pdf\"");
      try {
        ConcatPDF.concat(alist, response.getOutputStream());
      } catch (IOException ex) {
        MiscUtils.getLogger().error("Error", ex);
      }
      return null;
    }

    return mapping.findForward("noprint");
  }
  @SuppressWarnings("unused")
  public ActionForward order(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    String lookupListItemId = request.getParameter("lookupListItemId");
    String lookupListItemDisplayOrder = request.getParameter("lookupListItemDisplayOrder");

    if (lookupListItemId != null
        && !lookupListItemId.isEmpty()
        && lookupListItemDisplayOrder != null
        && !lookupListItemDisplayOrder.isEmpty()) {

      lookupListManager.updateLookupListItemDisplayOrder(
          loggedInInfo,
          Integer.parseInt(lookupListItemId),
          Integer.parseInt(lookupListItemDisplayOrder));
    }

    return mapping.findForward("success");
  }
  public ActionForward getBillingArgs(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    HashMap<String, Object> hashMap = new HashMap<String, Object>();

    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);

    DemographicDao demographicDao = (DemographicDao) SpringUtils.getBean("demographicDao");
    OscarAppointmentDao appointmentDao =
        (OscarAppointmentDao) SpringUtils.getBean("oscarAppointmentDao");

    Appointment appointment = null;
    try {
      appointment = appointmentDao.find(Integer.parseInt(request.getParameter("appointment_no")));
    } catch (Exception e) {
      // appointment_no is not a number, I guess
      appointment = null;
    }

    Demographic demographic = demographicDao.getDemographic(request.getParameter("demographic_no"));

    hashMap.put("ohip_version", "V03G");

    if (demographic != null) {
      Integer sex = null;
      if (demographic.getSex().equalsIgnoreCase("M")) sex = 1;
      else if (demographic.getSex().equalsIgnoreCase("F")) sex = 2;

      String dateOfBirth =
          StringUtils.join(
              new String[] {
                demographic.getYearOfBirth(),
                demographic.getMonthOfBirth(),
                demographic.getDateOfBirth()
              },
              "");

      hashMap.put("hin", demographic.getHin());
      hashMap.put("ver", demographic.getVer());
      hashMap.put("hc_type", demographic.getHcType());
      hashMap.put("sex", sex);
      hashMap.put("demographic_dob", dateOfBirth);
      hashMap.put("demographic_name", demographic.getLastName() + "," + demographic.getFirstName());
    }

    if (appointment != null) {
      hashMap.put("apptProvider_no", appointment.getProviderNo());
      hashMap.put("start_time", appointment.getStartTime().toString());
      hashMap.put("appointment_date", appointment.getAppointmentDate().getTime());
    }

    hashMap.put("current_provider_no", loggedInInfo.getLoggedInProviderNo());
    hashMap.put("demo_mrp_provider_no", demographic.getProviderNo());

    JsonConfig config = new JsonConfig();
    config.registerJsonBeanProcessor(java.sql.Date.class, new JsDateJsonBeanProcessor());

    JSONObject json = JSONObject.fromObject(hashMap, config);
    response.getOutputStream().write(json.toString().getBytes());

    return null;
  }
  @Override
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) {
    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);
    if (!securityInfoManager.hasPrivilege(loggedInInfo, "_lab", "w", null)) {
      throw new SecurityException("missing required security object (_lab)");
    }

    LabUploadForm frm = (LabUploadForm) form;
    FormFile importFile = frm.getImportFile();
    String filename = importFile.getFileName();
    String proNo = (String) request.getSession().getAttribute("user");
    String outcome = "failure";

    InputStream formFileIs = null;
    InputStream localFileIs = null;

    try {
      formFileIs = importFile.getInputStream();

      String type = request.getParameter("type");
      if (type.equals("OTHER")) type = request.getParameter("otherType");

      String filePath = Utilities.saveFile(formFileIs, filename);
      File file = new File(filePath);

      localFileIs = new FileInputStream(filePath);
      int checkFileUploadedSuccessfully =
          FileUploadCheck.addFile(file.getName(), localFileIs, proNo);

      if (checkFileUploadedSuccessfully != FileUploadCheck.UNSUCCESSFUL_SAVE) {
        logger.debug("filePath" + filePath);
        logger.debug("Type :" + type);
        MessageHandler msgHandler = HandlerClassFactory.getHandler(type);
        if (msgHandler != null) {
          logger.debug("MESSAGE HANDLER " + msgHandler.getClass().getName());
        }
        if ((msgHandler.parse(
                loggedInInfo,
                getClass().getSimpleName(),
                filePath,
                checkFileUploadedSuccessfully,
                request.getRemoteAddr()))
            != null) outcome = "success";

      } else {
        outcome = "uploaded previously";
      }

    } catch (Exception e) {
      logger.error("Error: ", e);
      outcome = "exception";
    } finally {
      IOUtils.closeQuietly(formFileIs);
      IOUtils.closeQuietly(localFileIs);
    }

    request.setAttribute("outcome", outcome);
    return mapping.findForward("success");
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {
    LoggedInInfo loggedInInfo = LoggedInInfo.getLoggedInInfoFromSession(request);

    ProcessConsultationBean formBean = null;

    String path = request.getSession().getServletContext().getRealPath("/");
    ConsultationConfiguration config =
        new ConsultationConfiguration(path + File.separator + "WEB-INF/consultation.xml");
    ConsultationsConfigBean configBean = config.loadConfig();

    String providerNo = (String) request.getSession().getAttribute("user");

    if (request.getParameter("action") == null) {
      formBean = new ProcessConsultationBean();
      formBean.setId("Process Consultation Request");
      request.setAttribute("formHandler", formBean);
      return new ActionForward(getViewPath());
    }

    // populate the bean - better way to do this???
    formBean = tearForm(request);

    if (formBean.getDemographic_no() != null && formBean.getAction().equals("populate")) {
      List<ConsultationRequest> consultationRequests =
          consultationRequestDao.getConsults(Integer.parseInt(formBean.getDemographic_no()));
      request.setAttribute("consultations", consultationRequests);
      formBean.setAction("");
      request.setAttribute("formBean", formBean);
      return new ActionForward(this.getViewPath());
    }

    if (formBean.getAction().equals("generate")) {
      String requestId = request.getParameter("current_consultation");
      ConsultationRequest consultation = consultationRequestDao.find(Integer.parseInt(requestId));
      ProfessionalSpecialist spec = professionalSpecialistDao.find(consultation.getSpecialistId());
      // Provider provider = providerMgr
      // create a tickler here
      Tickler tickler = new Tickler();
      tickler.setCreator(providerNo);
      tickler.setDemographicNo(Integer.parseInt(formBean.getDemographic_no()));
      tickler.setServiceDate(new Date());
      tickler.setTaskAssignedTo(configBean.getProcessrequest().getRecipient());
      String contextName =
          request.getScheme()
              + "://"
              + request.getServerName()
              + ":"
              + request.getServerPort()
              + request.getContextPath().substring(0, request.getContextPath().indexOf("/", 1));
      tickler.setMessage(
          "A consultation request has been made for <br/>"
              + formBean.getDemographic_name()
              + "<br/>to<br/>"
              + spec.getFirstName()
              + " "
              + spec.getLastName()
              + " <br/>ADDRESS:"
              + spec.getStreetAddress()
              + " <br/>PHONE:"
              + spec.getPhoneNumber()
              + " <br/>FAX:"
              + spec.getFaxNumber()
              + "<br/>Reason: "
              + consultation.getReasonForReferral()
              + "<br/><br/>"
              + "Please obtain an appointment, and enter the information into the consultation form, and update"
              + " the status to 'Nothing'."
              + "<br/>"
              + "<br/><a target=\"consultation\" href=\""
              + contextName
              + "/oscarEncounter/ViewRequest.do?requestId="
              + consultation.getId()
              + "\">Link to consultation</a>"
              + "<br/><a target=\"demographic\" href=\""
              + contextName
              + "/demographic/demographiccontrol.jsp?displaymode=edit&demographic_no="
              + formBean.getDemographic_no()
              + "&dboperation=search_detail\">Link to patient</a>");

      ticklerMgr.addTickler(loggedInInfo, tickler);
    }
    return null;
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws IOException, ServletException {
    if (request.getSession().getAttribute("user") == null) {
      return (mapping.findForward("Logout"));
    }

    BillingReProcessBillForm frm = (BillingReProcessBillForm) form;

    GregorianCalendar now = new GregorianCalendar();
    int curYear = now.get(Calendar.YEAR);
    int curMonth = (now.get(Calendar.MONTH) + 1);
    int curDay = now.get(Calendar.DAY_OF_MONTH);
    String curDate =
        String.valueOf(curYear) + "-" + String.valueOf(curMonth) + "-" + String.valueOf(curDay);

    String dataCenterId = OscarProperties.getInstance().getProperty("dataCenterId");

    String billingmasterNo = frm.getBillingmasterNo();

    String demographicNo = frm.getDemoNo();
    DemographicData demoD = new DemographicData();
    org.oscarehr.common.model.Demographic demo =
        demoD.getDemographic(LoggedInInfo.getLoggedInInfoFromSession(request), demographicNo);

    oscar.oscarBilling.data.BillingFormData billform =
        new oscar.oscarBilling.data.BillingFormData();

    ///
    String providerNo = frm.getProviderNo(); // f
    String demographicFirstName = demo.getFirstName(); // d
    String demographicLastName = demo.getLastName(); // d
    String name_verify =
        demographicFirstName.substring(0, 1) + " " + demographicLastName.substring(0, 2); // d
    String billingGroupNo = billform.getGroupNo(providerNo);
    String practitionerNo = billform.getPracNo(providerNo); // p
    String hcNo = demo.getHin().trim() + demo.getVer().trim(); // d
    String dependentNo = frm.getDependentNo(); // f

    String visitLocation = frm.getLocationVisit(); // f
    String clarificationCode = visitLocation.substring(0, 2); // f
    String anatomicalArea = frm.getAnatomicalArea(); // f
    String afterHour = frm.getAfterHours(); // f
    String newProgram = frm.getNewProgram(); // f
    String billingUnit = frm.getBillingUnit(); // /f
    String billingServiceCode = frm.getService_code(); // f
    String billingServicePrice = frm.getBillingAmount(); // f
    String payment_mode = frm.getPaymentMode(); // f
    String serviceDate = frm.getServiceDate(); // f
    String serviceToDate = frm.getServiceToDay(); // f
    String submissionCode = frm.getSubmissionCode(); // f
    String exSubmissionCode = ""; // f
    String dxCode1 = frm.getDx1(); // f
    String dxCode2 = frm.getDx2(); // f
    String dxCode3 = frm.getDx3(); // f
    String dxExpansion = ""; // f
    String serviceLocation = frm.getServiceLocation().substring(0, 1); // f

    String referralFlag1 = frm.getReferalPracCD1(); // f
    String referralNo1 = frm.getReferalPrac1(); // f
    String referralFlag2 = frm.getReferalPracCD2(); // f
    String referralNo2 = frm.getReferalPrac2(); // f
    String timeCall = frm.getTimeCallRec(); // f
    String serviceStartTime = frm.getStartTime(); // f
    String serviceEndTime = frm.getFinishTime(); // f
    String birthDate = DemographicData.getDob(demo); // d
    String correspondenceCode = frm.getCorrespondenceCode(); // f
    String claimComment = frm.getShortComment(); // f

    String billingStatus = frm.getStatus(); // f

    String oinInsurerCode = frm.getInsurerCode(); // f
    String oinRegistrationNo = demo.getHin() + demo.getVer(); // d
    String oinBirthdate = DemographicData.getDob(demo); // d
    String oinFirstName = demo.getFirstName(); // d
    String oinSecondName = ""; // d
    String oinSurname = demo.getLastName(); // d
    String oinSexCode = demo.getSex(); // d
    String oinAddress = demo.getAddress(); // d
    String oinAddress2 = demo.getCity(); // d
    String oinAddress3 = ""; // d
    String oinAddress4 = ""; // d
    String oinPostalcode = demo.getPostal(); // d

    String hcType = demo.getHcType(); // d
    String billRegion = OscarProperties.getInstance().getProperty("billregion");
    ////

    String submit = frm.getSubmit();
    String secondSQL = null;

    if (submit.equals("Resubmit Bill") || billingStatus.equals("O")) {
      billingStatus = "O";
      secondSQL = "update billing set status = 'O' where billing_no ='" + frm.getBillNumber() + "'";
    } else if (submit.equals("Settle Bill")) {
      billingStatus = "S";
    }

    if (hcType.equals(billRegion)) { // if its bc go on
      oinInsurerCode = "";
      oinRegistrationNo = "";
      oinBirthdate = "";
      oinFirstName = "";
      oinSecondName = "";
      oinSurname = "";
      oinSexCode = "";
      oinAddress = "";
      oinAddress2 = "";
      oinAddress3 = "";
      oinAddress4 = "";
      oinPostalcode = "";

    } else { // other provinces
      oinInsurerCode = hcType;
      hcNo = "000000000";
      name_verify = "0000";
    }

    Billingmaster b = billingmasterDao.getBillingmaster(Integer.parseInt(billingmasterNo));
    if (b != null) {
      b.setBillingstatus(billingStatus);
      b.setDatacenter(dataCenterId);
      b.setPayeeNo(billingGroupNo);
      b.setPractitionerNo(practitionerNo);
      b.setPhn(hcNo);
      b.setNameVerify(name_verify);
      b.setDependentNum(dependentNo);
      b.setBillingUnit(billingUnit);
      b.setClarificationCode(clarificationCode);
      b.setAnatomicalArea(anatomicalArea);
      b.setAfterHour(afterHour);
      b.setNewProgram(newProgram);
      b.setBillingCode(billingServiceCode);
      b.setBillAmount(billingServicePrice);
      b.setPaymentMode(payment_mode);
      b.setServiceDate(serviceDate);
      b.setServiceToDay(convertDate8Char(serviceDate));
      b.setSubmissionCode(exSubmissionCode);
      b.setExtendedSubmissionCode(exSubmissionCode);
      b.setDxCode1(dxCode1);
      b.setDxCode2(dxCode2);
      b.setDxCode3(dxCode3);
      b.setDxExpansion(dxExpansion);
      b.setServiceLocation(serviceLocation);
      b.setReferralFlag1(referralFlag1);
      b.setReferralNo1(referralNo1);
      b.setReferralFlag2(referralFlag2);
      b.setReferralNo2(referralNo2);
      b.setTimeCall(timeCall);
      b.setServiceStartTime(serviceStartTime);
      b.setServiceEndTime(serviceEndTime);
      b.setBirthDate(oinBirthdate);
      b.setCorrespondenceCode(correspondenceCode);
      b.setClaimComment(claimComment);
      b.setOinInsurerCode(oinInsurerCode);
      b.setOinRegistrationNo(oinRegistrationNo);
      b.setOinBirthdate(oinBirthdate);
      b.setOinFirstName(oinFirstName);
      b.setOinSecondName(oinSecondName);
      b.setOinSurname(oinSurname);
      b.setOinSexCode(oinSexCode);
      b.setOinAddress(oinAddress4);
      b.setOinAddress2(oinAddress2);
      b.setOinAddress3(oinAddress3);
      b.setOinAddress4(oinAddress4);
      b.setOinPostalcode(oinPostalcode);

      billingmasterDao.update(b);
    }

    if (secondSQL != null) {
      Billing bb = billingDao.find(Integer.parseInt(frm.getBillNumber()));
      if (bb != null) {
        bb.setStatus("O");
        billingDao.merge(bb);
      }
    }

    request.setAttribute("billing_no", billingmasterNo);
    return (mapping.findForward("success"));
  }
  public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws IOException, ServletException {

    if (request.getSession().getAttribute("user") == null) {
      return (mapping.findForward("Logout"));
    }

    oscar.oscarBilling.pageUtil.BillingSessionBean bean;
    bean =
        (oscar.oscarBilling.pageUtil.BillingSessionBean)
            request.getSession().getAttribute("billingSessionBean");

    String[] service = ((BillingCreateBillingForm) form).getService();
    String other_service1 = ((BillingCreateBillingForm) form).getXml_other1();
    String other_service2 = ((BillingCreateBillingForm) form).getXml_other2();
    String other_service3 = ((BillingCreateBillingForm) form).getXml_other3();
    String other_service1_unit = ((BillingCreateBillingForm) form).getXml_other1_unit();
    String other_service2_unit = ((BillingCreateBillingForm) form).getXml_other2_unit();
    String other_service3_unit = ((BillingCreateBillingForm) form).getXml_other3_unit();
    oscar.oscarBilling.pageUtil.BillingBillingManager bmanager;
    bmanager = new BillingBillingManager();
    ArrayList<BillingItem> billItem =
        bmanager.getDups2(
            service,
            other_service1,
            other_service2,
            other_service3,
            other_service1_unit,
            other_service2_unit,
            other_service3_unit);
    MiscUtils.getLogger().debug("Calling getGrandTotal");

    bean.setGrandtotal(bmanager.getGrandTotal(billItem));
    MiscUtils.getLogger().debug("GrandTotal" + bmanager.getGrandTotal(billItem));
    oscar.oscarDemographic.data.DemographicData demoData =
        new oscar.oscarDemographic.data.DemographicData();

    org.oscarehr.common.model.Demographic demo =
        demoData.getDemographic(
            LoggedInInfo.getLoggedInInfoFromSession(request), bean.getPatientNo());
    bean.setPatientLastName(demo.getLastName());
    bean.setPatientFirstName(demo.getFirstName());
    bean.setPatientDoB(DemographicData.getDob(demo));
    bean.setPatientAddress1(demo.getAddress());
    bean.setPatientAddress2(demo.getCity());
    bean.setPatientPostal(demo.getPostal());
    bean.setPatientSex(demo.getSex());
    bean.setPatientPHN(demo.getHin() + demo.getVer());
    bean.setPatientHCType(demo.getHcType());
    bean.setPatientAge(demo.getAge());
    bean.setBillingType(((BillingCreateBillingForm) form).getXml_billtype());
    bean.setVisitType(((BillingCreateBillingForm) form).getXml_visittype());
    bean.setVisitLocation(((BillingCreateBillingForm) form).getXml_location());
    bean.setServiceDate(((BillingCreateBillingForm) form).getXml_appointment_date());
    bean.setStartTime(((BillingCreateBillingForm) form).getXml_starttime());
    bean.setEndTime(((BillingCreateBillingForm) form).getXml_endtime());
    bean.setAdmissionDate(((BillingCreateBillingForm) form).getXml_vdate());
    bean.setBillingProvider(((BillingCreateBillingForm) form).getXml_provider());

    oscar.oscarBilling.data.BillingFormData billform =
        new oscar.oscarBilling.data.BillingFormData();

    bean.setBillingPracNo(billform.getPracNo(((BillingCreateBillingForm) form).getXml_provider()));
    bean.setBillingGroupNo(
        billform.getGroupNo(((BillingCreateBillingForm) form).getXml_provider()));

    bean.setDx1(((BillingCreateBillingForm) form).getXml_diagnostic_detail1());
    bean.setDx2(((BillingCreateBillingForm) form).getXml_diagnostic_detail2());
    bean.setDx3(((BillingCreateBillingForm) form).getXml_diagnostic_detail3());
    bean.setReferral1(((BillingCreateBillingForm) form).getXml_refer1());
    bean.setReferral2(((BillingCreateBillingForm) form).getXml_refer2());
    bean.setReferType1(((BillingCreateBillingForm) form).getRefertype1());
    bean.setReferType2(((BillingCreateBillingForm) form).getRefertype2());
    bean.setBillItem(billItem);

    // bean.setApptProviderNo(request.getParameter("apptProvider_no"));
    // bean.setPatientName(request.getParameter("demographic_name"));
    // bean.setProviderView(request.getParameter("providerview"));
    // bean.setBillRegion(request.getParameter("billRegion"));
    // bean.setBillForm(request.getParameter("billForm"));
    // bean.setCreator(request.getParameter("user_no"));
    // bean.setPatientNo(request.getParameter("demographic_no"));
    // bean.setApptNo(request.getParameter("appointment_no"));
    // bean.setApptDate(request.getParameter("appointment_date"));

    return (mapping.findForward("success"));
  }