|
@ -17,9 +17,11 @@ import com.yihu.wlyy.repository.doctor.*;
|
|
|
import com.yihu.wlyy.repository.patient.PatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.TrackPatientDao;
|
|
|
import com.yihu.wlyy.repository.patient.scheme.PatientSchemeListDao;
|
|
|
import com.yihu.wlyy.service.BaseService;
|
|
|
import com.yihu.wlyy.util.DateUtil;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.apache.poi.util.StringUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@ -41,7 +43,7 @@ import java.util.*;
|
|
|
* @date 2017/9/13 15:46
|
|
|
*/
|
|
|
@Service
|
|
|
public class DoctorSchemeService {
|
|
|
public class DoctorSchemeService extends BaseService{
|
|
|
private static Logger logger = LoggerFactory.getLogger(DoctorSchemeService.class);
|
|
|
|
|
|
@Autowired
|
|
@ -91,10 +93,15 @@ public class DoctorSchemeService {
|
|
|
* @date 2017/9/13 16:23
|
|
|
* @return
|
|
|
*/
|
|
|
public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType,String doctorcode) throws Exception{
|
|
|
public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType,String doctorcode,String trackFlag) throws Exception{
|
|
|
|
|
|
String sql = "select DISTINCT p.code from wlyy_patient p ";
|
|
|
|
|
|
//1.4.2加入跟踪居民过滤
|
|
|
if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
|
|
|
sql = sql + " JOIN wlyy_track_patient tp ON tp.patientCode = p.code ";
|
|
|
}
|
|
|
|
|
|
if(-1 != deviceType){
|
|
|
sql = sql + " LEFT JOIN wlyy_patient_device dev on dev.user = p.code ";
|
|
|
}
|
|
@ -127,6 +134,12 @@ public class DoctorSchemeService {
|
|
|
|
|
|
sql = sql + " and p.status > 0 and sp.label_type = 3 and sf.status > 0 ";
|
|
|
|
|
|
//1.4.2加入跟踪居民过滤
|
|
|
if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
|
|
|
sql = sql + "pt.del='1' AND pt.doctor_code = '"+doctorcode+"' AND pt.teamCode = "+teamCode;
|
|
|
}
|
|
|
|
|
|
|
|
|
List<String> result = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
|
|
|
|
|
|
|
|
@ -779,7 +792,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 > 6.1 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" ) bf, " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
@ -793,7 +806,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 > 7.8 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" ) aft";
|
|
|
String stdSql ="SELECT " +
|
|
|
" (bf.befHighCount + aft.aftHighCount) AS stdCount " +
|
|
@ -811,7 +824,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 >= 3.9 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" ) bf, " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
@ -826,7 +839,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 >= 4.4 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" ) aft";
|
|
|
String lowSql ="SELECT " +
|
|
|
" (bf.befHighCount + aft.aftHighCount) AS lowCount " +
|
|
@ -843,7 +856,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 <= 3.9 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" ) bf, " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
@ -857,7 +870,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 <= 4.4 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
|
|
|
" ) aft";
|
|
|
|
|
|
String pHighSql ="SELECT " +
|
|
@ -870,7 +883,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 >= 139 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
|
|
|
String pStdSql ="SELECT " +
|
|
|
" count(1) AS stdCount " +
|
|
|
" FROM " +
|
|
@ -882,7 +895,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 >= 90 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
|
|
|
String pLowSql ="SELECT " +
|
|
|
" count(1) AS lowCount " +
|
|
|
" FROM " +
|
|
@ -893,7 +906,7 @@ public class DoctorSchemeService {
|
|
|
" AND i.value1 <= 90 " +
|
|
|
" AND i.record_date >='"+startDate+"'" +
|
|
|
" AND i.record_date <='"+endDate+"'" +
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
|
|
|
" AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
|
|
|
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
//0血檀
|
|
@ -1061,7 +1074,8 @@ public class DoctorSchemeService {
|
|
|
" FROM " +
|
|
|
" wlyy_track_patient t " +
|
|
|
" WHERE " +
|
|
|
" t.doctor_code = '"+doctor+"' " +
|
|
|
" t.del='1' " +
|
|
|
" AND t.doctor_code = '"+doctor+"' " +
|
|
|
" AND t.team_code = '"+teamCode+"' " +
|
|
|
" AND t.create_time >= '"+startDate+"' " +
|
|
|
" AND t.create_time <= '"+endDate+"'";
|
|
@ -1127,7 +1141,7 @@ public class DoctorSchemeService {
|
|
|
" AND t.create_time >= '" + startDate + "' " +
|
|
|
" AND t.create_time <= '" + endDate + "'" +
|
|
|
" AND c.patient IN(" +
|
|
|
" SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+
|
|
|
" SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+
|
|
|
" )" +
|
|
|
" )c ON c.id = m.doctor_code " +
|
|
|
" WHERE " +
|
|
@ -1144,7 +1158,7 @@ public class DoctorSchemeService {
|
|
|
public Long getReservationByteam(Long id,String doctor, String startDate, String endDate) {
|
|
|
//获取待预约
|
|
|
String reservation_sql = "SELECT COUNT(1) AS reservationCount FROM wlyy_patient_reservation w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "' " +
|
|
|
" AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
|
|
|
" AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
|
|
|
//获取待预约
|
|
|
Map<String, Object> reservationCout = jdbcTemplate.queryForMap(reservation_sql);
|
|
|
if (reservationCout.get("reservationCount") == null) {
|
|
@ -1156,7 +1170,7 @@ public class DoctorSchemeService {
|
|
|
public Long getEduArticleByTeam(Long id,String doctor, String startDate, String endDate) {
|
|
|
//获取健康教育
|
|
|
String article_sql = "SELECT COUNT(1) AS articleCount FROM wlyy_health_edu_article_patient w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "'" +
|
|
|
" AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
|
|
|
" AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
|
|
|
//获取健康教育
|
|
|
Map<String, Object> articleCout = jdbcTemplate.queryForMap(article_sql);
|
|
|
if (articleCout.get("articleCount") == null) {
|
|
@ -1168,7 +1182,7 @@ public class DoctorSchemeService {
|
|
|
public Long getGuidanceByTeam(Long id,String doctor, String startDate, String endDate) {
|
|
|
//获取健康指导
|
|
|
String guidance_sql = "SELECT COUNT(1) AS guidanceCount FROM wlyy_patient_health_guidance w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "' " +
|
|
|
" AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
|
|
|
" AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
|
|
|
//获取健康指导
|
|
|
Map<String, Object> guidanceCout = jdbcTemplate.queryForMap(guidance_sql);
|
|
|
if (guidanceCout.get("guidanceCount") == null) {
|
|
@ -1181,7 +1195,7 @@ public class DoctorSchemeService {
|
|
|
public Long getFollowByTeam(Long id,String doctor, String startDate, String endDate) {
|
|
|
//随访数目
|
|
|
String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' " +
|
|
|
" AND w.doctor_code ='"+doctor+"' AND w.patient_code IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
|
|
|
" AND w.doctor_code ='"+doctor+"' AND w.patient_code IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
|
|
|
//随访数目
|
|
|
Map<String, Object> followupCout = jdbcTemplate.queryForMap(followup_sql);
|
|
|
if (followupCout.get("followupCount") == null) {
|
|
@ -1204,7 +1218,7 @@ public class DoctorSchemeService {
|
|
|
" AND p.patient IN ( " +
|
|
|
" SELECT t.patient_code " +
|
|
|
" FROM wlyy_track_patient t " +
|
|
|
" WHERE t.doctor_code ='"+doctor+"' " +
|
|
|
" WHERE t.del='1' AND t.doctor_code ='"+doctor+"' " +
|
|
|
" AND t.team_code = " +id+")";
|
|
|
//审核数目
|
|
|
Map<String, Object> reviewedCount = jdbcTemplate.queryForMap(sql);
|
|
@ -1213,4 +1227,199 @@ public class DoctorSchemeService {
|
|
|
}
|
|
|
return (Long)reviewedCount.get("reviewedCount");
|
|
|
}
|
|
|
|
|
|
public Map<String,Object> getTrackPatientAimByteam(String doctor ,Long teamCode,String startDate,String endDate){
|
|
|
startDate = startDate +" 00:00:00";
|
|
|
endDate = endDate +" 23:59:59";
|
|
|
|
|
|
String presSql="SELECT " +
|
|
|
" COUNT(1) AS dbCount " +
|
|
|
" FROM " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
|
" i.`user`, " +
|
|
|
" COUNT(1) AS total " +
|
|
|
" FROM " +
|
|
|
" device.wlyy_patient_health_index i " +
|
|
|
" WHERE " +
|
|
|
" i.`user` in " +
|
|
|
" ( " +
|
|
|
" SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
|
|
|
" ) " +
|
|
|
" AND i.del ='1' " +
|
|
|
" AND i.type = 2 " +
|
|
|
" AND i.record_date >= '"+startDate+"' " +
|
|
|
" AND i.record_date <= '"+endDate+"' " +
|
|
|
" GROUP BY " +
|
|
|
" i.`user` " +
|
|
|
" ) tt " +
|
|
|
" LEFT JOIN " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
|
" i.`user`, " +
|
|
|
" COUNT(1) AS dbtotal " +
|
|
|
" FROM " +
|
|
|
" device.wlyy_patient_health_index i " +
|
|
|
" JOIN wlyy_patient_aim_blood_pressure p ON p.patientcode = i.`user` " +
|
|
|
" WHERE " +
|
|
|
" i.`user` in " +
|
|
|
" ( " +
|
|
|
" SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
|
|
|
" ) " +
|
|
|
" AND " +
|
|
|
" i.value1 <= p.sbp " +
|
|
|
" AND " +
|
|
|
" i.value1 >= p.sbp_min " +
|
|
|
" AND i.del ='1' " +
|
|
|
" AND i.type = 2 " +
|
|
|
" AND i.record_date >= '"+startDate+"' " +
|
|
|
" AND i.record_date <= '"+endDate+"' " +
|
|
|
" GROUP BY " +
|
|
|
" i.`user` " +
|
|
|
" ) dbt ON tt.`user`=dbt.`user` " +
|
|
|
" WHERE dbt.dbtotal/tt.total > 0.7";
|
|
|
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
List<Map<String,Object>> presTotal = jdbcTemplate.queryForList(presSql);
|
|
|
if(presTotal!=null&&presTotal.size()>0){
|
|
|
rs.put("dbPresCount",presTotal.get(0).get("dbCount"));
|
|
|
}else {
|
|
|
rs.put("dbPresCount",0);
|
|
|
}
|
|
|
|
|
|
//餐前达标数量
|
|
|
List<Map<String,Object>> cqXT = jdbcTemplate.queryForList(getXTSql( doctor , teamCode, startDate, endDate, "0"));
|
|
|
Long cqtotal;
|
|
|
if(cqXT!=null&&cqXT.size()>0){
|
|
|
cqtotal = (Long)cqXT.get(0).get("dbCount");
|
|
|
}else{
|
|
|
cqtotal = 0L;
|
|
|
}
|
|
|
//餐后达标数量
|
|
|
List<Map<String,Object>> chXT = jdbcTemplate.queryForList(getXTSql( doctor , teamCode, startDate, endDate, "1"));
|
|
|
Long chtotal;
|
|
|
if(chXT!=null&&chXT.size()>0){
|
|
|
chtotal = (Long)chXT.get(0).get("dbCount");
|
|
|
}else{
|
|
|
chtotal = 0L;
|
|
|
}
|
|
|
|
|
|
rs.put("dbSuggerCount",chtotal+cqtotal);
|
|
|
return rs;
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* @param doctor
|
|
|
* @param teamCode
|
|
|
* @param startDate
|
|
|
* @param endDate
|
|
|
* @param state 0 餐前,1餐后
|
|
|
* @return
|
|
|
*/
|
|
|
public String getXTSql(String doctor ,Long teamCode,String startDate,String endDate,String state){
|
|
|
String value2 ="1,3,5,7";
|
|
|
if("1".equals(state)){
|
|
|
value2 = "2,4,6";
|
|
|
}
|
|
|
//餐前血糖达标数
|
|
|
String xtSql = "SELECT " +
|
|
|
" COUNT(1) AS dbCount " +
|
|
|
" FROM " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
|
" i.`user`, " +
|
|
|
" COUNT(1) AS total " +
|
|
|
" FROM " +
|
|
|
" device.wlyy_patient_health_index i " +
|
|
|
" WHERE " +
|
|
|
" i.`user` in " +
|
|
|
" ( " +
|
|
|
" SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
|
|
|
" ) " +
|
|
|
" AND i.del ='1' " +
|
|
|
" AND i.type = 1 " +
|
|
|
" AND i.record_date >= '"+startDate+"' " +
|
|
|
" AND i.record_date <= '"+endDate+"' " +
|
|
|
" GROUP BY " +
|
|
|
" i.`user` " +
|
|
|
" ) tt " +
|
|
|
" LEFT JOIN " +
|
|
|
" ( " +
|
|
|
" SELECT " +
|
|
|
" i.`user`, " +
|
|
|
" COUNT(1) AS dbtotal " +
|
|
|
" FROM " +
|
|
|
" device.wlyy_patient_health_index i " +
|
|
|
" JOIN wlyy_patient_aim_blood_sugger p ON p.patientcode = i.`user` " +
|
|
|
" WHERE " +
|
|
|
" i.`user` in " +
|
|
|
" ( " +
|
|
|
" SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
|
|
|
" ) " +
|
|
|
" AND " +
|
|
|
" i.value1 <= p.fbg " +
|
|
|
" AND " +
|
|
|
" i.value1 >= p.fbg_min " +
|
|
|
" AND i.value2 in("+value2+") " +
|
|
|
" AND i.del ='1' " +
|
|
|
" AND i.type = 1 " +
|
|
|
" AND i.record_date >= '"+startDate+"' " +
|
|
|
" AND i.record_date <= '"+endDate+"' " +
|
|
|
" GROUP BY " +
|
|
|
" i.`user` " +
|
|
|
" ) dbt ON tt.`user`=dbt.`user` " +
|
|
|
" WHERE dbt.dbtotal/tt.total > 0.7";
|
|
|
return xtSql;
|
|
|
}
|
|
|
|
|
|
public Map<String,Object> getDeviceStateByTeam(String doctor ,Long teamCode){
|
|
|
String sql ="SELECT " +
|
|
|
" COUNT(1) AS total " +
|
|
|
" FROM " +
|
|
|
" wlyy_patient_device d JOIN " +
|
|
|
" wlyy_track_patient t ON t.patient_code = d.`user` " +
|
|
|
" WHERE " +
|
|
|
" t.del='1' " +
|
|
|
" AND d.category_code = ? " +
|
|
|
" AND t.doctor_code = '"+doctor+"' " +
|
|
|
" AND t.team_code = "+teamCode;
|
|
|
Map<String,Object> rs = new HashedMap();
|
|
|
//血糖仪
|
|
|
List<Map<String,Object>> xt = jdbcTemplate.queryForList(sql,new Object[]{"1"});
|
|
|
if(xt!=null&&xt.size()>0){
|
|
|
rs.put("suggerDevCount",xt.get(0).get("total"));
|
|
|
}else{
|
|
|
rs.put("suggerDevCount",0);
|
|
|
}
|
|
|
//血压计
|
|
|
List<Map<String,Object>> xh = jdbcTemplate.queryForList(sql,new Object[]{"2"});
|
|
|
if(xh!=null&&xh.size()>0){
|
|
|
rs.put("presDevCount",xh.get(0).get("total"));
|
|
|
}else{
|
|
|
rs.put("presDevCount",0);
|
|
|
}
|
|
|
return rs;
|
|
|
}
|
|
|
|
|
|
public String setPatientAim(String patients ,String suggerJson,String presJson){
|
|
|
if(StringUtils.isNotBlank(patients)){
|
|
|
String[] patient = patients.split(",");
|
|
|
for(String p : patient){
|
|
|
net.sf.json.JSONObject sj = net.sf.json.JSONObject.fromObject(suggerJson);
|
|
|
net.sf.json.JSONObject pj = net.sf.json.JSONObject.fromObject(presJson);
|
|
|
PatientAimBloodSugger patientAimBloodSugger = (PatientAimBloodSugger)net.sf.json.JSONObject.toBean(sj,PatientAimBloodSugger.class);
|
|
|
PatientAimBloodPressure patientAimBloodPressure = (PatientAimBloodPressure)net.sf.json.JSONObject.toBean(pj,PatientAimBloodPressure.class);
|
|
|
patientAimBloodSugger.setCode(getCode());
|
|
|
patientAimBloodSugger.setCreateTime(new Date());
|
|
|
patientAimBloodSuggerDao.save(patientAimBloodSugger);
|
|
|
patientAimBloodPressure.setCode(getCode());
|
|
|
patientAimBloodPressure.setCreateTime(new Date());
|
|
|
patientAimBloodPressureDao.save(patientAimBloodPressure);
|
|
|
}
|
|
|
}
|
|
|
return "0";
|
|
|
|
|
|
}
|
|
|
}
|