public ArrayList<HashMap<String, String>> patientList(String did){ String sql="select patient.pid, patient.name as pname,record.ordertime,record.state, record.rid,record.visitdate,record.visittime "+ "from record,patient where "+ "record.did=? and record.pid=patient.pid "+ "order by ordertime desc"; ArrayList<HashMap<String, String>> list = DBUtil.getHashmap(sql, new Object[]{did}); return list; }
时间: 2024-01-29 10:02:37 浏览: 22
这段代码是用来查询数据库中符合某一条件的患者信息的方法。其中,参数did表示医生的ID。代码中使用了预编译的SQL语句,其中使用了多表连接查询,查询了patient和record两张表,使用了where子句限定了查询条件,即查询record表中医生ID为did的记录,并且这些记录的患者ID和patient表中的患者ID相同。最终调用了DBUtil.getHashmap()方法来执行查询,并返回查询结果。查询结果是一个ArrayList类型的列表,其中每个元素是一个HashMap类型的映射,映射键是列名,映射值是该列对应的值。这个方法查询了patient、record两张表中的pid、name、ordertime、state、rid、visitdate和visittime共7个字段。
相关问题
public ArrayList<HashMap<String, String>> tagList = new ArrayList<HashMap<String, String>>()
这段代码定义了一个公共的成员变量 `tagList`,它是一个 ArrayList 类型的对象,泛型为 HashMap<String, String>。也就是说,`tagList` 是一个由多个键值对组成的列表,每个键值对都由一个字符串类型的键和一个字符串类型的值组成。这个变量是公共的,也就是说其他类可以访问和修改它。
public ArrayList<HashMap<String, String>> jList = new ArrayList<HashMap<String, String>>();jList 可以add一个List数组吗
可以,你可以使用`jList.addAll()`方法向列表中添加一个List数组。例如,如果要向列表中添加一个包含多个人员信息的List数组,可以使用以下代码:
```
List<HashMap<String, String>> personList = new ArrayList<HashMap<String, String>>();
HashMap<String, String> person1 = new HashMap<String, String>();
person1.put("Name", "John");
person1.put("Age", "25");
personList.add(person1);
HashMap<String, String> person2 = new HashMap<String, String>();
person2.put("Name", "Mary");
person2.put("Age", "30");
personList.add(person2);
jList.addAll(personList);
```
这将向jList列表中添加两个人员信息,分别是"John",年龄为"25"和"Mary",年龄为"30"。