Explorar el Código

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

yeshijie hace 7 años
padre
commit
e08ca6fa8f

+ 4 - 30
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java

@ -22,6 +22,8 @@ import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -58,6 +60,8 @@ public class PrenatalInspectorPreCardService extends BaseService {
    @Autowired
    private JwMaternalChildService jwMaternalChildService;
    Logger logger = LoggerFactory.getLogger(PrenatalInspectorPreCardService.class);
    /**
     * 产检提醒(1预约提醒,2就诊提醒)
@ -124,36 +128,6 @@ public class PrenatalInspectorPreCardService extends BaseService {
    }
    /**
     * 向医生发出产检系统消息
     */
    public void sendMessagePrenatalBak() throws Exception {
        try {
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            List<PrenatalInspectorPlan> planList = prenatalInspectorPlanDao.findByTime();
            for (PrenatalInspectorPlan plan : planList) {
                String code = plan.getPatient();
                Patient patient = patientDao.findByCode(code);
                String content = "您的签约居民" + patient.getName() + "超期未进行孕检,原计划孕检时间" + format.format(plan.getInspectionTime());
                List<PrenatalInspectorPlan> plans = prenatalInspectorPlanDao.getScopeById(plan.getId());
                if (plans == null || plans.size() == 0) {
                    SignFamily signFamily = signFamilyDao.findByPatient(code);
                    String doctor = signFamily.getDoctor();
                    String doctorHealth = signFamily.getDoctorHealth();
                    if (StringUtils.isNotEmpty(doctor)) {
                        saveMessageRecord(plan.getId().toString(), doctor,code, content);
                    }
                    if (StringUtils.isNotEmpty(doctorHealth)) {
                        saveMessageRecord(plan.getId().toString(), doctorHealth,code, content);
                    }
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    /**
     * 向医生发出产检系统消息

+ 4 - 3
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -603,11 +603,12 @@ public class DateUtil {
	 */
	public static int getDutyDays(Date startDate, Date endDate) {
		int result = 0;
		while (startDate.compareTo(endDate) <= 0) {
			if (startDate.getDay() != 6 && startDate.getDay() != 0) {
        Date  startTime = new Date(startDate.getTime());
		while (startTime.compareTo(endDate) <= 0) {
			if (startTime.getDay() != 6 && startTime.getDay() != 0) {
				result++;
			}
			startDate.setDate(startDate.getDate() + 1);
            startTime.setDate(startTime.getDate() + 1);
		}
		return result;
	}

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

@ -22,11 +22,17 @@ public interface PrenatalInspectorPlanDao extends PagingAndSortingRepository<Pre
    List<PrenatalInspectorPlan> findByPatient(String patient);
    //查询当前时间14天前之后所有产检计划中距当前时间最近的记录
    @Query(value = "SELECT a.id,a.inspection_time FROM wlyy_prenatal_inspector_plan a WHERE a.patient = ?1 " +
    @Query(value = "SELECT a.* FROM wlyy_prenatal_inspector_plan a WHERE a.patient = ?1 " +
            " AND a. STATUS = '0' AND a.del = '1' AND a.inspection_time >= DATE_ADD(CURDATE(),INTERVAL -14 DAY) " +
            " ORDER BY ABS(DATEDIFF(NOW(),inspection_time)) ASC LIMIT 0,1 ",nativeQuery = true)
    PrenatalInspectorPlan findByPatientlateliest(String patient);
    //查询当前时间14天前之前所有产检计划中距当前时间最近的记录
    @Query(value = "SELECT a.* FROM wlyy_prenatal_inspector_plan a WHERE a.patient = ?1 " +
            " AND a. STATUS = '0' AND a.del = '1' AND a.inspection_time < DATE_ADD(CURDATE(), INTERVAL - 14 DAY) " +
            " ORDER BY ABS( DATEDIFF(NOW(), inspection_time) ) ASC LIMIT 0,1 ",nativeQuery = true)
    PrenatalInspectorPlan findByPatientBeforeList(String patient);
    //应产检时间前14天后14天待产检计划(不包括应产检当天)
    @Query(value = "SELECT a.* FROM wlyy_prenatal_inspector_plan a, (SELECT t.* from wlyy_prenatal_inspector_plan t where t.id = ?1 )b  " +
            " WHERE a.inspection_time >= DATE_ADD(b.inspection_time,INTERVAL -14 DAY) and a.inspection_time <= DATE_ADD(b.inspection_time,INTERVAL 14 DAY) " +

+ 10 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1551,7 +1551,13 @@ public class DoctorInfoService extends BaseService {
    }
    public List<Map<String,Object>>  getDoctorManagerRole(String code) {
    /**
     *
     * @param code 医生code
     * @param authenCode 权限code
     * @return
     */
    public List<Map<String,Object>>  getDoctorManagerRole(String code,String authenCode) {
        //获取医生在后台管理系统的权限  wlly_user的code是wlyy_doctor的code
        String sql=" select f.url url,f.code code from " +
                " wlyy_user u," +
@ -1563,6 +1569,9 @@ public class DoctorInfoService extends BaseService {
                " ru.role_id=rf.role_id and" +
                " rf.feature_id=f.id and" +
                " u.`code`='"+code+"'";
        if(StringUtils.isNotEmpty(authenCode)){
            sql+=" and f.code='"+authenCode+"'";
        }
        return jdbcTemplate.queryForList(sql);
    }
}

+ 22 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.prenatalInspector;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.device.entity.DevicePatientHealthIndex;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
@ -831,7 +832,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
    /**
     * 根据待产检ID查询最近一条待产检计划状态
     *
     * 及列表范围之外最近一条待产检计划状态
     * @param prenatalId
     */
    public JSONObject getPrenatalStatus(Long prenatalId) throws Exception {
@ -850,6 +851,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
            if (StringUtils.isNotEmpty(pregnancyNo) && (pregnancyNo != null)){
                Map<String,String> exams = getExamStatus(patient,pregnancyNo,begin,end);
                String examStatus = exams.get("status");
                Object beforePlan = exams.containsKey("plan")?exams.get("plan"):null;
                if ("1".equals(examStatus)){
                    String examTime = exams.get("examTime");
                    json.put("renatalStatus", "4");
@ -858,10 +860,14 @@ public class PrenatalInspectorPreCardService extends BaseService {
                    if (days > 7) {
                        json.put("renatalStatus", "3");
                        json.put("sendStatus", flag == true ? "1" : "0");
                        json.put("plan", plan);
                    }else{
                        PrenatalInspectorRecord record = recordDao.findByRelationAndType(prenatalId.toString(), 0);
                        if (record == null) {
                            json.put("renatalStatus", "1");
                            if (beforePlan !=null){
                                json.put("plan", beforePlan);
                            }
                            if (days < -7) {
                                json.put("reason", "未到提醒时间(" + format.format(DateUtil.getPreDays(plan.getInspectionTime(), -7)) + " 08:00)");
                            }else {
@ -871,6 +877,9 @@ public class PrenatalInspectorPreCardService extends BaseService {
                            PrenatalInspectorRecord docRecord = recordDao.findByRelationAndType(prenatalId.toString(), 1);
                            json.put("renatalStatus", "2");
                            json.put("sendStatus", flag == true ? "1" : "0");
                            if (beforePlan !=null){
                                json.put("plan", beforePlan);
                            }
                            if (docRecord == null) {
                                json.put("sendTime", format.format(record.getSendTime()));
                            } else {
@ -1029,10 +1038,11 @@ public class PrenatalInspectorPreCardService extends BaseService {
     * @throws Exception
     */
    public Map getExamStatus(String patient,String pregnancyNo,Date begin,Date end) throws Exception {
        Map<String,String> respose = new HashMap();
        Map<String,Object> respose = new HashMap();
        respose.put("status","0");
        try {
                SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                PrenatalInspectorPlan plan = prenatalInspectorPlanDao.findByPatientBeforeList(patient);
                JSONArray natals = reExamRecode(patient,pregnancyNo);
                for (Object natal : natals) {
                    JSONObject examRecord = JSON.parseObject(natal.toString());
@ -1041,8 +1051,17 @@ public class PrenatalInspectorPreCardService extends BaseService {
                    if ((examTime.getTime()<= end.getTime()) && (examTime.getTime() >= begin.getTime())){
                        respose.put("status","1");
                        respose.put("examTime",exam_time);
                        return respose;
                    }
                    if ((plan != null) && (StringUtils.isNotEmpty(plan.getInspectionCode()))){
                        Date planTime = plan.getInspectionTime();
                        Date beginTime = DateUtil.getPreDays(planTime,-14);
                        Date endTime = DateUtil.getPreDays(planTime,14);
                        respose.put("plan",plan);
                        if ((examTime.getTime()<= beginTime.getTime()) && (examTime.getTime() >= endTime.getTime())){
                            respose.remove("plan");
                        }
                    }
                }
        } catch (Exception e) {
            e.printStackTrace();

+ 6 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -13,6 +13,7 @@ import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.common.account.RoleService;
@ -64,6 +65,8 @@ public class JMJkEduArticleService extends BaseService {
    private CommonUtil commonUtil;
    @Autowired
    private SignPatientLabelInfoService signPatientLabelInfoService;
    @Autowired
    private DoctorInfoService doctorInfoService;
    /**
     *
@ -970,8 +973,9 @@ public class JMJkEduArticleService extends BaseService {
        //当管理员具有审核权限时,添加文章不需认证,添加后自动认证,
        Doctor doctor = doctorDao.findByCode(userCode);
        if(doctor.getLevel()==10){
            List<RoleWithAuthorityCheck> list = doctorDao.findEduAuthority(userCode,operatorRoleCode);
            if(list.size()>0){
//            List<RoleWithAuthorityCheck> list = doctorDao.findEduAuthority(userCode,operatorRoleCode);
            List<Map<String, Object>> list = doctorInfoService.getDoctorManagerRole(userCode,"Manage_Article_Authentication");
            if(list.size()>0&&!StringUtils.isEmpty(list.get(0).get("code"))){
                isAuthentication = 1;
            }
        }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -112,7 +112,7 @@ public class FileUploadController extends BaseController {
     * @throws IOException
     * @throws IllegalStateException
     */
    @RequestMapping(value = "image", method = RequestMethod.POST/* , headers = "Accept=image/png" */)
    @RequestMapping(value = "image", method = RequestMethod.POST  /*,headers = "Accept=image/png"*/ )
    @ResponseBody
    public String image(HttpServletRequest request, HttpServletResponse response) {
        if (isneiwang) {

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -2056,13 +2056,14 @@ public class DoctorController extends BaseController {
    @ResponseBody
    @RequestMapping(value = "/getDoctorManagerRole", method = RequestMethod.GET)
    public String getDoctorManagerRole(
            @ApiParam(required = false, name = "code", value = "医生code") @RequestParam(value = "code", required = false) String code
            @ApiParam(required = false, name = "code", value = "医生code") @RequestParam(value = "code", required = false) String code,
            @ApiParam(required = false, name = "authenCode", value = "权限code,如:Manage_Article_Authentication") @RequestParam(value = "authenCode", required = false) String authenCode
    ) {
        try {
            if (org.springframework.util.StringUtils.isEmpty(code)) {
                code = super.getUID();
            }
            List<Map<String, Object>> returnData = doctorInfoService.getDoctorManagerRole(code);
            List<Map<String, Object>> returnData = doctorInfoService.getDoctorManagerRole(code,authenCode);
            return write(200, "获取成功", "data", returnData);
        } catch (Exception e) {
            error(e);

+ 100 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -6,8 +6,11 @@ import com.yihu.wlyy.wechat.util.WeiXinMessageReplyUtils;
import com.yihu.wlyy.wechat.util.WeiXinMessageUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
@ -21,6 +24,8 @@ import java.util.*;
@Component
public class WeiXinEventProcess {
    private static Logger logger = LoggerFactory.getLogger(WeiXinEventProcess.class);
    @Value("${wechat.wechat_base_url}")
    private String wechat_base_url;
    @Value("${wechat.appId}")
@ -29,6 +34,9 @@ public class WeiXinEventProcess {
    private String serverUrl;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 微信推送事件处理
@ -313,7 +321,38 @@ public class WeiXinEventProcess {
            json.put("type", 20);
            //模板消息json串
            result = json.toString();
        } else {
        }else if (StringUtils.isNotEmpty(eventKey) && (("wechat_hslq").equals(eventKey)) ||
                eventKey.startsWith("qrscene_wechat_hslq")) {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String, String>> articles = new ArrayList<>();
            Map<String, String> article = new HashMap<>();
            // 图文URL
            String url = systemConf.getProperty("doctor_subscribe_url");
            // 图文消息图片URL
            String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
            // URL设置服务器URL、AppId
            url = url.replace("{server}", wechat_base_url)
                    .replace("{appId}", appId);
            //图片地址
            picUrl = picUrl.replace("{server}", serverUrl);
            article.put("Url", url);
            article.put("Title", "欢迎关注厦门i健康,快来签约家庭医生吧~");
            article.put("Description", "请点击查看家庭签约");
            article.put("PicUrl", picUrl);
            articles.add(article);
            //设置共有的图文消息
            setUrlItems(articles, systemConf);
            setWifi(message.get("FromUserName"),articles,systemConf);
            // 构建回复消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }else {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
@ -346,6 +385,35 @@ public class WeiXinEventProcess {
        return result;
    }
    public void setWifi(String openid,List<Map<String, String>> articles, Properties systemConf){
        try{
            String sql = "SELECT t.id FROM wlyy_patient t WHERE t.openid = '"+openid+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            logger.info("setWifi_openid:"+openid+" openid_listSize:"+list.size());
            if(list!=null&&list.size()>0) {
                Map<String, String> articleConsult = new HashMap<>();
                // 图文URL
                String urlConsult = systemConf.getProperty("patient_wifi_url");
                // 图文消息图片URL
                String picUrlConsult = systemConf.getProperty("patient_wifi_pic_url");
                // URL设置服务器URL、AppId
                urlConsult = urlConsult.replace("{server}", wechat_base_url)
                        .replace("{appId}", appId);
                //图片地址
                picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
                articleConsult.put("Url", urlConsult);
                articleConsult.put("Title", "一键上网(莲前卫生服务中心家庭医生为您服务)");
                articleConsult.put("Description", "一键上网(莲前卫生服务中心家庭医生为您服务)");
                articleConsult.put("PicUrl", picUrlConsult);
                articles.add(articleConsult);
            }
        }catch (Exception e){
            logger.info(e.getMessage());
        }
    }
    /**
     * 设置微信公共的图文消息
     *
@ -555,6 +623,37 @@ public class WeiXinEventProcess {
            json.put("type", 20);
            //模板消息json串
            result = json.toString();
        }else if (StringUtils.isNotEmpty(eventKey) && (("wechat_hslq").equals(eventKey)) ||
                eventKey.startsWith("qrscene_wechat_hslq")) {
            // 配置信息
            Properties systemConf = SystemConf.getInstance().getSystemProperties();
            // 图文信息
            List<Map<String, String>> articles = new ArrayList<>();
            Map<String, String> article = new HashMap<>();
            // 图文URL
            String url = systemConf.getProperty("doctor_subscribe_url");
            // 图文消息图片URL
            String picUrl = systemConf.getProperty("doctor_qrcode_pic_url");
            // URL设置服务器URL、AppId
            url = url.replace("{server}", wechat_base_url)
                    .replace("{appId}", appId);
            //图片地址
            picUrl = picUrl.replace("{server}", serverUrl);
            article.put("Url", url);
            article.put("Title", "欢迎关注厦门i健康,快来签约家庭医生吧~");
            article.put("Description", "请点击查看家庭签约");
            article.put("PicUrl", picUrl);
            articles.add(article);
            //设置共有的图文消息
            setUrlItems(articles, systemConf);
            setWifi(message.get("FromUserName"),articles,systemConf);
            // 构建回复消息XML
            result = WeiXinMessageReplyUtils.replyNewsMessage(message.get("FromUserName"), message.get("ToUserName"), articles);
        }
        return result;

+ 4 - 2
patient-co/patient-co-wlyy/src/main/resources/system.properties

@ -28,8 +28,10 @@ patient_examination_url=https://open.weixin.qq.com/connect/oauth2/authorize?appi
patient_prescription_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fprescription_records.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#居民取药码
patient_QRCode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fmy-medicine-code.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=STATE#wechat_redirect
#居民wifi图片地址
patient_wifi_pic_url = {server}/images/wifi.png
#居民wifi链接
patient_wifi_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&amp;redirect_uri={server}%2fwx%2fhtml%2fintroduction%2fhtml%2fyygh.html&amp;response_type=code&amp;scope=snsapi_base&amp;state=code#wechat_redirect
#就诊记录
patient_visit_pic ={server}/images/visit.png
#检查检验

BIN
patient-co/patient-co-wlyy/src/main/webapp/images/wifi.png