コード例 #1
0
 /**
  * 取得指定住院号的记录
  *
  * @param admissionNum 住院号
  * @return 住院记录
  */
 public record GetRecord(String admissionNum) {
   try {
     MongoDAO dao = MongoDAO.GetInstance();
     BasicDBObject cond = new BasicDBObject();
     cond.append("admission_number", new BasicDBObject("$eq", admissionNum));
     FindIterable<Document> result = dao.GetCollection("records").find(cond);
     MongoCursor<Document> it = result.iterator();
     if (it.hasNext()) {
       Document doc = it.next();
       record fol = new record();
       fol.setAdmission_number(doc.getString("admission_number"));
       fol.setName(doc.getString("name"));
       fol.setWeixin_openid(doc.getString("weixin_openid"));
       fol.setLeaveTime(doc.getDate("leaveTime"));
       fol.setInTime(doc.getDate("inTime"));
       fol.setDisease(doc.getString("disease"));
       return fol;
     }
     return null;
   } catch (Exception e) {
     e.printStackTrace();
     logger.error(e.toString());
     return null;
   }
 }
コード例 #2
0
 /**
  * 取得已出院未回访的用户
  *
  * @return
  */
 public List<record> GetleavehospitalRecords() {
   try {
     List<record> list = new ArrayList<record>();
     MongoDAO dao = MongoDAO.GetInstance();
     BasicDBObject cond = new BasicDBObject();
     cond.append("leaveHospital", new BasicDBObject("$eq", true));
     cond.append("followup", new BasicDBObject("$eq", false));
     FindIterable<Document> result = dao.GetCollection("records").find(cond);
     MongoCursor<Document> it = result.iterator();
     while (it.hasNext()) {
       Document doc = it.next();
       record fol = new record();
       fol.setAdmission_number(doc.getString("admission_number"));
       fol.setName(doc.getString("name"));
       fol.setWeixin_openid(doc.getString("weixin_openid"));
       fol.setLeaveTime(doc.getDate("leaveTime"));
       fol.setDisease(doc.getString("disease"));
       list.add(fol);
     }
     return list;
   } catch (Exception e) {
     e.printStackTrace();
     logger.error(e.toString());
     return null;
   }
 }