|
@ -6,10 +6,12 @@ import com.yihu.jw.entity.hospital.message.BaseUserMsgContentDO;
|
|
|
import com.yihu.jw.hospital.message.dao.BaseUserMessageDao;
|
|
|
import com.yihu.jw.hospital.message.dao.BaseUserMsgContentDao;
|
|
|
import com.yihu.jw.hospital.message.dao.MsgContentDao;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import com.yihu.jw.mysql.query.BaseJpaService;
|
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
import org.apache.commons.collections.map.HashedMap;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@ -22,6 +24,9 @@ import java.util.Map;
|
|
|
|
|
|
@Service
|
|
|
public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO, BaseUserMsgContentDao> {
|
|
|
|
|
|
private Logger logger = LoggerFactory.getLogger(UserMsgContentService.class);
|
|
|
|
|
|
@Autowired
|
|
|
private BaseUserMsgContentDao baseUserMsgContentDao;
|
|
|
@Autowired
|
|
@ -61,7 +66,7 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
|
|
|
long countTmp = 0L;
|
|
|
//专家咨询业务数满意数量
|
|
|
Long expertFix = 0L;
|
|
|
System.out.println(countsqlForExpert);
|
|
|
logger.info("count="+countsqlForExpert);
|
|
|
List<Map<String,Object>> total = hibenateUtils.createSQLQuery(countsqlForExpert,params);
|
|
|
if(total!=null){
|
|
|
countTmp = Long.parseLong(total.get(0).get("total").toString());
|
|
@ -73,6 +78,7 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
|
|
|
}
|
|
|
String sqlExpertFix = sqlForExpert+" and c.score >= 80";
|
|
|
String countForExpert = "SELECT COUNT(1) AS \"total\" FROM ("+sqlExpertFix+") t";
|
|
|
logger.info("expertFix="+countForExpert);
|
|
|
List<Map<String,Object>> expert = hibenateUtils.createSQLQuery(countForExpert,params);
|
|
|
if (expert!=null){
|
|
|
expertFix = hibenateUtils.objTransformLong(expert.get(0).get("total"));
|
|
@ -84,6 +90,7 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
|
|
|
Long countOnlineTotalTmp = 1L;
|
|
|
//在线复诊业务数满意数量
|
|
|
Long onlineFix = 0L;
|
|
|
logger.info("countOnlineTotal="+countsqlForOnline);
|
|
|
List<Map<String,Object>> totalOnline = hibenateUtils.createSQLQuery(countsqlForOnline,params);
|
|
|
if(totalOnline!=null){
|
|
|
countOnlineTotalTmp = Long.parseLong(totalOnline.get(0).get("total").toString());
|
|
@ -95,15 +102,19 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
|
|
|
}
|
|
|
String sqlOlineFix = sql+" and c.score >= 80";
|
|
|
String countForFix = "SELECT COUNT(1) AS \"total\" FROM ("+sqlOlineFix+") t";
|
|
|
System.out.println(countForFix
|
|
|
);
|
|
|
logger.info("onlineFix="+countForFix);
|
|
|
List<Map<String,Object>> onlineFixList = hibenateUtils.createSQLQuery(countForFix,params);
|
|
|
if (onlineFixList!=null){
|
|
|
onlineFix = hibenateUtils.objTransformLong(onlineFixList.get(0).get("total"));
|
|
|
}
|
|
|
float expertMY=(float) expertFix/count;
|
|
|
float inlineMY = (float)onlineFix/countOnlineTotal;
|
|
|
float totalCountTmp = countTmp + countOnlineTotalTmp;
|
|
|
float totalConunt = (float)(expertFix+onlineFix)/(count+countOnlineTotal);
|
|
|
if(totalCountTmp>0){
|
|
|
totalConunt = (float)(expertFix+onlineFix)/totalCountTmp;
|
|
|
}
|
|
|
|
|
|
DecimalFormat df = new DecimalFormat("0.00");
|
|
|
List<Map<String,Object>> resultList= new ArrayList<>();
|
|
|
Map<String,Object> resultMap = new HashMap<>();
|
|
@ -117,13 +128,15 @@ public class UserMsgContentService extends BaseJpaService<BaseUserMsgContentDO,
|
|
|
}else {
|
|
|
resultMap.put("zxfz",df.format(inlineMY * 100)+"%");
|
|
|
}
|
|
|
if((countOnlineTotalTmp+countTmp)==0){
|
|
|
if(totalCountTmp==0){
|
|
|
resultMap.put("totalCount","100%");
|
|
|
}else {
|
|
|
resultMap.put("totalCount",df.format(totalConunt * 100)+"%");
|
|
|
}
|
|
|
|
|
|
resultMap.put("doctor",doctor);
|
|
|
resultMap.put("expertMY",expertFix+"/"+countTmp);
|
|
|
resultMap.put("inlineMY",onlineFix+"/"+countOnlineTotalTmp);
|
|
|
resultList.add(resultMap);
|
|
|
return resultList;
|
|
|
|