|
@ -27,6 +27,7 @@ import org.springframework.jdbc.core.BeanPropertyRowMapper;
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@ -676,16 +677,21 @@ public class StatisticsService {
|
|
|
public JSONArray capacityAssessment(String endDate, String area, int level) throws Exception{
|
|
|
//评估类型
|
|
|
JSONArray jsonArray = new JSONArray();
|
|
|
List<SaveModel> list = statisticsUtilService.findDateAllQuotaLevel1Sort(endDate,endDate,area,level,"37",SaveModel.timeLevel_DDL,null,null);
|
|
|
for(int i=0;i<list.size();i++){
|
|
|
SaveModel saveModel = list.get(i);
|
|
|
String sql = " select dict.dict_code,dict_value,count(DISTINCT lab.patient) total from wlyy_hospital_sys_dict dict \n" +
|
|
|
"LEFT JOIN wlyy_patient_label lab on dict.dict_code = lab.label_code\n" +
|
|
|
"where dict.dict_name='service_type' and dict.dict_code is not null and dict_code<>5 \n" +
|
|
|
" GROUP BY dict.dict_code; ";
|
|
|
List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
|
|
|
|
|
|
String older = " select count(id) from base_patient where archive_type=1 ";
|
|
|
Integer count = jdbcTemplate.queryForObject(older,Integer.class);
|
|
|
|
|
|
for(Map<String,Object> map:list){
|
|
|
JSONObject json = new JSONObject();
|
|
|
if (saveModel.getResult2().longValue()==0&&StringUtils.isBlank(saveModel.getSlaveKey1())){
|
|
|
continue;
|
|
|
}
|
|
|
json.put("num",saveModel.getResult2().longValue());
|
|
|
json.put("code",saveModel.getSlaveKey1());
|
|
|
json.put("name",saveModel.getSlaveKey1Name());
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
json.put("num", df.format((Integer.parseInt(map.get("total").toString())*1.00) / count * 100));
|
|
|
json.put("code",map.get("dict_code").toString());
|
|
|
json.put("name",map.get("dict_value").toString());
|
|
|
jsonArray.add(json);
|
|
|
}
|
|
|
return jsonArray;
|