for (MedicalRecordQueryDTO.NurseStatusEnum statusEnum : MedicalRecordQueryDTO.NurseStatusEnum.values()) { if (MedicalRecordQueryDTO.NurseStatusEnum.ALL.getCode() == statusEnum.getCode()) { continue; } //如果是退回状态,需要查询50和90的 if (MedicalRecordQueryDTO.NurseStatusEnum.RETURNED.getCode() == statusEnum.getCode()) { queryDTO.setStatusList(CollUtil.newArrayList(MedicalRecordStatusEnum.ARCHIVE_RETURN.getIntCode(), MedicalRecordStatusEnum.SIGN_RETURN.getIntCode())); } else { queryDTO.setStatusList(null); queryDTO.setStatus(statusEnum.getCode()); } // 按不同病案状态,分别查询 long count = medicalRecordMapper.count(queryDTO); countAll += count; countList.add(new MedicalRecordStatusCountVO() .setStatus(statusEnum.getCode()) .setStatusName(statusEnum.getDesc()) .setCount(count)); }
时间: 2024-02-14 19:23:27 浏览: 17
这段代码主要是用于统计护士病案的数量,并根据病案的状态进行分类统计。它的逻辑如下:
1. 遍历 `MedicalRecordQueryDTO.NurseStatusEnum` 枚举类型的所有元素,除了 `ALL` 元素。
2. 如果当前枚举元素为 `RETURNED`,则将查询条件中的状态列表设置为 `ARCHIVE_RETURN` 和 `SIGN_RETURN`。
3. 否则,将查询条件中的状态列表设置为 `null`,并将查询条件中的状态设置为当前枚举元素的状态码。
4. 执行查询,并将返回的病案数量加到总数量 `countAll` 中。
5. 将当前枚举元素的状态码、状态名称和数量封装成一个 `MedicalRecordStatusCountVO` 对象,并添加到 `countList` 列表中。
6. 返回总数量 `countAll`。
相关问题
def get_argparser(): parser = argparse.ArgumentParser()
Sorry, as an AI language model, I don't have access to the previous context or the purpose of the function you shared. But based on the function signature, it seems like this is a Python function that returns an instance of the `ArgumentParser` class from the `argparse` module. The purpose of this class is to create a parser object that can parse command-line arguments and options.
Here's an example usage of the `ArgumentParser` class:
```
import argparse
def get_argparser():
parser = argparse.ArgumentParser()
parser.add_argument('--name', help='Enter your name')
parser.add_argument('--age', type=int, help='Enter your age')
return parser
if __name__ == '__main__':
parser = get_argparser()
args = parser.parse_args()
print(f"Hello {args.name}, you are {args.age} years old!")
```
In the above example, the `get_argparser()` function creates an instance of the `ArgumentParser` class and adds two arguments to it - `name` and `age`. The `parse_args()` method of the parser object is then called to parse the command-line arguments and options. Finally, the values of the `name` and `age` arguments are printed using the `print()` function.
queryset = User.objects.all()如何指定字段
`queryset = User.objects.all()` 表示搜索的对象是 `User` 模型中的所有记录。如果你想指定搜索的字段,可以使用 Django ORM 中的 `filter()` 或 `exclude()` 方法进行筛选。例如,如果你只想搜索 `is_active` 字段为 `True` 的用户,可以这样写:
```python
queryset = User.objects.filter(is_active=True)
```
如果你只想搜索某些字段,可以使用 `values()` 或 `values_list()` 方法指定返回的字段。例如,如果你只想返回用户名和邮箱,可以这样写:
```python
queryset = User.objects.filter(is_active=True).values('username', 'email')
```
这样返回的结果中,只包含 `username` 和 `email` 两个字段的值。如果你想返回所有字段,可以使用 `values()` 方法而不指定任何字段:
```python
queryset = User.objects.filter(is_active=True).values()
```
这样返回的结果中,包含 `User` 模型中的所有字段的值。