* 検索テキストを解析して,該当する検索タスクを呼び出す
* @param text キーワード
*/
private void find(String text) {
PatientSearchSpec spec = new PatientSearchSpec();
if (text.startsWith("N ") || text.startsWith("n ")) {
spec.setCode(PatientSearchSpec.NAME_SEARCH);
text = text.substring(2);
spec.setName(text);
} else if (text.startsWith("K ") || text.startsWith("k ")) {
spec.setCode(PatientSearchSpec.KANA_SEARCH);
text = text.substring(2);
spec.setName(text);
} else if (text.startsWith("A ") || text.startsWith("a ")) {
spec.setCode(PatientSearchSpec.ADDRESS_SEARCH);
text = text.substring(2);
spec.setAddress(text);
} else if (text.startsWith("Z ") || text.startsWith("z ")) {
spec.setCode(PatientSearchSpec.ZIPCODE_SEARCH);
text = text.substring(2);
spec.setZipCode(text);
} else if (text.startsWith("T ") || text.startsWith("t ")) {
spec.setCode(PatientSearchSpec.TELEPHONE_SEARCH);
text = text.substring(2);
spec.setTelephone(text);
} else if (text.startsWith("I ") || text.startsWith("i ")) {
spec.setCode(PatientSearchSpec.ID_SEARCH);
text = text.substring(2);
spec.setPatientId(text);
} else if (text.startsWith("E ") || text.startsWith("e ")) {
spec.setCode(PatientSearchSpec.EMAIL_SEARCH);
text = text.substring(2);
spec.setEmail(text);
} else if (text.startsWith("O ") || text.startsWith("o ")) {
spec.setCode(PatientSearchSpec.OTHERID_SEARCH);
text = text.substring(2);
spec.setOtherId(text);
} else if (text.startsWith("B ") || text.startsWith("b ")) {
spec.setCode(PatientSearchSpec.BIRTHDAY_SEARCH);
text = text.substring(2);
spec.setBirthday(ModelUtils.toSeireki(text));
} else if (text.startsWith("M ") || text.startsWith("m ")) {
spec.setCode(PatientSearchSpec.MEMO_SEARCH);
text = text.substring(2);
spec.setSearchText(text);
} else if (text.startsWith("F ") || text.startsWith("f ")) {
spec.setCode(PatientSearchSpec.FULL_TEXT_SEARCH);
text = text.substring(2);
spec.setSearchText(text);
} else if (isNengoDate(text)) {
spec.setCode(PatientSearchSpec.BIRTHDAY_SEARCH);
spec.setBirthday(ModelUtils.toSeireki(text));
} else if (isOrcaDate(text)) {
spec.setCode(PatientSearchSpec.BIRTHDAY_SEARCH);
spec.setBirthday(ModelUtils.toSeireki(ModelUtils.OrcaDateToNengo(text)));
} else if (isDate(text)) {
//System.out.println("Date search");
spec.setCode(PatientSearchSpec.DATE_SEARCH);
spec.setDate(ModelUtils.toSeireki(text)); // 月/日が1桁で指定された場合の調整 by pns
} else if (isKana(text)) {
spec.setCode(PatientSearchSpec.KANA_SEARCH);
spec.setName(text);
} else if (isHiragana(text)){
spec.setCode(PatientSearchSpec.KANA_SEARCH);
spec.setName(StringTool.hiraganaToKatakana(text));
} else if (isId(text)) {
spec.setCode(PatientSearchSpec.ID_SEARCH);
spec.setPatientId(text);
} else if (text.length() <= 1) {
MyJSheet.showMessageDialog(getContext().getFrame(),
"検索文字列は2文字以上入力して下さい", "検索文字列入力エラー", JOptionPane.ERROR_MESSAGE);
return;
} else {
spec.setCode(PatientSearchSpec.FULL_TEXT_SEARCH);
spec.setSearchText(text);
}
FindTask task = new FindTask(view, "患者検索", "検索中...", spec);
task.setInputBlocker(new Blocker());