Browse Source

question 查询报告单和生成报告单

sd
zhizhi wu 3 years ago
parent
commit
244b0ae5cf
  1. 6
      question/src/main/java/com/ccsens/question/api/PatientReportController.java
  2. 4
      question/src/main/java/com/ccsens/question/bean/dto/PatientReportDto.java
  3. 11
      question/src/main/java/com/ccsens/question/bean/po/HtPatientReport.java
  4. 60
      question/src/main/java/com/ccsens/question/bean/po/HtPatientReportExample.java
  5. 10
      question/src/main/java/com/ccsens/question/persist/dao/HtPatientReportDao.java
  6. 31
      question/src/main/java/com/ccsens/question/service/PatientReportService.java
  7. 18
      question/src/main/resources/mapper_dao/HtPatientReportDao.xml
  8. 55
      question/src/main/resources/mapper_raw/HtPatientReportMapper.xml

6
question/src/main/java/com/ccsens/question/api/PatientReportController.java

@ -20,6 +20,7 @@ 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 javax.validation.Valid;
import java.io.IOException;
import java.util.List;
@ -35,7 +36,7 @@ import java.util.List;
@RestController
public class PatientReportController {
@Autowired
@Resource
private IPatientReportService patientReportService;
@MustLogin
@ -93,7 +94,6 @@ public class PatientReportController {
if (patientReport == null || patientReport.getPatientId() == null || patientReport.getPatientId() == 0) {
return JsonResponse.newInstance().ok(CodeEnum.PARAM_NULL);
}
//TODO 判断病友是否和当前医院绑定,未绑定,进行绑定
JsonResponse<PatientReportVo.Generate> response = patientReportService.generatePatientReport(patientReport, dto.getUserId());
log.info("生成病友报告单返回:{}", response);
return response;
@ -115,7 +115,7 @@ public class PatientReportController {
}
@MustLogin
@ApiOperation(value = "查询报告单列表",notes = "根据病人ID/医生ID查询报告单列表")
@ApiOperation(value = "查询报告单列表",notes = "根据病人ID查询报告单列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "编辑报告单信息", required = true)
})

4
question/src/main/java/com/ccsens/question/bean/dto/PatientReportDto.java

@ -45,6 +45,8 @@ public class PatientReportDto {
private Long patientId;
@ApiModelProperty("病案号")
private String serialNumber;
@ApiModelProperty("第几天 0 14 90")
private byte times = 0;
}
@ApiModel("PatientReportDtoEdit")
@ -81,6 +83,8 @@ public class PatientReportDto {
public static class QueryReports{
@ApiModelProperty("病人ID")
private Long patientId;
@ApiModelProperty("第几天 0 14 90")
private byte times = 0;
@ApiModelProperty("第几页")
@Min(value = 1)
private int pageNum = 1;

11
question/src/main/java/com/ccsens/question/bean/po/HtPatientReport.java

@ -10,6 +10,8 @@ public class HtPatientReport implements Serializable {
private Long patientId;
private Byte times;
private String patientIdcard;
private Byte patientAge;
@ -80,6 +82,14 @@ public class HtPatientReport implements Serializable {
this.patientId = patientId;
}
public Byte getTimes() {
return times;
}
public void setTimes(Byte times) {
this.times = times;
}
public String getPatientIdcard() {
return patientIdcard;
}
@ -265,6 +275,7 @@ public class HtPatientReport implements Serializable {
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", patientId=").append(patientId);
sb.append(", times=").append(times);
sb.append(", patientIdcard=").append(patientIdcard);
sb.append(", patientAge=").append(patientAge);
sb.append(", doctorId=").append(doctorId);

60
question/src/main/java/com/ccsens/question/bean/po/HtPatientReportExample.java

@ -295,6 +295,66 @@ public class HtPatientReportExample {
return (Criteria) this;
}
public Criteria andTimesIsNull() {
addCriterion("times is null");
return (Criteria) this;
}
public Criteria andTimesIsNotNull() {
addCriterion("times is not null");
return (Criteria) this;
}
public Criteria andTimesEqualTo(Byte value) {
addCriterion("times =", value, "times");
return (Criteria) this;
}
public Criteria andTimesNotEqualTo(Byte value) {
addCriterion("times <>", value, "times");
return (Criteria) this;
}
public Criteria andTimesGreaterThan(Byte value) {
addCriterion("times >", value, "times");
return (Criteria) this;
}
public Criteria andTimesGreaterThanOrEqualTo(Byte value) {
addCriterion("times >=", value, "times");
return (Criteria) this;
}
public Criteria andTimesLessThan(Byte value) {
addCriterion("times <", value, "times");
return (Criteria) this;
}
public Criteria andTimesLessThanOrEqualTo(Byte value) {
addCriterion("times <=", value, "times");
return (Criteria) this;
}
public Criteria andTimesIn(List<Byte> values) {
addCriterion("times in", values, "times");
return (Criteria) this;
}
public Criteria andTimesNotIn(List<Byte> values) {
addCriterion("times not in", values, "times");
return (Criteria) this;
}
public Criteria andTimesBetween(Byte value1, Byte value2) {
addCriterion("times between", value1, value2, "times");
return (Criteria) this;
}
public Criteria andTimesNotBetween(Byte value1, Byte value2) {
addCriterion("times not between", value1, value2, "times");
return (Criteria) this;
}
public Criteria andPatientIdcardIsNull() {
addCriterion("patient_idcard is null");
return (Criteria) this;

10
question/src/main/java/com/ccsens/question/persist/dao/HtPatientReportDao.java

@ -56,11 +56,17 @@ public interface HtPatientReportDao extends HtPatientReportMapper {
/**
* 查询报告单名字ID名字导出路径
* @param doctorId 医生ID
* @param patientId 病人ID
* @param times 第几天
* @return
*/
List<PatientReportVo.ReportName> queryReportNameByPatient( @Param("patientId") Long patientId, @Param("times") byte times);
/**
* 查询报告单名字ID名字导出路径
* @param doctorId 医生ID
* @return
*/
List<PatientReportVo.ReportName> queryReportName(@Param("doctorId") Long doctorId, @Param("patientId") Long patientId);
List<PatientReportVo.ReportName> queryReportNameByDoctor(@Param("doctorId") Long doctorId);
/**
* 管理员查询报告单

31
question/src/main/java/com/ccsens/question/service/PatientReportService.java

@ -82,7 +82,22 @@ public class PatientReportService implements IPatientReportService {
// return JsonResponse.newInstance().ok(CodeEnum.PARAM_ERROR);
// }
// 判断患者+第几次的报告单是否存在,存在,直接返回ID,否则新建
HtPatientReportExample reportExample = new HtPatientReportExample();
reportExample.createCriteria().andPatientIdEqualTo(generate.getPatientId())
.andTimesEqualTo(generate.getTimes());
reportExample.setOrderByClause("id desc limit 1");
List<HtPatientReport> htPatientReports = htPatientReportDao.selectByExample(reportExample);
log.info("有无报告单:{}", htPatientReports);
// 已添加
if (CollectionUtil.isNotEmpty(htPatientReports)) {
HtPatientReport report = htPatientReports.get(0);
PatientReportVo.Generate generateVo = new PatientReportVo.Generate();
generateVo.setId(report.getId());
generateVo.setName(report.getName());
return JsonResponse.newInstance().ok(generateVo);
}
// 未添加
HtPatientReport htPatientReport = new HtPatientReport();
htPatientReport.setId(snowflake.nextId());
// htPatientReport.setDoctorId(doctors.get(0).getId());
@ -93,6 +108,7 @@ public class PatientReportService implements IPatientReportService {
htPatientReport.setEvaluationCode(Constant.Ht.Report.PARENT_CODE);
htPatientReport.setName(Constant.Ht.Report.PARENT_NAME + DateUtil.today());
htPatientReport.setReportTime(System.currentTimeMillis());
htPatientReport.setTimes(generate.getTimes());
// 查询医院信息
// String hospital = htPositionDao.queryHospital(doctors.get(0).getPositionId());
// htPatientReport.setHospital(hospital);
@ -174,19 +190,17 @@ public class PatientReportService implements IPatientReportService {
List<HtDoctor> doctors = htDoctorDao.selectByExample(doctorExample);
log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors));
// 获取医生ID和病人ID
Long patientId = null;
Long doctorId = null;
Long patientId;
if (query.getPatientId() != null) {
patientId = query.getPatientId();
} else if (CollectionUtil.isNotEmpty(doctors)) {
doctorId = doctors.get(0).getId();
} else {
log.info("既无病人信息,有无医生信息,不允许查询");
throw new BaseException(CodeEnum.PARAM_ERROR);
}
//分页查询报告单列表
PageHelper.startPage(query.getPageNum(), query.getPageSize());
List<PatientReportVo.ReportName> reportVos = htPatientReportDao.queryReportName(doctorId, patientId);
List<PatientReportVo.ReportName> reportVos = htPatientReportDao.queryReportNameByPatient(patientId, query.getTimes());
// if (CollectionUtils.isEmpty(reportVos)) {
// return new PageInfo<>(reportVos);
// }
@ -484,10 +498,7 @@ public class PatientReportService implements IPatientReportService {
}
// 查询该医生报告单
PageHelper.startPage(param.getPageNum(), param.getPageSize());
HtPatientReportExample reportExample = new HtPatientReportExample();
reportExample.createCriteria().andDoctorIdEqualTo(param.getId()).andShowStatusEqualTo(Constant.Ht.Report.SHOW_HISTORY);
reportExample.setOrderByClause("create_time desc");
List<PatientReportVo.ReportName> reports = htPatientReportDao.queryReportName(param.getId(), null);
List<PatientReportVo.ReportName> reports = htPatientReportDao.queryReportNameByDoctor(param.getId());
if (CollectionUtils.isEmpty(reports)) {
log.info("未查询到报告单");
return new PageInfo<>(reports);

18
question/src/main/resources/mapper_dao/HtPatientReportDao.xml

@ -87,7 +87,20 @@
where id = #{id, jdbcType=BIGINT} and complete_status = 0 and is_del = 0 and doctor_id in
(select doctor_id from t_ht_doctor where user_id = #{userId, jdbcType=BIGINT} and audit_state = 1 and is_del = 0)
</select>
<select id="queryReportName" resultType="com.ccsens.question.bean.vo.PatientReportVo$ReportName">
<select id="queryReportNameByPatient" resultType="com.ccsens.question.bean.vo.PatientReportVo$ReportName">
select id, name, url, doctor_id as doctorId, 0 as authority from t_ht_patient_report
<where>
<if test="patientId != null">
and patient_id = #{patientId, jdbcType=BIGINT}
</if>
<if test="times != null">
and times = #{times}
</if>
and is_del = 0
</where>
order by create_time desc
</select>
<select id="queryReportNameByDoctor" resultType="com.ccsens.question.bean.vo.PatientReportVo$ReportName">
select id, name, url, doctor_id as doctorId, 0 as authority from t_ht_patient_report
<where>
<if test="doctorId != null">
@ -96,6 +109,9 @@
<if test="patientId != null">
and patient_id = #{patientId, jdbcType=BIGINT}
</if>
<if test="times != null">
and times = #{times}
</if>
and show_status = 1
and is_del = 0
</where>

55
question/src/main/resources/mapper_raw/HtPatientReportMapper.xml

@ -5,6 +5,7 @@
<id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="patient_id" jdbcType="BIGINT" property="patientId" />
<result column="times" jdbcType="TINYINT" property="times" />
<result column="patient_idcard" jdbcType="VARCHAR" property="patientIdcard" />
<result column="patient_age" jdbcType="TINYINT" property="patientAge" />
<result column="doctor_id" jdbcType="BIGINT" property="doctorId" />
@ -87,10 +88,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, patient_id, patient_idcard, patient_age, doctor_id, serial_number, initial_impression,
clinical_diagnosis, pasi, department, bed_number, report_time, check_time, evaluation_code,
url, qr_code_url, remark, create_time, update_time, is_del, show_status, hospital,
complete_status, user_id
id, name, patient_id, times, patient_idcard, patient_age, doctor_id, serial_number,
initial_impression, clinical_diagnosis, pasi, department, bed_number, report_time,
check_time, evaluation_code, url, qr_code_url, remark, create_time, update_time,
is_del, show_status, hospital, complete_status, user_id
</sql>
<select id="selectByExample" parameterType="com.ccsens.question.bean.po.HtPatientReportExample" resultMap="BaseResultMap">
select
@ -124,23 +125,23 @@
</delete>
<insert id="insert" parameterType="com.ccsens.question.bean.po.HtPatientReport">
insert into t_ht_patient_report (id, name, patient_id,
patient_idcard, patient_age, doctor_id,
serial_number, initial_impression, clinical_diagnosis,
pasi, department, bed_number,
report_time, check_time, evaluation_code,
url, qr_code_url, remark,
create_time, update_time, is_del,
show_status, hospital, complete_status,
user_id)
times, patient_idcard, patient_age,
doctor_id, serial_number, initial_impression,
clinical_diagnosis, pasi, department,
bed_number, report_time, check_time,
evaluation_code, url, qr_code_url,
remark, create_time, update_time,
is_del, show_status, hospital,
complete_status, user_id)
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{patientId,jdbcType=BIGINT},
#{patientIdcard,jdbcType=VARCHAR}, #{patientAge,jdbcType=TINYINT}, #{doctorId,jdbcType=BIGINT},
#{serialNumber,jdbcType=VARCHAR}, #{initialImpression,jdbcType=VARCHAR}, #{clinicalDiagnosis,jdbcType=VARCHAR},
#{pasi,jdbcType=TINYINT}, #{department,jdbcType=VARCHAR}, #{bedNumber,jdbcType=VARCHAR},
#{reportTime,jdbcType=BIGINT}, #{checkTime,jdbcType=BIGINT}, #{evaluationCode,jdbcType=VARCHAR},
#{url,jdbcType=VARCHAR}, #{qrCodeUrl,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, #{isDel,jdbcType=TINYINT},
#{showStatus,jdbcType=TINYINT}, #{hospital,jdbcType=VARCHAR}, #{completeStatus,jdbcType=TINYINT},
#{userId,jdbcType=BIGINT})
#{times,jdbcType=TINYINT}, #{patientIdcard,jdbcType=VARCHAR}, #{patientAge,jdbcType=TINYINT},
#{doctorId,jdbcType=BIGINT}, #{serialNumber,jdbcType=VARCHAR}, #{initialImpression,jdbcType=VARCHAR},
#{clinicalDiagnosis,jdbcType=VARCHAR}, #{pasi,jdbcType=TINYINT}, #{department,jdbcType=VARCHAR},
#{bedNumber,jdbcType=VARCHAR}, #{reportTime,jdbcType=BIGINT}, #{checkTime,jdbcType=BIGINT},
#{evaluationCode,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{qrCodeUrl,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
#{isDel,jdbcType=TINYINT}, #{showStatus,jdbcType=TINYINT}, #{hospital,jdbcType=VARCHAR},
#{completeStatus,jdbcType=TINYINT}, #{userId,jdbcType=BIGINT})
</insert>
<insert id="insertSelective" parameterType="com.ccsens.question.bean.po.HtPatientReport">
insert into t_ht_patient_report
@ -154,6 +155,9 @@
<if test="patientId != null">
patient_id,
</if>
<if test="times != null">
times,
</if>
<if test="patientIdcard != null">
patient_idcard,
</if>
@ -231,6 +235,9 @@
<if test="patientId != null">
#{patientId,jdbcType=BIGINT},
</if>
<if test="times != null">
#{times,jdbcType=TINYINT},
</if>
<if test="patientIdcard != null">
#{patientIdcard,jdbcType=VARCHAR},
</if>
@ -317,6 +324,9 @@
<if test="record.patientId != null">
patient_id = #{record.patientId,jdbcType=BIGINT},
</if>
<if test="record.times != null">
times = #{record.times,jdbcType=TINYINT},
</if>
<if test="record.patientIdcard != null">
patient_idcard = #{record.patientIdcard,jdbcType=VARCHAR},
</if>
@ -393,6 +403,7 @@
set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR},
patient_id = #{record.patientId,jdbcType=BIGINT},
times = #{record.times,jdbcType=TINYINT},
patient_idcard = #{record.patientIdcard,jdbcType=VARCHAR},
patient_age = #{record.patientAge,jdbcType=TINYINT},
doctor_id = #{record.doctorId,jdbcType=BIGINT},
@ -428,6 +439,9 @@
<if test="patientId != null">
patient_id = #{patientId,jdbcType=BIGINT},
</if>
<if test="times != null">
times = #{times,jdbcType=TINYINT},
</if>
<if test="patientIdcard != null">
patient_idcard = #{patientIdcard,jdbcType=VARCHAR},
</if>
@ -501,6 +515,7 @@
update t_ht_patient_report
set name = #{name,jdbcType=VARCHAR},
patient_id = #{patientId,jdbcType=BIGINT},
times = #{times,jdbcType=TINYINT},
patient_idcard = #{patientIdcard,jdbcType=VARCHAR},
patient_age = #{patientAge,jdbcType=TINYINT},
doctor_id = #{doctorId,jdbcType=BIGINT},

Loading…
Cancel
Save