11 changed files with 227 additions and 7 deletions
@ -0,0 +1,41 @@ |
|||
package com.ccsens.tcm.api; |
|||
|
|||
import com.ccsens.tcm.bean.dto.CodeVo; |
|||
import com.ccsens.tcm.bean.vo.InpatientVo; |
|||
import com.ccsens.tcm.bean.vo.QuestionVo; |
|||
import com.ccsens.tcm.service.IInpatientService; |
|||
import com.ccsens.util.JsonResponse; |
|||
import com.ccsens.util.bean.dto.QueryDto; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiImplicitParams; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RequestMethod; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Api(tags = "对照组相关接口") |
|||
@RestController |
|||
@RequestMapping("/inpatient") |
|||
public class InpatientController { |
|||
@Resource |
|||
private IInpatientService inpatientService; |
|||
|
|||
@ApiOperation(value = "查询所有对照组的信息",notes = "") |
|||
@ApiImplicitParams({}) |
|||
@RequestMapping(value="/query",method = RequestMethod.POST,produces = {"application/json;charset=UTF-8"}) |
|||
public JsonResponse<List<InpatientVo.InpatientInfo>> queryInpatient() throws Exception { |
|||
List<InpatientVo.InpatientInfo> inpatientInfos = inpatientService.queryInpatient(); |
|||
return JsonResponse.newInstance().ok(inpatientInfos); |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.ccsens.tcm.bean.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Data |
|||
public class QuestionDto { |
|||
@Data |
|||
@ApiModel("查询患者答题信息及答案") |
|||
public static class QueryQuestionAndAnswer { |
|||
@ApiModelProperty("试题code") |
|||
private String code; |
|||
@ApiModelProperty("第几次录入信息,1代表第0天或180天,2代表第14天或者第365天,3代表第90天") |
|||
private int nums; |
|||
} |
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.ccsens.tcm.bean.vo; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public class InpatientVo { |
|||
@Data |
|||
@ApiModel("查询所有对照组信息") |
|||
public static class InpatientInfo{ |
|||
@ApiModelProperty("对照组id") |
|||
private Long id; |
|||
@ApiModelProperty("名称") |
|||
private String name; |
|||
@ApiModelProperty("备注") |
|||
private String remarks; |
|||
@ApiModelProperty("采集次数") |
|||
private int collectionNum; |
|||
} |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.ccsens.tcm.service; |
|||
|
|||
import com.ccsens.tcm.bean.vo.InpatientVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
public interface IInpatientService { |
|||
|
|||
/** |
|||
* 查看所有对照组 |
|||
* @return 返回对照组信息 |
|||
*/ |
|||
List<InpatientVo.InpatientInfo> queryInpatient(); |
|||
|
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.ccsens.tcm.service; |
|||
|
|||
import cn.hutool.core.bean.BeanUtil; |
|||
import com.ccsens.tcm.bean.po.Inpatient; |
|||
import com.ccsens.tcm.bean.po.InpatientExample; |
|||
import com.ccsens.tcm.bean.vo.InpatientVo; |
|||
import com.ccsens.tcm.persist.mapper.InpatientMapper; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Propagation; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import javax.annotation.Resource; |
|||
import java.util.ArrayList; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
/** |
|||
* @author 逗 |
|||
*/ |
|||
@Slf4j |
|||
@Service |
|||
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
|||
public class InpatientService implements IInpatientService{ |
|||
@Resource |
|||
private InpatientMapper inpatientMapper; |
|||
|
|||
@Override |
|||
public List<InpatientVo.InpatientInfo> queryInpatient() { |
|||
List<InpatientVo.InpatientInfo> inpatientInfos = new ArrayList<>(); |
|||
|
|||
InpatientExample inpatientExample = new InpatientExample(); |
|||
inpatientExample.clear(); |
|||
List<Inpatient> inpatients = inpatientMapper.selectByExample(inpatientExample); |
|||
inpatients.forEach(inpatient -> { |
|||
InpatientVo.InpatientInfo inpatientInfo = new InpatientVo.InpatientInfo(); |
|||
BeanUtil.copyProperties(inpatient,inpatientInfo); |
|||
inpatientInfos.add(inpatientInfo); |
|||
}); |
|||
return inpatientInfos; |
|||
} |
|||
} |
@ -1,6 +1,5 @@ |
|||
spring: |
|||
profiles: |
|||
active: dev |
|||
include: common, util-dev |
|||
|
|||
active: test |
|||
include: common, util-test |
|||
|
|||
|
Loading…
Reference in new issue