Exemplo n.º 1
0
  private String buildPracticeRegistrationRequest(ECommerceUpdate oneUpdate) {
    StringBuffer requestBuf = new StringBuffer();
    String timeNow = getTimeStampString();
    int pendingItemID = oneUpdate.getPendingItemID().intValue();

    MemberDBBean dbBean = new MemberDBBean(getClass().getName());
    Member contact = null;
    PracticeGroup practice = null;
    String ToBeDetermined = null;

    Vector aff = new Vector();
    try {
      practice = dbBean.retrievePracticeRegistration(pendingItemID);
      aff = dbBean.getPracticeActiveAffiliations(practice.getPracticeID());
      contact = practice.getContact();

    } catch (Exception e) {
      e.printStackTrace();
    }
    String aff_type = "MC";
    String contract_username = "";
    java.text.SimpleDateFormat df = new java.text.SimpleDateFormat("MMddyy");
    String start_date = "";
    String end_date = "";
    String aff_rec_id = "";
    if (aff != null && !aff.isEmpty()) {
      int asize = aff.size();
      for (int x = 0; x < asize; x++) {
        UserAffiliation vv = (UserAffiliation) aff.elementAt(x);
        if (aff_type.equals(vv.getAffiliationType())) {
          if (vv.getStartDate() != null) start_date = df.format(vv.getStartDate());
          if (vv.getEndDate() != null) end_date = df.format(vv.getEndDate());
          aff_rec_id = "" + vv.getID();
          if (vv.getPrefix() != null && !vv.getPrefix().equals(""))
            aff_rec_id = vv.getPrefix() + "-" + aff_rec_id;
          User user = dbBean.retrieveUser((long) vv.getAffiliationID());
          contract_username = user.getUserName();
          break;
        }
      }
    }

    if (practice.getPracticeID() > 0) {
      requestBuf.append("service=Rcopia&action=register_practice");
      requestBuf.append("&drwebid=");
      requestBuf.append(practice.getPracticeID());
      requestBuf.append("&username="******"&password=dGVzdDEyMzQ%3D");
      // requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPassword())));
      requestBuf.append("&prefix=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrefix())));
      requestBuf.append("&firstName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getFirstName())));
      requestBuf.append("&lastName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getLastName())));
      requestBuf.append("&email=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getEmail())));
      requestBuf.append("&memberType=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getMemberType())));
      requestBuf.append("&spec1_desc=");
      requestBuf.append(
          StringFunctions.urlEncoded(
              StringFunctions.objectToString(practice.getPrimarySpecialty())));
      requestBuf.append("&practicename=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getPracticeName())));
      requestBuf.append("&officeName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getOfficeName())));
      requestBuf.append("&address1=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryAddress1())));
      requestBuf.append("&address2=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryAddress2())));
      requestBuf.append("&city=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryCity())));
      requestBuf.append("&state=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryState())));
      requestBuf.append("&zip=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getPrimaryZip())));
      requestBuf.append("&country=US");
      requestBuf.append("&PhoneAreaCode1=");
      requestBuf.append(
          StringFunctions.urlEncoded(
              StringFunctions.objectToString(contact.getPrimaryPhoneAreaCode())));
      requestBuf.append("&PhonePrefix1=");
      requestBuf.append(
          StringFunctions.urlEncoded(
              StringFunctions.objectToString(contact.getPrimaryPhonePrefix())));
      requestBuf.append("&PhoneSuffix1=");
      requestBuf.append(
          StringFunctions.urlEncoded(
              StringFunctions.objectToString(contact.getPrimaryPhoneSuffix())));
      requestBuf.append("&PhoneExtension1=");
      requestBuf.append(
          StringFunctions.urlEncoded(
              StringFunctions.objectToString(contact.getPrimaryPhoneExtension())));
      requestBuf.append("&FaxAreaCode1=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getFaxAreaCode())));
      requestBuf.append("&FaxPrefix1=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getFaxPrefix())));
      requestBuf.append("&FaxSuffix1=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(contact.getFaxSuffix())));
      requestBuf.append("&registered_by=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getRegisteredBy())));
      requestBuf.append("&created_date=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getCreatedDate())));
      requestBuf.append("&practiceManagementSystem=");
      requestBuf.append(
          StringFunctions.urlEncoded(
              StringFunctions.objectToString(practice.getPracticeManagementSystem())));
      requestBuf.append("&user_affiliation_id=");
      requestBuf.append(aff_rec_id);
      requestBuf.append("&start_date=");
      requestBuf.append(StringFunctions.objectToString(start_date));
      requestBuf.append("&end_date=");
      requestBuf.append(StringFunctions.objectToString(end_date));
      requestBuf.append("&contract_username="******"&assigned_region=");
      requestBuf.append(
          StringFunctions.urlEncoded(
              StringFunctions.objectToString(practice.getAssignedRegionName())));
      System.out.println(
          "practice assigned Region name========" + practice.getAssignedRegionName());

      requestBuf.append("&time=");
      requestBuf.append(getTimeStampString());
    }

    return requestBuf.toString();
  }
Exemplo n.º 2
0
  private String buildUserRequest(ECommerceUpdate oneUpdate) {
    StringBuffer requestBuf = new StringBuffer();
    String timeNow = getTimeStampString();
    String username = oneUpdate.getUsername();
    String actionDate = oneUpdate.getActionDate();

    MemberDBBean dbBean = new MemberDBBean(getClass().getName());
    Long user_id = new Long(0);
    Long practice_id = new Long(0);
    Member member = new Member();
    Vector dates = new Vector();
    String practice_username = "";
    try {
      user_id = dbBean.getDrWebId(username);
      practice_id = dbBean.getPracticeId(user_id);
      practice_username = dbBean.getUsername(practice_id);
      member = dbBean.retrieveURSMember(user_id, practice_id);
      dates = dbBean.retrieveRxDates(user_id);
    } catch (Exception e) {
      e.printStackTrace();
    }

    System.out.println("username=========" + username);
    System.out.println("user_id=========" + user_id);
    System.out.println("practice_id=========" + practice_id);
    System.out.println("practice_username=========" + practice_username);

    if (practice_id == 0) throw new IllegalArgumentException("No practice is associated.");

    if (user_id > 0 && practice_id > 0 && member.getMemberID() > 0) {
      requestBuf.append("service=Rcopia&action=updateUser");
      requestBuf.append("&time=");
      requestBuf.append(timeNow);

      requestBuf.append("&practice_username="******"&user_username="******"&drwebid=");
      requestBuf.append(member.getMemberID());
      requestBuf.append("&firstName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getFirstName())));
      requestBuf.append("&lastName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getLastName())));
      requestBuf.append("&middleInitial=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getMiddleName())));
      requestBuf.append("&suffix=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getSuffix())));
      requestBuf.append("&memberType=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getMemberType())));
      requestBuf.append("&status=");
      String aflag = StringFunctions.objectToString(member.getActiveFlag());
      String rflag = StringFunctions.objectToString(member.getEPS());
      if (aflag.equals("A")) {
        if (rflag.equals("D") || rflag.equals("X") || rflag.equals("V") || rflag.equals("I"))
          aflag = rflag;
        else if (rflag.equals("R") || rflag.equals("NM")) aflag = "I";
      } else if (!aflag.equals("A")
          && !aflag.equals("I")
          && !aflag.equals("D")
          && !aflag.equals("X")) aflag = "O";

      requestBuf.append(StringFunctions.urlEncoded(aflag));
      Vector disableInfo = new Vector();
      if (aflag.equals("D")) {
        try {
          disableInfo = dbBean.getLastDisabledInformation(new Long(user_id));
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      requestBuf.append("&disabled_by=");
      if (disableInfo != null && !disableInfo.isEmpty()) {
        requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(1)));
      }
      requestBuf.append("&disabled_reason=");
      if (disableInfo != null && !disableInfo.isEmpty()) {
        requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(2)));
      }
      requestBuf.append("&disable_date=");
      if (disableInfo != null && !disableInfo.isEmpty()) {
        requestBuf.append(StringFunctions.objectToString(disableInfo.elementAt(4)));
      }

      requestBuf.append("&isTest=");
      if (member.getIsTest() != null && !member.getIsTest().equals(""))
        requestBuf.append(
            StringFunctions.urlEncoded(StringFunctions.objectToString(member.getIsTest())));
      else requestBuf.append("n");

      requestBuf.append("&isProvider=");

      String m = member.getMemberType();
      if (m != null && !m.equals("M") && !m.equals("NP") && !m.equals("PA") && !m.equals("D"))
        requestBuf.append("n");
      else requestBuf.append("y");

      requestBuf.append("&dea=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getDEA())));
      requestBuf.append("&spec1_desc=");
      if (member.getPrimarySpecialty() != null)
        requestBuf.append(
            StringFunctions.urlEncoded(
                StringFunctions.objectToString(member.getPrimarySpecialty())));
      requestBuf.append("&practice_drwebid=");
      requestBuf.append(practice_id);

      Vector groups = member.getGroups();
      String groupIds = "";
      String groupNames = "";
      if (groups != null && !groups.isEmpty()) {
        int s = groups.size();
        for (int y = 0; y < s; y++) {
          PracticeGroup pg = (PracticeGroup) groups.elementAt(y);
          groupIds += pg.getGroupID();
          groupNames += pg.getGroupName();
          if (y > 0) {
            groupIds += "|";
            groupNames += "|";
          }
        }
      }

      requestBuf.append("&groupID=");
      requestBuf.append(groupIds);
      requestBuf.append("&groupName=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(groupNames)));
      requestBuf.append("&officeName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getOfficeName())));
      requestBuf.append("&address1=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress1())));
      requestBuf.append("&address2=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress2())));
      requestBuf.append("&city=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryCity())));
      requestBuf.append("&state=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryState())));
      requestBuf.append("&zip=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryZip())));
      requestBuf.append("&phoneNumber=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryPhone())));
      requestBuf.append("&faxNumber=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryFax())));
      requestBuf.append("&email=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getEmail())));

      Vector affils = member.getAffiliations();

      String sponsor = "";
      String sales = "";
      String acct_manager = "";
      String deploy_manager = "";
      String ipa = "";

      if (affils != null && !affils.isEmpty()) {
        int si = affils.size();
        for (int t = 0; t < si; t++) {
          UserAffiliation ua = (UserAffiliation) affils.elementAt(t);
          if (ua.getAffiliationType().equals("SP")) sponsor = ua.getAffiliationName();
          else if (ua.getAffiliationType().equals("SA")) sales = ua.getAffiliationName();
          if (ua.getAffiliationType().equals("AM")) acct_manager = ua.getAffiliationName();
          if (ua.getAffiliationType().equals("DM")) deploy_manager = ua.getAffiliationName();
          if (ua.getAffiliationType().equals("IPA")) ipa = ua.getAffiliationName();
        }
      }

      requestBuf.append("&ipa=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(ipa)));
      requestBuf.append("&sponsor=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(sponsor)));
      requestBuf.append("&salesrep=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(sales)));
      requestBuf.append("&accountManager=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(acct_manager)));
      requestBuf.append("&deploymentManager=");
      requestBuf.append(StringFunctions.urlEncoded(StringFunctions.objectToString(deploy_manager)));

      if (dates != null && !dates.isEmpty()) {
        Vector d = (Vector) dates.elementAt(0);
        requestBuf.append("&rx1Date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(0)));
        requestBuf.append("&rx5Date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(1)));
        requestBuf.append("&rx50Date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(2)));
        requestBuf.append("&rx200Date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(3)));
        requestBuf.append("&last_script_date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(4)));
        requestBuf.append("&last_pda_activity_date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(5)));
        requestBuf.append("&total_scripts=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(6)));
        requestBuf.append("&last_login_date=");
        requestBuf.append(StringFunctions.objectToString(d.elementAt(7)));

      } else {
        requestBuf.append("&rx1Date=");
        requestBuf.append("&rx5Date=");
        requestBuf.append("&rx50Date=");
        requestBuf.append("&rx200Date=");
        requestBuf.append("&last_script_date=");
        requestBuf.append("&last_pda_activity_date=");
        requestBuf.append("&total_scripts=");
        requestBuf.append("&last_login_date=");
      }
    }

    return requestBuf.toString();
  }
Exemplo n.º 3
0
  private String buildUserRegistrationRequest(ECommerceUpdate oneUpdate) {
    StringBuffer requestBuf = new StringBuffer();
    String timeNow = getTimeStampString();
    int pendingItemID = oneUpdate.getPendingItemID().intValue();

    MemberDBBean dbBean = new MemberDBBean(getClass().getName());
    Member member = null;
    PracticeGroup practice = null;

    try {
      member = dbBean.retrieveUserRegistration(pendingItemID);
      practice = member.getPractice();
    } catch (Exception e) {
      e.printStackTrace();
    }

    if (member.getMemberID() > 0) {
      requestBuf.append("service=Order&action=registerUser");
      requestBuf.append("&drwebid=");
      requestBuf.append(member.getMemberID());
      requestBuf.append("&username="******"&password="******"&firstName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getFirstName())));
      requestBuf.append("&lastName=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getLastName())));
      requestBuf.append("&email=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getEmail())));
      requestBuf.append("&memberTypeSelectBox=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getMemberType())));
      requestBuf.append("&practicename");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(practice.getPracticeName())));
      requestBuf.append("&address1=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress1())));
      requestBuf.append("&address2=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryAddress2())));
      requestBuf.append("&city=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryCity())));
      requestBuf.append("&state=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryState())));
      requestBuf.append("&zip=");
      requestBuf.append(
          StringFunctions.urlEncoded(StringFunctions.objectToString(member.getPrimaryZip())));
      requestBuf.append("&PhoneAreaCode1=");
      requestBuf.append(member.getPrimaryPhone().substring(1, 3));
      requestBuf.append("&PhonePrefix1=");
      requestBuf.append(member.getPrimaryPhone().substring(6, 8));
      requestBuf.append("&PhoneSuffix1=");
      requestBuf.append(member.getPrimaryPhone().substring(10, 13));
      requestBuf.append("&time=");
      requestBuf.append(getTimeStampString());
    }

    return requestBuf.toString();
  }