소스 검색

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

yeshijie 7 년 전
부모
커밋
56994c44db
29개의 변경된 파일1714개의 추가작업 그리고 99개의 파일을 삭제
  1. 3 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/DeviceHealthIndexController.java
  2. 126 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/WechatTemplateController.java
  3. 147 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/wechat/WechatTemplateConfig.java
  4. 71 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/wechat/WeixinTemplate.java
  5. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/PatientDao.java
  6. 2 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/SignFamilyDao.java
  7. 17 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/wechat/WechatTemplateConfigDao.java
  8. 78 31
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java
  9. 2 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java
  10. 92 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/wechat/WechatTemplateService.java
  11. 1 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/deviceHealthIndex_list.jsp
  12. 3 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/main.jsp
  13. 191 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/wechat/wechat_edit.jsp
  14. 575 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/wechat/wechat_edit_js.jsp
  15. 44 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/wechat/wechat_list.jsp
  16. 284 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/wechat/wechat_list_js.jsp
  17. 1 0
      patient-co-manage/wlyy-manage/src/main/webapp/static/js/menu.js
  18. 10 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/Patient.java
  19. 4 4
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignRenewZYService.java
  20. 1 1
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignZYService.java
  21. 0 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  22. 7 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java
  23. 17 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java
  24. 5 20
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  25. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionNoticesService.java
  26. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  27. 22 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  28. 5 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PyhsicExamRemindController.java
  29. 2 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

+ 3 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/DeviceHealthIndexController.java

@ -97,9 +97,10 @@ public class DeviceHealthIndexController extends BaseController{
            @RequestParam(value = "indexTypeMax1",required = false) Double indexTypeMax1,
            @RequestParam(value = "indexTypeMin2",required = false) Double indexTypeMin2,
            @RequestParam(value = "indexTypeMax2",required = false) Double indexTypeMax2,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            HttpServletResponse response){
        try {
            List<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.getExcelByFilter(deviceSn,date, idcard, userName, indexType,indexTypeMin1,indexTypeMax1,indexTypeMin2,indexTypeMax2);
            List<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.getExcelByFilter(deviceSn,date, idcard, userName, indexType,indexTypeMin1,indexTypeMax1,indexTypeMin2,indexTypeMax2,doctorName);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "patientHealthIndexDataList.xls"));
            OutputStream os = response.getOutputStream();
@ -182,7 +183,7 @@ public class DeviceHealthIndexController extends BaseController{
                addCell(ws, i, 1, format.format(m.getCzrq()),"");
                addCell(ws, i, 2, m.getIdcard(),"");
                addCell(ws, i, 3, m.getUserName(),"");
                addCell(ws, i, 4, "","");
                addCell(ws, i, 4, type,"");
                addCell(ws, i, 5, m.getValue1(),"");
                addCell(ws, i, 6, m.getValue2(),"");
                addCell(ws, i, 7, m.getValue3(),"");

+ 126 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/notification/WechatTemplateController.java

@ -0,0 +1,126 @@
package com.yihu.wlyy.controller.manager.notification;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.WlyyAuditNotice;
import com.yihu.wlyy.entity.WlyyAuditNoticeScope;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.service.manager.notification.WlyyAuditNoticeScopeService;
import com.yihu.wlyy.service.manager.notification.WlyyAuditNoticeService;
import com.yihu.wlyy.service.manager.wechat.WechatTemplateService;
import com.yihu.wlyy.service.manager.wlyyrole.WlyyUserRoleService;
import com.yihu.wlyy.service.wechat.WechatService;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* @Description: 微信模板管理
* @Author: WuJunjie
* @Date: Created in 2018/3/20 9:07
*/
@Controller
@RequestMapping("/admin/wechatTemplate")
public class WechatTemplateController extends BaseController {
    @Autowired
    private WechatTemplateService wechatTemplateService;
    @Autowired
    private WlyyAuditNoticeScopeService wlyyAuditNoticeScopeService;
    @Autowired
    private WlyyUserRoleService wlyyUserRoleService;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    @ApiIgnore
    public String notificationListInitial(Model model) {
        return "wechat/wechat_list";
    }
    /**
     * 根据模板自定义名称和场景值查询模板消息
     * @param templateName
     * @param scene
     * @param page
     * @param pageSize
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "list", method = RequestMethod.POST)
    @ResponseBody
    public String searchNotificationList(
            @ApiParam(name = "templateName", value = "模板名称")
            @RequestParam(value = "templateName", required = false) String templateName,
            @ApiParam(name = "scene", value = "模板场景值")
            @RequestParam(value = "scene", required = false) String scene,
            @ApiParam(name = "page")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "rows")
            @RequestParam(value = "rows") int pageSize) {
        try {
            Page<WechatTemplateConfig> templetes = wechatTemplateService.searchList(templateName, scene, page, pageSize);
            return write(200, "操作成功", page, pageSize, templetes);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    /**
     * 根据模板自定义名称和场景值查询模板消息详情
     * @param templateName
     * @param scene
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "getTemplate", method = RequestMethod.POST)
    @ResponseBody
    public String getTemplate(
            @ApiParam(name = "templateName", value = "模板名称")
            @RequestParam(value = "templateName", required = false) String templateName,
            @ApiParam(name = "scene", value = "模板场景值")
            @RequestParam(value = "scene", required = false) String scene) {
        try {
            WechatTemplateConfig templete = wechatTemplateService.getTemplate(templateName, scene);
            return write(200, "操作成功", "data",templete);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
    /**
     * 新增或修改模板详情
     * @param templateName
     * @param scene
     * @return
     * @throws Exception
     */
    @RequestMapping(value = "updateTemplate", method = RequestMethod.POST)
    @ResponseBody
    public String updateTemplate(
            @ApiParam(name = "templateName", value = "模板名称")
            @RequestParam(value = "templateName", required = false) String templateName,
            @ApiParam(name = "scene", value = "模板场景值")
            @RequestParam(value = "scene", required = false) String scene) {
        try {
            return write(200, "操作成功", "data","");
        } catch (Exception ex) {
            error(ex);
            return error(-1, "操作失败");
        }
    }
}

+ 147 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/wechat/WechatTemplateConfig.java

@ -0,0 +1,147 @@
package com.yihu.wlyy.entity.wechat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 微信消息模板按场景区分消息内容
 * @author WuJunjie
 */
@Entity
@Table(name = "weixin_template_config")
public class WechatTemplateConfig extends IdEntity {
	private static final long serialVersionUID = -7399054549159698617L;
	private String templateName;//'自定义模板名称'
    private String scene;//使用场景值
    private String sceneDescription;//'使用场景描述'
    private String first;
    private String url;//模板消息'跳转链接'
    private String remark;
    private String keyword1;
    private String keyword2;
    private String keyword3;
    private String keyword4;
    private String keyword5;
    private String keyword6;
    private String keyword7;
    private Integer status;//状态 1:正常 0:删除
    public static long getSerialVersionUID() {
        return serialVersionUID;
    }
    public String getTemplateName() {
        return templateName;
    }
    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }
    public String getScene() {
        return scene;
    }
    public void setScene(String scene) {
        this.scene = scene;
    }
    public String getSceneDescription() {
        return sceneDescription;
    }
    public void setSceneDescription(String sceneDescription) {
        this.sceneDescription = sceneDescription;
    }
    public String getFirst() {
        return first;
    }
    public void setFirst(String first) {
        this.first = first;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getKeyword1() {
        return keyword1;
    }
    public void setKeyword1(String keyword1) {
        this.keyword1 = keyword1;
    }
    public String getKeyword2() {
        return keyword2;
    }
    public void setKeyword2(String keyword2) {
        this.keyword2 = keyword2;
    }
    public String getKeyword3() {
        return keyword3;
    }
    public void setKeyword3(String keyword3) {
        this.keyword3 = keyword3;
    }
    public String getKeyword4() {
        return keyword4;
    }
    public void setKeyword4(String keyword4) {
        this.keyword4 = keyword4;
    }
    public String getKeyword5() {
        return keyword5;
    }
    public void setKeyword5(String keyword5) {
        this.keyword5 = keyword5;
    }
    public String getKeyword6() {
        return keyword6;
    }
    public void setKeyword6(String keyword6) {
        this.keyword6 = keyword6;
    }
    public String getKeyword7() {
        return keyword7;
    }
    public void setKeyword7(String keyword7) {
        this.keyword7 = keyword7;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 71 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/wechat/WeixinTemplate.java

@ -0,0 +1,71 @@
package com.yihu.wlyy.entity.wechat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * @Description: 记录各公众号模板详情及自定义类型
 * @Author: WuJunjie
 * @Date: Created in 2018/2/24 17:38
 */
@Entity
@Table(name = "weixin_template")
public class WeixinTemplate extends IdEntity {
    private String accId;//'微信公众号原始ID'
    private String templateName;//'自定义模板名称'
    private String templateTitle;//'模板标题'
    private Integer type;//'自定义模板类型'
    private String format;//'模板内容格式'
    private Integer status;//'模板状态 1:正常  0:删除'
    public String getAccId() {
        return accId;
    }
    public void setAccId(String accId) {
        this.accId = accId;
    }
    public String getTemplateName() {
        return templateName;
    }
    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }
    public String getTemplateTitle() {
        return templateTitle;
    }
    public void setTemplateTitle(String templateTitle) {
        this.templateTitle = templateTitle;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getFormat() {
        return format;
    }
    public void setFormat(String format) {
        this.format = format;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

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

@ -22,7 +22,7 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long>,Jp
    // 根据姓名查询
    @Query("select p.code from Patient p where p.name=?1")
    String[] findByName(String name);
    List<String> findByName(String name);
	// 根據患者標識查詢患者信息
	@Query("select p from Patient p where p.code=?1")

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/SignFamilyDao.java

@ -50,8 +50,8 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    List<SignFamily> findLastJySignByPatient(String patient, int type);
    @Query("select a.patient from SignFamily a where (a.doctorName like ?1 or a.doctorHealthName like ?1) and a.status > 0")
    String[] findByDoctorName(String doctorName);
    List<String> findByDoctorName(String doctorName);
    @Query("select a.patient from SignFamily a where a.hospital=?1 and a.status > 0")
    String[] findByHospital(String hospital);
    List<String> findByHospital(String hospital);
}

+ 17 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/wechat/WechatTemplateConfigDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.repository.wechat;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @Description: 分场景值查询模板文案内容
 * @Author: WuJunjie
 * @Date: Created in 2018/2/23 11:51
 */
public interface WechatTemplateConfigDao extends PagingAndSortingRepository<WechatTemplateConfig, Long>, JpaSpecificationExecutor<WechatTemplateConfig> {
    //根据自定义模板名称、场景值查询有效模板内容
    @Query("select t  from WechatTemplateConfig t where t.templateName=?1 and t.scene=?2 and t.status = 1 ")
    WechatTemplateConfig findByScene(String templateName, String scene);
}

+ 78 - 31
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java

@ -64,22 +64,28 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
        User loginUser = (User) request.getSession().getAttribute("userInfo");
//        HttpServletRequest request = ServletActionContext.getRequest();
//        HttpSession session = request.getSession();
        Pageable pageRequest = new PageRequest(page-1,pageSize);
        StringBuilder filter = new StringBuilder();
        String sql = "SELECT a.patient  FROM wlyy.wlyy_sign_family a, wlyy.wlyy_patient b WHERE a.status > 0 AND a.patient = b.code  ";
        //1、管理员  2、医生 0、其他
        if(loginUser.getType()==2){
            Doctor doctor = doctorDao.findByCode(loginUser.getCode());
            String[] codes =signFamilyDao.findByHospital(doctor.getHospital());
            if(codes != null && codes.length >0){
                filter.append("user="+StringUtils.join(codes, ","));
            }else {
                return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
            if(doctor!=null &&StringUtils.isNotEmpty(doctor.getHospital())){
                sql += " AND a.hospital = '"+doctor.getHospital()+"' ";
            }
        }
        //根据患者名称过滤
        if(!StringUtils.isEmpty(userName)){
            sql +=" AND b.NAME LIKE '%"+userName+"%'";
        }
        //根据健管师或医生名称过滤
        if(!StringUtils.isEmpty(doctorName)){
            sql += " and (a.doctor_name like '%"+doctorName+"%' or a.doctor_health_name like '%"+doctorName+"%') ";
        }
        List<String> patientList = jdbcTemplate.queryForList(sql,String.class);
        if(!StringUtils.isEmpty(deviceSn)){
            filter.append("deviceSn="+deviceSn+";");
        }
@ -98,22 +104,12 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
            filter.append("czrq>=" + DateTimeUtil.utcDateTimeFormat(startTimeTemp)+ ";");
            filter.append("czrq<=" + DateTimeUtil.utcDateTimeFormat(endTimeTemp)+ ";");
        }
        if(!StringUtils.isEmpty(userName)){
            String[] codes = patientDao.findByName(userName);
            if(codes != null && codes.length >0){
                filter.append("user="+StringUtils.join(codes, ","));
            }else {
                return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
            }
        }
        //根据医生名称过滤居民
        if(!StringUtils.isEmpty(doctorName)){
            String[] codes = signFamilyDao.findByDoctorName("%"+doctorName+"%");
            if(codes != null && codes.length >0){
                filter.append("user="+StringUtils.join(codes, ","));
            }else {
                return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
            }
        if(patientList != null && patientList.size() >0){
            String temp = StringUtils.join(patientList, ",");
//            temp = temp.substring(0,temp.length()-1);
            filter.append("user="+temp+";");
        }else {
            return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
        }
        if(!StringUtils.isEmpty(indexType)){
@ -169,9 +165,33 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
    }
    public List<DeviceHealthIndexVO> getExcelByFilter(String deviceSn,String date,String idcard,
                                                String userName,String indexType,Double indexTypeMin1,Double indexTypeMax1,Double indexTypeMin2,Double indexTypeMax2)throws Exception{
                                                String userName,String indexType,Double indexTypeMin1,Double indexTypeMax1,Double indexTypeMin2,Double indexTypeMax2,String doctorName)throws Exception{
        HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
        User loginUser = (User) request.getSession().getAttribute("userInfo");
        StringBuilder filter = new StringBuilder();
        String sql = "SELECT a.patient  FROM wlyy.wlyy_sign_family a, wlyy.wlyy_patient b WHERE a.status > 0 AND a.patient = b.code  ";
        //1、管理员  2、医生 0、其他
        if(loginUser.getType()==2){
            Doctor doctor = doctorDao.findByCode(loginUser.getCode());
            if(doctor!=null &&StringUtils.isNotEmpty(doctor.getHospital())){
                sql += " AND a.hospital = '"+doctor.getHospital()+"' ";
            }
        }
        //根据患者名称过滤
        if(!StringUtils.isEmpty(userName)){
            sql +=" AND b.NAME LIKE '%"+userName+"%'";
        }
        //根据健管师或医生名称过滤
        if(!StringUtils.isEmpty(doctorName)){
            sql += " and (a.doctor_name like '%"+doctorName+"%' or a.doctor_health_name like '%"+doctorName+"%') ";
        }
        List<String> patientList = jdbcTemplate.queryForList(sql,String.class);
        if(!StringUtils.isEmpty(deviceSn)){
            filter.append("deviceSn="+deviceSn+";");
        }
@ -190,15 +210,41 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
            filter.append("czrq>=" + DateTimeUtil.utcDateTimeFormat(startTimeTemp)+ ";");
            filter.append("czrq<=" + DateTimeUtil.utcDateTimeFormat(endTimeTemp)+ ";");
        }
        if(!StringUtils.isEmpty(userName)){
            String[] codes = patientDao.findByName(userName);
            if(codes != null && codes.length >0){
                filter.append("user="+StringUtils.join(codes, ","));
            }
        if(patientList != null && patientList.size() >0){
            String temp = StringUtils.join(patientList, ",");
            filter.append("user="+temp+";");
        }
        if(!StringUtils.isEmpty(indexType)){
            filter.append("type="+indexType+";");
        }
        if("1".equals(indexType)||"2".equals(indexType)||"4".equals(indexType)){
            if(indexTypeMin1!=null){
                filter.append("value1>="+indexTypeMin1+";");
            }
            if(indexTypeMax1!=null){
                filter.append("value1<="+indexTypeMax1+";");
            }
            if(indexTypeMin2!=null){
                filter.append("value2>="+indexTypeMin2+";");
            }
            if(indexTypeMax2!=null){
                filter.append("value2<="+indexTypeMax2+";");
            }
        }else{
            if(indexTypeMin1!=null){
                filter.append("value3>="+indexTypeMin1+";");
            }
            if(indexTypeMax1!=null){
                filter.append("value3<="+indexTypeMax1+";");
            }
            if(indexTypeMin2!=null){
                filter.append("value4>="+indexTypeMin2+";");
            }
            if(indexTypeMax2!=null){
                filter.append("value4<="+indexTypeMax2+";");
            }
        }
        List<DeviceHealthIndex> list = (List<DeviceHealthIndex>)search(filter.toString());
        String regex = "(\\w{3})(\\w+)(\\w{3})";
        List<DeviceHealthIndexVO> listTemp = new ArrayList<>();
@ -206,6 +252,7 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
            for (DeviceHealthIndex info : list){
                DeviceHealthIndexVO bean = new DeviceHealthIndexVO();
                BeanUtils.copyProperties(info, bean);
//                BeanUtils.copyProperties(bean, info);
                Patient patient = findPatient(bean.getUser());
                bean.setUserName(patient== null?"":patient.getName());
                if(StringUtils.isNotBlank(bean.getIdcard())){

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java

@ -41,8 +41,8 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
        PageRequest pageRequest = new PageRequest(page-1,pageSize);
        StringBuilder filters = new StringBuilder();
        if(!StringUtils.isEmpty(userName)){
            String[] codes = patientDao.findByName(userName);
            if(codes != null && codes.length >0){
            List<String> codes = patientDao.findByName(userName);
            if(codes != null && codes.size() >0){
                filters.append("user="+StringUtils.join(codes, ",")+";");
            }else {
                return new PageImpl<WlyyPatientDevice>(new ArrayList<>(), pageRequest, 0);

+ 92 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/wechat/WechatTemplateService.java

@ -0,0 +1,92 @@
package com.yihu.wlyy.service.manager.wechat;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.service.SMSService;
import com.yihu.wlyy.service.manager.wlyyrole.WlyyRoleService;
import com.yihu.wlyy.service.manager.wlyyrole.WlyyUserRoleService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.SQLQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @Description: 微信模板管理业务逻辑
 * @Author: WuJunjie
 * @Date: Created in 2018/3/20 9:30
 */
@Service
public class WechatTemplateService extends BaseJpaService<WlyyAuditNotice, WlyyAuditNoticeDao> {
    @Autowired
    private WlyyRoleDao wlyyRoleDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 根据模板自定义名称和场景值查询模板消息
     * @param templateName
     * @param scene
     * @param page
     * @param pageSize
     * @return
     * @throws Exception
     */
    public Page<WechatTemplateConfig> searchList(String templateName, String scene, int page, int pageSize) throws Exception {
        if (page <= 0) {
            page = 1;
        }
        if (pageSize <= 0) {
            pageSize = 15;
        }
        PageRequest pageRequest = new PageRequest(page - 1, pageSize);
        String filters = "";
        if (!StringUtils.isEmpty(templateName)) {
            filters = "templateName?" + templateName + ";";
        }
        if (!StringUtils.isEmpty(scene)) {
            filters += "scene=" + scene + ";";
        }
        List<WechatTemplateConfig> list = search("", filters, "", page, pageSize);
        return new PageImpl<WechatTemplateConfig>(list, pageRequest, getCount(filters));
    }
    /**
     * 根据模板自定义名称和场景值查询模板消息详情
     * @param templateName
     * @param scene
     * @return
     * @throws Exception
     */
    public WechatTemplateConfig getTemplate(String templateName, String scene) throws Exception {
        String filters = "";
        if (!StringUtils.isEmpty(templateName)) {
            filters = "templateName=" + templateName + ";";
        }
        if (!StringUtils.isEmpty(scene)) {
            filters += "scene=" + scene + ";";
        }
        String sql = "SELECT t.template_name, t.template_title, t.format, c.`first`, " +
                " c.keyword1 , c.keyword2, c.keyword3, c.keyword4, c.keyword5, c.keyword6 , c.keyword7, c.remark " +
                " FROM weixin_template t, weixin_template_config c " +
                " WHERE t.template_name = c.template_name AND c.scene = ''";
        return null;
    }
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/deviceHealthIndex_list.jsp

@ -46,7 +46,7 @@
					<span>导出</span>
				</div>
			</sec:authorize>
			<div class="m-form-control f-ml15">
			<div class="m-form-control f-ml15 f-mt10">
				<input type="text" id="inp_doctor_name" placeholder="请输入医生/健管师名称" class="f-ml10" data-attr-scan="doctorName"/>
			</div>
			<div id="select-list" class="f-mt10" style="display: none">

+ 3 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/main.jsp

@ -221,6 +221,9 @@
								<sec:authorize url="/admin/notification/initial">
								<li><a href="javascript:locationMenu('notification');">消息通知</a></li>
								</sec:authorize>
								<sec:authorize url="/admin/wechatTemplate/initial">
									<li><a href="javascript:locationMenu('wechatTemplate');">微信模板消息管理</a></li>
								</sec:authorize>
								<sec:authorize url="/admin/message/center">
							</ul>
					</div>

+ 191 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/wechat/wechat_edit.jsp

@ -0,0 +1,191 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"
		 pageEncoding="utf-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
	<%@ include file="../head/page_head.jsp"%>
	<title>机构管理</title>
</head>
<style>
	.m-form-group label.label_title {
		width: 100px
	}
	.m-form-group p.tip {
		width: auto;
        margin-left: 100px;
        line-height: 20px;
	}
	.m-form-group ul li{
		line-height: 30px;
		margin-left: 100px;
	}
	.m-form-group .inpRadio{
		 vertical-align: bottom;
		 margin: 8px 0 0;
	 }
	.m-form-group .inpChkb{
		vertical-align: sub;
	}
	.m-form-group .l-text-date{
		width: 140px;
	}
	.m-form-group .sendTime{
		width: 138px;
	}
    .m-form-group  span.community{
        width: 50px;
        display: inline-flex;
    }
	.f-pa{
		position: relative;
	}
	.f-pa .m-form-control{
		margin-left: 200px;
		margin-top: 10px;
	}
	.wordwrap{
		float: left;
		display: block;
		margin: 140px 0 0 10px;
	}
	.wordCount .word{
		color: red;
		padding: 0 4px;
	}
	#messageContent .j-text-wrapper{
		float: left;
	}
	#messageContent .l-text-trigger-cancel{
		display: none!important;
	}
</style>
<body>
<div id="div_roles_info_form" class="m-form-inline f-mt20 f-ml30"
	 data-role-form>
	<input type="hidden" id="uuid" value='${UUID}'/>
	<input type="hidden" id="cityAuthority" value='${cityAuthority}'/>
	<input type="hidden" id="areaAuthority" value='${areaAuthority}'/>
	<input type="hidden" id="communityAuthority" value='${communityAuthority}'/>
	<input type="hidden" id="mode" value='${mode}'/>
	<input type="hidden" id="scopeId"/>
	<input type="hidden" id="diseaseTypeId"/>
	<input type="hidden" id="healthSituationId"/>
	<input type="hidden" id="serverTypeId"/>
	<input type="hidden" id="noticeId" value='${id}' data-attr-scan="id" />
	<div class="m-form-group">
		<label class="label_title" style="">发送范围:</label>
		<div class="u-radio-wrap m-form-control">
			<input type="radio" value="0" name="scope" id="cityScope" class="inpRadio" data-attr-scan=""> 全市
			<input type="radio" value="1" name="scope" id="areaScope" class="inpRadio" data-attr-scan=""> 指定区
			<input type="radio" value="2" name="scope" id="communityScope" class="inpRadio" data-attr-scan=""> 指定社区
		</div>
	</div>
	<div class="m-form-group" id="scope_area" style="display: none">
		<label class="label_title" style="">选择区:</label>
		<div class="u-checkbox-wrap m-form-control scope_areaDiv">
			<%--<input type="checkbox" name="scope_area" class="inpChkb" value="1" data-attr-scan>选项一--%>
			<%--<input type="checkbox" name="scope_area" class="inpChkb" value="2" data-attr-scan>选项二--%>
			<%--<input type="checkbox" name="scope_area" class="inpChkb" value="3" data-attr-scan>选项三--%>
		</div>
	</div>
	<div class="m-form-group" id="scope_community" style="display: none">
		<label class="label_title" style="">选择社区:</label>
		<div class="m-form-control scope_communityDiv" style="margin-top: 5px;">
			<%--<input type="checkbox" name="scope_community" class="inpChkb" value="1" data-attr-scan>选项一--%>
			<%--<input type="checkbox" name="scope_community" class="inpChkb" value="2" data-attr-scan>选项二--%>
			<%--<input type="checkbox" name="scope_community" class="inpChkb" value="3" data-attr-scan>选项三--%>
		</div>
	</div>
	<div class="m-form-group">
		<label class="label_title" style="">筛选条件:</label>
		<div class="u-radio-wrap m-form-control">
			<input type="radio" value="0" name="condition_type" class="inpRadio" data-attr-scan=""> 全部居民
			<input type="radio" value="1" name="condition_type" class="inpRadio" data-attr-scan=""> 设置条件
		</div>
	</div>
	<div class="m-form-group" id="inpCondition" style="display: none;padding-bottom: 0px">
		<label class="label_title" style=""></label>
		<div class="u-checkbox-wrap m-form-control">
			<input type="checkbox" name="condition" class="inpChkb" value="1" data-class=".serverType" data-name="serverType" data-tip="服务类型" data-attr-scan>按服务类型
			<input type="checkbox" name="condition" class="inpChkb" value="2" data-class=".health_situation" data-name="health_situation" data-tip="健康情况" data-attr-scan>按健康情况
			<input type="checkbox" name="condition" class="inpChkb" value="3" data-class=".diease" data-name="diease" data-tip="疾病类型" data-attr-scan>按疾病类型
		</div>
	</div>
	<div class="m-form-group" style=" ">
		<ul style="display: block; vertical-align: middle;">
			<li>
				<div class="m-form-group serverType" style="display: none;padding-bottom: 0px;">
					<label class="label_title" style="text-align: left;width: auto;line-height: 20px;">服务类型:</label>
					<div class="u-checkbox-wrap m-form-control serverTypeDiv" style="line-height: 20px;">
						<%--<input type="checkbox" name="server" class="inpChkb" value="1" data-attr-scan>按服务类型--%>
						<%--<input type="checkbox" name="server" class="inpChkb" value="2" data-attr-scan>按健康情况--%>
						<%--<input type="checkbox" name="server" class="inpChkb" value="3" data-attr-scan>按疾病类型--%>
					</div>
				</div>
			</li>
			<li>
				<div class="m-form-group health_situation" style="display: none;padding-bottom: 0px;">
					<label class="label_title" style="text-align: left;width: auto;line-height: 20px;">健康情况:</label>
					<div class="u-checkbox-wrap m-form-control health_situationDiv" style="line-height: 20px;">
						<%--<input type="checkbox" name="health_situation" class="inpChkb" value="1" data-attr-scan>按服务类型--%>
						<%--<input type="checkbox" name="health_situation" class="inpChkb" value="2" data-attr-scan>按健康情况--%>
						<%--<input type="checkbox" name="health_situation" class="inpChkb" value="3" data-attr-scan>按疾病类型--%>
					</div>
				</div>
			</li>
			<li>
				<div class="m-form-group diease" style="display: none;padding-bottom: 0px;">
					<label class="label_title" style="text-align: left;width: auto;line-height: 20px;">疾病类型:</label>
					<div class="u-checkbox-wrap m-form-control dieaseDiv" style="line-height: 20px;">
						<%--<input type="checkbox" name="diease" class="inpChkb" value="1" data-attr-scan>按服务类型--%>
						<%--<input type="checkbox" name="diease" class="inpChkb" value="2" data-attr-scan>按健康情况--%>
						<%--<input type="checkbox" name="diease" class="inpChkb" value="3" data-attr-scan>按疾病类型--%>
					</div>
				</div>
			</li>
		</ul>
	</div>
	<div class="m-form-group" style="">
		<label class="label_title" style="">通知标题:</label>
		<div class="l-text-wrapper m-form-control essential">
			<input type="text" id="title" class="required useTitle validate-special-char" required-title="请输入通知标题" placeholder="请输入通知标题" data-attr-scan="title" />
		</div>
	</div>
    <div class="m-form-group">
        <label class="label_title" style="">通知内容:</label>
        <div class="l-text-wrapper m-form-control" id="messageContent">
				<textarea type="text" id="content"  maxlength="120"
                          class="required max-length-120 validate-special-char" placeholder="请输入通知具体内容,最多120字,因每条短信限制70字,若大于70字可能将被分割成两条短信" data-attr-scan="content"></textarea>
				<span class="wordwrap" id="wordwrap"><var class="word">0</var>/120</span>
        </div>
    </div>
	<div class="m-form-group">
		<label class="label_title">发送时间:</label>
		<div class="l-text-wrapper m-form-control useTitle ajax validate-special-char">
			<input id="send_type_combo_select" data-type="text" class="" data-name="text" data-attr-scan="sendType">
		</div>
		<div class="m-form-control essential send_time" style="margin-left: 10px;">
			<input type="text" id="send_time" class="sendTime required" placeholder="输入发送时间"  required-title="不能为空" data-attr-scan="sendTime"/>
		</div>
	</div>
	<div class="m-form-group">
		<p class="tip">1、立即发送,则审核通过后立即发送</p>
		<p class="tip">2、定时发送,则审核通过后将在指定时间发送。如在指定时间前未审核通过,则将自动撤回</p>
	</div>
	<div class="m-form-group f-pa" id="btn_save_close" style="right: 10px;bottom: 0;">
		<div class="m-form-control">
			<input type="button" value="提    交" id="btn_save" class="l-button u-btn u-btn-primary u-btn-large f-ib f-vam" />
			<div id="btn_cancel" class="l-button u-btn u-btn-cancel u-btn-large f-ib f-vam" >
				<span>关闭</span>
			</div>
		</div>
	</div>
</div>
</body>
<%@ include file="../head/page_foot.jsp"%>
<%@ include file="wechat_edit_js.jsp" %>
</html>

+ 575 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/wechat/wechat_edit_js.jsp

@ -0,0 +1,575 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<script language="javascript">
    $(function(){
        //先选出 textarea 和 统计字数 dom 节点
        var wordCount = $("#messageContent"),
                textArea = wordCount.find("textarea"),
                word = wordCount.find(".word");
        //调用
        statInputNum(textArea,word);
    });
    /*
     * 剩余字数统计
     * 注意 最大字数只需要在放数字的节点哪里直接写好即可 如:<var class="word">200</var>
     */
    function statInputNum(textArea,numItem) {
        var max = numItem.text(), curLength;
        curLength = textArea.val().length;
        numItem.text(max - curLength);
        textArea.on('input propertychange', function () {
            var _value = $(this).val().replace(/\n/gi,"");
            numItem.text(_value.length);
        });
    }
</script>
<script>
    (function ($, win) {
		$(function () {
			/* ************************** 变量定义 ******************************** */
			var Util = $.Util;
			var notificationInfo = null;
            var serviceLabelType = 1;
            var healthLabelType = 2;
            var dieaseLabelType = 3;
			var province = 350000;
			var city = 350200;
			var isAuditor = ${isAuditor};
			// 表单校验工具类
			var jValidation = $.jValidation;
			/* *************************** 函数定义 ******************************* */
			function pageInit() {
				notificationInfo.init();
			}
			//发送范围事件
            $(":radio[name='scope']").click(function(){
                var scope = $(this).val();
                var scopeId = $("#scopeId").val();//修改时选中值
                if(scope=="0"){
                    $("#scope_area").hide();
                    $("#scope_community").hide();
                }else if(scope=="1"){//展示区
                    $.ajax({
                        url: ctx + "/common/districtAuthority",
                        method: "post",
                        dataType: "json",
                        data: {"type": 3, "code": city},
                        success: function (data) {
                            if(data.status=='200'){
                                var html = "";
                                if(scopeId){
                                    var scopeIds = scopeId.split(",");
                                    for(var i=0;i<data.list.length;i++){
                                        var town = data.list[i];
                                        if(scopeId.indexOf(town.code)<0){
                                            html +="<input type='checkbox' name='scope_area' class='inpChkb' data-name='"+town.name+"' value='"+town.code+"' >"+town.name+"&nbsp;";
                                        }else{
                                            html +="<input type='checkbox' checked='checked' name='scope_area' class='inpChkb' data-name='"+town.name+"' value='"+town.code+"' >"+town.name+"&nbsp;";
                                        }
                                    }
                                }else{
                                    for(var i=0;i<data.list.length;i++){
                                        var town = data.list[i];
                                        html +="<input type='checkbox' name='scope_area' class='inpChkb' data-name='"+town.name+"' value='"+town.code+"' >"+town.name+"&nbsp;";
                                    }
                                }
                                $(".scope_areaDiv").html(html);
                            }else{
                                $.Notice.error(data.msg);
                            }
                        }
                    });
                    $("#scope_area").show();
                    $("#scope_community").hide();
                }else if(scope=="2"){//展示社区
                    $.ajax({
                        url: ctx + "/admin/hos/community",
                        method: "post",
                        dataType: "json",
                        data: {"city": city},
                        success: function (data) {
                            if(data.status=='200'){
                                var communityAuthority = $("#communityAuthority").val();
                                var html = "";
                                var attrTown = "";
                                for(var i=0;i<data.list.length;i++){
                                    var town = data.list[i];
                                    attrTown += town.town+";";
                                    var tn = town.town.split(":");
                                    html +="<div  class='m-form-group u-checkbox-wrap m-form-control' style='height: auto;line-height: 15px;'>";
                                    if("2"==communityAuthority||scopeId.indexOf(tn[0])>=0){
                                        html +="<input type='checkbox' name='"+tn[0]+"' checked='checked' class='inpChkb chkCommunity' data-name='"+town.town+"' data-area='"+tn[1]+"' value='"+tn[0]+"' >"+tn[1]+"&nbsp;";
                                    }else{
                                        html +="<input type='checkbox' name='"+tn[0]+"' class='inpChkb chkCommunity' data-name='"+town.town+"' data-area='"+tn[1]+"' value='"+tn[0]+"' >"+tn[1]+"&nbsp;";
                                    }
                                    for(var j=0;j<town.community.length;j++){
                                        community = town.community[j];
                                        if(j>0&&j%6==0){
                                            html+="<br><span style='display: inline-block;width: 61px;'></span>";
                                        }
                                        var comName = community.name;
                                        comName = comName.substring(3,comName.length);
                                        if("2"==communityAuthority||scopeId.indexOf(community.code)>=0){
                                            html +="<input type='checkbox' name='"+town.town+"' checked='checked' class='inpChkb' data-name='"+comName+"' value='"+community.code+"' ><span class='community'>"+comName+"</span>&nbsp;";
                                        }else{
                                            html +="<input type='checkbox' name='"+town.town+"' class='inpChkb' data-name='"+comName+"' value='"+community.code+"' ><span class='community'>"+comName+"</span>&nbsp;";
                                        }
                                    }
                                    html +="</div>"
                                    html +="<br>";
                                }
                                $(".scope_communityDiv").attr("attr-towns",attrTown);
                                $(".scope_communityDiv").html(html);
                            }else{
                                $.Notice.error(data.msg);
                            }
                        }
                    });
                    $("#scope_area").hide();
                    $("#scope_community").show();
                }
            });
            //选择区 全选/反选 社区
            $(document).on("click",".chkCommunity",function () {
                var name = $(this).attr("data-name");
                $("[name = '"+name+"']:checkbox").prop("checked", $(this).is(':checked'));
            });
            //筛选条件
            $(":radio[name='condition_type']").click(function(){
                var condition_type = $(this).val();
                if(condition_type=="0"){
                    $("#inpCondition").hide();
                    $("[name = 'condition']:checkbox").prop("checked",false);
                    $(".serverType").hide();
                    $(".health_situation").hide();
                    $(".diease").hide();
                }else if(condition_type=="1"){
                    $("#inpCondition").show();
                }
            });
            //标签事件
            $(":checkbox[name='condition']").change(function () {
                var chkValue = $(this).val();
                var selClass = $(this).attr("data-class");
                if($(this).is(':checked')){
                    $.ajax({
                        url: ctx + "/common/label/signPatientLabel",
                        method: "post",
                        dataType: "json",
                        data: {"labelType": chkValue},
                        success: function (data) {
                            if(data.status=='200'){
                                var html = "";
                                var name = selClass.substring(1,selClass.length);
                                for(var i=0;i<data.list.length;i++){
                                    var patiemtLabel = data.list[i];
                                    if(i>0&&i%6==0){
                                        html+="<br>";
                                    }
                                    var selectId = "";
                                    if("1"==chkValue){
                                        selectId = $("#serverTypeId").val();
                                    }
                                    if("2"==chkValue){
                                        selectId = $("#healthSituationId").val();
                                    }
                                    if("3"==chkValue){
                                        selectId = $("#diseaseTypeId").val();
                                    }
                                    if(selectId&&selectId.indexOf(patiemtLabel.code)>=0){
                                        html +="<input type='checkbox' name='"+name+"' checked='checked' class='inpChkb' data-name='"+patiemtLabel.name+"' value='"+patiemtLabel.code+"' >"+patiemtLabel.name+"&nbsp;";
                                    }else{
                                        html +="<input type='checkbox' name='"+name+"' class='inpChkb' data-name='"+patiemtLabel.name+"' value='"+patiemtLabel.code+"' >"+patiemtLabel.name+"&nbsp;";
                                    }
                                }
                                $(selClass+"Div").html(html);
                            }else{
                                $.Notice.error(data.msg);
                            }
                            $(selClass).show();
                        }
                    });
                }else{
                    $(selClass).hide();
                }
            });
			/* *************************** 模块初始化 ***************************** */
			notificationInfo = {
				$form: $("#div_roles_info_form"),
				$scope: $("input[name='scope']"),//发送范围
				$scope_area: $("input[name='scope_area']"),//指定区
				$scope_community: $("input[name='scope_community']"),//指定社区
				$condition_type: $("input[name='condition_type']"),//筛选条件
				$condition: $("input[name='condition']"),//筛选条件
				$server: $("input[name='server']"),//服务类型
				$health_situation: $("input[name='health_situation']"),//健康情况
				$diease: $("input[name='diease']"),//疾病类型
				$title: $("#title"),//消息标题
				$content: $("#content"),//消息内容
				$send_type_combo_select: $("#send_type_combo_select"),//发送方式
				$send_time: $("#send_time"),//发送时间
				$btnsave: $("#btn_save"),//保存按钮
				$btncancle: $("#btn_cancel"),//结束按钮
				init: function () {
					_this = this;
                    //范围权限控制
                    var cityAuthority = $("#cityAuthority").val();
                    var areaAuthority = $("#areaAuthority").val();
                    var communityAuthority = $("#communityAuthority").val();
                    if("0"==cityAuthority){
                        $("#cityScope").attr("disabled", false);
                        $("#cityScope").attr("disabled","disabled")
                    }
                    if("0"==areaAuthority){
                        $("#areaScope").attr("disabled", false);
                        $("#areaScope").attr("disabled", "disabled");
                    }
                    if("0"==communityAuthority){
                        $("#communityScope").attr("disabled", false);
                        $("#communityScope").attr("disabled", "disabled");
                    }
//                    if("2"==communityAuthority){
//                        $("#communityScope").attr("checked", true);
//                    }
					this.$title.ligerTextBox({width: 240, validate: {required: true}});
                    var sendTypeSelect = this.$send_type_combo_select.ligerComboBox({
                        with:180,
                        data: [
                            { text: "立即发送", id: "0" },
//                            { text: "定时发送", id: "1" }//暂时只做立即发送(有审核权限-新增时立即发送,无权限-审核通过后立即发送)
                        ],
                        valueField: 'id',
                        textField: 'text',
                        cancelable: false,
                        initIsTriggerEvent: false,
                        onSelected: function (newvalue){
                            if(newvalue=="0"){
                                $(".send_time").hide();
                            }else{
                                $(".send_time").show();
                            }
                        }
                    });
                    sendTypeSelect.setValue("0");
                    this.$content.ligerTextBox({width: 430, height: 150, validate: {required: true}});
					this.$form.attrScan();
					_this = this;
					var noticeId = $("#noticeId").val();
					var mode = $("#mode").val();//模式  (新增/修改/查看)
					if (isNoEmpty(noticeId) && noticeId != 0) {
						//id不为空时 :为修改页面,进行修改操作
						//异步根据id获取消息信息
                        $.ajax({
                            url: ctx + "/admin/notification/notice",
                            method: "post",
                            dataType: "json",
                            data: {id: noticeId},
                            success: function (result) {
                                if (result.status == '200') {
                                    var notice = result.data;
                                    var scope = notice.scope;
                                    var scopeId = notice.scopeId;
                                    $("#scopeId").val(scopeId);//范围
                                    $(":radio[name='scope'][value='" + scope + "']").click();
                                    var conditionType = notice.condition;//筛选条件
                                    var diseaseTypeId = notice.diseaseTypeId;
                                    var healthSituationId = notice.healthSituationId;
                                    var serverTypeId = notice.serverTypeId;
                                    $("#serverTypeId").val(serverTypeId);
                                    $("#healthSituationId").val(healthSituationId);
                                    $("#diseaseTypeId").val(diseaseTypeId);
                                    $(":radio[name='condition_type'][value='" + conditionType + "']").click();
                                    if(serverTypeId){
                                        $(":checkbox[name='condition'][value='1']").click();
                                    }
                                    if(healthSituationId){
                                        $(":checkbox[name='condition'][value='2']").click();
                                    }
                                    if(diseaseTypeId){
                                        $(":checkbox[name='condition'][value='3']").click();
                                    }
                                    _this.$form.Fields.fillValues({
                                        title: notice.title,
                                        content: notice.content,
                                    });
                                    $(".word").text(notice.content.length);
                                    //发送方式
                                    var sendType = notice.sendType;
                                    if("1"==sendType){
                                        var sendTime = notice.sendTime;
                                        sendTime = sendTime.substring(0,16);
                                        sendTypeSelect.setValue(sendType);
                                        $("#send_time").ligerDateEditor({showTime: true,initValue: sendTime});
                                        $(".send_time").show();
                                    }
                                } else {
                                    $.Notice.error(result.msg);
                                }
                            },
                            error: function (data) {
                                $.Notice.error("系统异常,请联系管理员!");
                            }
                        });
					}else{
                        this.$send_time.ligerDateEditor({showTime: true});
                    }
					this.$form.show();
					this.bindEvents();
				},
				bindEvents: function () {
					var self = this;
					var flag = false;
					$("#btn_save").click(function () {
						var values = self.$form.Fields.getValues();
						if (values.id == '') {
							values.id = 0;
						}
                        values.city = city+"";
                        var s = self.$send_type_combo_select;
                        values.sendType = self.$send_type_combo_select.ligerComboBox().getValue();
                        values.sendTime = self.$send_time.val();
                        values.communityAuthority = $("#communityAuthority").val();
						if (isEmpty(values.scope)) {
							$.Notice.error("请选择发送范围!");
							return false;
						}
						if(values.scope=="0"){
                            values.conditionDescription = "厦门市 全市";
                        }else if(values.scope=="1"){
                            var area = "";
                            var areaName = "";
                            $("input[name='scope_area']:checked").each(function(){
                                area+=$(this).val()+",";
                                areaName+=$(this).attr("data-name")+",";
                            });
                            if(area==""){
                                $.Notice.error("请至少选择一个区!");
                                return false;
                            }
                            areaName = areaName.substring(0,areaName.length-1);
                            area = area.substring(0,area.length-1);
                            values.town = area;
                            values.scopeId = area;
                            values.scopeContent = areaName;
                            values.conditionDescription = "厦门市 "+areaName;
                        }else if(values.scope=="2"){
                            var attrTowns = $(".scope_communityDiv").attr("attr-towns");
                            if(attrTowns.length==0){
                                $.Notice.error("请至少选择一个社区!");
                                return false;
                            }
                            var towns = attrTowns.split(";");
                            var selctCommunity = "";
                            var townCommunity = "";
                            var conditionDescription = "";
                            for(var i=0;i<towns.length;i++){
                                var townName = towns[i];
                                var strCom = "";
                                var strComName = "";
                                $("input[name='"+townName+"']:checked").each(function(){
                                    strCom+=$(this).val()+",";
                                    strComName+=$(this).attr("data-name")+",";
                                });
                                if(strCom.length>0){
                                    //selctCommunity += strCom.substring(0,strCom.length-1);
                                    selctCommunity += strCom;
                                    townCommunity += townName.split(":")[0] +":"+strCom.substring(0,strCom.length-1)+";";
                                    conditionDescription += townName.split(":")[1] +":"+strComName.substring(0,strComName.length-1)+";\n ";
                                }
                            }
                            if(selctCommunity.length==0){
                                $.Notice.error("请至少选择一个社区!");
                                return false;
                            }
                            values.community = selctCommunity.substring(0,selctCommunity.length-1);
                            //values.townCommunity = townCommunity;
                            values.scopeId = townCommunity.substring(0,townCommunity.length-1);
                            values.scopeContent = conditionDescription;
                            values.conditionDescription = "厦门市 "+ conditionDescription;
                        }
                        if (isEmpty(values.condition_type)) {
                            $.Notice.error("请选择筛选条件!");
                            return false;
                        }
						if (values.condition_type=='0') {//全部居民
							var condition = "0";
							var conditionId = "";
							values.condition = condition;
							values.conditionId = conditionId;
						}
                        if(values.condition_type=='1'){
                            var condition = "";
                            var conditionId = "";
                            $("input[name='condition']:checked").each(function(){
                                condition+=$(this).val()+",";
                                var conDetail = "";
                                var nameDetail = "";
                                var dataName = $(this).attr("data-name");
                                $("input[name='"+dataName+"']:checked").each(function(){
                                    conDetail+=$(this).val()+",";
                                    conditionId+=$(this).val()+",";
                                    nameDetail+=$(this).attr("data-name")+",";
                                });
                                if(conDetail.length==0){
                                    $.Notice.error("请至少选择一个"+$(this).attr("data-tip")+"!");
                                    return false;
                                }
                                if(dataName=="serverType"){
                                    values.serverTypeId = conDetail.substring(0,conDetail.length-1);
                                    values.serverTypeContent = nameDetail.substring(0,nameDetail.length-1);
                                }else if(dataName=="health_situation"){
                                    values.healthSituationId = conDetail.substring(0,conDetail.length-1);
                                    values.healthSituationContent = nameDetail.substring(0,nameDetail.length-1);
                                }else if(dataName=="diease"){
                                    values.diseaseTypeId = conDetail.substring(0,conDetail.length-1);
                                    values.diseaseTypeContent= nameDetail.substring(0,nameDetail.length-1);
                                }
                            });
                            if(condition.length==0){
                                $.Notice.error("请至少选择一个设置条件!");
                                return false;
                            }
                            values.condition = condition;
                            values.conditionId = conditionId;
                        }
                        var validator = new jValidation.Validation(self.$form, {
                            immediate: true, onSubmit: false,
                            onElementValidate: function (result,elm) {
                                if (Util.isStrEquals($(elm).attr("id"), 'title')) {
                                    if (isEmpty(values.title)) {
                                        result.setResult(false);
                                        return result;
                                    }
                                }
                                if (Util.isStrEquals($(elm).attr("id"), 'content')) {
                                    if (isEmpty(values.content)) {
                                        result.setResult(false);
                                        return result;
                                    }
                                }
                                if (Util.isStrEquals($(elm).attr("id"), 'send_time')) {
                                    if (values.sendType=="1"&&isEmpty(values.sendTime)) {
                                        result.setResult(false);
                                        return result;
                                    }
                                }
                            }
                        });
                        validator.validate();
						if (isEmpty(values.title)) {
							$.Notice.error("通知标题不能为空!");
							return false;
						}
                        if (isEmpty(values.content)) {
                            $.Notice.error("通知内容不能为空!");
                            return false;
                        }
                        if(values.sendType=="1"&&isEmpty(values.sendTime)){
                            $.Notice.error("发送时间不能为空!");
                            return false;
                        }
						var ddf = $.ligerDialog.open({
                            height: 100,
                            width: 300,
                            title: "提示",
                            isHidden: true,
                            target: "<div style='margin: 0 auto; width: 200px;' >是否确认提交消息通知?提交后无法变更</div>",
							buttons: [
								{
									text: '立即提交', onclick: function (i, d) {
									d.hide();
									update(values);
								}
								},
                                { text: '我在看看', onclick: function (i, d) { d.hide(); }}
                            ]
                        });
//                        $.ajax({
//                            url: ctx + "/admin/notification/isNoticeAuditor",
//                            async: false,
//                            method: "post",
//                            dataType: "json",
//                            data: {},
//                            success: function (data) {
//                                if (data.status == 200) {
//                                    var authority = data.authority;
//
//                                    $.ligerDialog.open({
//                                        height: 250,
//                                        width: 300,
//                                        title: "tishi",
//                                        isHidden: true,
//                                        target: "是否确认提交消息通知?提交后无法变更",
//                                        buttons: [  { text: '立即提交', onclick: function (i, d) { update(values); }},
//                                            { text: '我在看看', onclick: function (i, d) { d.hide(); }}
//                                        ]
//                                    });
//                                } else {
//                                    $.Notice.error(data.msg);
//                                }
//                            }
//                        });
					});
					function update(values) {
						var dataModel = $.DataModel.init();
						var message = "保存中...";
						var url = "update";
						if (values.id == 0) {
							url = "create";
						}
						var wattingDialog = $.Notice.waitting(message);
						dataModel.updateRemote(ctx + "/admin/notification/" + url, {
							data: {jsonData: JSON.stringify(values)},
							success: function (data) {
								wattingDialog.close();
								if (data.status == 200) {
									parent.window.reloadMasterGrid(data.msg);
									parent.window.closeInfoDialog();
								} else {
									$.Notice.error(data.msg);
								}
							},
							error: function (data) {
								wattingDialog.close();
								$.Notice.error("系统异常,请联系管理员!");
							}
						});
					}
					$("#btn_cancel").click(function () {
						parent.window.closeInfoDialog();
					});
				}
			};
			/* *************************** 页面初始化 **************************** */
			pageInit();
		})
	})(jQuery, window);
</script>

+ 44 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/wechat/wechat_list.jsp

@ -0,0 +1,44 @@
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<!DOCTYPE html>
<html lang="en">
<head>
	<%@ include file="../head/page_head.jsp" %>
	<title>用户管理</title>
</head>
<style>
</style>
<body>
<div id="div_wrapper">
	<!-- 检索条件 -->
	<div class="m-retrieve-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
		<div class="m-form-group f-mt10">
			<%--<sec:authorize url="/admin/roles/rolesList">--%>
			<div class="m-form-control f-fs12 f-ml10">
				<input type="text" id="inp_searchNm" placeholder="请输入标题/提交人">
			</div>
			<div class="m-form-control f-fs12 f-ml10">
				<input id="sel_status" placeholder="选择状态"/>
			</div>
			<%--</sec:authorize>--%>
			<%--<sec:authorize url="/admin/roles/create">--%>
			<div class="m-form-control f-mr20" style="float: right">
				<div id="div_new_notice" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam">
					<span>新增消息通知</span>
				</div>
			</div>
			<%--</sec:authorize>--%>
		</div>
	</div>
	<!-- 列表 -->
	<div id="div_notice_list">
	</div>
</div>
</body>
<%@ include file="../head/page_foot.jsp" %>
<%@ include file="wechat_list_js.jsp" %>
</html>

+ 284 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/wechat/wechat_list_js.jsp

@ -0,0 +1,284 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<script>
	(function ($, win) {
		$(function () {
			/* ************************** 变量定义 ******************************** */
			// 通用工具类库
			var Util = $.Util;
			var retrieve = null;
			var master = null;
			var isFirstPage = false;
			var status = '';
			var isAuditor = ${isAuditor};
			/* *************************** 函数定义 ******************************* */
			function pageInit() {
				retrieve.init();
				master.init();
			}
			function reloadGrid(params) {
				if (isFirstPage) {
					master.grid.options.newPage = 1;
				}
				master.grid.setOptions({parms: params});
				master.grid.loadData(true);
			}
			/* *************************** 模块初始化 ***************************** */
			retrieve = {
				$element: $('.m-retrieve-area'),
				$addBtn: $('#div_new_notice'),
				$searchNm: $("#inp_searchNm"),
				$status: $('#sel_status'),
				init: function () {
					_this = this;
					this.$searchNm.ligerTextBox({
						width: 240, isSearch: true, search: function () {
							master.reloadGrid();//参数:标签/提交人+消息通知状态
						}
					})
					//状态复选框,选择时也刷新列表
					_this.statusBox = _this.$status.ligerComboBox({
						width: 180,
						data: [
							{text: '全部', statusId: ''},
							{text: '待提交', statusId: '1'},
							{text: '待审核', statusId: '2'},
							{text: '待发送', statusId: '3'},
							{text: '已发送', statusId: '4'},
							{text: '已拒绝', statusId: '5'},
							{text: '已撤回', statusId: '6'},
						],
						initIsTriggerEvent: false,
						valueFieldID: 'statusId',
						valueField: 'statusId',
						onSelected: function (newvalue) {
							status = newvalue;
							if (!master || !master.grid) {
								return
							}
							master.reloadGrid();//参数:标签/提交人+消息通知状态
						},
					});
                    this.bindEvents();
					if (isAuditor) {
						_this.statusBox.setValue('2');//根据是否是审核者设置默认值,审核者:默认选中待审核
					} else {
						_this.statusBox.setValue('');//根据是否是审核者设置默认值,审核者:待审核;非:默认全部
					}
				},bindEvents: function () {
                    var self = this;
                    self.$addBtn.click(function () {
                        master.infoDialog = $.ligerDialog.open({
                            height: 550,
                            width: 750,
                            title: '新增消息',
                            url: ctx + '/admin/notification/infoInit/' + "0" + "?mode=add"
                        })
                    });
                }
			};
			master = {
				infoDialog: null,
				grid: null,
				init: function () {
					this.grid = $("#div_notice_list").ligerGrid($.LigerGridEx.config({
						url: ctx + '/admin/notification/list',
						parms: {status: status},
						ajaxHeader: ajaxHeaderName,
						ajaxHeaderValue: ajaxHeaderValue,
						columns: [
							{display: 'ID', name: 'id', hide: true},
							{display: '标题', name: 'title', width: '14%', align: "left"},
							{display: '状态', name: 'status', hide: true},
							{
								display: '状态', name: 'status', width: '6%', align: "center",
								render: function (row) {
									var html = '';
									if (row.status == '0') {
										return "创建中"
									}
									;
									if (row.status == '1') {
										return "待提交"
									}
									;
									if (row.status == '2') {
										return "待审核"
									}
									;
									if (row.status == '3') {
										return "待发送"
									}
									;
									if (row.status == '4') {
										return "已发送"
									}
									;
									if (row.status == '5') {
										return "已拒绝"
									}
									;
									if (row.status == '6') {
										return "已撤回"
									}
									;
								}
							},
							{display: '通知总人数', name: 'totalCount', width: '15%', align: "center"},
//							{display: '定时发送时间', name: 'sendTime', width: '15%', align: "center"},
							{display: '提交人Id', name: 'applyUserId', hide: true},
							{display: '提交人', name: 'applyUserName', width: '10%', align: "center"},
							{display: '提交时间', name: 'applyTime', width: '15%', align: "center"},
							{display: '审核Id', name: 'auditUserId', hide: true},
							{display: '审核人', name: 'auditUserName', width: '10%', align: "center"},
							{display: '审核时间', name: 'auditTime', width: '15%', align: "center"},
							{
								display: '操作', name: 'operator', width: '15%', align: "center", isSort: false,
								render: function (row) {
									var html = '';
									html += '<a  href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "info:view", row.id) + '">查看</a>';
									if (row.owned == true) {
										if (row.status == 5 || row.status == 6) {
											html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "info:edit", row.id) + '">编辑</a>';
											html += '<a  style="margin-left:10px;" title="删除" href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}','{2}'])", "info:del", row.id) + '">删除</a>';
										}
										if (row.status == 2) {
											html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "info:revoke", row.id) + '">撤回</a>';
										}
										if (row.status == 1) {
											html += '<a  style="margin-left:10px;" title="删除" href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}','{2}'])", "info:del", row.id) + '">删除</a>';
										}
									}
									<%--<sec:authorize url="/admin/user/update">--%>
									if (row.owned == false && row.auditor == true && row.status == 2) {
										html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "info:edit", row.id) + '">审核</a>';
									}
									<%--</sec:authorize>--%>
									return html;
								}
							}
						],
					}));
					// 自适应宽度
					this.grid.adjustToWidth();
					this.bindEvents();
				},
				reloadGrid: function (msg) {
					if (msg) {
						//如果是新增,直接刷新页面
						master.grid.loadData();
					} else {
						debugger
						//如果是查询(获取查询参数)
						var searchNm = retrieve.$searchNm.val() || '';
						var status = retrieve.statusBox.getValue() || '';
						var values = {
							searchNm: searchNm,
							status: status
						}
						reloadGrid.call(this, values);
					}
				},
				delRecord: function (id, code) {
					var self = this;
					$.ajax({
						url: ctx + "/admin/notification/delete",
						data: {"id": id},
						method: "post",
						dataType: "json",
						success: function (result) {
							if (result.status == '200') {
								window.reloadMasterGrid(result.msg);
							} else {
								$.Notice.error(result.msg);
							}
						},
						error: function (data) {
							$.Notice.error("系统异常,请联系管理员!");
						}
					})
				},
				bindEvents: function () {
					var self = this;
					$.subscribe('info:view', function (event, id) {
						var title = '消息通知详情';
						self.infoDialog = $.ligerDialog.open({
							height: 550,
							width: 750,
							urlParms: {"id": id, "mode": "view"},
							title: title,
							url: ctx + '/admin/notification/view'
						})
					});
                    $.subscribe('info:revoke', function (event, id) {
                        var title = '消息通知撤回';
                        self.infoDialog = $.ligerDialog.open({
                            height: 550,
                            width: 750,
                            urlParms: {"id": id, "mode": "revoke"},
                            title: title,
                            url: ctx + '/admin/notification/view'
                        })
                    });
					$.subscribe('info:edit', function (event, id) {
						var title = '编辑用户信息';
						self.infoDialog = $.ligerDialog.open({
							height: 550,
							width: 750,
							title: title,
                            url: ctx + '/admin/notification/infoInit/' + id + "?mode=edit"
						})
					});
					$.subscribe('info:create', function (event, id) {
						var title = '新增消息';
						self.infoDialog = $.ligerDialog.open({
							height: 460,
							width: 490,
							title: title,
							url: ctx + '/notification/infoInit' + "0" + "?mode=add"
						})
					});
					$.subscribe('info:del', function (event, id, code) {
						$.ligerDialog.confirm('确认删除该行信息?<br>如果是请点击确认按钮,否则请点击取消。', function (yes) {
							if (yes) {
								self.delRecord(id, code);
							}
						});
					})
				}
			};
			/* ************************* Dialog页面回调接口 ************************** */
			win.reloadMasterGrid = function (msg) {
				if (isNoEmpty(msg)) {
					$.Notice.success(msg);
				}
				master.reloadGrid(msg);
			};
			win.closeUserInfoDialog = function () {
				master.infoDialog.close();
			};
            win.closeInfoDialog = function () {
                master.infoDialog.close();
            };
			win.openEditInfoDialog = function (id) {
				master.infoDialog.close();
				$.publish("info:edit", id);
			}
			win.deleteNoticeDialog = function (id) {
				master.delRecord(id);
				master.infoDialog.close();
			}
			/* *************************** 页面初始化 **************************** */
			pageInit();
		});
	})(jQuery, window);
</script>

+ 1 - 0
patient-co-manage/wlyy-manage/src/main/webapp/static/js/menu.js

@ -40,6 +40,7 @@ var menu = {
    //消息推送管理
    "notification": "/admin/notification/initial",//人员管理界面
    "wechatTemplate": "/admin/wechatTemplate/initial",//微信模板消息管理
    //问卷调查管理
    "surveyQuestion": "/admin/surveyQuestion/initial",//问题管理界面

+ 10 - 0
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/Patient.java

@ -78,6 +78,8 @@ public class Patient extends IdEntity {
	private String sickVillage;
	//居民预警状态:0为标准,1为预警状态
	private Integer standardStatus;
	//医疗保险号
	private String medicareNumber;
	public Patient() {
	}
@ -332,4 +334,12 @@ public class Patient extends IdEntity {
	public void setStandardStatus(Integer standardStatus) {
		this.standardStatus = standardStatus;
	}
	
	public String getMedicareNumber() {
		return medicareNumber;
	}
	
	public void setMedicareNumber(String medicareNumber) {
		this.medicareNumber = medicareNumber;
	}
}

+ 4 - 4
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignRenewZYService.java

@ -1461,7 +1461,7 @@ public class SignRenewZYService {
                        params.put("BIRTHDAY", DateUtil.dateToStrShort(patient.getBirthday()));
                        params.put("IDENTITY_CARD_NO", patient.getIdcard() == null ? sign.getIdcard() : patient.getIdcard());
                        params.put("CARD_NO", patient.getSsc() == null ? sign.getSsc() : patient.getSsc());
                        params.put("INSUR_SAFETY_NO", "");  //医疗保险号
                        params.put("INSUR_SAFETY_NO", patient.getMedicareNumber());  //医疗保险号
                        params.put("SICK_PHONE", patient.getMobile() == null ? "" : patient.getMobile());   //联系电话
                        params.put("SICK_COUNTY", patient.getTown() == null ? "" : patient.getTown());    //行政区
                        params.put("SICK_COUNTRY", patient.getStreet() == null ? "" : patient.getStreet());    //街道
@ -1541,7 +1541,7 @@ public class SignRenewZYService {
                        params.put("BIRTHDAY", DateUtil.dateToStrShort(patient.getBirthday()));
                        params.put("IDENTITY_CARD_NO", patient.getIdcard() == null ? sign.getIdcard() : patient.getIdcard());
                        params.put("CARD_NO", patient.getSsc() == null ? sign.getSsc() : patient.getSsc());
                        params.put("INSUR_SAFETY_NO", "");  //医疗保险号
                        params.put("INSUR_SAFETY_NO", patient.getMedicareNumber());  //医疗保险号
                        params.put("SICK_PHONE", patient.getMobile() == null ? "" : patient.getMobile());   //联系电话
                        params.put("SICK_COUNTY", patient.getTown() == null ? "" : patient.getTown());    //行政区
                        params.put("SICK_COUNTRY", patient.getStreet() == null ? "" : patient.getStreet());    //街道
@ -1697,7 +1697,7 @@ public class SignRenewZYService {
                    params.put("BIRTHDAY", DateUtil.dateToStrShort(patient.getBirthday()));
                    params.put("IDENTITY_CARD_NO", patient.getIdcard() == null ? sign.getIdcard() : patient.getIdcard());
                    params.put("CARD_NO", patient.getSsc() == null ? sign.getSsc() : patient.getSsc());
                    params.put("INSUR_SAFETY_NO", "");  //医疗保险号
                    params.put("INSUR_SAFETY_NO",patient.getMedicareNumber());  //医疗保险号
                    params.put("SICK_PHONE", patient.getMobile() == null ? "" : patient.getMobile());   //联系电话
                    params.put("SICK_COUNTY", patient.getTown() == null ? "" : patient.getTown());    //行政区
                    params.put("SICK_COUNTRY", patient.getStreet() == null ? "" : patient.getStreet());    //街道
@ -2087,7 +2087,7 @@ public class SignRenewZYService {
                    params.put("BIRTHDAY", DateUtil.dateToStrShort(patient.getBirthday()));
                    params.put("IDENTITY_CARD_NO", patient.getIdcard() == null ? sign.getIdcard() : patient.getIdcard());
                    params.put("CARD_NO", patient.getSsc() == null ? sign.getSsc() : patient.getSsc());
                    params.put("INSUR_SAFETY_NO", "");  //医疗保险号
                    params.put("INSUR_SAFETY_NO", patient.getMedicareNumber());  //医疗保险号
                    params.put("SICK_PHONE", patient.getMobile() == null ? "" : patient.getMobile());   //联系电话
                    params.put("SICK_COUNTY", patient.getTown() == null ? "" : patient.getTown());    //行政区
                    params.put("SICK_COUNTRY", patient.getStreet() == null ? "" : patient.getStreet());    //街道

+ 1 - 1
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignZYService.java

@ -1407,7 +1407,7 @@ public class SignZYService {
                    params.put("BIRTHDAY", DateUtil.dateToStrShort(patient.getBirthday()));
                    params.put("IDENTITY_CARD_NO", patient.getIdcard() == null ? sign.getIdcard() : patient.getIdcard());
                    params.put("CARD_NO", patient.getSsc() == null ? sign.getSsc() : patient.getSsc());
                    params.put("INSUR_SAFETY_NO", "");  //医疗保险号
                    params.put("INSUR_SAFETY_NO", patient.getMedicareNumber());  //医疗保险号
                    params.put("SICK_PHONE", patient.getMobile() == null ? "" : patient.getMobile());   //联系电话
                    params.put("SICK_COUNTY", patient.getTown() == null ? "" : patient.getTown());    //行政区
                    params.put("SICK_COUNTRY", patient.getStreet() == null ? "" : patient.getStreet());    //街道

+ 0 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -1274,7 +1274,6 @@ public class JwPrescriptionService {
                elastricSearchSave.save(resultdata,esIndex,esType);
            }
//            logger.info("同步单条随访记录-ES数据保存成功,时间:"+DateUtil.getStringDate());
            jestClient.shutdownClient();
        }catch (Exception e){
            logger.error(" save error :" + e.getMessage());
            e.printStackTrace();

+ 7 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -1033,11 +1033,12 @@ public class FamilyMemberService extends BaseService {
                        //发送添加成功消息模板
                        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","xzcy");
                        String first = templateConfig.getFirst();
                        first = first.replace("key1",(p.getName()==null?"":p.getName())).replace("key1",(m.getName()==null?"":m.getName()));
                        first = first.replace("key1",(p.getName()==null?"":p.getName())).replace("key2",(m.getName()==null?"":m.getName()));
                        String remark = templateConfig.getRemark();
                        remark = remark.replace("key1",(m.getName()==null?"":m.getName()))
                                .replace("key2",(relations.get(temp.getFamilyRelation())==null?"":relations.get(temp.getFamilyRelation())));
                                .replace("key2",(relations.get(temp.getFamilyRelation())==null?"":relations.get(temp.getFamilyRelation())))
                                .replace("br","\n");
                        String keyword1 = templateConfig.getKeyword1();
@ -1072,7 +1073,7 @@ public class FamilyMemberService extends BaseService {
                WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","xzcysb");
                String first = templateConfig.getFirst();
                first = first.replace("key1",(p.getName()==null?"":p.getName())).replace("key1",(m.getName()==null?"":m.getName()));
                first = first.replace("key1",(p.getName()==null?"":p.getName())).replace("key2",(m.getName()==null?"":m.getName()));
                String keyword1 = templateConfig.getKeyword1();
                //发送添加成功消息模板
@ -1242,8 +1243,7 @@ public class FamilyMemberService extends BaseService {
        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","xzcysq");
        String first = templateConfig.getFirst();
        first = first.replace("key1",(m.getName()==null?"":m.getName())).replace("key1",(p.getName()==null?"":p.getName()));
        first = first.replace("key1",(m.getName()==null?"":m.getName())).replace("key2",(p.getName()==null?"":p.getName()));
        String remark = templateConfig.getRemark();
        remark = remark.replace("key1",(p.getName()==null?"":p.getName()))
                .replace("key2",(relations.get(relation)==null?"":relations.get(relation)))
@ -1253,7 +1253,8 @@ public class FamilyMemberService extends BaseService {
        JSONObject json = new JSONObject();
//        json.put("first", m.getName() + ",您好!" + p.getName() + "向您发起添加家人申请,添加成功后,对方可使用您的账号,为您处理各类健康服务。");
        json.put("first", first);
        json.put("keyword1", "添加家人申请");
//        json.put("keyword1", "添加家人申请");
        json.put("keyword1", keyword1);
        json.put("keyword2", DateUtil.dateToStr(new Date(), "yyyy-MM-dd"));
        json.put("remark", remark);
//        json.put("keyword3", p.getName());

+ 17 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/physicalExamination/PhysicalExaminationRemindService.java

@ -96,11 +96,22 @@ public class PhysicalExaminationRemindService extends BaseService {
     * @return
     */
    public Integer isRemind(String patient){
        List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient, 1);
        if (records != null && records.size() > 0) {
            return 1;
        Patient people = patientDao.findByCode(patient);
        if (people!=null){
            int age = IdCardUtil.getAgeForIdcard(people.getIdcard()==null?"":people.getIdcard());
            if (age<65){
                return 2;
            }
            List<PatientRemindRecords> records = patientRemindRecordsDao.findByPatientAndType(patient, 1);
            if (records != null && records.size() > 0) {
                return 1;
            }else {
                return 0;
            }
        }else {
            return -1;
        }
        return 0;
    }
    /**
@ -340,7 +351,7 @@ public class PhysicalExaminationRemindService extends BaseService {
        // 推送消息给微信端
        String url = "jkda/html/jiankangtijian.html?openid=" + patient.getOpenid() +"&toUser="+patient.getCode()+"&toName=" + patient.getName();
//        String first = "您的家庭医生" + doctName + "提醒,您可以到签约社区进行65岁以上老年人的免费健康体检啦~";
        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_change","qkxz");
        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","jktj");
        String first = templateConfig.getFirst();
        first = first.replace("key1",(doctName==null?"":doctName));
        String remark = templateConfig.getRemark();
@ -410,7 +421,7 @@ public class PhysicalExaminationRemindService extends BaseService {
        String accessToken = accessTokenUtils.getAccessToken();
        Boolean flag = true;
        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_change","qkxz");
        WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","jktj");
        String first = templateConfig.getFirst();
        first = first.replace("key1",(doctName==null?"":doctName));
        String remark = templateConfig.getRemark();

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

@ -735,7 +735,7 @@ public class PrescriptionInfoService extends BaseService {
        return 1;
    }
    public List<Map<String, Object>> getDoctorPrescription(Integer teamCode, String state, String diseases, String startDate, String endDate, String nameKeyword, String patient, Integer page, Integer size,String isPcim) {
    public List<Map<String, Object>> getDoctorPrescription(Integer teamCode, String state, String diseases, String startDate, String endDate, String nameKeyword, String patient, Integer page, Integer size) {
        StringBuffer pre_sql = new StringBuffer("SELECT " +
                " p.`name`, " +
                " TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age, " +
@ -758,11 +758,11 @@ public class PrescriptionInfoService extends BaseService {
                    " WHERE s.prescription_code = pr.code " +
                    " AND s.health_problem = ?");
            params.add(diseases);
            setSQL(pre_sql, params, teamCode, state, startDate, endDate, nameKeyword, patient, page, size, isPcim);
            setSQL(pre_sql, params, teamCode, state, startDate, endDate, nameKeyword, patient, page, size);
        } else {
            //查询所有疾病类型表
            pre_sql.append(" WHERE 1=1 ");
            setSQL(pre_sql, params, teamCode, state, startDate, endDate, nameKeyword, patient, page, size, isPcim);
            setSQL(pre_sql, params, teamCode, state, startDate, endDate, nameKeyword, patient, page, size);
        }
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(pre_sql.toString(), params.toArray());
@ -775,29 +775,14 @@ public class PrescriptionInfoService extends BaseService {
        return rs;
    }
    public void setSQL(StringBuffer pre_sql, List<Object> params, Integer teamCode, String state, String startDate, String endDate, String nameKeyword, String patient, Integer page, Integer size, String isPcim) {
    public void setSQL(StringBuffer pre_sql, List<Object> params, Integer teamCode, String state, String startDate, String endDate, String nameKeyword, String patient, Integer page, Integer size) {
        if (teamCode != null && teamCode > 0) {
            pre_sql.append(" AND pr.admin_team_id =?");
            params.add(teamCode);
        }
        if (StringUtils.isNotBlank(state)) {
            //不是pcim新改的用原来的接口-2018.03.09
            if (StringUtils.isNotBlank(isPcim) && "0".equals(isPcim)){
                pre_sql.append(" AND pr.status IN (" + state + ") ");
            }else if (StringUtils.isNotBlank(isPcim) && "1".equals(isPcim)){
                //如果是pcim新改的则状态搜索改变
                //待审核和已完成
                if ("0".equals(state)  || "100".equals(state)){
                    pre_sql.append(" AND pr.status IN (" + state + ") ");
                }else if ("-1".equals(state)){
                    //已取消
                    pre_sql.append(" AND pr.status < (-1) ");
                }else if ("1".equals(state)){
                    //已完成
                    pre_sql.append(" AND pr.status > 0 AND pr.status <100 ");
                }
            }
            pre_sql.append(" AND pr.status IN (" + state + ") ");
        }
        if (StringUtils.isNotBlank(startDate)) {
            pre_sql.append(" AND pr.create_time >= ? ");

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionNoticesService.java

@ -200,10 +200,10 @@ public class PrescriptionNoticesService extends BaseService {
            }
        }
        if (type == 3) {
            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","xfqy");
            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_change","xfqy");
            first = templateConfig.getFirst();
            remark = templateConfig.getRemark();
            first = first.replace("key1",(name==null?"":name)).replace("key2",doctName);
            first = first.replace("key1",(name==null?"":name)).replace("key2",(doctName==null?"":doctName));
            String keyword3 = templateConfig.getKeyword3();
           /* first = name + "您好,您的续方订单配送员" + doctName + "已顺利取药,续方状态变更为配送中。";

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

@ -365,7 +365,7 @@ public class StatisticsESService {
                }
            }
        }
        if (SaveModel.OrgLevel.equals(level + "")) {
        if (SaveModel.OrgLevel.equals(level + "") || SaveModel.teamLevel.equals(lowLevel)) {
            statisticsAllService.translateTeamLeaderName(resultList);
        }
        Collections.sort(resultList, new Comparator<Map<String, Object>>() {

+ 22 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -15,6 +15,7 @@ import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -286,26 +287,34 @@ public class ManagerQuestionnaireService extends BaseService {
                }
//            });
            }*/
            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_change","qkxz");
            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","survey");
            String remark = templateConfig.getRemark();
            String keyword1 = templateConfig.getKeyword1();
            new Thread() {
                public void run() {
                    for (String c : codes) {
                        Patient p = patientDao.findByCode(c);
                        String name = p.getName();
                        String openId = p.getOpenid();
                        json.put("keyword2", sdf.format(new Date()));
                        json.put("toUser", c);
                        json.put("represented", c);
                        json.put("survey_id", surveyCode);
                        Patient p = null;
                        String name = null;
                        String openId = null;
                        String first = null;
                        try {
                            p = patientDao.findByCode(c);
                            name = p.getName();
                            openId = p.getOpenid();
                            json.put("keyword2", sdf.format(new Date()));
                            json.put("toUser", c);
                            json.put("represented", c);
                            json.put("survey_id", surveyCode);
//                        String first = name + ",您好!为了给您提供更好的家庭医生健康服务,现有一份问卷需要您填写。";
                        String first = templateConfig.getFirst();
                        first = first.replace("key1",(name==null?"":name));
                        json.put("first", first);
                        json.put("remark", remark);
                        json.put("keyword1", keyword1);
                            first = templateConfig.getFirst();
                            first = first.replace("key1",(name==null?"":name));
                            json.put("first", first);
                            json.put("remark", remark);
                            json.put("keyword1", keyword1);
                        } catch (JSONException e) {
                            continue;
                        }
                        //判断是否判定openId,有没有发则查找家人发送
                        if (StringUtils.isNotBlank(p.getOpenid())) {
                            // 添加到发送队列

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PyhsicExamRemindController.java

@ -101,7 +101,11 @@ public class PyhsicExamRemindController extends BaseController{
                                 @RequestParam(value = "patient", required = true) String patient){
        try {
            Integer re =  physicalExaminationRemindService.isRemind(patient);
            return write(200, "查询成功", "data", re);
            if (re!=-1){
                return write(200, "查询成功", "data", re);
            }else {
                return error(-1, "居民查询失败");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");

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

@ -113,8 +113,6 @@ public class PrescriptionInfoController extends BaseController {
        }
    }
    @RequestMapping(value = "/getDoctorPrescription", method = RequestMethod.GET)
    @ApiOperation(value = "获取全科医生/建管师续方列表/搜索")
    public String getDoctorPrescription(@RequestParam(required = false) @ApiParam(value = "团队code", name = "teamCode") Integer teamCode,
@ -125,10 +123,9 @@ public class PrescriptionInfoController extends BaseController {
                                        @RequestParam(required = false) @ApiParam(name = "nameKeyword", value = "患者姓名模糊匹配") String nameKeyword,
                                        @RequestParam(required = false) @ApiParam(name = "patient", value = "患者Code") String patient,
                                        @RequestParam(required = false) @ApiParam(name = "page", value = "起始页") Integer page,
                                        @RequestParam(required = false) @ApiParam(name = "size", value = "每页条数") Integer size,
                                        @RequestParam(required = false , defaultValue = "0") @ApiParam(name = "isPcim",value = "是否在pcim上使用,0否1是")String isPcim) {
                                        @RequestParam(required = false) @ApiParam(name = "size", value = "每页条数") Integer size) {
        try {
            return write(200, "查询成功!", "data", prescriptionInfoService.getDoctorPrescription(teamCode, state, diseases, startDate, endDate, nameKeyword, patient, page, size,isPcim));
            return write(200, "查询成功!", "data", prescriptionInfoService.getDoctorPrescription(teamCode, state, diseases, startDate, endDate, nameKeyword, patient, page, size));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");