Bläddra i källkod

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

zd_123 7 år sedan
förälder
incheckning
975bee38e1

+ 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);//设置未读

+ 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());
                        }
                    }

+ 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);