Commit 32c1c909 authored by 吴霞's avatar 吴霞

缓存和修改sql

parent 50827879
...@@ -195,5 +195,10 @@ public class DataPlatController { ...@@ -195,5 +195,10 @@ public class DataPlatController {
} }
} }
@GetMapping("/name")
public Object getnamelist() {
return dataPlatService.getnamDtos();
}
} }
package com.sict.data.dto;
import lombok.Data;
@Data
public class NameDTO {
private Integer id;
private String name;
}
...@@ -79,4 +79,7 @@ public interface DataPlatMapper extends BaseMapper<DataPlat> { ...@@ -79,4 +79,7 @@ public interface DataPlatMapper extends BaseMapper<DataPlat> {
* @return com.sict.data.dto.HospStatisticsDTO * @return com.sict.data.dto.HospStatisticsDTO
*/ */
HospStatisticsDTO getHospStatistics(); HospStatisticsDTO getHospStatistics();
List<NameDTO> getNameDTOs();
} }
...@@ -83,4 +83,6 @@ public interface IDataPlatService extends IService<DataPlat> { ...@@ -83,4 +83,6 @@ public interface IDataPlatService extends IService<DataPlat> {
* @return com.sict.data.dto.HospStatisticsDTO * @return com.sict.data.dto.HospStatisticsDTO
*/ */
HospStatisticsDTO getHospStatistics(); HospStatisticsDTO getHospStatistics();
List<NameDTO> getnamDtos();
} }
...@@ -224,4 +224,11 @@ public class DataPlatServiceImpl extends ServiceImpl<DataPlatMapper, DataPlat> i ...@@ -224,4 +224,11 @@ public class DataPlatServiceImpl extends ServiceImpl<DataPlatMapper, DataPlat> i
} }
} }
@Cacheable(cacheNames = {"getnamDtos"})
@Override
public List<NameDTO> getnamDtos() {
// TODO Auto-generated method stub
return dataPlatMapper.getNameDTOs();
}
} }
...@@ -2,20 +2,13 @@ ...@@ -2,20 +2,13 @@
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
updateCheck="false"> updateCheck="false">
<defaultCache
eternal="false"
maxElementsInMemory="10000"
overflowToDisk="false"
timeToIdleSeconds="300"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getScreeningRank" name="getScreeningRank"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
...@@ -23,10 +16,10 @@ ...@@ -23,10 +16,10 @@
<cache <cache
name="getScreeningRankEn" name="getScreeningRankEn"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
...@@ -34,73 +27,82 @@ ...@@ -34,73 +27,82 @@
<cache <cache
name="getSerumStatistics" name="getSerumStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getGastroscopyStatistics" name="getGastroscopyStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getScreeningStatistics" name="getScreeningStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getGastroscopyDetailResultStatistics" name="getGastroscopyDetailResultStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getRiskAssessStatistics" name="getRiskAssessStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getGastroscopyDetailStatistics" name="getGastroscopyDetailStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getHospStatistics" name="getHospStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getComplexStatistics" name="getComplexStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false"
diskPersistent="false"
timeToIdleSeconds="3600"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" />
<cache
name="getnamDtos"
eternal="false"
maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="6"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
</ehcache> </ehcache>
\ No newline at end of file
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
<mapper namespace="com.sict.data.mapper.DataPlatMapper"> <mapper namespace="com.sict.data.mapper.DataPlatMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.sict.data.model.DataPlat"> <resultMap id="BaseResultMap"
<id column="id" property="id"/> type="com.sict.data.model.DataPlat">
<result column="name" property="name"/> <id column="id" property="id" />
<result column="name" property="name" />
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
...@@ -14,263 +15,89 @@ ...@@ -14,263 +15,89 @@
</sql> </sql>
<!-- 获取各医联体下筛查人数排行榜 --> <!-- 获取各医联体下筛查人数排行榜 -->
<select id="getHospScreeningRank" resultType="com.sict.data.dto.HospScreeningDTO"> <select id="getHospScreeningRank"
resultType="com.sict.data.dto.HospScreeningDTO">
SELECT SELECT
hospNum, hospNum,
hospName, hospName,
count( * ) hospScreeningTotal, count( * ) hospScreeningTotal,
count( screeningStatus = 1 OR NULL ) hospApplyScreeningTotal count( NULL ) hospApplyScreeningTotal
FROM FROM
( (
SELECT SELECT
p.id patientId, p.id patientId,
p.hosp_number,
p.`name` patientName, p.`name` patientName,
rel5.number hospNum, rel1.number hospNum,
rel5.`name` hospName, rel1.`name`
CASE hospName
rel1.igg
WHEN 1 THEN
'阳性'
WHEN 0 THEN
'阴性' ELSE ''
END iggDetection,
CASE
rel2.grade
WHEN 1 THEN
'低风险'
WHEN 2 THEN
'中风险'
WHEN 3 THEN
'高风险' ELSE ''
END riskLevel,
CASE
rel3.is_inspect
WHEN 1 THEN
'是'
WHEN 0 THEN
'否' ELSE '否'
END isGastroscopy,
rel3.inspect_way gastroscopyWay,
CASE
rel3.capsule
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见异常' ELSE ''
END gastroscopyResult,
rel3.precise_way gastroscopyDetailWay,
CASE
rel3.diagnose_result
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见明显异常' ELSE ''
END gastroscopyDetailResult,
rel3.diagnose_info gastroscopyDetailInfo,
CASE
rel4.continue_flup
WHEN 1 THEN
'继续随访'
WHEN 0 THEN
'停止随访' ELSE ''
END isContinueFlup,
rel4.content_type planFlupContent,
rel1.`status` screeningStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel1 ON rel1.patient_id = p.id INNER JOIN ( SELECT number, `name` FROM
RIGHT JOIN ( SELECT patient_id, step, score, grade, `status` FROM tb_risk_assess WHERE `status` NOT IN ( 0, 5 ) ) rel2 ON rel2.patient_id = p.id tb_hosp ) rel1 ON rel1.number = p.hosp_number
AND rel2.step = rel1.step WHERE p.step=0
AND rel2.`status` = rel1.`status`
LEFT JOIN (
SELECT
patient_id,
step,
is_inspect,
inspect_way,
capsule,
precise_way,
diagnose_result,
diagnose_info,
`status`
FROM
tb_gastro_inspect
WHERE
`status` NOT IN ( 0, 5 )
) rel3 ON rel3.patient_id = p.id
AND rel3.step = rel2.step
AND rel3.`status` = rel2.`status`
LEFT JOIN ( SELECT patient_id, step, continue_flup, content_type, `status` FROM tb_flup_plan WHERE `status` NOT IN ( 0, 5 ) ) rel4 ON rel4.patient_id = p.id
AND rel4.step = rel3.step
AND rel4.`status` = rel3.`status`
INNER JOIN ( SELECT number, `name` FROM tb_hosp ) rel5 ON rel5.number = p.hosp_number
) rel ) rel
GROUP BY GROUP
BY
hospName hospName
ORDER BY ORDER BY
hospScreeningTotal DESC hospScreeningTotal DESC
</select> </select>
<!-- 获取各医联体下筛查人数排行榜 英文 -->
<select id="getHospScreeningRankEn"
resultType="com.sict.data.dto.HospScreeningDTO">
<!-- 获取各医联体下筛查人数排行榜 英文-->
<select id="getHospScreeningRankEn" resultType="com.sict.data.dto.HospScreeningDTO">
SELECT SELECT
hospNum, hospNum,
ehospName hospName, ehospName hospName,
count( * ) hospScreeningTotal, count( * )
count( screeningStatus = 1 OR NULL ) hospApplyScreeningTotal hospScreeningTotal,
count( NULL ) hospApplyScreeningTotal
FROM FROM
( (
SELECT SELECT
p.id patientId, p.id patientId,
p.hosp_number,
p.`name` patientName, p.`name` patientName,
rel5.number hospNum, rel1.number hospNum,
rel5.name hospName,rel5.ename ehospName, rel1.`name` hospName,
CASE rel1.ename ehospName
rel1.igg
WHEN 1 THEN
'阳性'
WHEN 0 THEN
'阴性' ELSE ''
END iggDetection,
CASE
rel2.grade
WHEN 1 THEN
'低风险'
WHEN 2 THEN
'中风险'
WHEN 3 THEN
'高风险' ELSE ''
END riskLevel,
CASE
rel3.is_inspect
WHEN 1 THEN
'是'
WHEN 0 THEN
'否' ELSE '否'
END isGastroscopy,
rel3.inspect_way gastroscopyWay,
CASE
rel3.capsule
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见异常' ELSE ''
END gastroscopyResult,
rel3.precise_way gastroscopyDetailWay,
CASE
rel3.diagnose_result
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见明显异常' ELSE ''
END gastroscopyDetailResult,
rel3.diagnose_info gastroscopyDetailInfo,
CASE
rel4.continue_flup
WHEN 1 THEN
'继续随访'
WHEN 0 THEN
'停止随访' ELSE ''
END isContinueFlup,
rel4.content_type planFlupContent,
rel1.`status` screeningStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel1 ON rel1.patient_id = p.id INNER JOIN (
RIGHT JOIN ( SELECT patient_id, step, score, grade, `status` FROM tb_risk_assess WHERE `status` NOT IN ( 0, 5 ) ) rel2 ON rel2.patient_id = p.id SELECT number, `name`,ename FROM tb_hosp_en ) rel1 ON rel1.number =
AND rel2.step = rel1.step p.hosp_number
AND rel2.`status` = rel1.`status` WHERE p.step=0
LEFT JOIN (
SELECT
patient_id,
step,
is_inspect,
inspect_way,
capsule,
precise_way,
diagnose_result,
diagnose_info,
`status`
FROM
tb_gastro_inspect
WHERE
`status` NOT IN ( 0, 5 )
) rel3 ON rel3.patient_id = p.id
AND rel3.step = rel2.step
AND rel3.`status` = rel2.`status`
LEFT JOIN ( SELECT patient_id, step, continue_flup, content_type, `status` FROM tb_flup_plan WHERE `status` NOT IN ( 0, 5 ) ) rel4 ON rel4.patient_id = p.id
AND rel4.step = rel3.step
AND rel4.`status` = rel3.`status`
INNER JOIN ( SELECT number,`name`, ename FROM tb_hosp_en ) rel5 ON rel5.number = p.hosp_number
) rel ) rel
GROUP BY GROUP BY
hospName hospName
ORDER BY ORDER BY
hospScreeningTotal DESC hospScreeningTotal DESC LIMIT 30
</select> </select>
<!-- 获取各省份血检人次统计结果 --> <!-- 获取各省份血检人次统计结果 -->
<select id="getProvinceSerumStatistics" resultType="com.sict.data.dto.ProvinceSerumDTO"> <select id="getProvinceSerumStatistics"
resultType="com.sict.data.dto.ProvinceSerumDTO">
SELECT SELECT
provinceName, provinceName,
sum( serumTestPlan + serumTestActual ) serumTestTotal, sum( serumTestPlan + serumTestActual )
serumTestTotal,
sum( serumTestPlan ) serumTestPlan, sum( serumTestPlan ) serumTestPlan,
sum( serumTestActual ) serumTestActual, sum( serumTestActual
) serumTestActual,
sum( iggPositive ) iggPositive, sum( iggPositive ) iggPositive,
sum( earlyCancer ) earlyCancer sum( earlyCancer )
earlyCancer
FROM FROM
( (
(
SELECT
provinceName,
count( * ) serumTestPlan,
count( NULL ) serumTestActual,
count( NULL ) iggPositive,
count( NULL ) earlyCancer
FROM
(
SELECT
p.id patientId,
rel3.area provinceName,
rel1.step planFlupStep,
CASE
rel1.continue_flup
WHEN 1 THEN
'继续随访'
WHEN 0 THEN
'停止随访' ELSE ''
END isContinueFlup,
rel1.content_type planFlupContent,
rel1.`status` planFlupAuditStatus
FROM
tb_patient p
RIGHT JOIN ( SELECT patient_id, step, continue_flup, content_type, `status` FROM tb_flup_plan WHERE continue_flup = 1 AND content_type LIKE '%b%' ) rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name`
) rel
GROUP BY
provinceName
) UNION
( (
SELECT SELECT
provinceName, provinceName,
count( NULL ) serumTestPlan, count( NULL ) serumTestPlan,
count( * ) serumTestActual, count( * ) serumTestActual,
count( iggDetection = '阳性' OR NULL ) iggPositive, count( iggDetection = '阳性' OR
NULL )
iggPositive,
count( NULL ) earlyCancer count( NULL ) earlyCancer
FROM FROM
( (
...@@ -279,7 +106,8 @@ ...@@ -279,7 +106,8 @@
rel3.area provinceName, rel3.area provinceName,
rel1.step labInspectStep, rel1.step labInspectStep,
rel1.g17 G17, rel1.g17 G17,
rel1.pg1 PG1, rel1.pg1
PG1,
rel1.pg2 PG2, rel1.pg2 PG2,
CASE CASE
rel1.igg rel1.igg
...@@ -291,9 +119,16 @@ ...@@ -291,9 +119,16 @@
rel1.`status` labInspectStatus rel1.`status` labInspectStatus
FROM FROM
tb_patient AS p tb_patient AS p
RIGHT JOIN ( SELECT patient_id, step, g17, pg1, pg2, igg, `status` FROM tb_lab_inspect ) rel1 ON rel1.patient_id = p.id INNER JOIN ( SELECT patient_id, step, g17, pg1, pg2, igg, `status`
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number FROM
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` tb_lab_inspect ) rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT
`name`, number FROM tb_hosp ) rel2 ON rel2.number =
p.hosp_number
INNER
JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON
rel3.`name`
= rel2.`name`
WHERE WHERE
rel1.`status` NOT IN ( 0, 5 ) rel1.`status` NOT IN ( 0, 5 )
) rel ) rel
...@@ -306,7 +141,9 @@ ...@@ -306,7 +141,9 @@
count( NULL ) serumTestPlan, count( NULL ) serumTestPlan,
count( NULL ) serumTestActual, count( NULL ) serumTestActual,
count( NULL ) iggPositive, count( NULL ) iggPositive,
count( gastroscopyDetailInfo LIKE '%"b":1%' OR NULL ) + count( gastroscopyDetailInfo LIKE '%"g":1%' OR NULL ) earlyCancer count(
gastroscopyDetailInfo LIKE '%"b":1%' OR NULL ) + count(
gastroscopyDetailInfo LIKE '%"g":1%' OR NULL ) earlyCancer
FROM FROM
( (
SELECT SELECT
...@@ -318,11 +155,12 @@ ...@@ -318,11 +155,12 @@
rel1.capsule gastroscopyResult, rel1.capsule gastroscopyResult,
rel1.precise_way gastroscopyDetailWay, rel1.precise_way gastroscopyDetailWay,
rel1.diagnose_result gastroscopyDetailResult, rel1.diagnose_result gastroscopyDetailResult,
rel1.diagnose_info gastroscopyDetailInfo, rel1.diagnose_info
gastroscopyDetailInfo,
rel1.`status` gastroscopyAuditStatus rel1.`status` gastroscopyAuditStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( INNER JOIN (
SELECT SELECT
patient_id, patient_id,
step, step,
...@@ -338,10 +176,16 @@ ...@@ -338,10 +176,16 @@
WHERE WHERE
is_inspect = 1 is_inspect = 1
AND `status` NOT IN ( 0, 5 ) AND `status` NOT IN ( 0, 5 )
AND diagnose_result = 1 AND
diagnose_result = 1
) rel1 ON rel1.patient_id = p.id ) rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number INNER JOIN ( SELECT
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` `name`, number FROM tb_hosp ) rel2 ON rel2.number =
p.hosp_number
LEFT
JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON
rel3.`name`
= rel2.`name`
) rel ) rel
GROUP BY GROUP BY
provinceName provinceName
...@@ -352,13 +196,17 @@ ...@@ -352,13 +196,17 @@
</select> </select>
<!-- 获取各省份胃镜检查人次统计结果 --> <!-- 获取各省份胃镜检查人次统计结果 -->
<select id="getProvinceGastroscopyStatistics" resultType="com.sict.data.dto.ProvinceGastroscopyDTO"> <select id="getProvinceGastroscopyStatistics"
resultType="com.sict.data.dto.ProvinceGastroscopyDTO">
SELECT SELECT
provinceName, provinceName,
sum( gastroscopyPlan + gastroscopyActual ) gastroscopyTotal, sum( gastroscopyPlan + gastroscopyActual
) gastroscopyTotal,
sum( gastroscopyPlan ) gastroscopyPlan, sum( gastroscopyPlan ) gastroscopyPlan,
sum( gastroscopyActual ) gastroscopyActual, sum(
sum( gastroscopyDetail ) gastroscopyDetail, gastroscopyActual ) gastroscopyActual,
sum( gastroscopyDetail )
gastroscopyDetail,
sum( earlyCancer ) earlyCancer sum( earlyCancer ) earlyCancer
FROM FROM
( (
...@@ -366,28 +214,41 @@ ...@@ -366,28 +214,41 @@
SELECT SELECT
provinceName, provinceName,
count( * ) gastroscopyPlan, count( * ) gastroscopyPlan,
count( NULL ) gastroscopyActual, count( NULL )
gastroscopyActual,
count( NULL ) gastroscopyDetail, count( NULL ) gastroscopyDetail,
count( NULL ) earlyCancer count( NULL )
earlyCancer
FROM FROM
( (
SELECT SELECT
p.id patientId, p.id patientId,
rel3.area provinceName, rel3.area provinceName,
rel1.step planFlupStep, rel1.step
planFlupStep,
CASE CASE
rel1.continue_flup rel1.continue_flup
WHEN 1 THEN WHEN 1 THEN
'继续随访' '继续随访'
WHEN 0 THEN WHEN 0 THEN
'停止随访' ELSE '' '停止随访'
ELSE ''
END isContinueFlup, END isContinueFlup,
rel1.content_type planFlupContent rel1.content_type planFlupContent
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, step, continue_flup, content_type FROM tb_flup_plan WHERE continue_flup = 1 AND content_type LIKE '%a%' ) rel1 ON rel1.patient_id = p.id RIGHT JOIN ( SELECT patient_id, step, continue_flup,
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number content_type FROM
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` tb_flup_plan WHERE continue_flup = 1 AND content_type
LIKE '%a%' )
rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT `name`,
number FROM tb_hosp ) rel2 ON rel2.number =
p.hosp_number
LEFT JOIN (
SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON
rel3.`name` =
rel2.`name`
) rel ) rel
GROUP BY GROUP BY
provinceName provinceName
...@@ -395,10 +256,14 @@ ...@@ -395,10 +256,14 @@
( (
SELECT SELECT
provinceName, provinceName,
count( NULL ) gastroscopyPlan, count(
NULL ) gastroscopyPlan,
count( * ) gastroscopyActual, count( * ) gastroscopyActual,
count( gastroscopyDetailWay &lt;&gt; '[]' OR NULL ) gastroscopyDetail, count(
count( gastroscopyDetailDetail LIKE '%"b":1%' OR NULL ) + count( gastroscopyDetailDetail LIKE '%"g":1%' OR NULL ) earlyCancer gastroscopyDetailWay &lt;&gt; '[]' OR NULL ) gastroscopyDetail,
count(
gastroscopyDetailDetail LIKE '%"b":1%' OR NULL ) + count(
gastroscopyDetailDetail LIKE '%"g":1%' OR NULL ) earlyCancer
FROM FROM
( (
SELECT SELECT
...@@ -411,11 +276,13 @@ ...@@ -411,11 +276,13 @@
'是' '是'
WHEN 0 THEN WHEN 0 THEN
'否' ELSE '' '否' ELSE ''
END isGastroscopy, END
isGastroscopy,
rel1.inspect_way gastroscopyWay, rel1.inspect_way gastroscopyWay,
CASE CASE
rel1.capsule rel1.capsule
WHEN 1 THEN WHEN 1
THEN
'异常' '异常'
WHEN 2 THEN WHEN 2 THEN
'未见异常' ELSE '' '未见异常' ELSE ''
...@@ -423,16 +290,18 @@ ...@@ -423,16 +290,18 @@
rel1.precise_way gastroscopyDetailWay, rel1.precise_way gastroscopyDetailWay,
CASE CASE
WHEN rel1.diagnose_result = 1 THEN WHEN rel1.diagnose_result =
1 THEN
'异常' '异常'
WHEN rel1.diagnose_result = 2 THEN WHEN rel1.diagnose_result = 2 THEN
'未见明显异常' ELSE '' '未见明显异常' ELSE ''
END gastroscopyDetailResult, END
gastroscopyDetailResult,
rel1.diagnose_info gastroscopyDetailDetail, rel1.diagnose_info gastroscopyDetailDetail,
rel1.STATUS gastroscopyAuditStatus rel1.STATUS gastroscopyAuditStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( INNER JOIN (
SELECT SELECT
patient_id, patient_id,
step, step,
...@@ -446,146 +315,119 @@ ...@@ -446,146 +315,119 @@
FROM FROM
tb_gastro_inspect tb_gastro_inspect
WHERE WHERE
is_inspect = 1 is_inspect
= 1
AND `status` NOT IN ( 0, 5 ) AND `status` NOT IN ( 0, 5 )
) rel1 ON rel1.patient_id = p.id ) rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number INNER
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number =
p.hosp_number
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area )
rel3 ON
rel3.`name` = rel2.`name`
) rel ) rel
GROUP BY GROUP BY
provinceName provinceName
) )
) rel ) rel
GROUP BY GROUP
BY
provinceName provinceName
</select> </select>
<!-- 获取各省份筛查人次统计结果 --> <!-- 获取各省份筛查人次统计结果 -->
<select id="getProvinceScreeningStatistics" resultType="com.sict.data.dto.ProvinceScreeningDTO"> <select id="getProvinceScreeningStatistics"
resultType="com.sict.data.dto.ProvinceScreeningDTO">
SELECT SELECT
provinceName, area provinceName,
count( * ) provinceScreeningTotal, count( * ) provinceScreeningTotal,
count( screeningStatus = 1 OR NULL ) provinceApplyScreeningTotal, count( NULL ) provinceApplyScreeningTotal,
count( hospaudditStatus = 0 OR NULL ) hospApply count( hospaudditStatus = 0
FROM OR NULL ) hospApply
( FROM(
SELECT SELECT p.id patientId,rel2.area
p.id patientId, area,rel3.is_auddit hospAudditStatus FROM
p.`name` patientName,
rel6.area provinceName,
CASE
rel1.igg
WHEN 1 THEN
'阳性'
WHEN 0 THEN
'阴性' ELSE ''
END iggDetection,
CASE
rel2.grade
WHEN 1 THEN
'低风险'
WHEN 2 THEN
'中风险'
WHEN 3 THEN
'高风险' ELSE ''
END riskLevel,
CASE
rel3.is_inspect
WHEN 1 THEN
'是'
WHEN 0 THEN
'否' ELSE '否'
END isGastroscopy,
rel3.inspect_way gastroscopyWay,
CASE
rel3.capsule
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见异常' ELSE ''
END gastroscopyResult,
rel3.precise_way gastroscopyDetailWay,
CASE
rel3.diagnose_result
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见明显异常' ELSE ''
END gastroscopyDetailResult,
rel3.diagnose_info gastroscopyDetailInfo,
CASE
rel4.continue_flup
WHEN 1 THEN
'继续随访'
WHEN 0 THEN
'停止随访' ELSE ''
END isContinueFlup,
rel4.content_type planFlupContent,
rel1.`status` screeningStatus,
rel7.is_auddit hospAudditStatus
FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel1 ON rel1.patient_id = p.id INNER JOIN (
LEFT JOIN ( SELECT patient_id, step, score, grade, `status` FROM tb_risk_assess WHERE `status` NOT IN ( 0, 5 ) ) rel2 ON rel2.patient_id = p.id SELECT number, `name` FROM tb_hosp ) rel1 ON rel1.number =
AND rel2.step = rel1.step p.hosp_number
AND rel2.`status` = rel1.`status` LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area )
LEFT JOIN ( rel2 ON
SELECT rel2.`name` = rel1.`name`
patient_id, LEFT JOIN ( SELECT hosp_number,
step, is_auddit FROM tmp_tb_hosp_apply ) rel3 ON
is_inspect, rel3.hosp_number =
inspect_way, rel1.number
capsule, WHERE p.step=0
precise_way, )rel
diagnose_result, GROUP BY provinceName
diagnose_info,
`status`
FROM
tb_gastro_inspect
WHERE
`status` NOT IN ( 0, 5 )
) rel3 ON rel3.patient_id = p.id
AND rel3.step = rel2.step
AND rel3.`status` = rel2.`status`
LEFT JOIN ( SELECT patient_id, step, continue_flup, content_type, `status` FROM tb_flup_plan WHERE `status` NOT IN ( 0, 5 ) ) rel4 ON rel4.patient_id = p.id
AND rel4.step = rel3.step
AND rel4.`status` = rel3.`status`
INNER JOIN ( SELECT number, `name` FROM tb_hosp ) rel5 ON rel5.number = p.hosp_number
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel6 ON rel6.`name` = rel5.`name`
LEFT JOIN ( SELECT hosp_number, is_auddit FROM tmp_tb_hosp_apply ) rel7 ON rel7.hosp_number = rel5.number
) rel
GROUP BY
provinceName
</select> </select>
<!-- 获取省份胃镜精查最终诊断异常统计结果 --> <!-- 获取省份胃镜精查最终诊断异常统计结果 -->
<select id="getProvinceGastroscopyResult" resultType="com.sict.data.dto.ProvinceGastroscopyResultDTO"> <select id="getProvinceGastroscopyResult"
resultType="com.sict.data.dto.ProvinceGastroscopyResultDTO">
SELECT SELECT
provinceName, provinceName,
( (
count( gastroDetailInfo LIKE '%"a":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"b":1%' OR NULL ) count( gastroDetailInfo LIKE '%"a":1%'
+ count( gastroDetailInfo LIKE '%"c":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"d":1%' OR NULL ) OR NULL ) + count( gastroDetailInfo
+ count( gastroDetailInfo LIKE '%"e":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"f":1%' OR NULL ) LIKE '%"b":1%' OR NULL )
+ count( gastroDetailInfo LIKE '%"g":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"h":1%' OR NULL ) + count(
+ count( gastroDetailInfo LIKE '%"i":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"j":1%' OR NULL ) gastroDetailInfo LIKE '%"c":1%' OR NULL ) + count(
+ count( gastroDetailInfo LIKE '%"k":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"l":1%' OR NULL ) gastroDetailInfo
+ count( gastroDetailInfo LIKE '%"m":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"n":%' OR NULL ) LIKE '%"d":1%' OR NULL )
+ count( gastroDetailInfo LIKE '%"e":1%' OR
NULL ) + count(
gastroDetailInfo LIKE '%"f":1%' OR NULL )
+ count(
gastroDetailInfo LIKE '%"g":1%' OR NULL ) + count(
gastroDetailInfo
LIKE '%"h":1%' OR NULL )
+ count( gastroDetailInfo LIKE '%"i":1%' OR
NULL ) + count(
gastroDetailInfo LIKE '%"j":1%' OR NULL )
+ count(
gastroDetailInfo LIKE '%"k":1%' OR NULL ) + count(
gastroDetailInfo
LIKE '%"l":1%' OR NULL )
+ count( gastroDetailInfo LIKE '%"m":1%' OR
NULL ) + count(
gastroDetailInfo LIKE '%"n":%' OR NULL )
) total, ) total,
count( gastroDetailInfo LIKE '%"a":1%' OR NULL ) AS esophagusTumor, count(
count( gastroDetailInfo LIKE '%"b":1%' OR NULL ) AS earlyEsophagealCancer, gastroDetailInfo LIKE '%"a":1%' OR NULL ) AS esophagusTumor,
count( gastroDetailInfo LIKE '%"c":1%' OR NULL ) AS progressEsophagealCancer, count(
count( gastroDetailInfo LIKE '%"d":1%' OR NULL ) AS barretEsophagus, gastroDetailInfo LIKE '%"b":1%' OR NULL ) AS earlyEsophagealCancer,
count( gastroDetailInfo LIKE '%"e":1%' OR NULL ) AS refluxEsophagitis, count( gastroDetailInfo LIKE '%"c":1%' OR NULL ) AS
count( gastroDetailInfo LIKE '%"f":1%' OR NULL ) AS gastricMucosaTumor, progressEsophagealCancer,
count( gastroDetailInfo LIKE '%"g":1%' OR NULL ) AS earlyGastricCancer, count( gastroDetailInfo LIKE '%"d":1%' OR
count( gastroDetailInfo LIKE '%"h":1%' OR NULL ) AS progressGastricCancer, NULL ) AS barretEsophagus,
count( gastroDetailInfo LIKE '%"i":1%' OR NULL ) AS atrophicGastritis, count( gastroDetailInfo LIKE '%"e":1%' OR
count( gastroDetailInfo LIKE '%"j":1%' OR NULL ) AS stomachUlcer, NULL ) AS refluxEsophagitis,
count( gastroDetailInfo LIKE '%"k":1%' OR NULL ) AS gastricPolyp, count( gastroDetailInfo LIKE '%"f":1%' OR
count( gastroDetailInfo LIKE '%"l":1%' OR NULL ) AS nonAtrophicGastritis, NULL ) AS
count( gastroDetailInfo LIKE '%"m":1%' OR NULL ) AS duodenalUlcer, gastricMucosaTumor,
count( gastroDetailInfo LIKE '%"n":%' OR NULL ) AS others, count( gastroDetailInfo LIKE '%"g":1%' OR
count( gastroDetailInfo LIKE '%"type_a":"a"%' OR gastroDetailInfo LIKE '%"type_f":"a"%' OR NULL ) AS highEsophagusTumor NULL ) AS earlyGastricCancer,
count( gastroDetailInfo LIKE '%"h":1%' OR
NULL ) AS
progressGastricCancer,
count( gastroDetailInfo LIKE '%"i":1%'
OR NULL ) AS atrophicGastritis,
count( gastroDetailInfo LIKE '%"j":1%'
OR NULL ) AS stomachUlcer,
count( gastroDetailInfo LIKE '%"k":1%' OR
NULL ) AS gastricPolyp,
count( gastroDetailInfo LIKE '%"l":1%' OR NULL
) AS
nonAtrophicGastritis,
count( gastroDetailInfo LIKE '%"m":1%' OR
NULL ) AS duodenalUlcer,
count( gastroDetailInfo LIKE '%"n":%' OR NULL
) AS others,
count( gastroDetailInfo LIKE '%"type_a":"a"%' OR
gastroDetailInfo LIKE
'%"type_f":"a"%' OR NULL ) AS highEsophagusTumor
FROM FROM
( (
SELECT SELECT
...@@ -594,14 +436,17 @@ ...@@ -594,14 +436,17 @@
rel1.step gastroStep, rel1.step gastroStep,
rel1.is_inspect isGastro, rel1.is_inspect isGastro,
rel1.inspect_way gastroWay, rel1.inspect_way gastroWay,
rel1.capsule gastroResult, rel1.capsule
gastroResult,
rel1.precise_way gastroDetailWay, rel1.precise_way gastroDetailWay,
rel1.diagnose_result gastroDetailResult, rel1.diagnose_result
gastroDetailResult,
rel1.diagnose_info gastroDetailInfo, rel1.diagnose_info gastroDetailInfo,
rel1.`status` auditStatus rel1.`status`
auditStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( INNER JOIN (
SELECT SELECT
patient_id, patient_id,
step, step,
...@@ -616,27 +461,35 @@ ...@@ -616,27 +461,35 @@
tb_gastro_inspect tb_gastro_inspect
WHERE WHERE
is_inspect = 1 is_inspect = 1
AND `status` NOT IN ( 0, 5 ) AND
`status` NOT IN ( 0, 5 )
AND diagnose_result = 1 AND diagnose_result = 1
) rel1 ON rel1.patient_id = p.id ) rel1 ON
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number rel1.patient_id = p.id
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` INNER JOIN ( SELECT `name`, number FROM tb_hosp
) rel2 ON rel2.number =
p.hosp_number
LEFT JOIN ( SELECT area, `name`
FROM tmp_tb_hosp_area ) rel3 ON
rel3.`name` = rel2.`name`
) rel ) rel
GROUP BY GROUP BY
provinceName provinceName
</select> </select>
<!-- 获取患病风险等级评估统计 --> <!-- 获取患病风险等级评估统计 -->
<select id="getRiskAssessStatistics" resultType="com.sict.data.dto.RiskAssessDTO"> <select id="getRiskAssessStatistics"
resultType="com.sict.data.dto.RiskAssessDTO">
SELECT SELECT
count( riskLevel = '高风险' OR NULL ) highRisk, count( riskLevel = '高风险' OR NULL ) highRisk,
count( riskLevel = '中风险' OR NULL) mediumRisk, count(
count( riskLevel = '低风险' OR NULL) lowRisk riskLevel = '中风险' OR NULL) mediumRisk,
count( riskLevel = '低风险' OR
NULL) lowRisk
FROM FROM
( (
SELECT SELECT
p.id patientId, p.id patientId,
rel3.area provinceName,
rel1.score riskScore, rel1.score riskScore,
CASE CASE
rel1.grade rel1.grade
...@@ -646,91 +499,59 @@ ...@@ -646,91 +499,59 @@
'中风险' '中风险'
WHEN 3 THEN WHEN 3 THEN
'高风险' ELSE '' '高风险' ELSE ''
END riskLevel END
riskLevel
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel4 ON rel4.patient_id = p.id INNER JOIN ( SELECT patient_id, score,
LEFT JOIN ( SELECT patient_id, score, grade, step, `status` FROM tb_risk_assess ) rel1 ON rel1.patient_id = p.id AND rel1.step=rel4.step AND rel1.`status` = rel4.`status` grade
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number FROM tb_risk_assess ) rel1 ON
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` rel1.patient_id = p.id
INNER JOIN (SELECT
name,number FROM tb_hosp )rel2 ON rel2.number = p.hosp_number
) rel ) rel
</select> </select>
<!-- 获取胃镜精查统计结果 --> <!-- 获取胃镜精查统计结果 -->
<select id="getGastroscopyDetailStatistics" resultType="com.sict.data.dto.GastroscopyDetailDTO"> <select id="getGastroscopyDetailStatistics"
SELECT resultType="com.sict.data.dto.GastroscopyDetailDTO">
count( * ) total, SELECT sum(total )total,sum(actual) actual
count( gastroscopyResult = '异常' OR NULL ) actual
FROM FROM
( (
SELECT (SELECT
p.id patientId, COUNT(DISTINCT p2.patient_id) total,COUNT(NULL) actual from
p.`name` patientName, tb_patient
rel6.area provinceName, p1 INNER JOIN tb_risk_assess p2 on p1.id = p2.patient_id
CASE INNER JOIN
rel1.igg (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number =
WHEN 1 THEN p1.hosp_number
'阳性' WHERE p2.grade >1 AND p2.step=0
WHEN 0 THEN )
'阴性' ELSE '' UNION
END iggDetection, (SELECT COUNT(NULL)
CASE total, COUNT(*) actual FROM
rel2.grade tb_patient p1 INNER JOIN tb_gastro_inspect
WHEN 1 THEN p2 ON p1.id=p2.patient_id
'低风险' INNER JOIN (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number =
WHEN 2 THEN p1.hosp_number
'中风险' WHERE p2.capsule =1)
WHEN 3 THEN )rel
'高风险' ELSE ''
END riskLevel,
CASE
rel3.is_inspect
WHEN 1 THEN
'是'
WHEN 0 THEN
'否' ELSE '否'
END isGastroscopy,
rel3.inspect_way gastroscopyWay,
CASE
rel3.capsule
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见异常' ELSE ''
END gastroscopyResult,
rel3.precise_way gastroscopyDetailWay,
CASE
rel3.diagnose_result
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见明显异常' ELSE ''
END gastroscopyDetailResult,
rel3.diagnose_info gastroscopyDetailInfo,
rel1.`status` screeningStatus
FROM
tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel1 ON rel1.patient_id = p.id
LEFT JOIN ( SELECT patient_id, step, score, grade, `status` FROM tb_risk_assess ) rel2 ON rel2.patient_id = p.id
AND rel2.step = rel1.step
AND rel2.`status` = rel1.`status`
LEFT JOIN ( SELECT patient_id, step, is_inspect, inspect_way, capsule, precise_way, diagnose_result, diagnose_info, `status` FROM tb_gastro_inspect ) rel3 ON rel3.patient_id = p.id
AND rel3.step = rel2.step
AND rel3.`status` = rel2.`status`
INNER JOIN ( SELECT number, `name` FROM tb_hosp ) rel5 ON rel5.number = p.hosp_number
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel6 ON rel6.`name` = rel5.`name`
WHERE
rel2.grade = 2 OR rel2.grade = 3
) rel
</select> </select>
<!-- 获取医院相关统计(申请数、认证数) --> <!-- 获取医院相关统计(申请数、认证数) -->
<select id="getHospStatistics" resultType="com.sict.data.dto.HospStatisticsDTO"> <select id="getHospStatistics"
resultType="com.sict.data.dto.HospStatisticsDTO">
SELECT SELECT
count( is_auddit = 1 OR NULL ) certifiedHosp, count( is_auddit = 1 OR NULL ) certifiedHosp,
count( is_auddit = 0 OR NULL ) applyHosp count(
is_auddit = 0 OR NULL ) applyHosp
FROM FROM
tmp_tb_hosp_apply tmp_tb_hosp_apply
</select> </select>
<select id="getNameDTOs" resultType="com.sict.data.dto.NameDTO">
SELECT id,`name` FROM tb_name
</select>
</mapper> </mapper>
#Generated by Maven Integration for Eclipse #Generated by Maven Integration for Eclipse
#Tue Nov 26 13:15:55 CST 2019 #Fri Nov 29 10:02:44 CST 2019
version=1.0-SNAPSHOT version=1.0-SNAPSHOT
groupId=dataplat groupId=dataplat
m2e.projectName=data-plat m2e.projectName=data-plat
......
No preview for this file type
File added
No preview for this file type
No preview for this file type
No preview for this file type
...@@ -2,20 +2,13 @@ ...@@ -2,20 +2,13 @@
<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd" xsi:noNamespaceSchemaLocation="http://ehcache.org/ehcache.xsd"
updateCheck="false"> updateCheck="false">
<defaultCache
eternal="false"
maxElementsInMemory="10000"
overflowToDisk="false"
timeToIdleSeconds="300"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getScreeningRank" name="getScreeningRank"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
...@@ -23,10 +16,10 @@ ...@@ -23,10 +16,10 @@
<cache <cache
name="getScreeningRankEn" name="getScreeningRankEn"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
...@@ -34,73 +27,82 @@ ...@@ -34,73 +27,82 @@
<cache <cache
name="getSerumStatistics" name="getSerumStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getGastroscopyStatistics" name="getGastroscopyStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getScreeningStatistics" name="getScreeningStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getGastroscopyDetailResultStatistics" name="getGastroscopyDetailResultStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getRiskAssessStatistics" name="getRiskAssessStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getGastroscopyDetailStatistics" name="getGastroscopyDetailStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getHospStatistics" name="getHospStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="3600"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
<cache <cache
name="getComplexStatistics" name="getComplexStatistics"
eternal="false" eternal="false"
maxElementsInMemory="10000" maxElementsInMemory="100000"
overflowToDisk="false"
diskPersistent="false"
timeToIdleSeconds="3600"
timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" />
<cache
name="getnamDtos"
eternal="false"
maxElementsInMemory="100000"
overflowToDisk="false" overflowToDisk="false"
diskPersistent="false" diskPersistent="false"
timeToIdleSeconds="300" timeToIdleSeconds="6"
timeToLiveSeconds="86400" timeToLiveSeconds="86400"
memoryStoreEvictionPolicy="LRU" /> memoryStoreEvictionPolicy="LRU" />
</ehcache> </ehcache>
\ No newline at end of file
...@@ -3,9 +3,10 @@ ...@@ -3,9 +3,10 @@
<mapper namespace="com.sict.data.mapper.DataPlatMapper"> <mapper namespace="com.sict.data.mapper.DataPlatMapper">
<!-- 通用查询映射结果 --> <!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.sict.data.model.DataPlat"> <resultMap id="BaseResultMap"
<id column="id" property="id"/> type="com.sict.data.model.DataPlat">
<result column="name" property="name"/> <id column="id" property="id" />
<result column="name" property="name" />
</resultMap> </resultMap>
<!-- 通用查询结果列 --> <!-- 通用查询结果列 -->
...@@ -14,263 +15,89 @@ ...@@ -14,263 +15,89 @@
</sql> </sql>
<!-- 获取各医联体下筛查人数排行榜 --> <!-- 获取各医联体下筛查人数排行榜 -->
<select id="getHospScreeningRank" resultType="com.sict.data.dto.HospScreeningDTO"> <select id="getHospScreeningRank"
resultType="com.sict.data.dto.HospScreeningDTO">
SELECT SELECT
hospNum, hospNum,
hospName, hospName,
count( * ) hospScreeningTotal, count( * ) hospScreeningTotal,
count( screeningStatus = 1 OR NULL ) hospApplyScreeningTotal count( NULL ) hospApplyScreeningTotal
FROM FROM
( (
SELECT SELECT
p.id patientId, p.id patientId,
p.hosp_number,
p.`name` patientName, p.`name` patientName,
rel5.number hospNum, rel1.number hospNum,
rel5.`name` hospName, rel1.`name`
CASE hospName
rel1.igg
WHEN 1 THEN
'阳性'
WHEN 0 THEN
'阴性' ELSE ''
END iggDetection,
CASE
rel2.grade
WHEN 1 THEN
'低风险'
WHEN 2 THEN
'中风险'
WHEN 3 THEN
'高风险' ELSE ''
END riskLevel,
CASE
rel3.is_inspect
WHEN 1 THEN
'是'
WHEN 0 THEN
'否' ELSE '否'
END isGastroscopy,
rel3.inspect_way gastroscopyWay,
CASE
rel3.capsule
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见异常' ELSE ''
END gastroscopyResult,
rel3.precise_way gastroscopyDetailWay,
CASE
rel3.diagnose_result
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见明显异常' ELSE ''
END gastroscopyDetailResult,
rel3.diagnose_info gastroscopyDetailInfo,
CASE
rel4.continue_flup
WHEN 1 THEN
'继续随访'
WHEN 0 THEN
'停止随访' ELSE ''
END isContinueFlup,
rel4.content_type planFlupContent,
rel1.`status` screeningStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel1 ON rel1.patient_id = p.id INNER JOIN ( SELECT number, `name` FROM
RIGHT JOIN ( SELECT patient_id, step, score, grade, `status` FROM tb_risk_assess WHERE `status` NOT IN ( 0, 5 ) ) rel2 ON rel2.patient_id = p.id tb_hosp ) rel1 ON rel1.number = p.hosp_number
AND rel2.step = rel1.step WHERE p.step=0
AND rel2.`status` = rel1.`status`
LEFT JOIN (
SELECT
patient_id,
step,
is_inspect,
inspect_way,
capsule,
precise_way,
diagnose_result,
diagnose_info,
`status`
FROM
tb_gastro_inspect
WHERE
`status` NOT IN ( 0, 5 )
) rel3 ON rel3.patient_id = p.id
AND rel3.step = rel2.step
AND rel3.`status` = rel2.`status`
LEFT JOIN ( SELECT patient_id, step, continue_flup, content_type, `status` FROM tb_flup_plan WHERE `status` NOT IN ( 0, 5 ) ) rel4 ON rel4.patient_id = p.id
AND rel4.step = rel3.step
AND rel4.`status` = rel3.`status`
INNER JOIN ( SELECT number, `name` FROM tb_hosp ) rel5 ON rel5.number = p.hosp_number
) rel ) rel
GROUP BY GROUP
BY
hospName hospName
ORDER BY ORDER BY
hospScreeningTotal DESC hospScreeningTotal DESC
</select> </select>
<!-- 获取各医联体下筛查人数排行榜 英文 -->
<select id="getHospScreeningRankEn"
resultType="com.sict.data.dto.HospScreeningDTO">
<!-- 获取各医联体下筛查人数排行榜 英文-->
<select id="getHospScreeningRankEn" resultType="com.sict.data.dto.HospScreeningDTO">
SELECT SELECT
hospNum, hospNum,
ehospName hospName, ehospName hospName,
count( * ) hospScreeningTotal, count( * )
count( screeningStatus = 1 OR NULL ) hospApplyScreeningTotal hospScreeningTotal,
count( NULL ) hospApplyScreeningTotal
FROM FROM
( (
SELECT SELECT
p.id patientId, p.id patientId,
p.hosp_number,
p.`name` patientName, p.`name` patientName,
rel5.number hospNum, rel1.number hospNum,
rel5.name hospName,rel5.ename ehospName, rel1.`name` hospName,
CASE rel1.ename ehospName
rel1.igg
WHEN 1 THEN
'阳性'
WHEN 0 THEN
'阴性' ELSE ''
END iggDetection,
CASE
rel2.grade
WHEN 1 THEN
'低风险'
WHEN 2 THEN
'中风险'
WHEN 3 THEN
'高风险' ELSE ''
END riskLevel,
CASE
rel3.is_inspect
WHEN 1 THEN
'是'
WHEN 0 THEN
'否' ELSE '否'
END isGastroscopy,
rel3.inspect_way gastroscopyWay,
CASE
rel3.capsule
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见异常' ELSE ''
END gastroscopyResult,
rel3.precise_way gastroscopyDetailWay,
CASE
rel3.diagnose_result
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见明显异常' ELSE ''
END gastroscopyDetailResult,
rel3.diagnose_info gastroscopyDetailInfo,
CASE
rel4.continue_flup
WHEN 1 THEN
'继续随访'
WHEN 0 THEN
'停止随访' ELSE ''
END isContinueFlup,
rel4.content_type planFlupContent,
rel1.`status` screeningStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel1 ON rel1.patient_id = p.id INNER JOIN (
RIGHT JOIN ( SELECT patient_id, step, score, grade, `status` FROM tb_risk_assess WHERE `status` NOT IN ( 0, 5 ) ) rel2 ON rel2.patient_id = p.id SELECT number, `name`,ename FROM tb_hosp_en ) rel1 ON rel1.number =
AND rel2.step = rel1.step p.hosp_number
AND rel2.`status` = rel1.`status` WHERE p.step=0
LEFT JOIN (
SELECT
patient_id,
step,
is_inspect,
inspect_way,
capsule,
precise_way,
diagnose_result,
diagnose_info,
`status`
FROM
tb_gastro_inspect
WHERE
`status` NOT IN ( 0, 5 )
) rel3 ON rel3.patient_id = p.id
AND rel3.step = rel2.step
AND rel3.`status` = rel2.`status`
LEFT JOIN ( SELECT patient_id, step, continue_flup, content_type, `status` FROM tb_flup_plan WHERE `status` NOT IN ( 0, 5 ) ) rel4 ON rel4.patient_id = p.id
AND rel4.step = rel3.step
AND rel4.`status` = rel3.`status`
INNER JOIN ( SELECT number,`name`, ename FROM tb_hosp_en ) rel5 ON rel5.number = p.hosp_number
) rel ) rel
GROUP BY GROUP BY
hospName hospName
ORDER BY ORDER BY
hospScreeningTotal DESC hospScreeningTotal DESC LIMIT 30
</select> </select>
<!-- 获取各省份血检人次统计结果 --> <!-- 获取各省份血检人次统计结果 -->
<select id="getProvinceSerumStatistics" resultType="com.sict.data.dto.ProvinceSerumDTO"> <select id="getProvinceSerumStatistics"
resultType="com.sict.data.dto.ProvinceSerumDTO">
SELECT SELECT
provinceName, provinceName,
sum( serumTestPlan + serumTestActual ) serumTestTotal, sum( serumTestPlan + serumTestActual )
serumTestTotal,
sum( serumTestPlan ) serumTestPlan, sum( serumTestPlan ) serumTestPlan,
sum( serumTestActual ) serumTestActual, sum( serumTestActual
) serumTestActual,
sum( iggPositive ) iggPositive, sum( iggPositive ) iggPositive,
sum( earlyCancer ) earlyCancer sum( earlyCancer )
earlyCancer
FROM FROM
( (
(
SELECT
provinceName,
count( * ) serumTestPlan,
count( NULL ) serumTestActual,
count( NULL ) iggPositive,
count( NULL ) earlyCancer
FROM
(
SELECT
p.id patientId,
rel3.area provinceName,
rel1.step planFlupStep,
CASE
rel1.continue_flup
WHEN 1 THEN
'继续随访'
WHEN 0 THEN
'停止随访' ELSE ''
END isContinueFlup,
rel1.content_type planFlupContent,
rel1.`status` planFlupAuditStatus
FROM
tb_patient p
RIGHT JOIN ( SELECT patient_id, step, continue_flup, content_type, `status` FROM tb_flup_plan WHERE continue_flup = 1 AND content_type LIKE '%b%' ) rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name`
) rel
GROUP BY
provinceName
) UNION
( (
SELECT SELECT
provinceName, provinceName,
count( NULL ) serumTestPlan, count( NULL ) serumTestPlan,
count( * ) serumTestActual, count( * ) serumTestActual,
count( iggDetection = '阳性' OR NULL ) iggPositive, count( iggDetection = '阳性' OR
NULL )
iggPositive,
count( NULL ) earlyCancer count( NULL ) earlyCancer
FROM FROM
( (
...@@ -279,7 +106,8 @@ ...@@ -279,7 +106,8 @@
rel3.area provinceName, rel3.area provinceName,
rel1.step labInspectStep, rel1.step labInspectStep,
rel1.g17 G17, rel1.g17 G17,
rel1.pg1 PG1, rel1.pg1
PG1,
rel1.pg2 PG2, rel1.pg2 PG2,
CASE CASE
rel1.igg rel1.igg
...@@ -291,9 +119,16 @@ ...@@ -291,9 +119,16 @@
rel1.`status` labInspectStatus rel1.`status` labInspectStatus
FROM FROM
tb_patient AS p tb_patient AS p
RIGHT JOIN ( SELECT patient_id, step, g17, pg1, pg2, igg, `status` FROM tb_lab_inspect ) rel1 ON rel1.patient_id = p.id INNER JOIN ( SELECT patient_id, step, g17, pg1, pg2, igg, `status`
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number FROM
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` tb_lab_inspect ) rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT
`name`, number FROM tb_hosp ) rel2 ON rel2.number =
p.hosp_number
INNER
JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON
rel3.`name`
= rel2.`name`
WHERE WHERE
rel1.`status` NOT IN ( 0, 5 ) rel1.`status` NOT IN ( 0, 5 )
) rel ) rel
...@@ -306,7 +141,9 @@ ...@@ -306,7 +141,9 @@
count( NULL ) serumTestPlan, count( NULL ) serumTestPlan,
count( NULL ) serumTestActual, count( NULL ) serumTestActual,
count( NULL ) iggPositive, count( NULL ) iggPositive,
count( gastroscopyDetailInfo LIKE '%"b":1%' OR NULL ) + count( gastroscopyDetailInfo LIKE '%"g":1%' OR NULL ) earlyCancer count(
gastroscopyDetailInfo LIKE '%"b":1%' OR NULL ) + count(
gastroscopyDetailInfo LIKE '%"g":1%' OR NULL ) earlyCancer
FROM FROM
( (
SELECT SELECT
...@@ -318,11 +155,12 @@ ...@@ -318,11 +155,12 @@
rel1.capsule gastroscopyResult, rel1.capsule gastroscopyResult,
rel1.precise_way gastroscopyDetailWay, rel1.precise_way gastroscopyDetailWay,
rel1.diagnose_result gastroscopyDetailResult, rel1.diagnose_result gastroscopyDetailResult,
rel1.diagnose_info gastroscopyDetailInfo, rel1.diagnose_info
gastroscopyDetailInfo,
rel1.`status` gastroscopyAuditStatus rel1.`status` gastroscopyAuditStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( INNER JOIN (
SELECT SELECT
patient_id, patient_id,
step, step,
...@@ -338,10 +176,16 @@ ...@@ -338,10 +176,16 @@
WHERE WHERE
is_inspect = 1 is_inspect = 1
AND `status` NOT IN ( 0, 5 ) AND `status` NOT IN ( 0, 5 )
AND diagnose_result = 1 AND
diagnose_result = 1
) rel1 ON rel1.patient_id = p.id ) rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number INNER JOIN ( SELECT
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` `name`, number FROM tb_hosp ) rel2 ON rel2.number =
p.hosp_number
LEFT
JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON
rel3.`name`
= rel2.`name`
) rel ) rel
GROUP BY GROUP BY
provinceName provinceName
...@@ -352,13 +196,17 @@ ...@@ -352,13 +196,17 @@
</select> </select>
<!-- 获取各省份胃镜检查人次统计结果 --> <!-- 获取各省份胃镜检查人次统计结果 -->
<select id="getProvinceGastroscopyStatistics" resultType="com.sict.data.dto.ProvinceGastroscopyDTO"> <select id="getProvinceGastroscopyStatistics"
resultType="com.sict.data.dto.ProvinceGastroscopyDTO">
SELECT SELECT
provinceName, provinceName,
sum( gastroscopyPlan + gastroscopyActual ) gastroscopyTotal, sum( gastroscopyPlan + gastroscopyActual
) gastroscopyTotal,
sum( gastroscopyPlan ) gastroscopyPlan, sum( gastroscopyPlan ) gastroscopyPlan,
sum( gastroscopyActual ) gastroscopyActual, sum(
sum( gastroscopyDetail ) gastroscopyDetail, gastroscopyActual ) gastroscopyActual,
sum( gastroscopyDetail )
gastroscopyDetail,
sum( earlyCancer ) earlyCancer sum( earlyCancer ) earlyCancer
FROM FROM
( (
...@@ -366,28 +214,41 @@ ...@@ -366,28 +214,41 @@
SELECT SELECT
provinceName, provinceName,
count( * ) gastroscopyPlan, count( * ) gastroscopyPlan,
count( NULL ) gastroscopyActual, count( NULL )
gastroscopyActual,
count( NULL ) gastroscopyDetail, count( NULL ) gastroscopyDetail,
count( NULL ) earlyCancer count( NULL )
earlyCancer
FROM FROM
( (
SELECT SELECT
p.id patientId, p.id patientId,
rel3.area provinceName, rel3.area provinceName,
rel1.step planFlupStep, rel1.step
planFlupStep,
CASE CASE
rel1.continue_flup rel1.continue_flup
WHEN 1 THEN WHEN 1 THEN
'继续随访' '继续随访'
WHEN 0 THEN WHEN 0 THEN
'停止随访' ELSE '' '停止随访'
ELSE ''
END isContinueFlup, END isContinueFlup,
rel1.content_type planFlupContent rel1.content_type planFlupContent
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, step, continue_flup, content_type FROM tb_flup_plan WHERE continue_flup = 1 AND content_type LIKE '%a%' ) rel1 ON rel1.patient_id = p.id RIGHT JOIN ( SELECT patient_id, step, continue_flup,
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number content_type FROM
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` tb_flup_plan WHERE continue_flup = 1 AND content_type
LIKE '%a%' )
rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT `name`,
number FROM tb_hosp ) rel2 ON rel2.number =
p.hosp_number
LEFT JOIN (
SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON
rel3.`name` =
rel2.`name`
) rel ) rel
GROUP BY GROUP BY
provinceName provinceName
...@@ -395,10 +256,14 @@ ...@@ -395,10 +256,14 @@
( (
SELECT SELECT
provinceName, provinceName,
count( NULL ) gastroscopyPlan, count(
NULL ) gastroscopyPlan,
count( * ) gastroscopyActual, count( * ) gastroscopyActual,
count( gastroscopyDetailWay &lt;&gt; '[]' OR NULL ) gastroscopyDetail, count(
count( gastroscopyDetailDetail LIKE '%"b":1%' OR NULL ) + count( gastroscopyDetailDetail LIKE '%"g":1%' OR NULL ) earlyCancer gastroscopyDetailWay &lt;&gt; '[]' OR NULL ) gastroscopyDetail,
count(
gastroscopyDetailDetail LIKE '%"b":1%' OR NULL ) + count(
gastroscopyDetailDetail LIKE '%"g":1%' OR NULL ) earlyCancer
FROM FROM
( (
SELECT SELECT
...@@ -411,11 +276,13 @@ ...@@ -411,11 +276,13 @@
'是' '是'
WHEN 0 THEN WHEN 0 THEN
'否' ELSE '' '否' ELSE ''
END isGastroscopy, END
isGastroscopy,
rel1.inspect_way gastroscopyWay, rel1.inspect_way gastroscopyWay,
CASE CASE
rel1.capsule rel1.capsule
WHEN 1 THEN WHEN 1
THEN
'异常' '异常'
WHEN 2 THEN WHEN 2 THEN
'未见异常' ELSE '' '未见异常' ELSE ''
...@@ -423,16 +290,18 @@ ...@@ -423,16 +290,18 @@
rel1.precise_way gastroscopyDetailWay, rel1.precise_way gastroscopyDetailWay,
CASE CASE
WHEN rel1.diagnose_result = 1 THEN WHEN rel1.diagnose_result =
1 THEN
'异常' '异常'
WHEN rel1.diagnose_result = 2 THEN WHEN rel1.diagnose_result = 2 THEN
'未见明显异常' ELSE '' '未见明显异常' ELSE ''
END gastroscopyDetailResult, END
gastroscopyDetailResult,
rel1.diagnose_info gastroscopyDetailDetail, rel1.diagnose_info gastroscopyDetailDetail,
rel1.STATUS gastroscopyAuditStatus rel1.STATUS gastroscopyAuditStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( INNER JOIN (
SELECT SELECT
patient_id, patient_id,
step, step,
...@@ -446,146 +315,119 @@ ...@@ -446,146 +315,119 @@
FROM FROM
tb_gastro_inspect tb_gastro_inspect
WHERE WHERE
is_inspect = 1 is_inspect
= 1
AND `status` NOT IN ( 0, 5 ) AND `status` NOT IN ( 0, 5 )
) rel1 ON rel1.patient_id = p.id ) rel1 ON rel1.patient_id = p.id
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number INNER
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number =
p.hosp_number
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area )
rel3 ON
rel3.`name` = rel2.`name`
) rel ) rel
GROUP BY GROUP BY
provinceName provinceName
) )
) rel ) rel
GROUP BY GROUP
BY
provinceName provinceName
</select> </select>
<!-- 获取各省份筛查人次统计结果 --> <!-- 获取各省份筛查人次统计结果 -->
<select id="getProvinceScreeningStatistics" resultType="com.sict.data.dto.ProvinceScreeningDTO"> <select id="getProvinceScreeningStatistics"
resultType="com.sict.data.dto.ProvinceScreeningDTO">
SELECT SELECT
provinceName, area provinceName,
count( * ) provinceScreeningTotal, count( * ) provinceScreeningTotal,
count( screeningStatus = 1 OR NULL ) provinceApplyScreeningTotal, count( NULL ) provinceApplyScreeningTotal,
count( hospaudditStatus = 0 OR NULL ) hospApply count( hospaudditStatus = 0
FROM OR NULL ) hospApply
( FROM(
SELECT SELECT p.id patientId,rel2.area
p.id patientId, area,rel3.is_auddit hospAudditStatus FROM
p.`name` patientName,
rel6.area provinceName,
CASE
rel1.igg
WHEN 1 THEN
'阳性'
WHEN 0 THEN
'阴性' ELSE ''
END iggDetection,
CASE
rel2.grade
WHEN 1 THEN
'低风险'
WHEN 2 THEN
'中风险'
WHEN 3 THEN
'高风险' ELSE ''
END riskLevel,
CASE
rel3.is_inspect
WHEN 1 THEN
'是'
WHEN 0 THEN
'否' ELSE '否'
END isGastroscopy,
rel3.inspect_way gastroscopyWay,
CASE
rel3.capsule
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见异常' ELSE ''
END gastroscopyResult,
rel3.precise_way gastroscopyDetailWay,
CASE
rel3.diagnose_result
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见明显异常' ELSE ''
END gastroscopyDetailResult,
rel3.diagnose_info gastroscopyDetailInfo,
CASE
rel4.continue_flup
WHEN 1 THEN
'继续随访'
WHEN 0 THEN
'停止随访' ELSE ''
END isContinueFlup,
rel4.content_type planFlupContent,
rel1.`status` screeningStatus,
rel7.is_auddit hospAudditStatus
FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel1 ON rel1.patient_id = p.id INNER JOIN (
LEFT JOIN ( SELECT patient_id, step, score, grade, `status` FROM tb_risk_assess WHERE `status` NOT IN ( 0, 5 ) ) rel2 ON rel2.patient_id = p.id SELECT number, `name` FROM tb_hosp ) rel1 ON rel1.number =
AND rel2.step = rel1.step p.hosp_number
AND rel2.`status` = rel1.`status` LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area )
LEFT JOIN ( rel2 ON
SELECT rel2.`name` = rel1.`name`
patient_id, LEFT JOIN ( SELECT hosp_number,
step, is_auddit FROM tmp_tb_hosp_apply ) rel3 ON
is_inspect, rel3.hosp_number =
inspect_way, rel1.number
capsule, WHERE p.step=0
precise_way, )rel
diagnose_result, GROUP BY provinceName
diagnose_info,
`status`
FROM
tb_gastro_inspect
WHERE
`status` NOT IN ( 0, 5 )
) rel3 ON rel3.patient_id = p.id
AND rel3.step = rel2.step
AND rel3.`status` = rel2.`status`
LEFT JOIN ( SELECT patient_id, step, continue_flup, content_type, `status` FROM tb_flup_plan WHERE `status` NOT IN ( 0, 5 ) ) rel4 ON rel4.patient_id = p.id
AND rel4.step = rel3.step
AND rel4.`status` = rel3.`status`
INNER JOIN ( SELECT number, `name` FROM tb_hosp ) rel5 ON rel5.number = p.hosp_number
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel6 ON rel6.`name` = rel5.`name`
LEFT JOIN ( SELECT hosp_number, is_auddit FROM tmp_tb_hosp_apply ) rel7 ON rel7.hosp_number = rel5.number
) rel
GROUP BY
provinceName
</select> </select>
<!-- 获取省份胃镜精查最终诊断异常统计结果 --> <!-- 获取省份胃镜精查最终诊断异常统计结果 -->
<select id="getProvinceGastroscopyResult" resultType="com.sict.data.dto.ProvinceGastroscopyResultDTO"> <select id="getProvinceGastroscopyResult"
resultType="com.sict.data.dto.ProvinceGastroscopyResultDTO">
SELECT SELECT
provinceName, provinceName,
( (
count( gastroDetailInfo LIKE '%"a":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"b":1%' OR NULL ) count( gastroDetailInfo LIKE '%"a":1%'
+ count( gastroDetailInfo LIKE '%"c":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"d":1%' OR NULL ) OR NULL ) + count( gastroDetailInfo
+ count( gastroDetailInfo LIKE '%"e":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"f":1%' OR NULL ) LIKE '%"b":1%' OR NULL )
+ count( gastroDetailInfo LIKE '%"g":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"h":1%' OR NULL ) + count(
+ count( gastroDetailInfo LIKE '%"i":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"j":1%' OR NULL ) gastroDetailInfo LIKE '%"c":1%' OR NULL ) + count(
+ count( gastroDetailInfo LIKE '%"k":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"l":1%' OR NULL ) gastroDetailInfo
+ count( gastroDetailInfo LIKE '%"m":1%' OR NULL ) + count( gastroDetailInfo LIKE '%"n":%' OR NULL ) LIKE '%"d":1%' OR NULL )
+ count( gastroDetailInfo LIKE '%"e":1%' OR
NULL ) + count(
gastroDetailInfo LIKE '%"f":1%' OR NULL )
+ count(
gastroDetailInfo LIKE '%"g":1%' OR NULL ) + count(
gastroDetailInfo
LIKE '%"h":1%' OR NULL )
+ count( gastroDetailInfo LIKE '%"i":1%' OR
NULL ) + count(
gastroDetailInfo LIKE '%"j":1%' OR NULL )
+ count(
gastroDetailInfo LIKE '%"k":1%' OR NULL ) + count(
gastroDetailInfo
LIKE '%"l":1%' OR NULL )
+ count( gastroDetailInfo LIKE '%"m":1%' OR
NULL ) + count(
gastroDetailInfo LIKE '%"n":%' OR NULL )
) total, ) total,
count( gastroDetailInfo LIKE '%"a":1%' OR NULL ) AS esophagusTumor, count(
count( gastroDetailInfo LIKE '%"b":1%' OR NULL ) AS earlyEsophagealCancer, gastroDetailInfo LIKE '%"a":1%' OR NULL ) AS esophagusTumor,
count( gastroDetailInfo LIKE '%"c":1%' OR NULL ) AS progressEsophagealCancer, count(
count( gastroDetailInfo LIKE '%"d":1%' OR NULL ) AS barretEsophagus, gastroDetailInfo LIKE '%"b":1%' OR NULL ) AS earlyEsophagealCancer,
count( gastroDetailInfo LIKE '%"e":1%' OR NULL ) AS refluxEsophagitis, count( gastroDetailInfo LIKE '%"c":1%' OR NULL ) AS
count( gastroDetailInfo LIKE '%"f":1%' OR NULL ) AS gastricMucosaTumor, progressEsophagealCancer,
count( gastroDetailInfo LIKE '%"g":1%' OR NULL ) AS earlyGastricCancer, count( gastroDetailInfo LIKE '%"d":1%' OR
count( gastroDetailInfo LIKE '%"h":1%' OR NULL ) AS progressGastricCancer, NULL ) AS barretEsophagus,
count( gastroDetailInfo LIKE '%"i":1%' OR NULL ) AS atrophicGastritis, count( gastroDetailInfo LIKE '%"e":1%' OR
count( gastroDetailInfo LIKE '%"j":1%' OR NULL ) AS stomachUlcer, NULL ) AS refluxEsophagitis,
count( gastroDetailInfo LIKE '%"k":1%' OR NULL ) AS gastricPolyp, count( gastroDetailInfo LIKE '%"f":1%' OR
count( gastroDetailInfo LIKE '%"l":1%' OR NULL ) AS nonAtrophicGastritis, NULL ) AS
count( gastroDetailInfo LIKE '%"m":1%' OR NULL ) AS duodenalUlcer, gastricMucosaTumor,
count( gastroDetailInfo LIKE '%"n":%' OR NULL ) AS others, count( gastroDetailInfo LIKE '%"g":1%' OR
count( gastroDetailInfo LIKE '%"type_a":"a"%' OR gastroDetailInfo LIKE '%"type_f":"a"%' OR NULL ) AS highEsophagusTumor NULL ) AS earlyGastricCancer,
count( gastroDetailInfo LIKE '%"h":1%' OR
NULL ) AS
progressGastricCancer,
count( gastroDetailInfo LIKE '%"i":1%'
OR NULL ) AS atrophicGastritis,
count( gastroDetailInfo LIKE '%"j":1%'
OR NULL ) AS stomachUlcer,
count( gastroDetailInfo LIKE '%"k":1%' OR
NULL ) AS gastricPolyp,
count( gastroDetailInfo LIKE '%"l":1%' OR NULL
) AS
nonAtrophicGastritis,
count( gastroDetailInfo LIKE '%"m":1%' OR
NULL ) AS duodenalUlcer,
count( gastroDetailInfo LIKE '%"n":%' OR NULL
) AS others,
count( gastroDetailInfo LIKE '%"type_a":"a"%' OR
gastroDetailInfo LIKE
'%"type_f":"a"%' OR NULL ) AS highEsophagusTumor
FROM FROM
( (
SELECT SELECT
...@@ -594,14 +436,17 @@ ...@@ -594,14 +436,17 @@
rel1.step gastroStep, rel1.step gastroStep,
rel1.is_inspect isGastro, rel1.is_inspect isGastro,
rel1.inspect_way gastroWay, rel1.inspect_way gastroWay,
rel1.capsule gastroResult, rel1.capsule
gastroResult,
rel1.precise_way gastroDetailWay, rel1.precise_way gastroDetailWay,
rel1.diagnose_result gastroDetailResult, rel1.diagnose_result
gastroDetailResult,
rel1.diagnose_info gastroDetailInfo, rel1.diagnose_info gastroDetailInfo,
rel1.`status` auditStatus rel1.`status`
auditStatus
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( INNER JOIN (
SELECT SELECT
patient_id, patient_id,
step, step,
...@@ -616,27 +461,35 @@ ...@@ -616,27 +461,35 @@
tb_gastro_inspect tb_gastro_inspect
WHERE WHERE
is_inspect = 1 is_inspect = 1
AND `status` NOT IN ( 0, 5 ) AND
`status` NOT IN ( 0, 5 )
AND diagnose_result = 1 AND diagnose_result = 1
) rel1 ON rel1.patient_id = p.id ) rel1 ON
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number rel1.patient_id = p.id
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` INNER JOIN ( SELECT `name`, number FROM tb_hosp
) rel2 ON rel2.number =
p.hosp_number
LEFT JOIN ( SELECT area, `name`
FROM tmp_tb_hosp_area ) rel3 ON
rel3.`name` = rel2.`name`
) rel ) rel
GROUP BY GROUP BY
provinceName provinceName
</select> </select>
<!-- 获取患病风险等级评估统计 --> <!-- 获取患病风险等级评估统计 -->
<select id="getRiskAssessStatistics" resultType="com.sict.data.dto.RiskAssessDTO"> <select id="getRiskAssessStatistics"
resultType="com.sict.data.dto.RiskAssessDTO">
SELECT SELECT
count( riskLevel = '高风险' OR NULL ) highRisk, count( riskLevel = '高风险' OR NULL ) highRisk,
count( riskLevel = '中风险' OR NULL) mediumRisk, count(
count( riskLevel = '低风险' OR NULL) lowRisk riskLevel = '中风险' OR NULL) mediumRisk,
count( riskLevel = '低风险' OR
NULL) lowRisk
FROM FROM
( (
SELECT SELECT
p.id patientId, p.id patientId,
rel3.area provinceName,
rel1.score riskScore, rel1.score riskScore,
CASE CASE
rel1.grade rel1.grade
...@@ -646,91 +499,59 @@ ...@@ -646,91 +499,59 @@
'中风险' '中风险'
WHEN 3 THEN WHEN 3 THEN
'高风险' ELSE '' '高风险' ELSE ''
END riskLevel END
riskLevel
FROM FROM
tb_patient p tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel4 ON rel4.patient_id = p.id INNER JOIN ( SELECT patient_id, score,
LEFT JOIN ( SELECT patient_id, score, grade, step, `status` FROM tb_risk_assess ) rel1 ON rel1.patient_id = p.id AND rel1.step=rel4.step AND rel1.`status` = rel4.`status` grade
INNER JOIN ( SELECT `name`, number FROM tb_hosp ) rel2 ON rel2.number = p.hosp_number FROM tb_risk_assess ) rel1 ON
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel3 ON rel3.`name` = rel2.`name` rel1.patient_id = p.id
INNER JOIN (SELECT
name,number FROM tb_hosp )rel2 ON rel2.number = p.hosp_number
) rel ) rel
</select> </select>
<!-- 获取胃镜精查统计结果 --> <!-- 获取胃镜精查统计结果 -->
<select id="getGastroscopyDetailStatistics" resultType="com.sict.data.dto.GastroscopyDetailDTO"> <select id="getGastroscopyDetailStatistics"
SELECT resultType="com.sict.data.dto.GastroscopyDetailDTO">
count( * ) total, SELECT sum(total )total,sum(actual) actual
count( gastroscopyResult = '异常' OR NULL ) actual
FROM FROM
( (
SELECT (SELECT
p.id patientId, COUNT(DISTINCT p2.patient_id) total,COUNT(NULL) actual from
p.`name` patientName, tb_patient
rel6.area provinceName, p1 INNER JOIN tb_risk_assess p2 on p1.id = p2.patient_id
CASE INNER JOIN
rel1.igg (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number =
WHEN 1 THEN p1.hosp_number
'阳性' WHERE p2.grade >1 AND p2.step=0
WHEN 0 THEN )
'阴性' ELSE '' UNION
END iggDetection, (SELECT COUNT(NULL)
CASE total, COUNT(*) actual FROM
rel2.grade tb_patient p1 INNER JOIN tb_gastro_inspect
WHEN 1 THEN p2 ON p1.id=p2.patient_id
'低风险' INNER JOIN (SELECT `name`,number FROM tb_hosp )rel2 ON rel2.number =
WHEN 2 THEN p1.hosp_number
'中风险' WHERE p2.capsule =1)
WHEN 3 THEN )rel
'高风险' ELSE ''
END riskLevel,
CASE
rel3.is_inspect
WHEN 1 THEN
'是'
WHEN 0 THEN
'否' ELSE '否'
END isGastroscopy,
rel3.inspect_way gastroscopyWay,
CASE
rel3.capsule
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见异常' ELSE ''
END gastroscopyResult,
rel3.precise_way gastroscopyDetailWay,
CASE
rel3.diagnose_result
WHEN 1 THEN
'异常'
WHEN 2 THEN
'未见明显异常' ELSE ''
END gastroscopyDetailResult,
rel3.diagnose_info gastroscopyDetailInfo,
rel1.`status` screeningStatus
FROM
tb_patient p
RIGHT JOIN ( SELECT patient_id, igg, step, `status` FROM tb_lab_inspect WHERE `status` NOT IN ( 0, 5 ) ) rel1 ON rel1.patient_id = p.id
LEFT JOIN ( SELECT patient_id, step, score, grade, `status` FROM tb_risk_assess ) rel2 ON rel2.patient_id = p.id
AND rel2.step = rel1.step
AND rel2.`status` = rel1.`status`
LEFT JOIN ( SELECT patient_id, step, is_inspect, inspect_way, capsule, precise_way, diagnose_result, diagnose_info, `status` FROM tb_gastro_inspect ) rel3 ON rel3.patient_id = p.id
AND rel3.step = rel2.step
AND rel3.`status` = rel2.`status`
INNER JOIN ( SELECT number, `name` FROM tb_hosp ) rel5 ON rel5.number = p.hosp_number
LEFT JOIN ( SELECT area, `name` FROM tmp_tb_hosp_area ) rel6 ON rel6.`name` = rel5.`name`
WHERE
rel2.grade = 2 OR rel2.grade = 3
) rel
</select> </select>
<!-- 获取医院相关统计(申请数、认证数) --> <!-- 获取医院相关统计(申请数、认证数) -->
<select id="getHospStatistics" resultType="com.sict.data.dto.HospStatisticsDTO"> <select id="getHospStatistics"
resultType="com.sict.data.dto.HospStatisticsDTO">
SELECT SELECT
count( is_auddit = 1 OR NULL ) certifiedHosp, count( is_auddit = 1 OR NULL ) certifiedHosp,
count( is_auddit = 0 OR NULL ) applyHosp count(
is_auddit = 0 OR NULL ) applyHosp
FROM FROM
tmp_tb_hosp_apply tmp_tb_hosp_apply
</select> </select>
<select id="getNameDTOs" resultType="com.sict.data.dto.NameDTO">
SELECT id,`name` FROM tb_name
</select>
</mapper> </mapper>
No preview for this file type
...@@ -18,5 +18,6 @@ E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\co ...@@ -18,5 +18,6 @@ E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\co
E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\ScreeningDTO.java E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\ScreeningDTO.java
E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\SerumDTO.java E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\SerumDTO.java
E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\GastroscopyDetailDTO.java E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\GastroscopyDetailDTO.java
E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\NameDTO.java
E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\model\DataPlat.java E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\model\DataPlat.java
E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\GastroscopyDTO.java E:\BIGDATA\HadoopSpace\早筛综合统计页面展示\data-plat\src\main\java\com\sict\data\dto\GastroscopyDTO.java
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment