Browse Source

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

yeshijie 7 years ago
parent
commit
387dd7aeb3

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

@ -188,7 +188,10 @@ public class CustomerController extends BaseController {
            type="3";
        }
        Map<String, Object> resp = customerService.sendMsg(doctor,msg,type);
        return write(200,"","data",resp);
        if(resp.size()==0){
            return write(200,"发送成功");
        }
        return write(-1,"发送失败","data",resp);
    }
}

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

@ -113,22 +113,6 @@ public class CustomerService{
	public Map<String, Object> sendMsg(Doctor doctor,String msg,String type) {
		Map<String, Object> resp = new HashMap<String, Object>();
		//发送短信消息啦
		String mobile = doctor.getMobile();
		//
		if(!StringUtils.isBlank(mobile)&&!"2".equals(type)){
			List<NameValuePair> par = new ArrayList<NameValuePair>();
			par.add(new BasicNameValuePair("mobiles", mobile));
			par.add(new BasicNameValuePair("content", msg));
			String result = HttpClientUtil.post(messageApi+"/sendMobileMessage",par,"UTF-8");
			JSONObject resultJson = new JSONObject(result);
			if(1!=resultJson.getInt("successNum")){
				resp.put("mobile","-1");//-1代表发送失败
			}
		}
		//发送微信消息啦
		String openId = doctor.getOpenid();
		if(!StringUtils.isBlank(openId)&&!"1".equals(type)){
@ -142,6 +126,20 @@ public class CustomerService{
				resp.put("wechat","-1");//-1代表发送失败
			}
		}
		//发送短信消息啦
		String mobile = doctor.getMobile();
		if(!StringUtils.isBlank(mobile)&&!"2".equals(type)){
			msg+="\n您可通过微信关注\"i健康智能助手\"公众号(微信号:厦门i健康)更快更便捷的获取服务信息。";
			List<NameValuePair> par = new ArrayList<NameValuePair>();
			par.add(new BasicNameValuePair("mobiles", mobile));
			par.add(new BasicNameValuePair("content", msg));
			String result = HttpClientUtil.post(messageApi+"/sendMobileMessage",par,"UTF-8");
			JSONObject resultJson = new JSONObject(result);
			if(1!=resultJson.getInt("successNum")){
				resp.put("mobile","-1");//-1代表发送失败
			}
		}
		return resp;
	}
}

+ 1 - 1
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -2574,7 +2574,7 @@ public class SignWebService extends BaseService {
    }
    public List<String> findOpenidsByTown(String town) {
        String sql = "select w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !=''";
        String sql = "select  w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !=''";
        return jdbcTemplate.queryForList(sql, String.class);
    }

+ 3 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientDiseaseConditionSynJob.java

@ -26,8 +26,9 @@ public class PatientDiseaseConditionSynJob implements Job {
        logger.info("START=====开始更新慢病患者定标情况的JOB");
        try {
            String startdate = DateUtil.getStringDateShort() + " 00:00:00";
            String enddate = DateUtil.getStringDateShort() + " 23:59:59";
            //获取前一天的时间范围
            String startdate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-1) + " 00:00:00";
            String enddate = DateUtil.getNextDay(DateUtil.getStringDateShort(),-1) + " 23:59:59";
            //根据起止时间查询家签慢病患者定标情况,并同步到本地数据库
            jwPrescriptionService.getPatientDiseaseContentMapByTime(startdate,enddate);

+ 2 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/web/quota/JobController.java

@ -472,12 +472,12 @@ public class JobController extends BaseController {
    /**
     *立即执行当天的慢病患者定标情况同步
     *立即执行前一天的慢病患者定标情况同步
     *@author huangwenjie
     *@date 2017/9/17 14:16
     */
    @RequestMapping(value = "/executePatientDiseaseConditionSynJob", method = RequestMethod.POST)
    @ApiOperation("立即执行当天的慢病患者定标情况同步")
    @ApiOperation("立即执行前一天的慢病患者定标情况同步")
    public String executePatientDiseaseConditionSynJob() {
        try {
            quartzHelper.startNow(PatientDiseaseConditionSynJob.class, "PATIENT-DISEASE-CONDITION-SYN", null);

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

@ -12,7 +12,7 @@ import java.util.List;
 */
public interface PrescriptionReviewedDao extends PagingAndSortingRepository<PrescriptionReviewed, Long>, JpaSpecificationExecutor<PrescriptionReviewed> {
    @Query("select p from PrescriptionReviewed p where p.prescriptionCode=?1")
    @Query(value = "select p from PrescriptionReviewed p where p.prescriptionCode=?1 order by p.reviewedTime desc")
    PrescriptionReviewed findByPrescriptionCode(String prescriptionCode);
    @Query("select p from PrescriptionReviewed p where p.prescriptionCode=?1 and p.status=?2")

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

@ -1295,6 +1295,13 @@ public class PrescriptionInfoService extends BaseService {
                " LEFT(pr.create_time,19) AS createTime, " +
                " pr.doctor, " +
                " pr.dispensary_type AS dispensaryType," +
                " e.address, " +
                " e.province_name AS provinceName, " +
                " e.city_name AS cityName," +
                " e.town_name AS townName," +
                " e.street_name AS streetName," +
                " e.hospital_name AS hospitalName," +
                " e.hospital_address AS hospitalAddress," +
                " e.expressage_code AS expressageCode, " +
                " e.expressage_name AS expressageName, " +
                " e.expressage_hospital_address AS expressageHospitalAddress, " +
@ -1360,7 +1367,7 @@ public class PrescriptionInfoService extends BaseService {
            param.add(endDate + " 23:59:59");
        }
        if (StringUtils.isNotBlank(hospital)) {
            pre_sql.append(" AND e.hospital_code = ? ");
            pre_sql.append(" AND e.patient_hospital_code = ? ");
            param.add(hospital);
        }
        if (StringUtils.isNotBlank(state)) {
@ -1402,7 +1409,7 @@ public class PrescriptionInfoService extends BaseService {
            param.add(endDate + " 23:59:59");
        }
        if (StringUtils.isNotBlank(hospital)) {
            pre_sql.append(" AND e.hospital_code = ? ");
            pre_sql.append(" AND e.patient_hospital_code = ? ");
            param.add(hospital);
        }
        if (StringUtils.isNotBlank(state)) {
@ -1446,13 +1453,13 @@ public class PrescriptionInfoService extends BaseService {
    }
    public JSONArray getHospitalListTitle(String teamCode) {
        StringBuffer pre_sql = new StringBuffer("SELECT e.hospital_code AS hospitalCode ,e.hospital_name AS hospitalName FROM " +
        StringBuffer pre_sql = new StringBuffer("SELECT e.patient_hospital_code AS hospitalCode ,e.patient_hospital_name AS hospitalName FROM " +
                "  wlyy_prescription pr " +
                "  JOIN wlyy_prescription_expressage e ON pr.code = e.prescription_code " +
                "  WHERE pr.admin_team_id = ? " +
                "  AND (e.expressage_code IS NULL OR e.expressage_code ='') " +
                "  AND pr.dispensary_type =3 " +
                "  GROUP BY e.hospital_code ");
                "  GROUP BY e.patient_hospital_code ");
        List<Map<String, Object>> list = jdbcTemplate.queryForList(pre_sql.toString(), new Object[]{teamCode});
        return new JSONArray(list);
    }
@ -1708,7 +1715,7 @@ public class PrescriptionInfoService extends BaseService {
                    sql +=" AND d.`name` LIKE '%"+name+"%' ";
                }
                if(page!=null&&size!=null){
                    sql += " LIMIT "+(page-1)+","+size;
                    sql += " LIMIT "+(page-1)*size+","+size;
                }
        String totalSql = "SELECT " +
                " count(1) AS total" +

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -2582,7 +2582,8 @@ public class SignWebService extends BaseService {
    }
    public List<String> findOpenidsByTown(String town) {
        String sql = "select w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !=''";
        String sql = "select distinct w.openid from wlyy_sign_family w ,dm_hospital d where w.hospital=d.`code` and d.town='" + town + "' and w.openid is not null and w.openid !='' and w.`status`>0 " +
                " and w.expenses_status ='1' ";
        return jdbcTemplate.queryForList(sql, String.class);
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/CommonUtil.java

@ -368,7 +368,7 @@ public class CommonUtil {
        heightStr = df2.format(heightCM/100d);
        double height = Double.parseDouble(heightStr);
        double bmi = weight / height * 2;
        double bmi = weight / (height * height);
        return bmi;
    }

+ 8 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/WechatTagController.java

@ -37,6 +37,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.createTag(tagName);
            return write(200, "创建成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -49,6 +50,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.deleteTag(tageId);
            return write(200, "删除成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -60,6 +62,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.queryTags();
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -73,6 +76,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.queryTagWithOpenid(openid);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -88,6 +92,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.addTagWithOpenid(java.util.Arrays.asList(openis), tageId,null,null);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -103,6 +108,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.deleteTagWithOpenid(java.util.Arrays.asList(openis), tageId);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -117,6 +123,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.addTagWithOpenid(openids, tageId,null,null);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }
@ -130,6 +137,7 @@ public class WechatTagController extends BaseController {
            String string = weiXinTagUtil.deleteTagWithOpenid(openids, tageId);
            return write(200, "查询成功", "date", string);
        } catch (Exception e) {
            error(e);
            return error(-1, "失败");
        }
    }

+ 40 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinTagUtil.java

@ -21,6 +21,7 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -74,26 +75,55 @@ public class WeiXinTagUtil {
        try {
            net.sf.json.JSONObject params = new net.sf.json.JSONObject();
            params.put("openid_list", net.sf.json.JSONArray.fromObject(openIds));
            params.put("tagid", tagId);
            String result = httpUtil.sendPost(add_user_tag + weiXinAccessTokenUtils.getAccessToken(), params.toString());
            //为openID分组
            List<List<String>> list = getSplitList(openIds,40);
            net.sf.json.JSONObject resultJson = net.sf.json.JSONObject.fromObject(result);
            if(list!=null&&list.size()>0){
            if (resultJson.containsKey("errcode")) {
                Integer status = resultJson.getInt("errcode");
                if (status != 0) {
                    throw new Exception("创建失败," + result);
                for(List<String> ops : list){
                    params.put("openid_list", net.sf.json.JSONArray.fromObject(openIds));
                    params.put("tagid", tagId);
                    String result = httpUtil.sendPost(add_user_tag + weiXinAccessTokenUtils.getAccessToken(), params.toString());
                    net.sf.json.JSONObject resultJson = net.sf.json.JSONObject.fromObject(result);
                }
            }
            return result;
//            if (resultJson.containsKey("errcode")) {
//                Integer status = resultJson.getInt("errcode");
//                if (status != 0) {
//                    throw new Exception("创建失败," + result);
//                }
//            }
            return "1";
        } catch (Exception e) {
            logger.error(e.getMessage());
            return null;
        }
    }
    /**
     *
     * @param list 要拆分的集合
     * @param size 指定的大小
     * @return
     */
    public static List<List<String>> getSplitList(List<String> list , int size)
    {
        List<List<String>> returnList = new ArrayList<List<String>>();
        int listSize = list.size();
        int num = listSize%size==0?listSize/size:(listSize/size+1);
        int start = 0;
        int end = 0;
        for(int i=1;i<=num;i++)
        {
            start = (i-1)*size;
            end = i*size>listSize?listSize:i*size;
            System.out.println(start+":"+end);
            returnList.add(list.subList(start, end));
        }
        return returnList;
    }
    /**
     * 根据openID给用户打标签,
     *