52 lines
1.8 KiB
Java
52 lines
1.8 KiB
Java
package com.example.caseData.controller;
|
|
|
|
import com.example.caseData.common.Response;
|
|
import com.example.caseData.dto.caseLabel.GetCaseLabelDto;
|
|
import com.example.caseData.dto.user.UserDto;
|
|
import com.example.caseData.extend.app.Hospital.GetHospitalByUuidResponse;
|
|
import com.example.caseData.extend.app.Hospital.Hospital;
|
|
import com.example.caseData.extend.app.label.GetLabelsResponse;
|
|
import com.example.caseData.extend.app.label.Label;
|
|
import com.example.caseData.request.UserRequest.UserRequest;
|
|
import com.example.caseData.request.caseLabelRequest.getCaseLabel;
|
|
import jakarta.annotation.Resource;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
@RequestMapping("/api")
|
|
public class CaseLabelController {
|
|
@Resource
|
|
private Label label;
|
|
|
|
/**
|
|
* 获取疾病标签数据
|
|
*/
|
|
@GetMapping("/case/label")
|
|
public Response<List<GetCaseLabelDto>> getCaseLabel(@Validated() @ModelAttribute getCaseLabel request) {
|
|
GetLabelsResponse result = label.getLabels(request.getPId());
|
|
List<GetLabelsResponse.GetLabelsData> datas = result.getData();
|
|
|
|
List<GetCaseLabelDto> labelDtoList = new ArrayList<>();
|
|
for (GetLabelsResponse.GetLabelsData d : datas) {
|
|
GetCaseLabelDto dto = new GetCaseLabelDto();
|
|
dto.setAppIden(d.getId());
|
|
dto.setLabelName(d.getName());
|
|
if (d.getChildrenSize() > 0){
|
|
dto.setIsSub(1);
|
|
}
|
|
|
|
labelDtoList.add(dto);
|
|
}
|
|
|
|
return Response.success(labelDtoList);
|
|
|
|
}
|
|
}
|