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.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
@ -35,7 +36,7 @@ import java.util.List;
@RestController @RestController
public class PatientReportController { public class PatientReportController {
@Autowired @Resource
private IPatientReportService patientReportService; private IPatientReportService patientReportService;
@MustLogin @MustLogin
@ -93,7 +94,6 @@ public class PatientReportController {
if (patientReport == null || patientReport.getPatientId() == null || patientReport.getPatientId() == 0) { if (patientReport == null || patientReport.getPatientId() == null || patientReport.getPatientId() == 0) {
return JsonResponse.newInstance().ok(CodeEnum.PARAM_NULL); return JsonResponse.newInstance().ok(CodeEnum.PARAM_NULL);
} }
//TODO 判断病友是否和当前医院绑定,未绑定,进行绑定
JsonResponse<PatientReportVo.Generate> response = patientReportService.generatePatientReport(patientReport, dto.getUserId()); JsonResponse<PatientReportVo.Generate> response = patientReportService.generatePatientReport(patientReport, dto.getUserId());
log.info("生成病友报告单返回:{}", response); log.info("生成病友报告单返回:{}", response);
return response; return response;
@ -115,7 +115,7 @@ public class PatientReportController {
} }
@MustLogin @MustLogin
@ApiOperation(value = "查询报告单列表",notes = "根据病人ID/医生ID查询报告单列表") @ApiOperation(value = "查询报告单列表",notes = "根据病人ID查询报告单列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(name = "json", value = "编辑报告单信息", required = true) @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; private Long patientId;
@ApiModelProperty("病案号") @ApiModelProperty("病案号")
private String serialNumber; private String serialNumber;
@ApiModelProperty("第几天 0 14 90")
private byte times = 0;
} }
@ApiModel("PatientReportDtoEdit") @ApiModel("PatientReportDtoEdit")
@ -81,6 +83,8 @@ public class PatientReportDto {
public static class QueryReports{ public static class QueryReports{
@ApiModelProperty("病人ID") @ApiModelProperty("病人ID")
private Long patientId; private Long patientId;
@ApiModelProperty("第几天 0 14 90")
private byte times = 0;
@ApiModelProperty("第几页") @ApiModelProperty("第几页")
@Min(value = 1) @Min(value = 1)
private int pageNum = 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 Long patientId;
private Byte times;
private String patientIdcard; private String patientIdcard;
private Byte patientAge; private Byte patientAge;
@ -80,6 +82,14 @@ public class HtPatientReport implements Serializable {
this.patientId = patientId; this.patientId = patientId;
} }
public Byte getTimes() {
return times;
}
public void setTimes(Byte times) {
this.times = times;
}
public String getPatientIdcard() { public String getPatientIdcard() {
return patientIdcard; return patientIdcard;
} }
@ -265,6 +275,7 @@ public class HtPatientReport implements Serializable {
sb.append(", id=").append(id); sb.append(", id=").append(id);
sb.append(", name=").append(name); sb.append(", name=").append(name);
sb.append(", patientId=").append(patientId); sb.append(", patientId=").append(patientId);
sb.append(", times=").append(times);
sb.append(", patientIdcard=").append(patientIdcard); sb.append(", patientIdcard=").append(patientIdcard);
sb.append(", patientAge=").append(patientAge); sb.append(", patientAge=").append(patientAge);
sb.append(", doctorId=").append(doctorId); 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; 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() { public Criteria andPatientIdcardIsNull() {
addCriterion("patient_idcard is null"); addCriterion("patient_idcard is null");
return (Criteria) this; 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名字导出路径 * 查询报告单名字ID名字导出路径
* @param doctorId 医生ID
* @param patientId 病人ID * @param patientId 病人ID
* @param times 第几天
* @return
*/
List<PatientReportVo.ReportName> queryReportNameByPatient( @Param("patientId") Long patientId, @Param("times") byte times);
/**
* 查询报告单名字ID名字导出路径
* @param doctorId 医生ID
* @return * @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); // 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 htPatientReport = new HtPatientReport();
htPatientReport.setId(snowflake.nextId()); htPatientReport.setId(snowflake.nextId());
// htPatientReport.setDoctorId(doctors.get(0).getId()); // htPatientReport.setDoctorId(doctors.get(0).getId());
@ -93,6 +108,7 @@ public class PatientReportService implements IPatientReportService {
htPatientReport.setEvaluationCode(Constant.Ht.Report.PARENT_CODE); htPatientReport.setEvaluationCode(Constant.Ht.Report.PARENT_CODE);
htPatientReport.setName(Constant.Ht.Report.PARENT_NAME + DateUtil.today()); htPatientReport.setName(Constant.Ht.Report.PARENT_NAME + DateUtil.today());
htPatientReport.setReportTime(System.currentTimeMillis()); htPatientReport.setReportTime(System.currentTimeMillis());
htPatientReport.setTimes(generate.getTimes());
// 查询医院信息 // 查询医院信息
// String hospital = htPositionDao.queryHospital(doctors.get(0).getPositionId()); // String hospital = htPositionDao.queryHospital(doctors.get(0).getPositionId());
// htPatientReport.setHospital(hospital); // htPatientReport.setHospital(hospital);
@ -174,19 +190,17 @@ public class PatientReportService implements IPatientReportService {
List<HtDoctor> doctors = htDoctorDao.selectByExample(doctorExample); List<HtDoctor> doctors = htDoctorDao.selectByExample(doctorExample);
log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors)); log.info("当前用户是否为医生:{}", CollectionUtil.isNotEmpty(doctors));
// 获取医生ID和病人ID // 获取医生ID和病人ID
Long patientId = null; Long patientId;
Long doctorId = null;
if (query.getPatientId() != null) { if (query.getPatientId() != null) {
patientId = query.getPatientId(); patientId = query.getPatientId();
} else if (CollectionUtil.isNotEmpty(doctors)) {
doctorId = doctors.get(0).getId();
} else { } else {
log.info("既无病人信息,有无医生信息,不允许查询"); log.info("既无病人信息,有无医生信息,不允许查询");
throw new BaseException(CodeEnum.PARAM_ERROR); throw new BaseException(CodeEnum.PARAM_ERROR);
} }
//分页查询报告单列表 //分页查询报告单列表
PageHelper.startPage(query.getPageNum(), query.getPageSize()); 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)) { // if (CollectionUtils.isEmpty(reportVos)) {
// return new PageInfo<>(reportVos); // return new PageInfo<>(reportVos);
// } // }
@ -484,10 +498,7 @@ public class PatientReportService implements IPatientReportService {
} }
// 查询该医生报告单 // 查询该医生报告单
PageHelper.startPage(param.getPageNum(), param.getPageSize()); PageHelper.startPage(param.getPageNum(), param.getPageSize());
HtPatientReportExample reportExample = new HtPatientReportExample(); List<PatientReportVo.ReportName> reports = htPatientReportDao.queryReportNameByDoctor(param.getId());
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);
if (CollectionUtils.isEmpty(reports)) { if (CollectionUtils.isEmpty(reports)) {
log.info("未查询到报告单"); log.info("未查询到报告单");
return new PageInfo<>(reports); 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 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 doctor_id from t_ht_doctor where user_id = #{userId, jdbcType=BIGINT} and audit_state = 1 and is_del = 0)
</select> </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 select id, name, url, doctor_id as doctorId, 0 as authority from t_ht_patient_report
<where> <where>
<if test="doctorId != null"> <if test="doctorId != null">
@ -96,6 +109,9 @@
<if test="patientId != null"> <if test="patientId != null">
and patient_id = #{patientId, jdbcType=BIGINT} and patient_id = #{patientId, jdbcType=BIGINT}
</if> </if>
<if test="times != null">
and times = #{times}
</if>
and show_status = 1 and show_status = 1
and is_del = 0 and is_del = 0
</where> </where>

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

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

Loading…
Cancel
Save