Przeglądaj źródła

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

chenweida 7 lat temu
rodzic
commit
c8c5e5df79
16 zmienionych plików z 247 dodań i 108 usunięć
  1. 9 9
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientVO.java
  2. 7 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  3. 48 8
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  4. 80 2
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java
  5. 2 1
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/third/template/DoctorFeldsherTemplateController.java
  6. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  7. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  8. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  9. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  10. 5 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java
  11. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/reply/DoctorQuickReplyService.java
  12. 26 11
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java
  13. 40 40
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  14. 20 19
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  15. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java
  16. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

+ 9 - 9
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientVO.java

@ -53,7 +53,7 @@ public class PatientVO {
	// 地址
	private String address;
	// 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	private Integer disease;
	private String disease;
	// 病情:0绿标,1黄标,2红标
	private Integer diseaseCondition;
	// 病历记录总数
@ -257,14 +257,6 @@ public class PatientVO {
		this.address = address;
	}
	
	public Integer getDisease() {
		return disease;
	}
	
	public void setDisease(Integer disease) {
		this.disease = disease;
	}
	
	public Integer getDiseaseCondition() {
		return diseaseCondition;
	}
@ -392,4 +384,12 @@ public class PatientVO {
	public void setDeviceType(Integer deviceType) {
		this.deviceType = deviceType;
	}
	
	public String getDisease() {
		return disease;
	}
	
	public void setDisease(String disease) {
		this.disease = disease;
	}
}

+ 7 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java

@ -256,6 +256,7 @@ public class CustomerController extends BaseController {
    @ApiOperation(value = "获取通讯记录列表")
    public String getCallRecords(@ApiParam(name="callerNumber",value="呼叫人电话")@RequestParam(required = false)String callerNumber,
                                 @ApiParam(name="recipientNumber",value="客服座机电话")@RequestParam(required = false)String recipientNumber,
                                 @ApiParam(name="seat",value="客服座席号")@RequestParam(required = false)String seat,
                                 @ApiParam(name="answerStatus",value="接听状态: 1.接通,2. 队列中放弃,3.未接通")@RequestParam(required = false)Integer answerStatus,
                                 @ApiParam(name="serviceType",value="服务类型:1.医生转接 2.代理咨询")@RequestParam(required = false)Integer serviceType ,
                                 @ApiParam(name="userName",value="客服名称(模糊匹配)")@RequestParam(required = false)String  userName ,
@ -298,7 +299,11 @@ public class CustomerController extends BaseController {
    @ApiOperation(value = "保存协同服务")
    public String saveCallService(@ApiParam(name="callServiceJson",value="协同服务json串")@RequestParam(required = true)String callServiceJson){
        try {
            return write(200,"保存成功","data",customerService.saveCallService( callServiceJson,getUID()));
            String rs = customerService.saveCallService( callServiceJson,getUID());
            if("-1".equals(rs)){
               return error(-2,"协同服务已达上限");
            }
            return write(200,"保存成功","data",rs);
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
@ -357,7 +362,7 @@ public class CustomerController extends BaseController {
            return write(200,"操作成功","data",customerService.delCallService(code));
        }catch (Exception e){
            error(e);
            return error(-1,"操作成功");
            return error(-1,"操作失败");
        }
    }
}

+ 48 - 8
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java

@ -341,7 +341,7 @@ public class CustomerService extends BaseService{
			sql +=" AND r.call_time <='"+endDate+" 23:59:59'";
		}
		if(StringUtils.isNotBlank(userName)){
			sql +=" AND r.user_name LIKE '%"+userName+" %'";
			sql +=" AND r.user_name LIKE '%"+userName+"%'";
		}
		if(StringUtils.isNotBlank(jobNo)){
			User u = userDao.findByJobNo(jobNo);
@ -404,15 +404,25 @@ public class CustomerService extends BaseService{
	}
	/**
	 * 保存协同服务
	 * @param callServiceJson
	 * @param user
	 * @return
     */
	public String saveCallService(String callServiceJson,String user){
		net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(callServiceJson);
		CallService callService =  (CallService)net.sf.json.JSONObject.toBean(jsonObject,CallService.class);
		if(!checkCallServiceCount(callService)){
			return "-1";
		}
		callService.setCode(getCallServiceCode(callService.getType()+""));
		callService.setUser(user);
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
		//存储患者信息
		Patient p = patientDao.findByCode(callService.getCode());
		Patient p = patientDao.findByCode(callService.getPatient());
		callService.setIdcard(p.getIdcard());
		callService.setSsc(p.getSsc());
		//存储医生
@ -421,10 +431,26 @@ public class CustomerService extends BaseService{
		callService.setCreateTime(new Date());
		callServiceDao.save(callService);
		//待处理发送消息给医生
		sendCallServiceMes(callService,u);
		sendCallServiceMes(callService);
		//发送消息
		sendWxMes(callService,u);
		return "1";
	}
	public boolean checkCallServiceCount(CallService callService ){
		String sql = "SELECT count(1) AS total FROM manage_call_service s WHERE s.call_code ='"+callService.getCallCode() +"' AND s.type = "+callService.getType();
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		if(list!=null&&list.size()>0){
			Map<String,Object> map = list.get(0);
			Long total = (Long)map.get("total");
			if(total>=5){
				return false;
			}
		}
		return true;
	}
	public String updateCallService(String callServiceJson,String user){
		net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(callServiceJson);
		CallService callService =  (CallService)net.sf.json.JSONObject.toBean(jsonObject,CallService.class);
@ -433,11 +459,25 @@ public class CustomerService extends BaseService{
		callService.setUserName(u.getName());
		callServiceDao.save(callService);
		//待处理发送消息给医生
		sendCallServiceMes(callService,u);
		sendCallServiceMes(callService);
		//发送消息
		sendWxMes(callService,u);
		return "1";
	}
	public void sendCallServiceMes(CallService callService,User u){
	public void sendWxMes(CallService callService,User u){
		Doctor d = doctorDao.findByCode(callService.getDoctor());
		String mes = u.getName()+"(工号:"+u.getJobNo()+")代居民("+callService.getPatientName()+")发:" ;
		if(callService.getType()==1){
			mes += callService.getPatientName()+"需要预约挂号";
		}else{
			mes += callService.getPatientName()+"发起咨询";
		}
		mes +="\n请您登录i健康app,进入协同服务管理进行查看处理。";
		sendMsg(d,mes,"2");
	}
	public void sendCallServiceMes(CallService callService){
		//待处理发送消息给医生
		if(callService.getState()==1){
			Patient p = patientDao.findByCode(callService.getPatient());
@ -445,10 +485,10 @@ public class CustomerService extends BaseService{
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCreateTime(new Date());
			if("1".equals(callService.getType())){
				message.setContent(u.getName()+"需要预约挂号");
			if(callService.getType()==1){
				message.setContent(callService.getPatientName()+"需要预约挂号");
			}else{
				message.setContent(u.getName()+"发起咨询");
				message.setContent(callService.getPatientName()+"发起咨询");
			}
			message.setRead(1);//设置未读

+ 80 - 2
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/service/template/DoctorFeldsherTemplateService.java

@ -64,7 +64,7 @@ public class DoctorFeldsherTemplateService extends BaseService {
     * @param content      消息内容
     * @return
     */
    public Boolean sendDoctorTemplate(String doctorCode, String sessionId, String sessionType, String businessType, String from, String content) {
    public Boolean sendDoctorTemplate(String doctorCode, String sessionId, String sessionType, String businessType,String contentType, String from, String content) {
        try {
            String remark = "请进入手机APP查看,如尚未安装APP请点击详情下载安装";
            String url = server_url + "wx_doctor/html/home/html/jumpApp.html";
@ -74,7 +74,8 @@ public class DoctorFeldsherTemplateService extends BaseService {
            String doctorName = doctor.getName();
            String doctorOpenId = doctor.getOpenid();
            businessType = parseBusinessType(businessType);
            JSONObject sendJson = weiXinTempMsgSendUtils.packageTemplate(businessType, remark, content, dateFormat.format(new Date()));
            String responseContent = parseContentType(contentType,content);
            JSONObject sendJson = weiXinTempMsgSendUtils.packageTemplate(businessType, remark, responseContent, dateFormat.format(new Date()));
            Boolean flag = weiXinTempMsgSendUtils.sendTemplateMessage(templateId, doctorOpenId, url, sendJson, doctor);
            logger.info("send wechat message param : " + doctorOpenId + " =======> " + content);
            logger.info("send wechat message retuen : " + flag + " =======> " + flag);
@ -205,6 +206,83 @@ public class DoctorFeldsherTemplateService extends BaseService {
        }
    }
    /**
     * 解析contentType
     *   PlainText: 1,   // 信息
         Image: 2,       // 图片信息
         Audio: 3,       // 语音信息
         Article: 4,     // 文章信息
         GoTo: 5,        // 跳转信息,求组其他医生或者邀请其他医生发送的推送消息
         TopicBegin: 6,  // 议题开始
         TopicEnd: 7,    // 议题结束 10 11 系统发送的会话消息
         TopicInto: 14,    // 进入议题 系统发送的会话消息
         Video:12,//视频
         System:13,//系统消息
         PrescriptionCheck:15,//续方审核消息消息
         PrescriptionBloodStatus:16,//续方咨询血糖血压咨询消息
         PrescriptionFollowupContent:17,//续方咨询随访问卷消息
     * @param contentType 消息类型
     * @return
     */
    private String parseContentType(String contentType,String content) {
        String responseContent = "";
        try {
            switch (contentType) {
                case "1":
                    responseContent = content;
                    break;
                case "2":
                    responseContent = "[图片消息]";
                    break;
                case "3":
                    responseContent = "[语音消息]";
                    break;
                case "4":
                    responseContent = "[文章消息]";
                    break;
                case "5":
                    responseContent = "[跳转链接消息]";
                    break;
                case "6":
                    responseContent = content;
                    break;
                case "7":
                    responseContent = content;
                    break;
                case "10":
                    responseContent = content;
                    break;
                case "11":
                    responseContent = content;
                    break;
                case "12":
                    responseContent = "[视频消息]";
                    break;
                case "13":
                    responseContent = content;
                    break;
                case "14":
                    responseContent = content;
                    break;
                case "15":
                    responseContent = "[续方审核消息]";
                    break;
                case "16":
                    responseContent = "[体征记录咨询消息]";
                    break;
                case "17":
                    responseContent = "[随访问卷咨询消息]";
                    break;
                default:
                    responseContent = "[咨询消息]";
                    break;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return responseContent;
    }
    /**
     * i健康往医生助手 医生端推送模板消息
     * @param type

+ 2 - 1
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/third/template/DoctorFeldsherTemplateController.java

@ -42,10 +42,11 @@ public class DoctorFeldsherTemplateController extends BaseController {
                                     @RequestParam @ApiParam(value = "会话Id", required = false) String sessionId,
                                     @RequestParam @ApiParam(value = "会话类型", required = false) String sessionType,
                                     @RequestParam @ApiParam(value = "消息类型") String businessType,
                                     @RequestParam @ApiParam(value = "内容类型") String contentType,
                                     @RequestParam @ApiParam(value = "发送者", required = false) String from,
                                     @RequestParam @ApiParam(value = "消息内容") String content) {
        try {
            Boolean flag = feldsherTemplateService.sendDoctorTemplate(doctorCode, sessionId, sessionType, businessType, from, content);
            Boolean flag = feldsherTemplateService.sendDoctorTemplate(doctorCode, sessionId, sessionType, businessType,contentType, from, content);
            if (flag) {
                return write(200, "发送成功!");
            } else {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -98,7 +98,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("from Message a where a.type = 8 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    Message findByRelationCode(String relationCode);
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and receiver = ?1  ")
    @Query("from Message a where a.type = 12 and a.del='1' and a.over='1' and receiver = ?1  order by a.createTime desc")
    List<Message> findByReceiverCallService(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 ")

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -66,7 +66,7 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    @Query("select distinct p.openid from Patient p where p.openid is not null and p.openid <> '' ")
    List<String> findOpenids();
    @Query(value=" select p.* from wlyy_patient p LEFT JOIN wlyy_sign_family s on s.patient = p.code WHERE s.status > 0  and p.disease >0 and p.status>0 and s.admin_team_code = ?1 and (s.doctor = ?2 or s.doctor_health =?2)",nativeQuery = true)
    @Query(value=" select p.* from wlyy_patient p  LEFT JOIN wlyy_sign_family s on s.patient = p.code  RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code WHERE s.status > 0 and sp.label_type = 3 and (sp.label = 1 or sp.label = 2)  and s.admin_team_code = ?1 and (s.doctor = ?2 or s.doctor_health =?2))",nativeQuery = true)
    List<Patient> findAllSignPatientTeamcode(String teamcode, String  doctorcode);
    @Query(value="SELECT DISTINCT t.* FROM wlyy_sign_family t1,wlyy_patient t WHERE t.`code`=t1.patient AND t1.STATUS>0 AND " +

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -665,6 +665,7 @@ public class PatientHealthIndexService extends BaseService {
                        hadData = true;
                    }
                    obj.put("healthindexid", id);
                    obj.put("valuedata", data);
                    obj.put("dataType",dataType);
                }
            }

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -518,7 +518,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -3923,7 +3923,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -4366,7 +4366,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());
@ -4553,7 +4553,7 @@ public class SignPatientLabelInfoService extends BaseService {
                    json.put("expensesStatus", "1");
                }
                //病情类型:0健康,1高血压,2糖尿病,3高血压+糖尿病
                 //病情类型:0健康,1高血压,2糖尿病,(1,2)高血压+糖尿病
                json.put("disease",p.getDisease());
                // 病情:0绿标,1黄标,2红标,
                json.put("diseaseCondition",p.getDiseaseCondition());

+ 5 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java

@ -330,27 +330,24 @@ public class PrescriptionFollowupContentService extends BaseService {
			imBloodSugarDate = obj.getDate("recordDate");
			
			//餐前
			if(StringUtils.isNotBlank(obj.getString("value1"))){
				
				
				
			if(StringUtils.isNotBlank(obj.getString("valuedata"))){
				
				//餐前
				if(1 == valueType || 3 == valueType || 5 == valueType){
					followupProjectData = "{'BS_FPG':'"+obj.getString("value1")+"'}";
					followupProjectData = "{'BS_FPG':'"+obj.getString("valuedata")+"'}";
				}
				
				//参后
				if(2 == valueType || 4 == valueType || 6 == valueType){
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value1")+"'}";
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("valuedata")+"'}";
				}
				
				//睡前-随机血糖
				if(7 == valueType ){
					followupProjectData = "{'RANDOM_BLOOD_SUGAR':'"+obj.getString("value1")+"'}";
					followupProjectData = "{'RANDOM_BLOOD_SUGAR':'"+obj.getString("valuedata")+"'}";
				}
				
				imBloodSugarValue = obj.getString("value1");
				imBloodSugarValue = obj.getString("valuedata");
			}
			
			FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(followup_id,"3");

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/reply/DoctorQuickReplyService.java

@ -62,6 +62,7 @@ public class DoctorQuickReplyService extends BaseService {
        reply.setContent(content);
        reply.setType(Integer.parseInt(type));
        reply.setSystag(0);
        return quickReplyDao.save(reply);
    }

+ 26 - 11
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java

@ -10,6 +10,7 @@ import com.yihu.wlyy.entity.doctor.scheme.vo.DoctorSchemeBloodPressureVO;
import com.yihu.wlyy.entity.doctor.scheme.vo.DoctorSchemeBloodSuggerVO;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientSchemeList;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.health.repository.DevicePatientHealthIndexDao;
import com.yihu.wlyy.repository.doctor.DoctoreSchemeBloodPressureDao;
import com.yihu.wlyy.repository.doctor.DoctrorSchemeBloodSuggerDao;
@ -20,6 +21,7 @@ import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
@ -78,13 +80,15 @@ public class DoctorSchemeService {
        if(-1 != deviceType){
            sql = sql + " LEFT JOIN wlyy_patient_device dev on dev.user = p.code ";
        }
    
        sql = sql+ " LEFT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code ";
        sql = sql+ " LEFT JOIN wlyy_sign_family sf on sf.patient = p.code where sf.admin_team_code = "+teamCode;
        if(-1 != disease){
            sql = sql + " and (p.disease ="+disease+" or p.disease = 3) ";
        if(-1 != disease && 3 != disease){
            sql = sql + " and sp.label ="+disease;
        }else{
            sql = sql + " and p.disease >0 ";
            sql = sql + " and (sp.label = 1 or sp.label = 2) ";
        }
        if(StringUtils.isNotBlank(diseaseCondition) && !"-1".equals(diseaseCondition)){
@ -103,7 +107,7 @@ public class DoctorSchemeService {
        sql = sql + " and (sf.doctor = '"+doctorcode+"' or sf.doctor_health ='"+doctorcode+"')";
        sql = sql + " and p.status > 0 and p.disease > 0 and sf.status > 0 ";
        sql = sql + " and p.status > 0 and sp.label_type = 3 and sf.status > 0 ";
        List<String> result = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
@ -389,7 +393,18 @@ public class DoctorSchemeService {
     */
    public JSONObject getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate,String doctorcode) throws Exception{
        List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode,doctorcode);
//        List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode,doctorcode);
    
        List<PatientVO> patients = new ArrayList<>();
        String patientsql = "select p.name,b.deviceType as deviceType,group_concat(sp.label) diseaseType from wlyy_patient p " +
                "  LEFT JOIN wlyy_sign_family s on s.patient = p.code " +
                "  RIGHT JOIN wlyy_sign_patient_label_info sp on sp.patient = p.code and sp.label_type = 3 and (sp.label = 1 or sp.label = 2) " +
                "  LEFT JOIN (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on p.code = b.user " +
                "WHERE s.status > 0 and s.admin_team_code ='"+teamCode+"' and (s.doctor = '"+doctorcode+"' or s.doctor_health ='"+doctorcode+"') GROUP BY p.code";
        patients= jdbcTemplate.query(patientsql,new BeanPropertyRowMapper(PatientVO.class));
        
        
        JSONObject result = new JSONObject();
        JSONObject green = new JSONObject();//绿标
@ -406,13 +421,13 @@ public class DoctorSchemeService {
        int count = patients.size();
        //绿标居民
        List<Patient> green_patients = new ArrayList<>();
        List<PatientVO> green_patients = new ArrayList<>();
        //黄标居民
        List<Patient> yellow_patients = new ArrayList<>();
        List<PatientVO> yellow_patients = new ArrayList<>();
        //红标居民
        List<Patient> red_patients = new ArrayList<>();
        List<PatientVO> red_patients = new ArrayList<>();
        //高血压居民预警居民CODE
        List<String> bloodpressure_patientcodes = new ArrayList<>();
@ -421,7 +436,7 @@ public class DoctorSchemeService {
        List<String> bloodsugar_patientcodes = new ArrayList<>();
        if(!patients.isEmpty()){
            for (Patient patient : patients) {
            for (PatientVO patient : patients) {
                //获取居民颜色标签
                if(1 == getcolor && patient.getDiseaseCondition() != null){
@ -444,11 +459,11 @@ public class DoctorSchemeService {
                if(1 == getstands && (patient.getStandardStatus() !=null && patient.getStandardStatus() ==1)){
                    if(patient.getDisease() != null){
                        if( 1 == patient.getDisease() || 3 == patient.getDisease()){
                        if( "1" == patient.getDisease() || "1,2" == patient.getDisease()){
                            bloodpressure_patientcodes.add(patient.getCode());
                        }
                        if( 2 == patient.getDisease() || 3 == patient.getDisease()){
                        if( "2" == patient.getDisease() || "1,2" == patient.getDisease()){
                            bloodsugar_patientcodes.add(patient.getCode());
                        }
                    }

+ 40 - 40
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -2483,7 +2483,7 @@ public class StatisticsService extends BaseService {
        String sql;
        String totalSql;
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        if ("0".equals(type)) {
            //按周统计
            sql = "SELECT " +
@ -2592,7 +2592,7 @@ public class StatisticsService extends BaseService {
        String sql;
        String totalSql;
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        if ("0".equals(type)) {
            //按周统计
            sql = "SELECT " +
@ -2702,7 +2702,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getMemberConsultList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        String imDataBaseName = im_dataBase_name;
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        // 未回复咨询总量
        String onReySQL = "SELECT " +
                " IFNULL(c.total,0) AS noRely, " +
@ -2916,7 +2916,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getDoctorConsultTitle(String doctor, String teamCode, String startDate, String endDate) {
        String imDataBaseName = im_dataBase_name;
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        //获取咨询总数
        String couTotalSQL = "SELECT " +
                "  COUNT(1) total " +
@ -3045,7 +3045,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getTeamDoctorFollowupLine(String teamCode, String startDate, String endDate, String type, String doctor) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSQL;
        String planSQL;
        if ("0".equals(type)) {
@ -3110,7 +3110,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getTeamFollowupLine(String teamCode, String startDate, String endDate, String type) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSQL;
        String planSQL;
        if ("0".equals(type)) {
@ -3171,7 +3171,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getDoctorTeamFolList(String startDate, String endDate, String teamCode, String sort, String sortType) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSQL = "SELECT " +
                " IFNULL(c.followupCount,0) AS followupCount, " +
                " d.`code` AS doctorCode, " +
@ -3378,7 +3378,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getTeamDoctorFolTitle(String teamCode, String doctor, String startDate, String endDate) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " COUNT(1) AS followupCount " +
                " FROM " +
@ -3431,7 +3431,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamResLine(String teamCode, String startDate, String endDate, String type) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSql;
        if ("0".equals(type)) {
            //查周
@ -3465,7 +3465,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamDoctorResLine(String teamCode, String startDate, String endDate, String type, String doctor) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSql;
        if ("0".equals(type)) {
            //查周
@ -3501,7 +3501,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamDoctorResList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " IFNULL(c.reservationCount,0) AS reservationCount, " +
                " d.`code` AS doctorCode, " +
@ -3611,7 +3611,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getTeamDoctorResTitle(String teamCode, String doctor, String startDate, String endDate) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSQL = "SELECT " +
                " COUNT(1) AS reservationCount " +
                " FROM " +
@ -3652,8 +3652,8 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamGuidLine(String teamCode, String startDate, String endDate, String type) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String SQL;
        if ("0".equals(type)) {
            //按周统计
@ -3664,22 +3664,22 @@ public class StatisticsService extends BaseService {
                    " wlyy_patient_health_guidance w " +
                    " WHERE " +
                    " w.admin_team_code = " + teamCode +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.create_time >= '" + startDate + "' " +
                    " GROUP BY dateNo";
        } else {
            //按月统计
            SQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1 " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1 " +
                    " ) AS weekOfMonth, " +
                    " COUNT(1) AS guidanceCount " +
                    " FROM " +
                    " wlyy_patient_health_guidance w " +
                    " WHERE " +
                    " w.admin_team_code =" + teamCode +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.create_time >= '" + startDate + "' " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(SQL);
@ -3688,8 +3688,8 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamDoctorGuidLine(String teamCode, String startDate, String endDate, String type, String doctor) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String SQL;
        if ("0".equals(type)) {
            //按周统计
@ -3701,14 +3701,14 @@ public class StatisticsService extends BaseService {
                    " WHERE " +
                    " w.admin_team_code = " + teamCode +
                    " AND w.doctor ='" + doctor + "'" +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.create_time >= '" + startDate + "' " +
                    " GROUP BY dateNo";
        } else {
            //按月统计
            SQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1 " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDate + "', '%v') + 1 " +
                    " ) AS weekOfMonth, " +
                    " COUNT(1) AS guidanceCount " +
                    " FROM " +
@ -3716,8 +3716,8 @@ public class StatisticsService extends BaseService {
                    " WHERE " +
                    " w.admin_team_code =" + teamCode +
                    " AND w.doctor ='" + doctor + "'" +
                    " AND w.czrq <= '" + endDate + "' " +
                    " AND w.czrq >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.create_time >= '" + startDate + "' " +
                    " GROUP BY weekOfMonth";
        }
        List<Map<String, Object>> totalList = jdbcTemplate.queryForList(SQL);
@ -3725,8 +3725,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONArray getTeamGuidList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " IFNULL(c.guidanceCount,0) AS guidanceCount, " +
                " d.`code` AS doctorCode, " +
@ -3770,8 +3770,8 @@ public class StatisticsService extends BaseService {
                " wlyy_patient_health_guidance w " +
                " WHERE " +
                " w.admin_team_code =  " + teamCode +
                " AND w.czrq <= '" + endDate + "' " +
                " AND w.czrq >= '" + startDate + "' " +
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.create_time >= '" + startDate + "' " +
                " GROUP BY w.doctor " +
                " ) c ON c.doctor = m.doctor_code, " +
                " wlyy_doctor d " +
@ -3835,8 +3835,8 @@ public class StatisticsService extends BaseService {
    }
    public JSONObject getTeamDoctorGuiTitle(String teamCode, String doctor, String startDate, String endDate) {
        startDate = startDate + " 17:00:00";
        endDate = endDate + " 17:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 00:00:00";
        String totalSQL = "SELECT " +
                " COUNT(1) AS guidanceCount " +
                " FROM " +
@ -3844,7 +3844,7 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =  " + teamCode +
                " AND w.doctor ='" + doctor + "'" +
                " AND w.czrq <= '" + endDate + "'";
                " AND w.create_time <= '" + endDate + "'";
        String addSQL = "SELECT " +
                " COUNT(1) AS addCount " +
@ -3853,8 +3853,8 @@ public class StatisticsService extends BaseService {
                " WHERE " +
                " w.admin_team_code =  " + teamCode +
                " AND w.doctor ='" + doctor + "'" +
                " AND w.czrq <= '" + endDate + "' " +
                " AND w.czrq >= '" + startDate + "'";
                " AND w.create_time <= '" + endDate + "' " +
                " AND w.create_time >= '" + startDate + "'";
        JSONObject rs = new JSONObject();
        Long guidanceCount = 0L;
        Long addCount = 0L;
@ -3877,7 +3877,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamEduLine(String teamCode, String startDate, String endDate, String type) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String sql;
        if ("0".equals(type)) {
@ -3910,7 +3910,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamDoctorEduLine(String teamCode, String startDate, String endDate, String type, String doctor) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String sql;
        if ("0".equals(type)) {
@ -3945,7 +3945,7 @@ public class StatisticsService extends BaseService {
    public JSONArray getTeamEduList(String teamCode, String startDate, String endDate, String sort, String sortType) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " IFNULL(c.articleCount,0) AS articleCount, " +
                " IFNULL(c.batchno,0) AS batchno, " +
@ -4082,7 +4082,7 @@ public class StatisticsService extends BaseService {
    public JSONObject getTeamDoctorEduTitle(String teamCode, String startDate, String endDate, String doctor) {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        String totalSql = "SELECT " +
                " COUNT(1) AS articleCount, " +
                " COUNT(DISTINCT w.batch_no) batchno " +
@ -6723,7 +6723,7 @@ public class StatisticsService extends BaseService {
        String imDataBaseName = im_dataBase_name;
        String totalSql;
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        if ("0".equals(type)) {
            //按周统计
            totalSql = "SELECT " +

+ 20 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -2304,7 +2304,7 @@ public class StatisticsESService {
     */
    public JSONArray getTeamEduLine(String teamCode, String startDate, String endDate, String type)throws Exception {
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 00:00:00";
        List<Map<String,Object>> dateList = DateUtil.findDates(dateFormat.parse(startDate),dateFormat.parse(endDate));
        Integer interval = Integer.parseInt(type) + 1;
@ -3000,7 +3000,7 @@ public class StatisticsESService {
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param type      0周,1月
     * @param type      0周 1月
     * @return
     */
    public JSONObject getTeamConsultCount(String teamCode, String startDate, String endDate, String type) throws Exception {
@ -3055,41 +3055,44 @@ public class StatisticsESService {
     * @return
     */
    public JSONObject getTeamFollowupLine(String teamCode, String startDate, String endDate, String type) throws Exception {
        //startDate = elasticsearchUtil.changeTime(startDate+" 17:00:00");
        //endDate = elasticsearchUtil.changeTime(endDate+" 17:00:00");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list1 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "69", SaveModel.timeLevel_ZL, interval + "");
        List<SaveModel> list2 = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "70", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
        List<Map<String, Object>> planList = new ArrayList<>();
        for (SaveModel one : list2) {
            if (one.getResult2().intValue()!=0){
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list1) {
            if(one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("planCount", one.getResult2().longValue());
                planList.add(map);
                map.put("followupCount", one.getResult2().intValue());
                totalList.add(map);
            }
        }
        List<Map<String, Object>> totalList = new ArrayList<>();
        for (SaveModel one : list1) {
            if(one.getResult2().intValue()!=0){
        List<Map<String, Object>> planList = new ArrayList<>();
        for (SaveModel one : list2) {
            if (one.getResult2().intValue()!=0){
                map = new HashMap<>();
                if ("0".equals(type)) {
                    map.put("dateNo", dateFormat.format(one.getQuotaDate()));
                } else {
                    map.put("weekOfMonth", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
                }
                map.put("followupCount", one.getResult2().longValue());
                totalList.add(map);
                map.put("planCount", one.getResult2().intValue());
                planList.add(map);
            }
        }
        JSONObject result = new JSONObject();
        result.put("planList", planList);
        result.put("totalList", totalList);
        result.put("totalLine", totalList);
        result.put("planLine", planList);
        return result;
    }
@ -3104,8 +3107,8 @@ public class StatisticsESService {
     */
    public JSONArray getTeamResLine(String teamCode, String startDate, String endDate, String type) throws Exception {
        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 23:59:59");
//        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
//        endDate = elasticsearchUtil.changeTime(endDate + " 17:00:00");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "27", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;
@ -3284,8 +3287,6 @@ public class StatisticsESService {
    public JSONArray getTeamGuidLine(String teamCode, String startDate, String endDate, String type) throws Exception {
        startDate = elasticsearchUtil.changeTime(startDate + " 00:00:00");
        endDate = elasticsearchUtil.changeTime(endDate + " 23:59:59");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, teamCode, Integer.parseInt(SaveModel.teamLevel), "5", SaveModel.timeLevel_ZL, interval + "");
        Map<String, Object> map = null;

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -172,7 +172,7 @@ public class DoctorFollowUpController extends BaseController {
                                @RequestParam(value = "followupManagerStatus", required = false) String followupManagerStatus,
                                @ApiParam(name = "plandate", value = "下次随访时间", defaultValue = "2016-12-14 20:00:00")
                                @RequestParam(value = "plandate", required = false) String plandate,
                                @ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "续方CODE")
                                @ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "")
                                    @RequestParam(value = "prescriptioncode", required = false) String prescriptioncode) {
        try {
            followUpService.startFollowup(id, date, followupType, followupClass, followupManagerStatus,plandate,prescriptioncode);

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import java.util.*;
/**
 * Created by lyr on 2016/08/16
 * Created by lyr on 2016/08/16.
 */
@Controller
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})