Sfoglia il codice sorgente

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

huangwenjie 7 anni fa
parent
commit
6312c3206f
24 ha cambiato i file con 1310 aggiunte e 12 eliminazioni
  1. 21 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyPatientDeviceController.java
  2. 104 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/healthbank/ActivityController.java
  3. 77 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyPatientDevice.java
  4. 160 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyPatientDeviceLog.java
  5. 5 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/WlyyPatientDeviceDao.java
  6. 14 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/WlyyPatientDeviceLogDao.java
  7. 26 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java
  8. 67 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceLogService.java
  9. 70 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/healthbank/ActivityService.java
  10. 44 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java
  11. 10 0
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  12. 57 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/activity_list.jsp
  13. 209 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/activity_list_js.jsp
  14. 109 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/activity_modify.jsp
  15. 172 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/healthbank/activity_modify_js.jsp
  16. 16 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/main.jsp
  17. 3 0
      patient-co-manage/wlyy-manage/src/main/webapp/static/js/menu.js
  18. 21 1
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  19. 41 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  20. 6 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/DeviceDetailService.java
  21. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthGuidanceService.java
  22. 26 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java
  23. 25 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java
  24. 25 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

+ 21 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyPatientDeviceController.java

@ -5,12 +5,16 @@ import com.yihu.wlyy.device.entity.PatientDeviceExportVO;
import com.yihu.wlyy.device.entity.WlyyPatientDeviceVO;
import com.yihu.wlyy.entity.Doctor;
import com.yihu.wlyy.entity.WlyyPatientDevice;
import com.yihu.wlyy.repository.WlyyPatientDeviceDao;
import com.yihu.wlyy.service.doctor.DoctorService;
import com.yihu.wlyy.service.manager.device.WlyyDeviceService;
import com.yihu.wlyy.service.manager.device.WlyyPatientDeviceLogService;
import com.yihu.wlyy.service.manager.device.WlyyPatientDeviceService;
import jxl.Workbook;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -22,6 +26,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import java.util.Map;
/**
 * Created by yww on 2016/12/7.
@ -33,6 +38,14 @@ public class WlyyPatientDeviceController extends BaseController {
    private WlyyPatientDeviceService patientDeviceService;
    @Autowired
    private DoctorService doctorService;
    @Autowired
    private WlyyDeviceService wlyyDeviceService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private WlyyPatientDeviceLogService wlyyPatientDeviceLogService;
    @Autowired
    private WlyyPatientDeviceDao wlyyPatientDeviceDao;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String listPageInit(){
@ -106,7 +119,15 @@ public class WlyyPatientDeviceController extends BaseController {
            if(id == null){
                return write(-1,"id不能为空!");
            }
            WlyyPatientDevice wlyyPatientDevice = wlyyPatientDeviceDao.findOne(id);
            patientDeviceService.delete(id);
            String deviceSn = "";
            if (wlyyPatientDevice!=null){
                deviceSn = wlyyPatientDevice.getDeviceSn();
            }
            //全部解绑后去判断就更新设备表中是否绑定字段.
            wlyyDeviceService.unBindUpdateIsBinding(deviceSn);
            wlyyPatientDeviceLogService.savePatientDeviceLog(wlyyPatientDevice,deviceSn,3,2);
            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);

+ 104 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/healthbank/ActivityController.java

@ -0,0 +1,104 @@
package com.yihu.wlyy.controller.manager.healthbank;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.manager.healthbank.ActivityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * Created by humingfen on 2018/6/19.
 * 健康活动管理
 */
@Controller
@RequestMapping("admin/activity")
public class ActivityController extends BaseController {
    @Autowired
    private ActivityService activityService;
    @RequestMapping(value = "initial", method = RequestMethod.GET)
    public String initListPage(){
        return "healthbank/activity_list";
    }
    @RequestMapping(value = "infoInit")
    public String initInfoPage(@RequestParam(value = "id") String id,String type){
        request.setAttribute("id",id);
        request.setAttribute("type",type);
        return "healthbank/activity_modify";
    }
    @RequestMapping(value = "init")
    public String init(String type){
        request.setAttribute("type",type);
        return "healthbank/activity_modify";
    }
    @RequestMapping(value ="list",method = RequestMethod.POST)
    @ResponseBody
    public String searchList(
            @RequestParam(name = "activity") String activity,
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "rows",required = false) Integer pageSize){
        try{
            return write(200,"操作成功","detailModelList",activityService.searchList(activity, page, pageSize).get("detailModelList"));
//            return write(200,"操作成功");
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "findById")
    @ResponseBody
    public String findById(@RequestParam(value = "id") String id){
        try {
            String activity = "{\"id\":\""+ id + "\"}";
            return  write(200,"操作成功","data",activityService.searchList(activity, 1, 1));
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "update")
    @ResponseBody
    public String update(String jsonData) {
        try {
            activityService.update(jsonData);
            return write(200, "操作成功" );
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    @RequestMapping(value = "create")
    @ResponseBody
    public String create(String jsonData) {
        try {
            activityService.create(jsonData);
            return write(200, "操作成功" );
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }
    /*@RequestMapping(value = "delete")
    @ResponseBody
    public String delete(String id) {
        try {
            String jsonData = "{\"id\":\""+ id + "\"}";
            activityService.delete(jsonData);
            return write(200, "操作成功" );
        }catch (Exception ex){
            error(ex);
            return error(-1,"操作失败!");
        }
    }*/
}

+ 77 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyPatientDevice.java

@ -23,6 +23,20 @@ public class WlyyPatientDevice {
    private String userIdcard;
    private Date czrq;
    private String doctor;
    //操作医生姓名
    private String doctorName;
    //代绑人代码(家人)
    private String agent;
    //代绑人姓名
    private String agentName;
    //解绑人
    private String delUser;
    //1-解绑,0-绑定
    private Integer del;
    //设备活动类型
    private String deviceActivityType;
    //上传的协议图片地址
    private String agreementPhoto;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
@ -134,4 +148,67 @@ public class WlyyPatientDevice {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "agent")
    public String getAgent() {
        return agent;
    }
    public void setAgent(String agent) {
        this.agent = agent;
    }
    @Column(name = "agent_name")
    public String getAgentName() {
        return agentName;
    }
    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }
    @Column(name = "del_user")
    public String getDelUser() {
        return delUser;
    }
    public void setDelUser(String delUser) {
        this.delUser = delUser;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "device_activity_type")
    public String getDeviceActivityType() {
        return deviceActivityType;
    }
    public void setDeviceActivityType(String deviceActivityType) {
        this.deviceActivityType = deviceActivityType;
    }
    @Column(name = "agreement_photo")
    public String getAgreementPhoto() {
        return agreementPhoto;
    }
    public void setAgreementPhoto(String agreementPhoto) {
        this.agreementPhoto = agreementPhoto;
    }
}

+ 160 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/WlyyPatientDeviceLog.java

@ -0,0 +1,160 @@
package com.yihu.wlyy.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "wlyy_patient_device_log", schema = "", catalog = "wlyy")
public class WlyyPatientDeviceLog {
    private long id;
    //dm_device表主键
    private long deviceId;
    //患者id
    private String patient;
    //设备sn码
    private String deviceSn;
    //设备名称
    private String deviceName;
    // 设备类型标识
    private String categoryCode;
    //操作人code
    private String operator;
    //操作人姓名
    private String operatorName;
    // 医生或者患者(1医生 2患者)
    private Integer role;
    //操作动作(1绑定 2解绑)
    private Integer operateCode;
    // 创建时间
    private Date createTime;
    //是否有效(0无效1有效)
    private int isDel;
    //上传的协议图片地址
    private String agreementPhoto;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    @Column(name = "device_id")
    public long getDeviceId() {
        return deviceId;
    }
    public void setDeviceId(long deviceId) {
        this.deviceId = deviceId;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "device_sn")
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    @Column(name = "device_name")
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    @Column(name = "category_code")
    public String getCategoryCode() {
        return categoryCode;
    }
    public void setCategoryCode(String categoryCode) {
        this.categoryCode = categoryCode;
    }
    @Column(name = "operator")
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
    @Column(name = "operator_name")
    public String getOperatorName() {
        return operatorName;
    }
    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }
    @Column(name = "role")
    public Integer getRole() {
        return role;
    }
    public void setRole(Integer role) {
        this.role = role;
    }
    @Column(name = "operate_code")
    public Integer getOperateCode() {
        return operateCode;
    }
    public void setOperateCode(Integer operateCode) {
        this.operateCode = operateCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "is_del")
    public int getIsDel() {
        return isDel;
    }
    public void setIsDel(int isDel) {
        this.isDel = isDel;
    }
    @Column(name = "agreement_photo")
    public String getAgreementPhoto() {
        return agreementPhoto;
    }
    public void setAgreementPhoto(String agreementPhoto) {
        this.agreementPhoto = agreementPhoto;
    }
    public WlyyPatientDeviceLog() {
    }
}

+ 5 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/WlyyPatientDeviceDao.java

@ -5,10 +5,15 @@ import com.yihu.wlyy.entity.device.PatientHealthStandard;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yww on 2016/12/7.
 */
public interface WlyyPatientDeviceDao extends PagingAndSortingRepository<WlyyPatientDevice,Integer> {
    @Query("select a from PatientHealthStandard a where a.patient = ?1 and a.type = ?2")
    PatientHealthStandard findByPatientType(String patient, int type);
    @Query("select pd from WlyyPatientDevice pd where pd.deviceSn = ?1 and pd.del=0")
    List<WlyyPatientDevice> findByDeviceSn(String deviceSn);
}

+ 14 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/WlyyPatientDeviceLogDao.java

@ -0,0 +1,14 @@
package com.yihu.wlyy.repository;
import com.yihu.wlyy.entity.WlyyPatientDeviceLog;
import com.yihu.wlyy.entity.device.PatientHealthStandard;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by zd on 2018/06/21.
 */
public interface WlyyPatientDeviceLogDao extends PagingAndSortingRepository<WlyyPatientDeviceLog,Long> {
    @Query("select a from PatientHealthStandard a where a.patient = ?1 and a.type = ?2")
    PatientHealthStandard findByPatientType(String patient, int type);
}

+ 26 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.device.entity.WlyyDevice;
import com.yihu.wlyy.device.repository.DeviceManufacturerDao;
import com.yihu.wlyy.device.repository.WlyyDeviceDao;
import com.yihu.wlyy.entity.DmDevice;
import com.yihu.wlyy.entity.WlyyPatientDevice;
import com.yihu.wlyy.repository.DmDeviceDao;
import com.yihu.wlyy.service.common.excel.ExcelData;
import com.yihu.wlyy.util.ReadExcelUtil;
@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.persistence.DynamicSpecifications;
@ -36,6 +38,8 @@ public class WlyyDeviceService {
    private DeviceManufacturerDao deviceManufacturerDao;
    @Autowired
    private DmDeviceDao dmDeviceDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    public WlyyDevice findById(Long id){
        return deviceDao.findOne(id);
@ -366,4 +370,26 @@ public class WlyyDeviceService {
        return dataMap;
    }
    /**
     * 全部解绑后设备表更新为未绑定
     * @param deviceSn
     */
    public void unBindUpdateIsBinding(String deviceSn)throws Exception{
        String patientDeviceSql = "select count(*) num from wlyy.wlyy_patient_device pd where pd.device_sn ='"+deviceSn+"' and pd.del=0";
        Map<String,Object> map = jdbcTemplate.queryForMap(patientDeviceSql);
        int num = Integer.valueOf(String.valueOf(map.get("num")));
        String sql = "update device.wlyy_devices dd set dd.is_binding=? where dd.device_code=?";
        if (num==0){
            jdbcTemplate.update(sql,new Object[]{0,deviceSn});
            //deviceDetailDao.updateUnbindAll(0,deviceSn);
        }
        if (num==1){
            jdbcTemplate.update(sql,new Object[]{1,deviceSn});
            //deviceDetailDao.updateUnbindAll(1,deviceSn);
        }
        if (num>1){
            jdbcTemplate.update(sql,new Object[]{2,deviceSn});
            //deviceDetailDao.updateUnbindAll(2,deviceSn);
        }
    }
}

+ 67 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceLogService.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.service.manager.device;
import com.yihu.wlyy.device.entity.PatientDeviceExportVO;
import com.yihu.wlyy.device.entity.WlyyPatientDeviceVO;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.WlyyPatientDevice;
import com.yihu.wlyy.entity.WlyyPatientDeviceLog;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.WlyyPatientDeviceDao;
import com.yihu.wlyy.repository.WlyyPatientDeviceLogDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
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.BeanPropertyRowMapper;
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;
/**
 * Created by zd on 2018/6/21.
 * 居民设备日志表,wlyy数据库
 */
@Service
public class WlyyPatientDeviceLogService extends BaseJpaService<WlyyPatientDeviceLog,WlyyPatientDeviceLogDao>  {
   @Autowired
   private WlyyPatientDeviceDao wlyyPatientDeviceDao;
   @Autowired
   private WlyyPatientDeviceLogDao wlyyPatientDeviceLogDao;
    /**
     * 绑定和解绑的时候会保存一条数据
     * @param patientDevice
     * @param role
     * @param operateCode
     * @throws Exception
     */
    @Transactional
    public void savePatientDeviceLog(WlyyPatientDevice patientDevice,String deviceSn,int role,int operateCode)throws Exception{
        if (patientDevice==null){
            patientDevice = wlyyPatientDeviceDao.findByDeviceSn(deviceSn).get(0);
        }
        WlyyPatientDeviceLog patientDeviceLog = new WlyyPatientDeviceLog();
        patientDeviceLog.setDeviceId(patientDevice.getDeviceId());
        patientDeviceLog.setPatient(patientDevice.getUser());
        patientDeviceLog.setCategoryCode(patientDevice.getCategoryCode());
        patientDeviceLog.setDeviceName(patientDevice.getDeviceName());
        patientDeviceLog.setDeviceSn(patientDevice.getDeviceSn());
        patientDeviceLog.setRole(role);
        patientDeviceLog.setOperateCode(operateCode);
        //patientDeviceLog.setAgreementPhoto(patientDevice.getAgreementPhoto());
        patientDeviceLog.setOperatorName("admin");
        patientDeviceLog.setOperator("admin");
        patientDeviceLog.setCreateTime(new Date());
        patientDeviceLog.setIsDel(1);
        wlyyPatientDeviceLogDao.save(patientDeviceLog);
    }
}

+ 70 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/healthbank/ActivityService.java

@ -0,0 +1,70 @@
package com.yihu.wlyy.service.manager.healthbank;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.util.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by humingfen on 2018/6/19.
 * wlyy_health_bank_activity数据库
 */
@Service
public class ActivityService {
    @Value("${healthbank.activity}")
    private String baseUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
     * 查看活动列表
     * @param activity
     * @param page
     * @param pageSize
     * @return
     */
    public JSONObject searchList(String activity, Integer page, Integer pageSize) {
        String url = baseUrl + "findActivity";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("activity",activity);
        params.put("page",page.toString());
        params.put("size",pageSize.toString());
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
    public JSONObject update(String jsonData) {
        String url = baseUrl + "updateActivity";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("activity",jsonData);
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
    public JSONObject create(String jsonData) {
        String url = baseUrl + "createActivity";
        String response = "";
        Map<String,String> params = new HashMap<>();
        params.put("activity",jsonData);
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return JSONObject.parseObject(response);
    }
}

+ 44 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java

@ -4,12 +4,14 @@ import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import org.springframework.http.HttpHeaders;
@ -19,7 +21,9 @@ import org.springframework.web.client.RestTemplate;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@Component
public class HttpClientUtil {
@ -66,6 +70,46 @@ public class HttpClientUtil {
		return null;
	}
	/**
	 * http调用方法,(健康之路开放平台)
	 *
	 * @param url
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public  String httpPost(String url, Map<String, String> params) throws Exception {
		CloseableHttpClient httpclient = HttpClients.createDefault();
		RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(30000).setConnectTimeout(10000).build();//设置请求和传输超时时间
		try {
			HttpPost httpPost = new HttpPost(url);
			httpPost.setConfig(requestConfig);
			if (params != null && params.size() > 0) {
				List<NameValuePair> valuePairs = new ArrayList<NameValuePair>(params.size());
				for (Map.Entry<String, String> entry : params.entrySet()) {
					NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()));
					valuePairs.add(nameValuePair);
				}
				UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(valuePairs, "UTF-8");
				httpPost.setEntity(formEntity);
			}
			CloseableHttpResponse resp = httpclient.execute(httpPost);
			try {
				HttpEntity entity = resp.getEntity();
				String respContent = EntityUtils.toString(entity, "UTF-8").trim();
				return respContent;
			} finally {
				resp.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			httpclient.close();
		}
	}
	/**
	 * 发送get请求
	 * @param url 请求地址

+ 10 - 0
patient-co-manage/wlyy-manage/src/main/resources/application.yml

@ -100,6 +100,10 @@ server:
#智业预约记录接口
reservation:
  zyurl: http://59.61.92.90:8072/wlyy_service
#健康活动url
healthbank:
  activity: http://localhost:10051/svr-health-bank/
wechat:
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
@ -204,6 +208,9 @@ server:
#智业预约记录接口
reservation:
  zyurl: http://59.61.92.90:8072/wlyy_service
#健康活动url
healthbank:
  activity: http://localhost:10051/svr-health-bank/
wechat:
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb
@ -308,6 +315,9 @@ server:
#智业预约记录接口
reservation:
  zyurl: http://59.61.92.90:8072/wlyy_service
#健康活动url
healthbank:
  activity: http://localhost:10051/svr-health-bank/
wechat:
  appId: wxad04e9c4c5255acf
  appSecret: ae77c48ccf1af5d07069f5153d1ac8d3

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

@ -0,0 +1,57 @@
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/6/19 0019
  Time: 上午 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%@ include file="../head/page_head.jsp" %>
    <title>健康活动管理</title>
</head>
<body>
<div id="div_wrapper">
    <!-- 检索条件 -->
    <div class="m-activity-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
        <div class="m-form-group f-mt10">
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_title" placeholder="请输入活动名称" class="f-ml10" data-attr-scan="title"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_location" placeholder="请输入活动地点" class="f-ml10" data-attr-scan="location"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_type" placeholder="请输入活动类型" class="f-ml10" data-attr-scan="type"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_start_time" placeholder="请输入活动开始时间" class="f-ml10" data-attr-scan="startTime"/>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_end_time" placeholder="请输入活动结束时间" class="f-ml10" data-attr-scan="endTime"/>
            </div>
            <sec:authorize url="/admin/activity/list">
                <div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>查询</span>
                </div>
            </sec:authorize>
            <sec:authorize url="/admin/activity/create">
                <div id="btn_add" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                    <span>新增</span>
                </div>
            </sec:authorize>
        </div>
    </div>
    <!-- 列表 -->
    <div id="div_activity_list">
    </div>
</div>
</body>
<%@ include file="../head/page_foot.jsp" %>
<%@ include file="activity_list_js.jsp" %>
</html>

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

@ -0,0 +1,209 @@
<%@ 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 activity = null;
            var master = null;
            var isFirstPage = false;
            /* *************************** 函数定义 ******************************* */
            function pageInit() {
                activity.init();
                master.init();
            }
            function reloadGrid(params) {
                if (isFirstPage) {
                    this.grid.options.newPage = 1;
                }
                this.grid.setOptions({parms: params});
                this.grid.loadData(true);
            }
            /* *************************** 模块初始化 ***************************** */
            activity = {
                $element: $('.m-activity-area'),
                $searchBtn: $('#btn_search'),
                $addBtn: $('#btn_add'),
                $title: $("#inp_title"),//设备厂商名称
                $type: $("#inp_type"),
                $location: $("#inp_location"),
                $startTime: $("#inp_start_time"),
                $endTime: $("#inp_end_time"),
                init: function () {
                    this.$element.show();
                    this.$element.attrScan();
                    window.form = this.$element;
                    this.$title.ligerTextBox({width: 200});
                    this.$type.ligerTextBox({width: 200});
                    this.$location.ligerTextBox({width: 200});
                    this.$startTime.ligerDateEditor({
                        format: "yyyy-MM-dd",
                        showTime: false,
                        labelWidth: 100,
                        labelAlign: 'center',
                        cancelable: true
                    });
                    this.$endTime.ligerDateEditor({
                        format: "yyyy-MM-dd",
                        showTime: false,
                        labelWidth: 100,
                        labelAlign: 'center',
                        cancelable: true
                    });
                    this.bindEvents();
                },
                bindEvents: function () {
                    var self = this;
                    self.$searchBtn.click(function () {
                        master.grid.options.newPage = 1;
                        master.reloadGrid();
                    });
                    self.$addBtn.click(function () {
                        $.publish("activity:info:create", [0]);
                    });
                    
                }
            };
            master = {
                activityInfoDialog: null,
                grid: null,
                init: function () {
                    this.grid = $("#div_activity_list").ligerGrid($.LigerGridEx.config({
                        url: ctx + '/admin/activity/list',
                        parms: {"activity": JSON.stringify(activity.$element.Fields.getValues())},
                        root: "detailModelList",
                        ajaxHeader: ajaxHeaderName,
                        ajaxHeaderValue: ajaxHeaderValue,
                        columns: [
                            {display: 'id', name: 'id', hide: true},
                            {display: '主办方&发布机构', name: 'organizer', width: '10%', align: "left"},
                            {display: '活动标题', name: 'title', width: '10%', align: "left"},
                            {display: '活动地点', name: 'location', width: '10%', align: "left"},
                            {display: '活动说明', name: 'description', width: '10%', align: "left"},
                            {display: '活动类型', name: 'type', width: '10%', align: "left"},
                            {display: '开始时间', name: 'startTime', width: '10%', align: "left"},
                            {display: '结束时间', name: 'endTime', width: '10%', align: "left"},
                            {
                                display: '活动状态', name: 'status', width: '10%', align: "left",
                                render: function (row) {
                                    if (row.status == 1) {
                                        return "有效"
                                    }
                                    if (row.status == 0) {
                                        return "无效"
                                    }
                                    if (row.status == -1) {
                                        return "过期"
                                    }
                                }
                            },
                            {display: '活动备注', name: 'remark', width: '10%', align: "left"},
                            {
                                display: '操作', name: 'operator', width: '10%', align: "center", isSort: false,
                                render: function (row) {
                                    var html = '';
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "activity:info:view", row.id) + '">查看</a>';
                                    <sec:authorize url="/admin/activity/update">
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "activity:info:edit", row.id) + '">编辑</a>';
                                    </sec:authorize>
                                    <%--<sec:authorize url="/admin/activity/delete">
                                    html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "activity:info:del", row.id) + '">删除</a>';
                                    </sec:authorize>--%>
                                    return html;
                                }
                            }
                        ],
                    }));
                    // 自适应宽度
                    this.grid.adjustToWidth();
                    this.bindEvents();
                },
                reloadGrid: function (msg) {
                    activity.$element.attrScan();
                    var values = activity.$element.Fields.getValues();
                    reloadGrid.call(this,{"activity":JSON.stringify(values)});
                },
                delRecord: function (id, code) {
                    var self = this;
                    $.ajax({
                        url: ctx + "/admin/activity/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('activity:info:view', function (event, id) {
                        var title = '查看信息';
                        self.deviceInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"id": id, "type": "view"},
                            title: title,
                            url: ctx + '/admin/activity/infoInit'
                        })
                    });
                    $.subscribe('activity:info:edit', function (event, id) {
                        var title = '编辑信息';
                        self.activityInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"id": id, "type": "edit"},
                            title: title,
                            url: ctx + '/admin/activity/infoInit'
                        })
                    });
                    $.subscribe('activity:info:create', function (event) {
                        var title = '新增活动';
                        self.activityInfoDialog = $.ligerDialog.open({
                            height: 600,
                            width: 560,
                            urlParms: {"type": "create"},
                            title: title,
                            url: ctx + '/admin/activity/init'
                        })
                    });
                    $.subscribe('activity: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.closeActivityInfoDialog = function () {
                master.activityInfoDialog.close();
            };
            /* *************************** 页面初始化 **************************** */
            pageInit();
        });
    })(jQuery, window);
</script>

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

@ -0,0 +1,109 @@
<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/6/21
  Time: 10:29
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <%@ include file="../head/page_head.jsp"%>
    <title>活动详情</title>
    <style type="text/css">
        .m-form-group label.label_title{width: 100px}
    </style>
</head>
<body>
<div id="div_activity_info_form" data-role-form class="m-form-inline f-mt20 f-ml30" data-role-form>
    <input type="hidden" id="inp_id" value='${id}' data-attr-scan="id"/>
    <input type="hidden" id="type" value='${type}'/>
    <div class="m-form-group" style="padding:10 0 10 0">
        <label class="label_title" style="width:120px">主办方&发布机构</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_organizer" class="required useTitle f-w240 validate-special-char"  required-title="主办方不能为空"  data-attr-scan="organizer"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">活动标题</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_title" class="required useTitle f-w240 validate-special-char"  required-title="活动标题不能为空"  data-attr-scan="title"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">活动说明</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_description" class="required useTitle ajax f-w240 validate-special-char"  required-title="活动说明不能为空"  data-attr-scan="description"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">活动地点</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_location" class="required useTitle ajax f-w240 validate-special-char"  required-title="活动地点不能为空" data-attr-scan="location"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">活动类型</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_type" class="f-w240 validate-special-char" data-attr-scan="type"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">开始时间</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_startTime"  class="required useTitle f-w240 validate-special-char" required-title="开始时间不能为空" data-attr-scan="startTime"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">结束时间</label>
        <div class="l-text-wrapper m-form-control essential">
            <input type="text"  id="inp_endTime" class="required useTitle f-w240 validate-special-char"  required-title="结束时间不能为空" data-attr-scan="endTime"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">状态</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_status" class="f-w240 validate-special-char" data-attr-scan="status"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">是否有问卷</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_isFlag" class="f-w240 validate-special-char"   data-attr-scan="isFlag"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">活动备注</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_remark" class="f-w240 validate-special-char"   data-attr-scan="remark"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">区域</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_area" class="f-w240 validate-special-char"   data-attr-scan="area"/>
        </div>
    </div>
    <div class="m-form-group">
        <label class="label_title" style="width:120px">城市类型</label>
        <div class="l-text-wrapper m-form-control">
            <input type="text"  id="inp_areaType" class="f-w240 validate-special-char"   data-attr-scan="areaType"/>
        </div>
    </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="activity_modify_js.jsp" %>
<%--<script src="${ctx}/static/js/device/device_modify.js"></script>--%>
</html>

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

@ -0,0 +1,172 @@
<%@ 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 type = $('#type').val();
            var id = $('#inp_id').val();
            var activityInfo = "";
            var jValidation = $.jValidation;
            function pageInit() {
                activityInfo.init();
                if(type != "create") {
                    activityInfo.initForm();
                }
                activityInfo.bindEvents();
            }
            activityInfo = {
                //变量
                $form: $("#div_activity_info_form"),
                init: function () {
                    _this = this;
                    this.$form.attrScan();
                    $("#inp_organizer").ligerTextBox({width: 240}) //主办方&发布机构
                    $("#inp_title").ligerTextBox({width: 240})//活动标题
                    $("#inp_description").ligerTextBox({width: 240})//活动说明
                    $("#inp_location").ligerTextBox({width: 240})//活动地点
                    $("#inp_type").ligerTextBox({width: 240})//活动类型
                    $("#inp_startTime").ligerDateEditor({
                        format: "yyyy-MM-dd hh:mm:ss",
                        showTime: true,
                        width: 240,
                        labelAlign: 'center',
                        cancelable: true
                    });//开始时间
                    $("#inp_endTime").ligerDateEditor({
                        format: "yyyy-MM-dd hh:mm:ss",
                        showTime: true,
                        width: 240,
                        labelAlign: 'center',
                        cancelable: true
                    });//结束时间
                    $("#inp_status").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '有效', id: '1'},
                            {text: '无效', id: '0'},
                            {text: '过期', id: '-1'},
                        ]
                    })//状态
                    $("#inp_isFlag").ligerComboBox({
                        width: 240,
                        data: [
                            {text: '有', id: '1'},
                            {text: '没有', id: '-1'},
                        ]
                    })//是否有问卷
                    $("#inp_remark").ligerTextBox({width: 240})//活动备注
                    $("#inp_area").ligerTextBox({width: 240})//区域
                    $("#inp_areaType").ligerComboBox({
                        width: 240,
                        data: [
                            {text: 'PROVINCE', id: '1'},
                            {text: 'CITY', id: '2'},
                            {text: 'TOWN', id: '3'},
                            {text: 'HOSPITAL', id: '4'},
                        ]
                    })//城市类型
                },
                initForm: function () {
                    _this = this;
                    //修改、查看
                    $.ajax({
                        url: ctx + "/admin/activity/findById",
                        method: "post",
                        dataType: "json",
                        async: false,
                        data: {id: id},
                        success: function (result) {
                            if (result.status == '200') {
                                var data = result.data.detailModelList[0];
                                _this.$form.Fields.fillValues({
                                    organizer: data.organizer,
                                    title: data.title,
                                    description: data.description,
                                    location: data.location,
                                    type: data.type,
                                    startTime: data.startTime,
                                    endTime: data.endTime,
                                    remark: data.remark,
                                    area: data.area,
                                    areaType: data.areaType,
                                });
                                //填值
                                $("#inp_status").ligerComboBox("selectValue",data.status);
                                $("#inp_isFlag").ligerComboBox("selectValue",data.isFlag);
                                $("#inp_areaType").ligerComboBox("selectValue",data.areaType);
                            } else {
                                $.Notice.error(result.msg);
                            }
                        },
                        error: function (data) {
                            $.Notice.error("系统异常,请联系管理员!");
                        }
                    });
                    if (type == "view") {
                        _this.$form.addClass("m-form-readonly"); //表单只读
                        $(".essential").addClass("XXXtest");
                        $(".essential").removeClass("essential");
                        $("#btn_save_close").css("display", "none");
                    } else {
                        this.$form.removeClass("m-form-readonly");
                        $("#btn_save_close").css("display", "block");
                        $(".XXXtest").addClass("essential");
                    }
                    this.$form.show();
                },
                //绑定事件
                bindEvents: function () {
                    var validator = new jValidation.Validation(this.$form, {
                        immediate: true, onSubmit: false,
                        onElementValidateForAjax: function (elm) {
                        }
                    });
                    var self = this;
                    $("#btn_save").click(function () {
                        var values = self.$form.Fields.getValues();
                        values.status = $("#inp_status").ligerComboBox("getValue");
                        values.isFlag = $("#inp_isFlag").ligerComboBox("getValue");
                        values.areaType = $("#inp_areaType").ligerComboBox("getValue");
                        if (!validator.validate()) {
                            return;
                        }
                        update(values);
                    });
                    function update(values) {
                        var dataModel = $.DataModel.init();
                        var url = "update";
                        if (type == "create") {
                            url = "create";
                        }
                        dataModel.updateRemote(ctx + "/admin/activity/" + url, {
                            data: {jsonData: JSON.stringify(values)},
                            success: function (data) {
                                if (data.status == 200) {
                                    parent.window.reloadMasterGrid(data.msg);
                                    parent.window.closeActivityInfoDialog();
                                } else {
                                    $.Notice.error(data.msg);
                                }
                            }
                        });
                    }
                    $("#btn_cancel").click(function () {
                        parent.window.closeActivityInfoDialog();
                    });
                },
            }
            pageInit();
        });
    })(jQuery, window)
</script>

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

@ -120,6 +120,22 @@
				</div>
				</sec:authorize>
				<%-- 健康银行管理中心--%>
				<sec:authorize url="/admin/healthBank/center">
				<div class="a-divider"></div>
				<div class="a-menu">
					<div class="a-menu-tit"><i class="icons icons-aside-2 icons-24 mr15"></i>健康银行管理</div>
					<div class="a-menu-list c-hide">
						<ul>
							</sec:authorize>
							<sec:authorize url="/admin/activity/initial">
								<li><a href="javascript:locationMenu('activity');">活动管理</a></li>
							</sec:authorize>
							<sec:authorize url="/admin/healthBank/center">
						</ul>
					</div>
				</div>
				</sec:authorize>
				<%-- 数据统计--%>
				<sec:authorize url="/admin/static/center">

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

@ -22,6 +22,9 @@ var menu = {
    "patientDevice": "/admin/patientDevice/initial",//居民设备查询页面
    "manufacturer": "/admin/manufacturer/initial",//设备厂商页面
    //健康银行管理
    "activity": "/admin/activity/initial",//健康活动管理页面
    //数据统计
    "static": "/admin/static/center",//数据统计
    "staticPrescription": "/admin/static/prescription/initial",//长处方数据统计

+ 21 - 1
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -1,5 +1,6 @@
package com.yihu.hos.device.service;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.hos.device.common.configuration.HealthStandardConfig;
import com.yihu.hos.device.common.configuration.SystemConfig;
@ -85,6 +86,8 @@ public class DeviceService extends BaseService{
    private PatientAimBloodPressureDao patientAimBloodPressureDao;
    @Autowired
    private IotDeviceService iotDeviceService;
    @Autowired
    private SystemDictDao systemDictDao;
    private static Logger logger = LoggerFactory.getLogger(DeviceService.class);
    private ObjectMapper objectMapper = new ObjectMapper();
@ -499,7 +502,7 @@ public class DeviceService extends BaseService{
                Patient patient = patientDao.findByCode(patientCode);
                //增加积分
                if (dataUoloadCount>0 && "350205".equals(patient.getTown())){
                if (dataUoloadCount == 0 && "350205".equals(patient.getTown())){
                    String sql = "select count(*) num from device.wlyy_devices where device_code = '"+deviceSn+"'";
                    Map<String,Object> deviceCountMap = jdbcTemplate.queryForMap(sql);
                    if (Integer.valueOf(String.valueOf(deviceCountMap.get("num")))>0){
@ -531,6 +534,23 @@ public class DeviceService extends BaseService{
                    }
                }
                //增加活跃度
                if (dataUoloadCount == 0){
                    String url1 = systemDictDao.findByDictNameAndCode("HEALTH_BANK_URL","HEALTH_BANK_URL");
                    String url = url1 + "/createActiveRecord";
                    List<NameValuePair> params = new ArrayList<>();
                    params.add(new BasicNameValuePair("originalStatus", "0"));
                    params.add(new BasicNameValuePair("currentStatus","1"));
                    params.add(new BasicNameValuePair("patientId",patient.getCode()));
                    String response = HttpClientUtil.post(url,params,"UTF-8");
                    if (StringUtils.isNotEmpty(response)){
                        com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(response);
                        if (!"200".equals(jsonObject.getString("status"))){
                            logger.info("添加活跃度失败!");
                        }
                    }
                }
                //血糖、血压数据需校验,如果超标,需要发送消息给医生
	            if (1 == deviceType || 2 == deviceType) {
		            verifyHealthIndex(result);

+ 41 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -1743,14 +1743,14 @@ public class PatientInfoService extends BaseService {
        }
    }
    public List<Map<String,Object>> getPatientSignByNameOrIdCard(String keyWord,String deviceSn,String doctorId,int pageNo,int pageSize)throws Exception{
    /*public List<Map<String,Object>> getPatientSignByNameOrIdCard(String keyWord,String deviceSn,String doctorId,int pageNo,int pageSize)throws Exception{
        Doctor doctor = doctorDao.findByCode(doctorId);
        String hospital = doctor.getHospital();
        int start = (pageNo-1)*pageSize;
        List<Map<String,Object>> patientList = new ArrayList<>();
       /* String sql = "SELECT p.code,p.name,CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex,p.idcard,f.doctor_name" +
       *//* String sql = "SELECT p.code,p.name,CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex,p.idcard,f.doctor_name" +
                " FROM wlyy_patient p  LEFT JOIN wlyy_sign_family f ON p.code = f.patient" +
                " WHERE f.status = 1 AND p.name LIKE '%"+keyWord+"%' OR p.idcard LIKE '%"+keyWord+"%' and f.hospital = '"+hospital+"'"+" limit ?,?";*/
                " WHERE f.status = 1 AND p.name LIKE '%"+keyWord+"%' OR p.idcard LIKE '%"+keyWord+"%' and f.hospital = '"+hospital+"'"+" limit ?,?";*//*
        String sql ="SELECT f.patient as code,f.name,f.idcard,f.doctor_name FROM wlyy_sign_family f where f.status > 0 AND f.hospital = '"+hospital+"' " ;
        if (StringUtils.isNotEmpty(keyWord)){
            sql +=  "AND f.name LIKE '%"+keyWord+"%' OR f.idcard LIKE '%"+keyWord+"%'";
@ -1758,6 +1758,44 @@ public class PatientInfoService extends BaseService {
        sql += " limit ?,?";
        patientList = jdbcTemplate.queryForList(sql ,new Object[]{start,pageSize});
        String patientDeviceSql = "SELECT user as patientCode FROM wlyy_patient_device WHERE device_sn='"+deviceSn+"'";
        List<Map<String,Object>> patientDeviceList = jdbcTemplate.queryForList(patientDeviceSql);
        for (Map<String,Object> map : patientList){
            map.put("age",IdCardUtil.getAgeForIdcard(String.valueOf(map.get("idcard"))));
            map.put("sex",Constant.getLevelSexName(IdCardUtil.getSexForIdcard_new(String.valueOf(map.get("idcard")))));
            for (Map<String,Object> patientDeviceMap : patientDeviceList){
                if (String.valueOf(map.get("code")).equals(String.valueOf(patientDeviceMap.get("patientCode")))){
                    map.put("del",1);
                }else {
                    map.put("del",0);
                }
            }
        }
        return patientList;
    }*/
    public List<Map<String,Object>> getPatientSignByNameOrIdCard(String keyWord,String deviceSn,int isManage,int level,String area,int pageNo,int pageSize)throws Exception{
        /* String sql = "SELECT p.code,p.name,CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex,p.idcard,f.doctor_name" +
                " FROM wlyy_patient p  LEFT JOIN wlyy_sign_family f ON p.code = f.patient" +
                " WHERE f.status = 1 AND p.name LIKE '%"+keyWord+"%' OR p.idcard LIKE '%"+keyWord+"%' and f.hospital = '"+hospital+"'"+" limit ?,?";*/
        String sql = "";
        List<Map<String,Object>> patientList = new ArrayList<>();
        if (isManage == 1 && level ==3){
            sql = "SELECT f.patient as code,f.name,f.idcard,f.doctor_name FROM wlyy_sign_family f where f.status >0 and LEFT(f.hospital, 6) = '"+area+"'";
        }
        if (isManage==0 || (isManage==1 && level == 2)) {
            sql = "SELECT f.patient as code,f.name,f.idcard,f.doctor_name FROM wlyy_sign_family f where f.status >0 and f.hospital = '" + area + "' and f.status > 0 ";
        }
        if (!StringUtils.isEmpty(keyWord)){
            sql += " AND f.name LIKE '%"+keyWord+"%' OR f.idcard LIKE '%"+keyWord+"%'";
        }
        sql += " limit ?,?";
        int start = (pageNo-1)*pageSize;
        patientList = jdbcTemplate.queryForList(sql ,new Object[]{start,pageSize});
        //判断是否有绑定过该设备的人
        String patientDeviceSql = "SELECT user as patientCode FROM wlyy_patient_device WHERE device_sn='"+deviceSn+"'";
        List<Map<String,Object>> patientDeviceList = jdbcTemplate.queryForList(patientDeviceSql);
        for (Map<String,Object> map : patientList){

+ 6 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/DeviceDetailService.java

@ -59,7 +59,8 @@ public class DeviceDetailService extends BaseService {
	@Transactional
	public void updateAfterBinding(PatientDevice patientDevice, Date grantTime,boolean isFirst)throws Exception{
		DeviceDetail deviceDetail = deviceDetailDao.findBySn(patientDevice.getDeviceSn());
		List<SignFamily> signFamilyList = signFamilyDao.findSSandJTByIdcard(patientDevice.getUserIdcard());
		SignFamily signFamily = signFamilyDao.findByIdcard(patientDevice.getUserIdcard());
		/*List<SignFamily> signFamilyList = signFamilyDao.findSSandJTByIdcard(patientDevice.getUserIdcard());*/
		long adminTeam=0L;
		String hospital = "";
		String isFirstBind = "";
@ -68,10 +69,10 @@ public class DeviceDetailService extends BaseService {
		if ("2".equals(patientDevice.getUserType())){
			keyType="2";
		}
		if (signFamilyList!=null && signFamilyList.size()>0){
			adminTeam = signFamilyList.get(0).getAdminTeamId();
			hospital = signFamilyList.get(0).getHospital();
			hospitalName = signFamilyList.get(0).getHospitalName();
		if (signFamily!=null){
			adminTeam = signFamily.getAdminTeamId();
			hospital = signFamily.getHospital();
			hospitalName = signFamily.getHospitalName();
		}
		//设备表没有数据则插入一条数据
		if (deviceDetail==null){

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthGuidanceService.java

@ -180,10 +180,10 @@ public class PatientHealthGuidanceService extends BaseService {
			Date currentTime = new Date();
			long h24 = 60*60*24;
			for(Map<String, Object> one :list){
				if((Integer)one.get("manage_result")==1||(Integer)one.get("manage_result")==2)continue;
				if(one.get("manage_result")!=null&&((Integer)one.get("manage_result")==1||(Integer)one.get("manage_result")==2))continue;
				String tempSql="";
				Date temp =(Date)one.get("czrq");
				if(currentTime.getTime()-temp.getTime()>h24){//有效干预
				if(currentTime.getTime()-temp.getTime()<=h24){//有效干预
					tempSql = "update device.wlyy_patient_health_index set manage_result=1 where id="+one.get("id");
				}else{//无效干预
					tempSql = "update device.wlyy_patient_health_index set manage_result=2 where id="+one.get("id");

+ 26 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.doctor.device;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.aop.ObserverRequired;
@ -10,6 +11,7 @@ import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
@ -24,12 +26,15 @@ import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -48,6 +53,7 @@ import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -91,6 +97,10 @@ public class DoctorDeviceController extends BaseController {
	private PatientDeviceDao patientDeviceDao;
	@Autowired
	private SignFamilyDao signFamilyDao;
	@Autowired
	private SystemDictDao systemDictDao;
	@Autowired
	private HttpClientUtil httpClientUtil;
	@Autowired
	private JmsTemplate jmsTemplate;
@ -165,6 +175,22 @@ public class DoctorDeviceController extends BaseController {
					logger.info("添加积分失败!");
				}
			}
			//活动的活跃度
			if (flag){
				String url1 = systemDictDao.findByDictNameAndCode("HEALTH_BANK_URL","HEALTH_BANK_URL");
				String url = url1 + "/createActiveRecord";
				List<NameValuePair> params = new ArrayList<>();
				params.add(new BasicNameValuePair("originalStatus", "0"));
				params.add(new BasicNameValuePair("currentStatus","1"));
				params.add(new BasicNameValuePair("patientId",patient.getCode()));
				String response = httpClientUtil.post(url,params,"UTF-8");
				if (StringUtils.isNotEmpty(response)){
					JSONObject jsonObject = JSON.parseObject(response);
					if (!"200".equals(jsonObject.getString("status"))){
						logger.info("添加活跃度失败!");
					}
				}
			}
			try {
				String openId = patient.getOpenid();
				String name = patient.getName();

+ 25 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -525,7 +525,7 @@ public class PatientInfoController extends BaseController {
     * @param pageSize
     * @return
     */
    @RequestMapping(value = "/getPatientSignByNameOrIdCard",method = RequestMethod.GET)
    /*@RequestMapping(value = "/getPatientSignByNameOrIdCard",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("在绑定设备的时候查找患者(带签约信息)")
    public String getPatientSignByNameOrIdCard(@ApiParam(value = "关键搜索词", name = "keyWord") @RequestParam(value = "keyWord",required = false)String keyWord,
@ -544,5 +544,29 @@ public class PatientInfoController extends BaseController {
            error(e);
            return error( -1, "查询失败!");
        }
    }*/
    @RequestMapping(value = "/getPatientSignByNameOrIdCard",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("在绑定设备的时候查找患者(带签约信息)")
    public String getPatientSignByNameOrIdCard(@ApiParam(value = "关键搜索词", name = "keyWord") @RequestParam(value = "keyWord",required = true,defaultValue = "")String keyWord,
                                               @ApiParam(value = "设备sn码", name = "deviceSn") @RequestParam(value = "deviceSn",required = true)String deviceSn,
                                               @ApiParam(value = "是否为管理员登录(0不是1是)", name = "isManage") @RequestParam(value = "isManage",required = true)String isManage,
                                               @ApiParam(value = "管理员地区权限level(3区  2社区)", name = "level") @RequestParam(value = "level",required = false,defaultValue = "0")String level,
                                               @ApiParam(value = "管理员地区code", name = "area") @RequestParam(value = "area",required = true)String area,
                                               @ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
                                               @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
        if (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")){
            page = "1";
        }
        try {
            return  write(200,"查找成功!","data",patientInfoService.getPatientSignByNameOrIdCard(keyWord,deviceSn,Integer.valueOf(isManage),Integer.valueOf(level),area,Integer.valueOf(page),Integer.valueOf(pageSize)));
        } catch (Exception e) {
            error(e);
            return error( -1, "查询失败!");
        }
    }
}

+ 25 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.device;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.device.PatientHealthTime;
@ -8,6 +9,7 @@ import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.deviece.PatientHealthTimeDao;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
@ -20,12 +22,15 @@ import com.yihu.wlyy.service.app.health.bank.CreditLogService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -77,6 +82,10 @@ public class PatientDeviceController extends BaseController {
    private MessageDao messageDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private SystemDictDao systemDictDao;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Value("${yihu.yihu_OpenPlatform_url}")
    private String url;
@ -262,6 +271,22 @@ public class PatientDeviceController extends BaseController {
                    logger.info("添加积分失败!");
                }
            }
            //活动的活跃度
            if (flag){
                String url1 = systemDictDao.findByDictNameAndCode("HEALTH_BANK_URL","HEALTH_BANK_URL");
                String url = url1 + "/createActiveRecord";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("originalStatus", "0"));
                params.add(new BasicNameValuePair("currentStatus","1"));
                params.add(new BasicNameValuePair("patientId",patient.getCode()));
                String response = httpClientUtil.post(url,params,"UTF-8");
                if (StringUtils.isNotEmpty(response)){
                    com.alibaba.fastjson.JSONObject jsonObject = JSON.parseObject(response);
                    if (!"200".equals(jsonObject.getString("status"))){
                        logger.info("添加活跃度失败!");
                    }
                }
            }
            try {
                String openId = patient.getOpenid();
                String name = patient.getName();