Browse Source

提交病例搜索修改sql

recovery
wang1007152140 5 years ago
parent
commit
ea5baebc8f
  1. 9
      tcm/src/main/java/com/ccsens/tcm/bean/dto/PatientDto.java
  2. 17
      tcm/src/main/resources/mapper_dao/PatientDao.xml

9
tcm/src/main/java/com/ccsens/tcm/bean/dto/PatientDto.java

@ -87,6 +87,15 @@ public class PatientDto {
@Data @Data
@ApiModel("查询患者的搜索条件集合") @ApiModel("查询患者的搜索条件集合")
public static class SelPatlenConditionList{ public static class SelPatlenConditionList{
@ApiModelProperty("医院id")
private Long hospitalId;
@ApiModelProperty("录入状态")
private Byte inputStatus;
@ApiModelProperty("对照组id")
private Long inpatientId;
@ApiModelProperty("住院号")
private String hospitalization="";
@ApiModelProperty("搜索条件集合,不包含时间格式的条件") @ApiModelProperty("搜索条件集合,不包含时间格式的条件")
private List<Condition> conditionList; private List<Condition> conditionList;
@ApiModelProperty("搜索条件集合,是包含时间格式的条件") @ApiModelProperty("搜索条件集合,是包含时间格式的条件")

17
tcm/src/main/resources/mapper_dao/PatientDao.xml

@ -50,6 +50,19 @@
t_patient_information tpi left join t_inpatient ti on ti.rec_status=0 and ti.id=tpi.inpatient_id t_patient_information tpi left join t_inpatient ti on ti.rec_status=0 and ti.id=tpi.inpatient_id
WHERE WHERE
tpi.rec_status = 0 tpi.rec_status = 0
<if test="hospitalId!=null and hospitalId !=0 ">
and tpi.hospital_id=#{hospitalId}
</if>
<if test="hospitalization!=null and hospitalization!=''">
and tpi.hospitalization like concat('%',#{hospitalization},'%')
</if>
<if test="inpatientId !=null and inpatientId!=0">
and tpi.inpatient_id=#{inpatientId}
</if>
<if test="inputStatus !=null">
and tpi.input_status=#{inputStatus}
</if>
<if test="conditionList!=null and conditionList.size()!=0 and conditionListDate!=null and conditionListDate.size() !=0">
AND tpi.id IN ( AND tpi.id IN (
SELECT DISTINCT SELECT DISTINCT
( t.patient_id ) ( t.patient_id )
@ -82,6 +95,7 @@
</trim> </trim>
) t ) t
) )
</if>>
</select> </select>
<select id="selPatientInformationList" resultType="com.ccsens.tcm.bean.vo.PatientVo$SelPatient"> <select id="selPatientInformationList" resultType="com.ccsens.tcm.bean.vo.PatientVo$SelPatient">
SELECT SELECT
@ -130,7 +144,6 @@
and tpi.update_at &lt; #{param.endDate} and tpi.update_at &lt; #{param.endDate}
</if> </if>
</select> </select>
<<<<<<< HEAD
<select id="countAnalysis" resultType="com.ccsens.tcm.bean.vo.StatisticVo$SelGroupList"> <select id="countAnalysis" resultType="com.ccsens.tcm.bean.vo.StatisticVo$SelGroupList">
select if(LOCATE('其他'),'其他',tpr.contents) as content,count(*) as nums from t_patient_information tpi left join t_patient_record tpr on tpi.id=tpr.patient_id and tpr.rec_status=0 select if(LOCATE('其他'),'其他',tpr.contents) as content,count(*) as nums from t_patient_information tpi left join t_patient_record tpr on tpi.id=tpr.patient_id and tpr.rec_status=0
where tpi.rec_status=0 where tpi.rec_status=0
@ -181,7 +194,7 @@
<if test="id!=null and id!=0"> <if test="id!=null and id!=0">
group by content group by content
</if> </if>
======= </select>
<select id="statisticsComplete" resultType="com.ccsens.tcm.bean.vo.StatisticVo$StatisticsComplete"> <select id="statisticsComplete" resultType="com.ccsens.tcm.bean.vo.StatisticVo$StatisticsComplete">
SELECT SELECT
MAX(CASE t.input_status WHEN 0 THEN nums ELSE 0 END ) unfinished, MAX(CASE t.input_status WHEN 0 THEN nums ELSE 0 END ) unfinished,

Loading…
Cancel
Save