移行病名チェック
厚労省の病名マスターは何の断りもなく病名が廃止されたりすることがあるので,病名の有効期限をチェックして,有効期限が設定されている病名は赤で表示されるようにした。【2009/9/22 追記】ORCA につながってない状態で checkIkouByomei を呼ぶとフリーズしてしまっていたので,checkIkouByomei メソッドを DBTask に変更した。
infomodel/RegisteredDiagonosisModel.java
////↓
@Transient
private Boolean ikouByomei = false;
public void setIkouByomei(Boolean b) {
ikouByomei = b;
}
public Boolean isIkouByomei() {
return ikouByomei;
}
////↑
client/DiagnosisDocument.java
////↓
/**
* RegisteredDiagnosisModel を元に,移行病名かどうかをチェックする
* @param rd
*/
public void checkIkouByomei(final RegisteredDiagnosisModel rd) {
DBTask task = new DBTask(getContext()) {
@Override
protected List doInBackground() throws Exception {
// 病名コードを切り出し(接頭語,接尾語は捨てる)
SqlMasterDao dao = (SqlMasterDao) SqlDaoFactory.create(this, "dao.master");
String[] codes = rd.getDiagnosisCode().split("\\.");
for (String code : codes) {
if (code.length() == 7) { // 病名コードの桁数は7
ArrayList result = dao.getByName("disease", code, false, null, null, null);
DiseaseEntry de = (DiseaseEntry) result.get(0);
if (de.getDisUseDate().equals("99999999")) rd.setIkouByomei(false);
else rd.setIkouByomei(true);
}
}
return null;
}
};
task.execute();}
}
////↑
・
・
public void getDiagnosisHistory(Date past) {
・
・
DBTask task = new DBTask<List>(getContext()) {
・
・
@Override
@SuppressWarnings("unchecked")
protected void succeeded(List list) {
・
・
} else {
Collections.sort(list, Collections.reverseOrder());
int index = list.size() - 1;
RegisteredDiagnosisModel rd = (RegisteredDiagnosisModel) list.get(index);
dolphinFirstDate = rd.getStartDate();
}
////↓ ORCA マスタを検索して,有効期限(disUseDate)が99999999以外に設定されていたら移行病名としてセット
for (int i=0; i<list.size(); i++) {
checkIkouByomei((RegisteredDiagnosisModel) list.get(i));
}
////↑
・
・
private void insertStamp(StampModel sm, int row) {
・
・
// ALT キーが押されていたら,疑いにセットする
if (action == java.awt.dnd.DnDConstants.ACTION_COPY) {
module.setCategory("suspectedDiagnosis");
module.setCategoryDesc("疑い病名");
module.setCategoryCodeSys("MML0015");
}
// 移行病名チェック
checkIkouByomei(module);
////↑
・
・
class DolphinOrcaRenderer extends DefaultTableCellRenderer {
・
・
////↓ 移行病名なら foreground の色を変える(赤)
// setForeground(table.getForeground());
if (rd != null && rd.isIkouByomei()) setForeground(Color.RED);
else setForeground(table.getForeground());
////↑


