コード例 #1
0
ファイル: ProcessFileDataset.java プロジェクト: openhie/os-cr
 /**
  * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16, 16 (^-separated)
  * rec_id,given_name,surname,street_number,address_1,address_2,suburb,postcode,state,date_of_birth,age,phone_number,soc_sec_id,blocking_number,gender(M/F/O),race,account,id-seq
  */
 private void getPerson(int lineIndex, String line) throws ParseException {
   String[] fields = new String[MAX_FIELD_COUNT];
   int length = line.length();
   int begin = 0;
   int end = 0;
   int fieldIndex = 0;
   while (end < length) {
     while (end < length - 1 && line.charAt(end) != ',') {
       end++;
     }
     if (end == length - 1) {
       break;
     }
     fields[fieldIndex++] = line.substring(begin, end);
     end++;
     begin = end;
   }
   fields[fieldIndex] = line.substring(begin, end + 1);
   if (isPopulatedField(fields[16])) {
     log.debug("Extracted an account number of " + fields[16]);
     PersonIdentifier id = extractAccountIdentifier(fields[16]);
     log.debug("We have an ID of " + id);
     log.debug("Will set the account number to: " + String.format("%07d", lineIndex));
     id.setIdentifier(String.format("%07d", lineIndex));
     outputLine(fields, id);
   }
 }
コード例 #2
0
ファイル: ProcessFileDataset.java プロジェクト: openhie/os-cr
 private void outputLine(String[] fields, PersonIdentifier id) {
   for (int i = 0; i < fields.length; i++) {
     if (i == 16) {
       System.out.print(id.toString());
     } else {
       System.out.print(fields[i]);
     }
     if (i < fields.length - 1) {
       System.out.print(",");
     }
   }
   System.out.println();
 }
コード例 #3
0
ファイル: ProcessFileDataset.java プロジェクト: openhie/os-cr
 private PersonIdentifier extractAccountIdentifier(String accountId) {
   StringTokenizer idTokenizer = new StringTokenizer(accountId, "&");
   int count = 0;
   PersonIdentifier id = new PersonIdentifier();
   while (idTokenizer.hasMoreTokens()) {
     String field = idTokenizer.nextToken();
     switch (count) {
       case 0:
         id.setIdentifier(field);
         break;
       case 1:
         id.setNamespaceIdentifier(field);
         break;
       case 2:
         id.setUniversalIdentifier(field);
         break;
       case 3:
         id.setUniversalIdentifierTypeCode(field);
         break;
     }
     count++;
   }
   return id;
 }