Forráskód Böngészése

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

zd_123 7 éve
szülő
commit
9a51f8e133
19 módosított fájl, 230 hozzáadás és 69 törlés
  1. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/SMS.java
  2. 5 5
      common/common-entity/src/main/java/com/yihu/wlyy/entity/wechat/WechatTemplateConfig.java
  3. 5 5
      common/common-entity/src/main/java/com/yihu/wlyy/entity/wechat/WeixinTemplate.java
  4. 1 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_add_js.jsp
  5. 5 0
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  6. 25 0
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcMessageController.java
  7. 1 1
      patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml
  8. 1 1
      patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml
  9. 1 1
      patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml
  10. 1 1
      patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml
  11. 1 1
      patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml
  12. 13 8
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientConfirmReceiptJob.java
  13. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceDao.java
  14. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/wechat/WechatTemplateConfigDao.java
  15. 94 37
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java
  16. 9 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  17. 44 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/iot/IotDeviceService.java
  18. 5 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java
  19. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/iot/IotDeviceController.java

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/SMS.java

@ -18,7 +18,7 @@ public class SMS extends IdEntity {
    private String mobile;// 手机号
    private String ip;// ip地址
    private Integer type;// 消息类型:1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录,6代预约(发送给居民)  10患者添加家庭关系,11账号申诉处理完成
    private Integer type;// 消息类型:0:客服系统发送消息 1微信端注册,2微信端找回密码,3医生端找回密码,4患者登录,5医生登录,6代预约(发送给居民)  10患者添加家庭关系,11账号申诉处理完成
    private String captcha;// 验证码
    private String content;// 消息内容
    private Date deadline;// 过期时间

+ 5 - 5
common/common-entity/src/main/java/com/yihu/wlyy/entity/wechat/WechatTemplateConfig.java

@ -14,7 +14,7 @@ import javax.persistence.Table;
@Table(name = "weixin_template_config")
public class WechatTemplateConfig extends IdEntity {
	private static final long serialVersionUID = -7399054549159698617L;
	private String templateId; //'模板ID
	private String templateName;//'自定义模板名称'
    private String scene;//使用场景值
    private String sceneDescription;//'使用场景描述'
    private String first;
@ -33,12 +33,12 @@ public class WechatTemplateConfig extends IdEntity {
        return serialVersionUID;
    }
    public String getTemplateId() {
        return templateId;
    public String getTemplateName() {
        return templateName;
    }
    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }
    public String getScene() {

+ 5 - 5
common/common-entity/src/main/java/com/yihu/wlyy/entity/wechat/WeixinTemplate.java

@ -16,7 +16,7 @@ public class WeixinTemplate  extends IdEntity {
    private String accId;//'微信公众号原始ID'
    private String templateName;//'自定义模板名称'
    private String templateId;//'模板ID'
    private String templateTitle;//'模板标题'
    private Integer type;//'自定义模板类型'
    private String format;//'模板内容格式'
    private Integer status;//'模板状态 1:正常  0:删除'
@ -37,12 +37,12 @@ public class WeixinTemplate  extends IdEntity {
        this.templateName = templateName;
    }
    public String getTemplateId() {
        return templateId;
    public String getTemplateTitle() {
        return templateTitle;
    }
    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    public void setTemplateTitle(String templateTitle) {
        this.templateTitle = templateTitle;
    }
    public Integer getType() {

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/user/range/user_role_add_js.jsp

@ -102,7 +102,7 @@
//                            {display: '机构编码', name: 'hospital', width: '0%', align: "center", hide: true},
                            {display: '新增机构', name: 'hospitalName', width: '25%', align: "left",
                                render: function (row) {
                                    var html = '',
                                    var html = '<option value=""></option>',
                                        htmlStr = '';
                                    for(var i=0;i<selectDict.length;i++){
                                        if(row.hospital == selectDict[i].code){

+ 5 - 0
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -50,6 +50,8 @@ public class PushMsgTask {
    private String template_schedule_remind;
    @Value("${wechat.message.template_service_remind}")
    private String template_service_remind;
    @Value("${wechat.message.template_callserver_remind}")
    private String template_callserver_remind;
    @Value("${pushMes.method}")
    private String putMesMethod;
    @Value("${pushMes.redis_prescription_title}")
@ -335,6 +337,9 @@ public class PushMsgTask {
            case 10:
                templateId = template_service_remind;
                break;
            case 11:
                templateId = template_callserver_remind;
                break;
        }
        return templateId;
    }

+ 25 - 0
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcMessageController.java

@ -1,10 +1,14 @@
package com.yihu.wlyy.web.third.gateway.controller.doctor;
import com.yihu.wlyy.entity.message.SMS;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.message.SMSDao;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.NetworkUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultBatchModel;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
@ -46,6 +50,8 @@ public class GcMessageController {
    private SMSService smsService;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    public SMSDao smsDao;
    @Value("${wechat.message.template_consult_notice}")
    private String templateId;
    @Value("${wechat.message.template_callserver_remind}")
@ -211,6 +217,25 @@ public class GcMessageController {
            for (String mobile : codeArr) {
                try {
                    JSONObject result = smsService.sendMsg(mobile, content);
                    // 保存短信发送记录
                    SMS sms = new SMS();
                    Date date = new Date();
                    // 延后5分钟
                    sms.setContent(content);
                    sms.setDeadline(DateUtil.getNextMin(date, 5));
                    sms.setCzrq(date);
                    sms.setMobile(mobile);
                    sms.setIp("customer");
                    sms.setType(0);
                    // 调用总部发送信息的接口
                    if (result != null && result.getInt("result") == 0) {
                        //发送成功,保存到数据库
                        sms.setStatus(1);
                        smsDao.save(sms);
                    }
                    logger.info("send mobile message param : "+mobile+" ====> "+content);
                    logger.info("send mobile message return : "+result);
                    success++;

+ 1 - 1
patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml

@ -30,7 +30,7 @@ wechat:
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fweixin.xmtyw.cn%2fwlyy-dev
  accId: gh_aa9cd602b84b
  accId: gh_b0f086d0d2f5
  message:
   ##处方待处理提醒
   template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik

+ 1 - 1
patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml

@ -30,7 +30,7 @@ wechat:
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fwww.xmtyw.cn%2fassistant
  accId: gh_aa9cd602b84b
  accId: gh_b0f086d0d2f5
  message:
   ##处方待处理提醒
   template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik

+ 1 - 1
patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml

@ -30,7 +30,7 @@ wechat:
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fehr.yihu.com%2fwlyy
  accId: gh_aa9cd602b84b
  accId: gh_b0f086d0d2f5
  message:
   ##处方待处理提醒
   template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik

+ 1 - 1
patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml

@ -30,7 +30,7 @@ wechat:
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fehr.yihu.com%2fwlyy
  accId: gh_aa9cd602b84b
  accId: gh_b0f086d0d2f5
  message:
   ##处方待处理提醒
   template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik

+ 1 - 1
patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml

@ -29,7 +29,7 @@ wechat:
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fwww.xmtyw.cn%2fassistant
  accId: gh_aa9cd602b84b
  accId: gh_b0f086d0d2f5
  message:
   ##处方待处理提醒
   template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik

+ 13 - 8
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/PatientConfirmReceiptJob.java

@ -19,6 +19,7 @@ import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -71,14 +72,14 @@ public class PatientConfirmReceiptJob implements Job {
                        long days = DateUtil.getDays(today,payTime);
                        if(days == 3){
                            //支付后第三天发送自动确认预提醒
                            sendWechatTemplate(1,patient);
                            sendWechatTemplate(1,patient,prescription.getCode());
                        }
                        int result = today.compareTo(confirm);
                        if (result >= 0) {
                            prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.finish.getValue());
                            list.add(prescription);
                            //发送自动确认提醒
                            sendWechatTemplate(2,patient);
                            sendWechatTemplate(2,patient,prescription.getCode());
                        }
                    }
                }
@ -99,9 +100,10 @@ public class PatientConfirmReceiptJob implements Job {
     *
     * @param type    监测类型 2立即提醒,1预提醒
     * @param patient 居民code
     * @param patient 续方code
     * @throws Exception
     */
    public void sendWechatTemplate(int type, String patient) throws Exception {
    public void sendWechatTemplate(int type, String patient,String PrescriptionCode) throws Exception {
        Patient people = patientDao.findByCode(patient);
        String openId = people.getOpenid();
        String name = people.getName();
@ -111,7 +113,7 @@ public class PatientConfirmReceiptJob implements Job {
        JSONObject sendJson = new JSONObject();
        if (type == 1) {
            String url = "prescription/html/order_tracking.html?represented="+patient;
            String url = "prescription/html/order_tracking.html?code=" + PrescriptionCode +"&represented="+patient;
            String first = name + "您好,您的续方订单将在4天后自动确认收药,如您已经取药,请点击本消息完成确认收药操作,结束订单";
            String remark = "如果您希望延长自动确认收药时间,请点击本消息后进行延长收药操作。";
@ -122,7 +124,7 @@ public class PatientConfirmReceiptJob implements Job {
            sendJson.put("remark", remark);
            sendJson.put("url", url+ "&openid=" + openId +"&toUser=" + patient + "&toName=" +name);//带参数的模板跳转链接
            sendJson.put("toUser", patient);//带参数的模板跳转链接
            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, openId, name, sendJson);
            //发送代理人
            if (StringUtils.isEmpty(openId)){
                jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
@ -135,12 +137,13 @@ public class PatientConfirmReceiptJob implements Job {
                        newJson.put("url", url+ "&openid=" + member.getOpenid() +"&toUser=" + member.getCode() + "&toName=" +name);
                        //name患者姓名
                        newJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
                        pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, newJson);
                        pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, member.getOpenid(), name, newJson);
                    }
                }
            }
            logger.info("sendJson: " + sendJson);
        }else if (type == 2) {
            String url = "prescription/html/order_tracking.html?code=" + PrescriptionCode +"&represented="+patient;
            String first = name + "您好,您的续方订单已自动确认收药";
            String remark = "如果您未收到续方药品,请及时与社区药房工作人员联系。";
            sendJson.put("keyword1", name);
@ -148,8 +151,9 @@ public class PatientConfirmReceiptJob implements Job {
            sendJson.put("keyword3", "续方订单状态");
            sendJson.put("first", first);
            sendJson.put("remark", remark);
            sendJson.put("url", url+ "&openid=" + openId +"&toUser=" + patient + "&toName=" +name);//带参数的模板跳转链接
            sendJson.put("toUser", patient);//带参数的模板跳转链接
            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, openId, name, sendJson);
            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, openId, name, sendJson);
            //发送代理人
            if (StringUtils.isEmpty(openId)){
                jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
@ -159,9 +163,10 @@ public class PatientConfirmReceiptJob implements Job {
                        Patient member = (Patient) j.get("member");
                        JSONObject newJson =  new JSONObject();
                        newJson.put("toUser", member.getCode());//带参数的模板跳转链接
                        newJson.put("url", url+ "&openid=" + member.getOpenid() +"&toUser=" + member.getCode() + "&toName=" +name);
                        //name患者姓名
                        newJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
                        pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11, member.getOpenid(), name, newJson);
                        pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 10, member.getOpenid(), name, newJson);
                    }
                }
            }

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceDao.java

@ -44,4 +44,7 @@ public interface PatientDeviceDao extends PagingAndSortingRepository<PatientDevi
            "from PatientDevice a,Patient p where a.userIdcard=p.idcard")
    List<PatientDevice> findWithArrdess();
    @Query("select a from PatientDevice a")
    List<PatientDevice> findAll();
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/wechat/WechatTemplateConfigDao.java

@ -12,7 +12,7 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface WechatTemplateConfigDao extends PagingAndSortingRepository<WechatTemplateConfig, Long>, JpaSpecificationExecutor<WechatTemplateConfig> {
    //根据模板id、场景值查询有效模板内容
    @Query("select t  from WechatTemplateConfig t where t.templateId=?1 and t.scene=?2 and t.status = 1 ")
    WechatTemplateConfig findByScene(String templateId,String scene);
    //根据自定义模板名称、场景值查询有效模板内容
    @Query("select t  from WechatTemplateConfig t where t.templateName=?1 and t.scene=?2 and t.status = 1 ")
    WechatTemplateConfig findByScene(String templateName,String scene);
}

+ 94 - 37
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java

@ -24,6 +24,7 @@ import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.third.iot.IotDeviceService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
@ -103,6 +104,8 @@ public class PatientDeviceService extends BaseService {
    @Autowired
    private PatientEventDao patientEventDao;
    @Autowired
    private IotDeviceService iotDeviceService;
    @Autowired
    private Icd10DictDao icd10DictDao;
    Map<Integer, String> relations = new HashMap<>();
@ -152,42 +155,41 @@ public class PatientDeviceService extends BaseService {
     * 保存患者设备
     */
    public boolean saveDevice(PatientDevice patientDevice) throws Exception {
        synchronized (patientDevice.getDeviceSn()) {
            //判断sn码是否被使用
            String sn = patientDevice.getDeviceSn();
            String type = patientDevice.getCategoryCode();
            Long deviceId = patientDevice.getDeviceId();
            String userType = patientDevice.getUserType();
            if (userType == null) {
                userType = "-1";
                patientDevice.setUserType("-1");
            }
        //判断sn码是否被使用
        String sn = patientDevice.getDeviceSn();
        String type = patientDevice.getCategoryCode();
        Long deviceId = patientDevice.getDeviceId();
        String userType = patientDevice.getUserType();
        if (userType == null) {
            userType = "-1";
            patientDevice.setUserType("-1");
        }
            boolean needVerify = true;
            //修改操作
            if (patientDevice.getId() != null) {
                PatientDevice deviceOld = patientDeviceDao.findOne(patientDevice.getId());
                if (deviceOld != null) {
                    if (deviceOld.getDeviceSn().equals(sn)) {
                        needVerify = false;
                    }
                } else {
                    throw new Exception("不存在该条记录!");
        boolean needVerify = true;
        //修改操作
        if (patientDevice.getId() != null) {
            PatientDevice deviceOld = patientDeviceDao.findOne(patientDevice.getId());
            if (deviceOld != null) {
                if (deviceOld.getDeviceSn().equals(sn)) {
                    needVerify = false;
                }
            } else {
                throw new Exception("不存在该条记录!");
            }
        }
            //校验sn码是否被使用
            if (needVerify) {
        //校验sn码是否被使用
        if (needVerify) {
//				PatientDevice device = patientDeviceDao.findByDeviceIdAndDeviceSnAndUserType(deviceId, sn, userType);
                PatientDevice device = patientDeviceDao.findByDeviceSnAndUserType(sn, userType);
                if (device != null && !device.getId().equals(patientDevice.getId())) {
                    throw new Exception("sn码" + sn + "已被使用!");
                }
            PatientDevice device = patientDeviceDao.findByDeviceSnAndUserType(sn, userType);
            if (device != null && !device.getId().equals(patientDevice.getId())) {
                throw new Exception("sn码" + sn + "已被使用!");
            }
            patientDevice.setCzrq(clock.getCurrentDate());
            //当前用户的身份证
            Patient patient = patientDao.findByCode(patientDevice.getUser());
            patientDevice.setUserIdcard(patient.getIdcard());
        }
        patientDevice.setCzrq(clock.getCurrentDate());
        //当前用户的身份证
        Patient patient = patientDao.findByCode(patientDevice.getUser());
        patientDevice.setUserIdcard(patient.getIdcard());
//            //注册设备
//            Map<String, String> params = new HashMap<>();
@ -205,15 +207,28 @@ public class PatientDeviceService extends BaseService {
//                String message = json.get("Message").toString();
//                throw new Exception(message);
//            }
            if(checkDeviceSn(sn)){
                patientDeviceDao.save(patientDevice);
            }else {
                String message = "设备不存在";
                throw new Exception(message);
            }
        if(checkDeviceSn(sn)){
//            patientDeviceDao.save(patientDevice);
            savePatientDevice(patientDevice,patient.getAddress(),patient.getName());
        }else {
            String message = "设备不存在";
            throw new Exception(message);
        }
        return true;
    }
            return true;
    /**
     * 设备绑定
     * @param patientDevice
     */
    public void savePatientDevice(PatientDevice patientDevice,String address,String patientName){
        if(iotDeviceService.isUploadIot()){
            iotDeviceService.saveDevice(patientDevice,address,patientName);
        }else {
            patientDeviceDao.save(patientDevice);
        }
    }
    /**
@ -727,6 +742,9 @@ public class PatientDeviceService extends BaseService {
        sql.append("WHERE m.type = 2  ORDER BY m.id desc LIMIT ?,?");
        List<com.alibaba.fastjson.JSONObject> list = myJdbcTemplate.queryJson(sql.toString(),new Object[]{(page-1)*pageSize,pageSize});
        list.forEach(json->{
            json.put("value2Name",getTypeName(json.getString("tz_type"),json.getString("value2")));
        });
        return list;
    }
@ -986,4 +1004,43 @@ public class PatientDeviceService extends BaseService {
        });
        return mapList;
    }
    /**
     * 名字转换
     * @param type
     * @param value
     * @return
     */
    private String getTypeName(String type,String value){
        String name = "";
        //1早餐前、2早餐后、3午餐前、4午餐后、5晚餐前 6晚餐后 7睡前)
        if ("1".equals(type)){
            switch (value){
                case "1":
                    name = "早餐前";
                    break;
                case "2":
                    name = "早餐后";
                    break;
                case "3":
                    name = "午餐前";
                    break;
                case "4":
                    name = "午餐后";
                    break;
                case "5":
                    name = "晚餐前";
                    break;
                case "6":
                    name = "晚餐后";
                    break;
                default:
                    name = "睡前";
                    break;
            }
        }else {
            name = "舒张压";
        }
        return name;
    }
}

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

@ -1781,7 +1781,8 @@ public class SignWebService extends BaseService {
                                 String custom,
                                 String sevId, String healthDoctor,
                                 Long teamCode,
                                 String expenses) throws Exception {
                                 String expenses,
                                 String refuseReason) throws Exception {
//        List<SignFamily> renews = signFamilyDao.findByDoctorAndPatientOverDue(dotorCode, patientCode, signYear);
//
@ -1796,6 +1797,7 @@ public class SignWebService extends BaseService {
                if (StringUtils.isNotBlank(state)) {
                    if ("0".equals(state)) {
                        renew.setStatus(-2);
                        renew.setRefuseSpeak(refuseReason);
                    } else if ("1".equals(state)) {
                        renew.setStatus(1);
@ -1832,7 +1834,6 @@ public class SignWebService extends BaseService {
                JSONObject data = new JSONObject();
                data.put("doctorName", renew.getDoctorName());
                data.put("date", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
                data.put("content", "家庭医生续签");
                data.put("doctor", dotorCode);
                data.put("toUser", patientCode);
                data.put("represented", patientCode);
@ -1845,11 +1846,17 @@ public class SignWebService extends BaseService {
                if (patient != null && StringUtils.isNotBlank(patient.getOpenid())) {
                    if ("0".equals(state)) {
                        if (StringUtils.isNotEmpty(refuseReason)){
                            data.put("content", refuseReason);
                        }else {
                            data.put("content", "家庭医生续签");
                        }
                        data.put("first", renew.getName() + ",您好!\n" +
                                "您的家庭医生续签申请已被拒绝");
                        data.put("remark", "您可在到期后选择其他医生进行签约。");
                        pushMsgTask.putWxMsg(access_token, 2, patient.getOpenid(), patient.getName(), data);
                    } else if ("1".equals(state)) {
                        data.put("content", "家庭医生续签");
                        data.put("first", renew.getName() + ",您好!\n" +
                                "您的家庭医生续签申请已通过");
                        data.put("remark", "待自动扣费成功后,家庭医生将续签成功。");

+ 44 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/iot/IotDeviceService.java

@ -148,6 +148,34 @@ public class IotDeviceService {
        return response;
    }
    /**
     * 设备绑定
     * @param patientDevice
     * @param address
     * @return
     */
    public String saveDevice(PatientDevice patientDevice,String address,String name){
        JSONObject json = new JSONObject();
        json.put("categoryCode",patientDevice.getCategoryCode());
        json.put("address",address);
        json.put("patient",patientDevice.getUser());
        json.put("patientName",name);
        json.put("idcard",patientDevice.getUserIdcard());
        json.put("deviceId",patientDevice.getDeviceId());
        json.put("deviceName",patientDevice.getDeviceName());
        json.put("deviceSn",patientDevice.getDeviceSn());
        json.put("userType",patientDevice.getUserType());
        json.put("sim",patientDevice.getSim());
        json.put("agent",patientDevice.getAgent());
        json.put("doctor",patientDevice.getDoctor());
        String url = baseUrl+"/patientDevice/addPatientDevice";
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("jsonData",json.toString()));
        String response = httpClientUtil.post(url, params, "UTF-8");
        return response;
    }
    /**
     * 数据上传
     * @param json
@ -368,6 +396,22 @@ public class IotDeviceService {
        return response;
    }
    /**
     * 初始化设备绑定数据
     * @return
     */
    public void initPatientDevice(){
        List<PatientDevice> list = patientDeviceDao.findAll();
        list.forEach(patientDevice -> {
            Patient patient = patientDao.findByCode(patientDevice.getUser());
            String response = saveDevice(patientDevice,patient.getAddress(),patient.getName());
            JSONObject re = JSONObject.parseObject(response);
            if(re.getInteger("status")!=200){
                logger.error("id:"+patientDevice.getId()+" "+re.getString("errorMsg"));
            }
        });
    }
    /**
     * 初始化迁移数据
     * @return

+ 5 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -479,6 +479,8 @@ public class DoctorSignController extends WeixinBaseController {
    /**
     * 同意或拒绝
     * @param state
     * @param refuseReason 医生拒签原因
     *
     * @return
     */
    @RequestMapping("/agreeRenew")
@ -494,11 +496,12 @@ public class DoctorSignController extends WeixinBaseController {
                             @RequestParam(required = false) String sevId,
                             @RequestParam(required = false) String healthDoctor,
                             @RequestParam(required = false) Long teamCode,
                             @RequestParam(required = false) String expenses){
                             @RequestParam(required = false) String expenses,
                             @RequestParam(required = false) String refuseReason){
        try{
            //屏蔽了预签约
            int rs = 0;
            rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses);
            rs =signWebService.agreeRenewOverDue(getAccessToken(),getUID(),patient,state,mesId,"",signCode,health,disease,custom,sevId,healthDoctor,teamCode,expenses,refuseReason);
            if(rs != 1){
                //设置代码为已读
                signWebService.setMessState(mesId);

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/iot/IotDeviceController.java

@ -100,6 +100,18 @@ public class IotDeviceController extends BaseController{
        }
    }
    @RequestMapping(value = "/initPatientDevice",method = RequestMethod.POST)
    @ApiOperation("初始化迁移设备绑定数据")
    public String initPatientDevice(){
        try {
            iotDeviceService.initPatientDevice();
            return success("初始化成功");
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    @RequestMapping(value = "/findById",method = RequestMethod.GET)
    @ApiOperation("按id查询")
    public String findById(@ApiParam(name = "id",value = "id",defaultValue = "LggM5iaSi6u18TUmeDoaeSnyFxntPMA2NPGXBRyPTwFsg+oRn3bHgg==")