Просмотр исходного кода

Merge branch 'dev' of huangwenjie/patient-co-management into dev

yeshijie 7 лет назад
Родитель
Сommit
f7e7ef75dc
27 измененных файлов с 1777 добавлено и 311 удалено
  1. 5 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java
  2. 21 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/DeviceStaticController.java
  3. 0 9
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/PrescriptionStaticController.java
  4. 172 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/WeChatStaticController.java
  5. 80 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/DeviceHealthIndexController.java
  6. 0 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyDeviceController.java
  7. 81 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyPatientDeviceController.java
  8. 98 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/DeviceHealthIndexVO.java
  9. 98 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/PatientDeviceVO.java
  10. 126 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/wechat/WechatSignVO.java
  11. 45 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/wechat/WechatTotalVO.java
  12. 23 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java
  13. 32 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java
  14. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/user/UserService.java
  15. 126 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/wechat/WechatService.java
  16. 3 3
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/main.jsp
  17. 5 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list.jsp
  18. 6 13
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list_js.jsp
  19. 43 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/static_device.jsp
  20. 209 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/static_device_js.jsp
  21. 68 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/static_wechat.jsp
  22. 249 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/static_wechat_js.jsp
  23. 2 0
      patient-co-manage/wlyy-manage/src/main/webapp/static/js/menu.js
  24. 116 116
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/HealthArtListener.java
  25. 90 90
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/StartListener.java
  26. 70 70
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/ActiveMQConfig.java
  27. 8 6
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

+ 5 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java

@ -36,7 +36,12 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                "/admin/hos/importData",
                "/admin/hos/doctor/toExcel",
                "/admin/device/toExcel",
                "/admin/patientDevice/toExcel",
                "/admin/healthIndex/toExcel",
                "/admin/static/prescription/toExcel",
                "/admin/static/wechat/listToExcel",
                "/admin/static/wechat/hosipitaTotalToExcel",
                "/admin/static/wechat/townTotalToExcel",
                "/admin/basedata/importData",
                "/admin/wlyyUserRole/importData",
                "/WEB—INF/views/**"

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

@ -0,0 +1,21 @@
package com.yihu.wlyy.controller.manager.datastatic;
import com.yihu.wlyy.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
 * 设备统计报表导出
 * @author huangwenjie
 * @date 2017/12/12 10:26
 */
@Controller
@RequestMapping(value = "/admin/static/device/")
public class DeviceStaticController extends BaseController {
	
	//页面跳转(主页面)
	@RequestMapping(value = "initial")
	public String listInit() {
		return "static/static_device";
	}
}

+ 0 - 9
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/PrescriptionStaticController.java

@ -1,17 +1,11 @@
package com.yihu.wlyy.controller.manager.datastatic;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.WlyyDevice;
import com.yihu.wlyy.entity.SignFamily;
import com.yihu.wlyy.entity.prescription.Prescription;
import com.yihu.wlyy.entity.prescription.PrescriptionVO;
import com.yihu.wlyy.service.prescription.PrescriptionService;
import jxl.Workbook;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -21,7 +15,6 @@ import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
@ -77,8 +70,6 @@ public class PrescriptionStaticController extends BaseController {
			@RequestParam(value = "endDate",required = false)String endDate,
			HttpServletResponse response){
		try {
			ObjectMapper objectMapper = new ObjectMapper();
			JavaType javaType = objectMapper.getTypeFactory().constructParametricType(ArrayList.class, WlyyDevice.class);
			List<PrescriptionVO> datalist = prescriptionService.getPrescriptionList(hospital,disease,dispensarytype,status,beginDate,endDate,0,0,false);
			response.setContentType("octets/stream");
			response.setHeader("Content-Disposition", "attachment; filename="+ new String( "prescriptionDataList.xls"));

+ 172 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/datastatic/WeChatStaticController.java

@ -0,0 +1,172 @@
package com.yihu.wlyy.controller.manager.datastatic;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.prescription.PrescriptionVO;
import com.yihu.wlyy.entity.wechat.WechatSignVO;
import com.yihu.wlyy.entity.wechat.WechatTotalVO;
import com.yihu.wlyy.service.wechat.WechatService;
import jxl.Workbook;
import jxl.write.*;
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 javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
/**
 * 微信报表导出
 * @author huangwenjie
 * @date 2017/12/11 08:58
 */
@Controller
@RequestMapping(value = "/admin/static/wechat")
public class WeChatStaticController extends BaseController {
	
	@Autowired
	private WechatService wechatService;
	
	//页面跳转(主页面)
	@RequestMapping(value = "initial")
	public String listInit() {
		return "static/static_wechat";
	}
	
	//导出详情报表报表
	@RequestMapping(value="listToExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
	public void exportList(
			@RequestParam(value = "town",required = false)String town,
			@RequestParam(value = "hospital",required = false)String hospital,
			@RequestParam(value = "attention",required = false)String attention,
			HttpServletResponse response){
		try {
			List<WechatSignVO> datalist = wechatService.geSignWechatDataList(hospital,attention);
			response.setContentType("octets/stream");
			response.setHeader("Content-Disposition", "attachment; filename="+ new String( "signWechatDataList.xls"));
			OutputStream os = response.getOutputStream();
			this.listWrite(os,datalist);
		}catch (Exception ex){
			error(ex);
		}
	}
	
	//导出社区报表
	@RequestMapping(value="hosipitaTotalToExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
	public void hosipitaTotalData(
			HttpServletResponse response){
		try {
			List<WechatTotalVO> datalist = wechatService.hosipitaTotalData();
			response.setContentType("octets/stream");
			response.setHeader("Content-Disposition", "attachment; filename="+ new String( "hosipitaTotalData.xls"));
			OutputStream os = response.getOutputStream();
			this.totalWrite(os,datalist);
		}catch (Exception ex){
			error(ex);
		}
	}
	
	//导出行政区报表
	@RequestMapping(value="townTotalToExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
	public void townTotalData(
			HttpServletResponse response){
		try {
			List<WechatTotalVO> datalist = wechatService.townTotalData();
			response.setContentType("octets/stream");
			response.setHeader("Content-Disposition", "attachment; filename="+ new String( "townTotalData.xls"));
			OutputStream os = response.getOutputStream();
			this.totalWrite(os,datalist);
		}catch (Exception ex){
			error(ex);
		}
	}
	
	public void totalWrite(OutputStream os, List ls) throws Exception{
		WritableWorkbook wwb = Workbook.createWorkbook(os);
		try {
			WritableSheet ws;
			ws = wwb.createSheet("sheet",1);
			
			String[] header = {"机构/行政区","关注率(关注数/签约数)","关注数","签约数"};
			int k = 0;
			for (String h : header) {
				addCell(ws, 0, k, h);//表名,行,列,header
				k++;
			}
			
			int i = 1;
			for (WechatTotalVO m : (List<WechatTotalVO>) ls) {
				addCell(ws, i, 0, m.getName(),"");
				addCell(ws, i, 1,String.valueOf(m.getAttRate()),"");
				addCell(ws, i, 2, String.valueOf(m.getAttNumber()),"");
				addCell(ws, i, 3, String.valueOf(m.getSignNumber()),"");
				i++;
			}
			wwb.write();
			wwb.close();
		} catch (IOException e) {
			e.printStackTrace();
			if (wwb != null) wwb.close();
			throw e;
		}
	}
	
	
	public void listWrite(OutputStream os, List ls) throws Exception{
		WritableWorkbook wwb = Workbook.createWorkbook(os);
		try {
			WritableSheet ws;
			ws = wwb.createSheet("sheet",1);
			
			String[] header = {"居民openid","居民姓名","手机号码","openid更新时间", "身份证号","全科医生", "健管师", "社区医院", "居委会","住址","街道","openid重复数"};
			int k = 0;
			for (String h : header) {
				addCell(ws, 0, k, h);//表名,行,列,header
				k++;
			}
			
			int i = 1;
			for (WechatSignVO m : (List<WechatSignVO>) ls) {
				addCell(ws, i, 0, m.getOpenid(),"");
				addCell(ws, i, 1, m.getPatientname(),"");
				addCell(ws, i, 2, m.getMobile(),"");
				addCell(ws, i, 3, m.getOpenid_time(),"");
				addCell(ws, i, 4, m.getIdcard(),"");
				addCell(ws, i, 5, m.getDoctor_name(),"");
				addCell(ws, i, 6, m.getDoctor_name(),"");
				addCell(ws, i, 7, m.getDoctor_health_name(),"");
				addCell(ws, i, 8, m.getHospital_name(),"");
				addCell(ws, i, 9, m.getSick_village_name(),"");
				addCell(ws, i, 10, m.getAddress(),"");
				addCell(ws, i, 11, m.getStreet_name(),"");
				addCell(ws, i, 12, m.getTcount(),"");
				i++;
			}
			wwb.write();
			wwb.close();
		} catch (IOException e) {
			e.printStackTrace();
			if (wwb != null) wwb.close();
			throw e;
		}
	}
	//添加单元格内容
	public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException {
		Label label = new Label(column ,row, data);
		ws.addCell(label);
	}
	//添加单元格内容
	public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
		Label label = new Label(column ,row, data);
		if(!org.springframework.util.StringUtils.isEmpty(memo)){
			WritableCellFeatures cellFeatures = new WritableCellFeatures();
			cellFeatures.setComment(memo);
			label.setCellFeatures(cellFeatures);
		}
		ws.addCell(label);
	}
}

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

@ -2,7 +2,11 @@ package com.yihu.wlyy.controller.manager.device;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.DeviceHealthIndex;
import com.yihu.wlyy.device.entity.DeviceHealthIndexVO;
import com.yihu.wlyy.device.entity.PatientDeviceVO;
import com.yihu.wlyy.service.manager.device.DeviceHealthIndexService;
import jxl.Workbook;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
@ -11,6 +15,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
/**
 * Created by Administrator on 2016/12/5.
 */
@ -40,6 +49,77 @@ public class DeviceHealthIndexController extends BaseController{
            return error(-1,"操作失败!");
        }
    }
    
    //导出报表
    @RequestMapping(value="toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public void exportList(
            @RequestParam(value = "town",required = false)String town,
            @RequestParam(value = "hospital",required = false)String hospital,
            HttpServletResponse response){
        try {
            List<DeviceHealthIndexVO> wlyyDevices = healthIndexService.exportDeviceHealthIndexList(town,hospital);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "deviceHealthIndexDataList.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os,wlyyDevices);
        }catch (Exception ex){
            error(ex);
        }
    }
    
    
    public void addHeader(WritableSheet ws) throws WriteException {
        
        String[] header = {"居民姓名","手机号","身份证","设备码","设备名称","签约医生", "地址"};
        int i = 0;
        for (String h : header) {
            addCell(ws, 0, i, h);//表名,行,列,header
            i++;
        }
    }
    
    public void write(WritableWorkbook wwb, List ls) throws Exception {
        try {
            WritableSheet ws;
            ws = wwb.createSheet("sheet",1);
            addHeader(ws);
            int i = 1;
            for (DeviceHealthIndexVO m : (List<DeviceHealthIndexVO>) ls) {
                addCell(ws, i, 0, m.getName(),"");
                addCell(ws, i, 1, m.getMobile(),"");
                addCell(ws, i, 2, m.getIdcard(),"");
                addCell(ws, i, 3, m.getDevice_sn(),"");
                addCell(ws, i, 4, m.getDevice_name(),"");
                addCell(ws, i, 5, m.getDoctor_name(),"");
                addCell(ws, i, 6, m.getAddress(),"");
                i++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    public void write(OutputStream os, List ls) throws Exception{
        write(Workbook.createWorkbook(os), ls);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException {
        Label label = new Label(column ,row, data);
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column ,row, data);
        if(!org.springframework.util.StringUtils.isEmpty(memo)){
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }

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

@ -151,8 +151,6 @@ public class WlyyDeviceController extends BaseController {
            @RequestParam(value = "linkman",required = false) String linkman,
            HttpServletResponse response){
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            JavaType javaType = objectMapper.getTypeFactory().constructParametricType(ArrayList.class, WlyyDevice.class);
            List<WlyyDevice> wlyyDevices = deviceService.exporthDeviceList(deviceName,deviceCode,orgName,linkman);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "deviceDataList.xls"));

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

@ -1,8 +1,11 @@
package com.yihu.wlyy.controller.manager.device;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.PatientDeviceVO;
import com.yihu.wlyy.entity.WlyyPatientDevice;
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.stereotype.Controller;
@ -11,6 +14,11 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
/**
 * Created by yww on 2016/12/7.
 */
@ -60,4 +68,77 @@ public class WlyyPatientDeviceController extends BaseController {
        }
    }
    
    //导出报表
    @RequestMapping(value="toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public void exportList(
            @RequestParam(value = "town",required = false)String town,
            @RequestParam(value = "hospital",required = false)String hospital,
            HttpServletResponse response){
        try {
            List<PatientDeviceVO> wlyyDevices = patientDeviceService.exportPatientDeviceList(town,hospital);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "patientDeviceDataList.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os,wlyyDevices);
        }catch (Exception ex){
            error(ex);
        }
    }
    
    
    public void addHeader(WritableSheet ws) throws WriteException {
        
        String[] header = {"居民姓名","手机号","身份证","设备码", "设备类型","签约医生", "居民住址", "openid", "是否绑定微信号"};
        int i = 0;
        for (String h : header) {
            addCell(ws, 0, i, h);//表名,行,列,header
            i++;
        }
    }
    
    public void write(WritableWorkbook wwb, List ls) throws Exception {
        try {
            WritableSheet ws;
            ws = wwb.createSheet("sheet",1);
            addHeader(ws);
            int i = 1;
            for (PatientDeviceVO m : (List<PatientDeviceVO>) ls) {
                addCell(ws, i, 0, m.getName(),"");
                addCell(ws, i, 1, m.getMobile(),"");
                addCell(ws, i, 2, m.getIdcard(),"");
                addCell(ws, i, 3, m.getDevice_sn(),"");
                addCell(ws, i, 4, m.getDevice_name(),"");
                addCell(ws, i, 5, m.getDoctor_name(),"");
                addCell(ws, i, 6, m.getAddress(),"");
                addCell(ws, i, 7, m.getOpenid(),"");
                addCell(ws, i, 8, m.getIsopenid(),"");
                i++;
            }
            wwb.write();
            wwb.close();
        } catch (IOException e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    public void write(OutputStream os, List ls) throws Exception{
        write(Workbook.createWorkbook(os), ls);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException {
        Label label = new Label(column ,row, data);
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column ,row, data);
        if(!org.springframework.util.StringUtils.isEmpty(memo)){
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }
}

+ 98 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/DeviceHealthIndexVO.java

@ -0,0 +1,98 @@
package com.yihu.wlyy.device.entity;
/**
 * @author huangwenjie
 * @date 2017/12/12 10:10
 */
public class DeviceHealthIndexVO {
	private String patient;
	private String name;
	private String mobile;
	private String idcard;
	private String device_sn;
	private String device_name;
	private String record_date;
	private String statusName;
	private String doctor_name;
	private String address;
	
	public String getPatient() {
		return patient;
	}
	
	public void setPatient(String patient) {
		this.patient = patient;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getMobile() {
		return mobile;
	}
	
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	public String getIdcard() {
		return idcard;
	}
	
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	
	public String getDevice_sn() {
		return device_sn;
	}
	
	public void setDevice_sn(String device_sn) {
		this.device_sn = device_sn;
	}
	
	public String getRecord_date() {
		return record_date;
	}
	
	public void setRecord_date(String record_date) {
		this.record_date = record_date;
	}
	
	public String getStatusName() {
		return statusName;
	}
	
	public void setStatusName(String statusName) {
		this.statusName = statusName;
	}
	
	public String getDoctor_name() {
		return doctor_name;
	}
	
	public void setDoctor_name(String doctor_name) {
		this.doctor_name = doctor_name;
	}
	
	public String getAddress() {
		return address;
	}
	
	public void setAddress(String address) {
		this.address = address;
	}
	
	public String getDevice_name() {
		return device_name;
	}
	
	public void setDevice_name(String device_name) {
		this.device_name = device_name;
	}
}

+ 98 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/PatientDeviceVO.java

@ -0,0 +1,98 @@
package com.yihu.wlyy.device.entity;
/**
 * @author huangwenjie
 * @date 2017/12/12 09:47
 */
public class PatientDeviceVO {
	private String patient;
	private String name;
	private String mobile;
	private String idcard;
	private String device_sn;
	private String device_name;
	private String address;
	private String openid;
	private String isopenid;
	private String doctor_name;
	
	public String getPatient() {
		return patient;
	}
	
	public void setPatient(String patient) {
		this.patient = patient;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getMobile() {
		return mobile;
	}
	
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	public String getIdcard() {
		return idcard;
	}
	
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	
	public String getDevice_sn() {
		return device_sn;
	}
	
	public void setDevice_sn(String device_sn) {
		this.device_sn = device_sn;
	}
	
	public String getDevice_name() {
		return device_name;
	}
	
	public void setDevice_name(String device_name) {
		this.device_name = device_name;
	}
	
	public String getAddress() {
		return address;
	}
	
	public void setAddress(String address) {
		this.address = address;
	}
	
	public String getOpenid() {
		return openid;
	}
	
	public void setOpenid(String openid) {
		this.openid = openid;
	}
	
	public String getIsopenid() {
		return isopenid;
	}
	
	public void setIsopenid(String isopenid) {
		this.isopenid = isopenid;
	}
	
	public String getDoctor_name() {
		return doctor_name;
	}
	
	public void setDoctor_name(String doctor_name) {
		this.doctor_name = doctor_name;
	}
}

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

@ -0,0 +1,126 @@
package com.yihu.wlyy.entity.wechat;
/**
 * @author huangwenjie
 * @date 2017/12/11 21:18
 */
public class WechatSignVO {
	
	private String openid;
	private String patientcode;
	private String patientname;
	private String mobile;
	private String openid_time;
	private String idcard;
	private String doctor_name;
	private String doctor_health_name;
	private String sick_village_name;
	private String address;
	private String street_name;
	private String hospital_name;
	private String tcount;
	
	public String getOpenid() {
		return openid;
	}
	
	public void setOpenid(String openid) {
		this.openid = openid;
	}
	
	public String getPatientcode() {
		return patientcode;
	}
	
	public void setPatientcode(String patientcode) {
		this.patientcode = patientcode;
	}
	
	public String getPatientname() {
		return patientname;
	}
	
	public void setPatientname(String patientname) {
		this.patientname = patientname;
	}
	
	public String getMobile() {
		return mobile;
	}
	
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	public String getOpenid_time() {
		return openid_time;
	}
	
	public void setOpenid_time(String openid_time) {
		this.openid_time = openid_time;
	}
	
	public String getIdcard() {
		return idcard;
	}
	
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	
	public String getDoctor_name() {
		return doctor_name;
	}
	
	public void setDoctor_name(String doctor_name) {
		this.doctor_name = doctor_name;
	}
	
	public String getDoctor_health_name() {
		return doctor_health_name;
	}
	
	public void setDoctor_health_name(String doctor_health_name) {
		this.doctor_health_name = doctor_health_name;
	}
	
	public String getSick_village_name() {
		return sick_village_name;
	}
	
	public void setSick_village_name(String sick_village_name) {
		this.sick_village_name = sick_village_name;
	}
	
	public String getAddress() {
		return address;
	}
	
	public void setAddress(String address) {
		this.address = address;
	}
	
	public String getStreet_name() {
		return street_name;
	}
	
	public void setStreet_name(String street_name) {
		this.street_name = street_name;
	}
	
	public String getTcount() {
		return tcount;
	}
	
	public void setTcount(String tcount) {
		this.tcount = tcount;
	}
	
	public String getHospital_name() {
		return hospital_name;
	}
	
	public void setHospital_name(String hospital_name) {
		this.hospital_name = hospital_name;
	}
}

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

@ -0,0 +1,45 @@
package com.yihu.wlyy.entity.wechat;
/**
 * @author huangwenjie
 * @date 2017/12/11 22:14
 */
public class WechatTotalVO {
	
	private String name;
	private Double attRate;
	private Integer attNumber;
	private Integer signNumber;
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public Double getAttRate() {
		return attRate;
	}
	
	public void setAttRate(Double attRate) {
		this.attRate = attRate;
	}
	
	public Integer getAttNumber() {
		return attNumber;
	}
	
	public void setAttNumber(Integer attNumber) {
		this.attNumber = attNumber;
	}
	
	public Integer getSignNumber() {
		return signNumber;
	}
	
	public void setSignNumber(Integer signNumber) {
		this.signNumber = signNumber;
	}
}

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

@ -1,6 +1,8 @@
package com.yihu.wlyy.service.manager.device;
import com.yihu.wlyy.device.entity.DeviceHealthIndex;
import com.yihu.wlyy.device.entity.DeviceHealthIndexVO;
import com.yihu.wlyy.device.entity.PatientDeviceVO;
import com.yihu.wlyy.device.repository.DeviceHealthIndexDao;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.repository.PatientDao;
@ -12,6 +14,8 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.*;
@ -25,6 +29,8 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
    private DeviceHealthIndexDao healthIndexDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
@ -83,5 +89,21 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        }
       return patientDao.findByCode(patientCode);
    }
	
	public List<DeviceHealthIndexVO> exportDeviceHealthIndexList(String town, String hospital) {
        List<DeviceHealthIndexVO> list = new ArrayList<>();
        String sql  = "SELECT " +
                "s.patient," +
                "s.`name`," +
                "s.mobile," +
                "CONCAT(LEFT (s.idcard,6),'**********',RIGHT (s.idcard,2)) idcard," +
                "d.device_sn," +
                "d.device_name," +
                "s.doctor_name," +
                "p.address FROM wlyy_sign_family s,wlyy_patient_device d,wlyy_patient p WHERE s.patient=d.`user` AND s.hospital='"+hospital+"' AND s.`status`> 0 AND s.patient=p.CODE AND s.patient NOT IN (" +
                "SELECT s.patient FROM wlyy_sign_family s,(" +
                "SELECT `user`,device_sn,type,max(record_date) record_date FROM device.wlyy_patient_health_index WHERE device_sn IS NOT NULL AND del=1 GROUP BY `user`,device_sn,type) d WHERE s.patient=d.`user` AND s.hospital='"+hospital+"' AND s.`status`> 0) ORDER BY patient";
        list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(DeviceHealthIndexVO.class));
        return list ;
	}
}

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

@ -1,18 +1,24 @@
package com.yihu.wlyy.service.manager.device;
import com.yihu.wlyy.device.entity.PatientDeviceVO;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.WlyyPatientDevice;
import com.yihu.wlyy.entity.wechat.WechatTotalVO;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.WlyyPatientDeviceDao;
import com.yihu.wlyy.util.DateUtil;
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 java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
@ -23,6 +29,8 @@ import java.util.List;
public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,WlyyPatientDeviceDao>  {
    @Autowired
    private PatientDao patientDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
    public Page<WlyyPatientDevice> searchList(String deviceName,String categoryCode,String deviceSn,String userName,Integer page,Integer pageSize) throws Exception{
@ -70,4 +78,28 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
        }
        return patientDao.findByCode(patientCode);
    }
    
    /**
     * 根据社区查找居民设备绑定详情
     * @param town
     * @param hospital
     * @return
     */
	public List<PatientDeviceVO> exportPatientDeviceList(String town, String hospital) {
        List<PatientDeviceVO> list = new ArrayList<>();
        String sql  = "SELECT s.patient," +
                "s.`name`," +
                "s.mobile," +
                "CONCAT(LEFT (s.idcard,6),'**********',RIGHT (s.idcard,2)) idcard," +
                "d.device_sn," +
                "d.device_name," +
                "s.doctor_name," +
                "p.address," +
                "p.openid," +
                "CASE WHEN p.openid IS NULL THEN '未绑定' ELSE '已绑定' END isopenid " +
                "FROM wlyy_sign_family s,wlyy_patient_device d,wlyy_patient p " +
                "WHERE s.patient=d.`user` AND s.hospital='"+hospital+"' AND s.`status`> 0 AND s.patient=p.CODE ORDER BY patient";
        list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(PatientDeviceVO.class));
        return list ;
	}
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/user/UserService.java

@ -196,7 +196,7 @@ public class UserService extends BaseJpaService<User,UserDao> {
            String[] codes = code.split(",");
            List<ManageDictEntry> manageDictEntries = manageDictEntryDao.findByDictIdAndCodes(dictId, codes);
            if (null != manageDictEntries && manageDictEntries.size() > 0) {
                return "http://localhost:8180/admin/main";
                return manageDictEntries.get(0).getValue();
            }
        }
        return null;

+ 126 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/wechat/WechatService.java

@ -0,0 +1,126 @@
package com.yihu.wlyy.service.wechat;
import com.yihu.wlyy.entity.wechat.WechatSignVO;
import com.yihu.wlyy.entity.wechat.WechatTotalVO;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
 * 微信相关业务层方法
 * @author huangwenjie
 * @date 2017/12/11 21:16
 */
@Service
public class WechatService extends BaseService {
	
	@Autowired
	JdbcTemplate jdbcTemplate;
	
	/**
	 * 根据社区和关注状态查找微信关注量详情
	 * @param hospital
	 * @param attention
	 * @return
	 */
	public List<WechatSignVO> geSignWechatDataList(String hospital,String attention) {
		
		List<WechatSignVO> list = new ArrayList<>();
		String sql  = "";
		if("1".equals(attention)){
			sql = "SELECT m.*,n.tcount FROM (" +
					"SELECT t.openid," +
					"t.CODE as patientcode," +
					"t.NAME as patientname," +
					"a.mobile," +
					"t.openid_time," +
					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
					"a.doctor_name," +
					"a.doctor_health_name," +
					"t.sick_village_name," +
					"t.address," +
					"a.hospital_name,"+
					"t.street_name FROM (" +
					"SELECT b.patient,b.mobile,b.idcard,b.doctor_name,b.doctor_health_name,b.hospital_name FROM wlyy_sign_family b WHERE b.hospital='"+hospital+"' AND b.sign_year=2017 AND b.STATUS=1 AND b.expenses_status=1) a,wlyy_patient t WHERE t.CODE=a.patient) m," +
					"(SELECT t.openid,count(t.openid) tcount FROM wlyy_patient t WHERE t.`code` IN (" +
					"SELECT patient FROM wlyy_sign_family s WHERE s.hospital='"+hospital+"' AND s.sign_year=2017 AND s.expenses_status=1 AND s.STATUS=1) GROUP BY t.openid) n WHERE m.openid=n.openid";
		}else if("0".equals(attention)){
			sql = "SELECT m.*FROM (" +
					"SELECT a.mobile," +
					"a.code as patientcode ," +
					"a.NAME as patientname ," +
					"a.openid_time," +
					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
					"b.doctor_name," +
					"b.doctor_health_name," +
					"b.hospital_name," +
					"a.address," +
					"a.sick_village_name," +
					"a.street_name FROM (" +
					"SELECT t.CODE,t.NAME,t.address,t.sick_village_name,t.street_name,idcard,mobile,openid_time FROM wlyy_patient t WHERE t.`code` IN (" +
					"SELECT patient FROM wlyy_sign_family s WHERE s.hospital='"+hospital+"' AND s.sign_year=2017 AND s.expenses_status=1 AND s.STATUS=1 AND s.expenses_time IS NOT NULL) AND t.openid IS NULL) a,wlyy_sign_family b WHERE b.hospital='"+hospital+"' AND b.sign_year=2017 AND b.STATUS=1 AND b.expenses_status=1 AND a.CODE=b.patient AND b.expenses_time IS NOT NULL) m";
		}
		
		list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WechatSignVO.class));
		return list ;
	}
	
	/**
	 *获取社区关注率
	 *@author huangwenjie
	 *@date 2017/12/11 22:17
	 */
	public List<WechatTotalVO> hosipitaTotalData() {
		List<WechatTotalVO> list = new ArrayList<>();
		String sql  = "SELECT " +
				"a1.hospital_name as name," +
				"(a1.count/a2.count) as attRate," +
				"a1.count as attNumber," +
				"a2.count as signNumber from (" +
				"SELECT sf.hospital hospital,sf.hospital_name hospital_name,count(sf.id) count " +
				"FROM wlyy_patient p,wlyy_sign_family sf WHERE p.idcard=sf.idcard AND sf.type=2 " +
				"AND sf.STATUS> 0 AND LENGTH(sf.hospital)=10 " +
				"AND sf.admin_team_code IS NOT NULL AND p.openid IS NOT NULL " +
				"AND p.openid_time<= '"+ DateUtil.dateToStrShort(new Date())+"' AND sf.sign_year='2017' GROUP BY sf.hospital ORDER BY count desc) a1," +
				"(SELECT a.hospital hospital,count(a.id) count,a.hospital_name hospital_name " +
				"FROM wlyy_sign_family a WHERE STATUS IN (1,2) AND a.type=2 AND expenses_status=1 " +
				"AND a.expenses_time<= '"+ DateUtil.dateToStrShort(new Date())+"' AND a.sign_year='2017' GROUP BY a.hospital ORDER BY count desc) a2 WHERE a1.hospital=a2.hospital";
	
		list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WechatTotalVO.class));
		return list ;
	}
	
	/**
	 *获取行政区关注率
	 *@author huangwenjie
	 *@date 2017/12/11 22:18
	 */
	public List<WechatTotalVO> townTotalData() {
		List<WechatTotalVO> list = new ArrayList<>();
		String sql  = "SELECT " +
				"a1.town_name as name," +
				"(a1.count/a2.count) as attRate," +
				"a1.count as attNumber," +
				"a2.count as signNumber " +
				"from (" +
				"SELECT count(sf.id) count,h.town_name town_name,h.town town " +
				"FROM wlyy_patient p,wlyy_sign_family sf,dm_hospital h WHERE p.idcard=sf.idcard " +
				"AND sf.type=2 AND sf.STATUS> 0 AND LENGTH(sf.hospital)=10 AND sf.hospital=h.CODE " +
				"AND sf.admin_team_code IS NOT NULL AND p.openid IS NOT NULL " +
				"AND p.openid_time< '"+ DateUtil.dateToStrShort(new Date())+"' AND sf.sign_year='2017' GROUP BY h.town ORDER BY count desc) a1,(" +
				"SELECT count(a.id) count,h.town_name town_name,h.town town FROM wlyy_sign_family a,dm_hospital h" +
				" WHERE STATUS IN (1,2) AND a.type=2 AND expenses_status=1 AND a.hospital=h.CODE " +
				"AND a.expenses_time< '"+ DateUtil.dateToStrShort(new Date())+"' AND a.sign_year='2017' GROUP BY h.town) a2 WHERE a1.town=a2.town";
		
		list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WechatTotalVO.class));
		return list ;
	}
}

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

@ -132,9 +132,9 @@
							<sec:authorize url="/admin/static/wechat/initial">
								<li><a href="javascript:locationMenu('staticWechat');">微信统计报表</a></li>
							</sec:authorize>
							<sec:authorize url="/admin/static/sign/initial">
								<li><a href="javascript:locationMenu('staticSign');">签约统计报表</a></li>
							</sec:authorize>
							<%--<sec:authorize url="/admin/static/sign/initial">--%>
								<%--<li><a href="javascript:locationMenu('staticSign');">签约统计报表</a></li>--%>
							<%--</sec:authorize>--%>
							<sec:authorize url="/admin/static/device/initial">
								<li><a href="javascript:locationMenu('staticDevice');">设备统计报表</a></li>
							</sec:authorize>

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

@ -36,6 +36,11 @@
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_end_date" placeholder="结束日期" class="f-ml10" data-attr-scan="endDate"/>
                </div>
            </div>
        </div>
        <div class="m-form-group f-mt10">
            <div class="m-form-group f-mt10">
                <div class="m-form-control f-ml15">
                    <input type="text" id="inp_disease" placeholder="请选择病种" class="f-ml10" data-attr-scan="disease"/>
                </div>

+ 6 - 13
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/prescription/prescription_list_js.jsp

@ -224,19 +224,12 @@
                            {display: '配送方式', name: 'pay', align: "center"},
                            {display: '时间', name: 'create_time', width: '12%', align: "center"},
                            {
                                display: '操作', name: 'operator', width: '10%', align: "center", isSort: false,
                                <%--render: function (row) {--%>
                                <%--var html = '';--%>
                                <%--html += '<a  href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "sign:info:view", row.id) + '">明细</a>';--%>
                                <%--//html += '<a  style="margin-left:10px;"href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}'])", "patient:info:edit", row.id) + '">编辑</a>';--%>
                                <%--//html += '<a  style="margin-left:10px;" title="删除" href="javascript:void(0)" onclick="javascript:' + Util.format("$.publish('{0}',['{1}','{2}'])", "patient:info:del", row.id,row.code) + '">删除</a>';--%>
                                <%--if (row.adminTeamId) {--%>
                                <%--<sec:authorize url="/admin/sign/memberList">--%>
                                <%--html += '<a style="margin-left:10px;" href="' + ctx + '/admin/team/signTeamInfo/' + row.adminTeamId + '" target="centerFrame">行政团队</a>';--%>
                                <%--</sec:authorize>--%>
                                <%--}--%>
                                <%--return html;--%>
                                <%--}--%>
                                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}'])", "patient:info:view", row.id) + '">查看</a>';
                                    return html;
                                }
                            }
                        ],
                    }));

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

@ -0,0 +1,43 @@
<%@ 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>
<body>
<div >
    <div style="font-family:微软雅黑;font-size:Small;display:block;clear:left;padding:0;margin:0;margin-left: 5px">
        <div style="position:relative;display:inline;left:10px;top:8px;white-space:nowrap;text-align:center;background-color:#ffffff;font-weight:bold">微信关注量详情</div>
        <div style="height:auto;width:auto;border:#dde7f1 1px solid;">
            <div class="m-form-group f-mt10" id="we_export_div">
                <div class="m-form-control f-ml15" style="display: none">
                    <input type="text" id="inp_device_name" placeholder="请选择城市" class="f-ml10"/></div>
                <br>
            </div>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_categoryCode" placeholder="请选择市区" class="f-ml10"/>
            </div>
            <br>
            <div class="m-form-control f-ml15">
                <input type="text" id="inp_hos" placeholder="请选择机构" class="f-ml10"/>
            </div>
            <br>
            <div id="export_patient_device_list" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                <span>导出居民设备绑定明细</span>
                <br>
            </div>
            <div id="export_patient_healthindex_list" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                <span>导出居民设备体征上传明细</span>
                <br>
            </div>
            <br>
        </div>
    </div>
</div>
</body>
<%@ include file="../head/page_foot.jsp"%>
<%@ include file="static_device_js.jsp" %>
</html>

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

@ -0,0 +1,209 @@
<%--
  Created by IntelliJ IDEA.
  User: Mewtwo
  Date: 2017/12/8
  Time: 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ 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 retrieve = null;
            var inpStarDate = null,inpEndDate = null;
            retrieve = {
                url: {
                    //接口链接
                    /*
                    * 省,市,区
                    * */
                    district: '/common/district',
                    /*
                    *获取医院列表
                    * */
                    hospitalsByType: '/admin/hos/hospitalsByType',
                },
                $inpDeviceName: $('#inp_device_name'),//城市
                $inpCategoryCode: $('#inp_categoryCode'),//区
                $inpHos: $('#inp_hos'),//机构
                dnc: null,
                ccc: null,
                hc: null,
                $btnDeviceList: $('#export_patient_device_list'),
                $btnHealthindexList: $('#export_patient_healthindex_list'),
                init: function () {
                    this.initComboBox();
                    this.bindEvents();
                },
                //初始化市区下拉框
                initComboBox: function () {
                    this.dnc = this.$inpDeviceName.ligerComboBox({
                        width: 150,
                        data: [
                            {text: '厦门市', statusId: '350200'}
                        ],
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                    this.dnc.selectValue('350200');//默认选中厦门市
                    this.setCityFun(this);
                    this.initInpCat( [], this);
                    this.initHc( [], this);
                },
                //区
                initInpCat: function ( d, me) {
                    me.ccc = me.$inpCategoryCode.ligerComboBox({
                        width: 250,
                        data: d,
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                },
                //机构
                initHc: function ( d, me) {
                    me.hc = me.$inpHos.ligerComboBox({
                        width: 250,
                        data: d,
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                },
                setCityFun: function (me) {
                    var v = me.dnc.getValue();
                    if (v != '') {
                        me.rAjax( me.url.district, {
                            type: 3,
                            code: v
                        }, function (data) {
                            var d = [];
                            for (var i = 0; i < data.list.length; i++) {
                                d.push({
                                    text: data.list[i].name,
                                    statusId: data.list[i].code
                                });
                            }
                            //区
                            me.initInpCat( d, me);
                        })
                    } else {
                        me.initInpCat( [], me);
                        me.initHc( [], me);
                    }
                },
                setAreaFun: function (me) {
                    var v = me.ccc.getValue();
                    if (v != '') {
                        me.rAjax( me.url.hospitalsByType, {
                            type: 2,
                            code: v
                        }, function (data) {
                            var d = [];
                            for (var i = 0; i < data.list.length; i++) {
                                d.push({
                                    text: data.list[i].name,
                                    statusId: data.list[i].code
                                });
                            }
                            //机构
                            me.initHc( d, me);
                        })
                    } else {
                        me.initHc( [], me);
                    }
                },
                bindEvents: function () {
                    var me = this;
                    //城市下拉
                    me.$inpDeviceName.on( 'change', function () {
                        me.setCityFun(me);
                    });
                    //区下拉
                    me.$inpCategoryCode.on( 'change', function () {
                        me.setAreaFun(me);
                        me.hc.setValue('');
                    });
                    //机构
                    me.$inpHos.on( 'change', function () {
                    });
                    //居民设备绑定详情导出
                    me.$btnDeviceList.on('click',function () {
                        //定义一个form表单
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/patientDevice/toExcel');
                        //区
                        var town = $("<input type='hidden' name='town' />")
                        town.attr('value',$("#inp_categoryCode").val());
                        //社区医院
                        var hospital = $("<input type='hidden' name='hospital' />")
                        hospital.attr('value',$("#inp_hos_val").val());
                        //关注状态
                        var attention = $("<input type='hidden' name='attention' />")
                        attention.attr('value',$("#inp_att_val").val());
                        myform.append(town);
                        myform.append(hospital);
                        myform.append(attention);
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    });
                    //居民提振数据详情导出
                    me.$btnHealthindexList.on('click',function () {
                        //定义一个form表单
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/healthIndex/toExcel');
                        //区
                        var town = $("<input type='hidden' name='town' />")
                        town.attr('value',$("#inp_categoryCode").val());
                        //社区医院
                        var hospital = $("<input type='hidden' name='hospital' />")
                        hospital.attr('value',$("#inp_hos_val").val());
                        //关注状态
                        var attention = $("<input type='hidden' name='attention' />")
                        attention.attr('value',$("#inp_att_val").val());
                        myform.append(town);
                        myform.append(hospital);
                        myform.append(attention);
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    });
                },
                rAjax: function ( url, d, cb) {
                    $.ajax({
                        url: ctx + url,
                        data: d,
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                            if (data.status == 200) {
                                cb && cb.call( this, data);
                            } else {
                                $.Notice.error(data.msg);
                            }
                        }
                    });
                }
            };
            retrieve.init();
        });
    })( jQuery, window);
</script>

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

@ -0,0 +1,68 @@
<%@ 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>
<body>
<div >
        <div style="font-family:微软雅黑;font-size:Small;display:block;clear:left;padding:0;margin:0;margin-left: 5px">
            <div style="position:relative;display:inline;left:10px;top:8px;white-space:nowrap;text-align:center;background-color:#ffffff;font-weight:bold">微信关注量详情</div>
            <div style="height:auto;width:auto;border:#dde7f1 1px solid;">
                <div class="m-form-group f-mt10" id="we_export_div">
                    <div class="m-form-control f-ml15" style="display: none">
                        <input type="text" id="inp_device_name" placeholder="请选择城市" class="f-ml10"/></div>
                    <br>
                    </div>
                    <div class="m-form-control f-ml15">
                    <input type="text" id="inp_categoryCode" placeholder="请选择市区" class="f-ml10"/>
                    </div>
                    <br>
                    <div class="m-form-control f-ml15">
                    <input type="text" id="inp_hos" placeholder="请选择机构" class="f-ml10"/>
                    </div>
                    <br>
                    <div class="m-form-control f-ml15">
                    <input type="text" id="inp_att" placeholder="请选择关注状态" class="f-ml10"/>
                    </div>
                    <br>
                    <div id="export_list" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                        <span>导出</span>
                        <br>
                    </div>
                    <br>
                </div>
            </div>
        </div>
        <div style="font-family:微软雅黑;font-size:Small;display:block;clear:left;padding:0;margin:0;margin-left: 5px">
            <div style="position:relative;display:inline;left:10px;top:8px;white-space:nowrap;text-align:center;background-color:#ffffff;font-weight:bold">社区微信关注率</div>
            <div style="height:auto;width:auto;border:#dde7f1 1px solid;">
                <div class="m-form-group f-mt10">
                    <br>
                    <div id="export_hosipital_total" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                        <span>导出</span><br>
                    </div>
                </div>
            </div>
        </div>
        <div style="font-family:微软雅黑;font-size:Small;display:block;clear:left;padding:0;margin:0;margin-left: 5px">
            <div style="position:relative;display:inline;left:10px;top:8px;white-space:nowrap;text-align:center;background-color:#ffffff;font-weight:bold">行政区微信关注率</div>
            <div style="height:auto;width:auto;border:#dde7f1 1px solid;">
                <div class="m-form-group f-mt10">
                    <br>
                    <div id="export_town_total" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                        <span>导出</span><br>
                    </div>
                </div>
            </div>
        </div>
</div>
</body>
<%@ include file="../head/page_foot.jsp"%>
<%@ include file="static_wechat_js.jsp" %>
</html>

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

@ -0,0 +1,249 @@
<%--
  Created by IntelliJ IDEA.
  User: Mewtwo
  Date: 2017/12/8
  Time: 11:29
  To change this template use File | Settings | File Templates.
--%>
<%@ 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 retrieve = null;
            var inpStarDate = null,inpEndDate = null;
            retrieve = {
                url: {
                    //接口链接
                    /*
                    * 省,市,区
                    * */
                    district: '/common/district',
                    /*
                    *获取医院列表
                    * */
                    hospitalsByType: '/admin/hos/hospitalsByType',
                },
                $inpDeviceName: $('#inp_device_name'),//城市
                $inpCategoryCode: $('#inp_categoryCode'),//区
                $inpHos: $('#inp_hos'),//机构
                $inpStatus:$('#inp_status'),//状态
                $inpStarDate: $('#inp_star_date'),
                $inpEndDate: $('#inp_end_date'),
                dnc: null,
                ccc: null,
                hc: null,
                $btnExportList: $('#export_list'),
                $btnExportHosipitalList: $('#export_hosipital_total'),
                $btnExportTownList: $('#export_town_total'),
                init: function () {
                    this.initComboBox();
                    inpStarDate = this.$inpStarDate.ligerDateEditor({
                        format: "yyyy-MM-dd",
                        showTime: false,
                        labelWidth: 100,
                        labelAlign: 'center',
                        cancelable: true
                    });
                    inpEndDate = this.$inpEndDate.ligerDateEditor({
                        format: "yyyy-MM-dd",
                        showTime: false,
                        labelWidth: 100,
                        labelAlign: 'center',
                        cancelable: true
                    });
                    //状态拉框
                    retrieve.statusBox = $("#inp_att").ligerComboBox({
                        width: 150,
                        data: [
                            {text: '已关注', statusId: '1'},
                            {text: '未关注', statusId: '0'},
                        ],
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                    this.bindEvents();
                },
                //初始化市区下拉框
                initComboBox: function () {
                    this.dnc = this.$inpDeviceName.ligerComboBox({
                        width: 150,
                        data: [
                            {text: '厦门市', statusId: '350200'}
                        ],
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                    this.dnc.selectValue('350200');//默认选中厦门市
                    this.setCityFun(this);
                    this.initInpCat( [], this);
                    this.initHc( [], this);
                },
                //区
                initInpCat: function ( d, me) {
                    me.ccc = me.$inpCategoryCode.ligerComboBox({
                        width: 250,
                        data: d,
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                },
                //机构
                initHc: function ( d, me) {
                    me.hc = me.$inpHos.ligerComboBox({
                        width: 250,
                        data: d,
                        initIsTriggerEvent: false,
                        valueField: 'statusId',
                    });
                },
                setCityFun: function (me) {
                    var v = me.dnc.getValue();
                    if (v != '') {
                        me.rAjax( me.url.district, {
                            type: 3,
                            code: v
                        }, function (data) {
                            var d = [];
                            for (var i = 0; i < data.list.length; i++) {
                                d.push({
                                    text: data.list[i].name,
                                    statusId: data.list[i].code
                                });
                            }
                            //区
                            me.initInpCat( d, me);
                        })
                    } else {
                        me.initInpCat( [], me);
                        me.initHc( [], me);
                    }
                },
                setAreaFun: function (me) {
                    var v = me.ccc.getValue();
                    if (v != '') {
                        me.rAjax( me.url.hospitalsByType, {
                            type: 2,
                            code: v
                        }, function (data) {
                            var d = [];
                            for (var i = 0; i < data.list.length; i++) {
                                d.push({
                                    text: data.list[i].name,
                                    statusId: data.list[i].code
                                });
                            }
                            //机构
                            me.initHc( d, me);
                        })
                    } else {
                        me.initHc( [], me);
                    }
                },
                bindEvents: function () {
                    var me = this;
                    //城市下拉
                    me.$inpDeviceName.on( 'change', function () {
                        me.setCityFun(me);
                    });
                    //区下拉
                    me.$inpCategoryCode.on( 'change', function () {
                        me.setAreaFun(me);
                        me.hc.setValue('');
                    });
                    //机构
                    me.$inpHos.on( 'change', function () {
                    });
                    //关注量详情导出
                    me.$btnExportList.on('click',function () {
                        //定义一个form表单
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/static/wechat/listToExcel');
                        //区
                        var town = $("<input type='hidden' name='town' />")
                        town.attr('value',$("#inp_categoryCode").val());
                        //社区医院
                        var hospital = $("<input type='hidden' name='hospital' />")
                        hospital.attr('value',$("#inp_hos_val").val());
                        //关注状态
                        var attention = $("<input type='hidden' name='attention' />")
                        attention.attr('value',$("#inp_att_val").val());
                        myform.append(town);
                        myform.append(hospital);
                        myform.append(attention);
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    });
                    //社区微信关注率导出
                    me.$btnExportHosipitalList.on('click',function () {
                        //定义一个form表单
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/static/wechat/hosipitaTotalToExcel');
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    });
                    //行政区微信关注率
                    me.$btnExportTownList.on('click',function () {
                        //定义一个form表单
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/static/wechat/townTotalToExcel');
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    });
                },
                rAjax: function ( url, d, cb) {
                    $.ajax({
                        url: ctx + url,
                        data: d,
                        type: 'POST',
                        dataType: 'json',
                        success: function (data) {
                            if (data.status == 200) {
                                cb && cb.call( this, data);
                            } else {
                                $.Notice.error(data.msg);
                            }
                        }
                    });
                },
                formatDate:function (date) {//格式化日期
                    var myyear = date.getFullYear();
                    var mymonth = date.getMonth()+1;
                    var myweekday = date.getDate();
                    if(mymonth < 10){
                        mymonth = "0" + mymonth;
                    }
                    if(myweekday < 10){
                        myweekday = "0" + myweekday;
                    }
                    return (myyear+"-"+mymonth + "-" + myweekday);
                }
            };
            win.reloadMasterUpdateGrid = function () {
                retrieve.reloadGrid(retrieve);
            };
            retrieve.init();
        });
    })( jQuery, window);
</script>

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

@ -24,6 +24,8 @@ var menu = {
    //数据统计
    "static": "/admin/static/center",//数据统计
    "staticPrescription": "/admin/static/prescription/initial",//长处方数据统计
    "staticWechat": "/admin/static/wechat/initial",//微信统计报表
    "staticDevice": "/admin/static/device/initial",//设备统计报表
    //安全管理
    "user": "/admin/user/initial",//人员管理界面

+ 116 - 116
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/HealthArtListener.java

@ -1,116 +1,116 @@
package com.yihu.wlyy.activemq;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.app.consult.ConsultService;
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.ImUtill;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import java.util.List;
/**
 * Created by chenweida on 2017/9/9.
 * 健康教育文章监听
 */
@Component
public class HealthArtListener implements MessageListener {
    private Logger logger = LoggerFactory.getLogger(HealthArtListener.class);
    @Autowired
    private WeiXinOpenIdUtils weiXinOpenIdUtils;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PatientService patientService;
    @Autowired
    private ConsultService consultService;
    @Autowired
    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
    @Override
    public void onMessage(Message message) {
        try {
            TextMessage textMessage = (TextMessage) message;
            HealthEduArticlePatient healthEduArticlePatient = (HealthEduArticlePatient)JSONObject.toBean(JSONObject.fromObject(textMessage.getText()),HealthEduArticlePatient.class);
//            logger.info(jo.toString());
            sendWxTemplateAndIM(healthEduArticlePatient);
            //返回服务器表示消息消费成功
            message.acknowledge();
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
    //发送到IM和微信消息模板
    private void sendWxTemplateAndIM(HealthEduArticlePatient one) {
        String endMsg = "";//"为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
//        healthEduArticlePatients.stream().forEach(one -> {
            Patient patient = patientService.findByCode(one.getPatient());
            try {
                //卫纪委发送不推IM
                if (1 == one.getSendType()) {
                    consultService.sendMucMessageBySingnType(one.getSendCode(), one.getSendName(), patient.getCode(), "{\"title\":\"" + one.getAttachedTitle() + "\",\"type\":0,\"id\":\"" + one.getId() + "\",\"img\":\"" + one.getAttachedPic() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patient.getName());
                    if (StringUtils.isNotBlank(one.getAttachedMessage())) {
                        //发送备注
                        consultService.sendMucMessageBySingnType(one.getSendCode(), one.getSendName(), patient.getCode(), one.getAttachedMessage(), ImUtill.CONTENT_TYPE_TEXT, patient.getName());
                    }
                }
                // 推送消息给微信端
                org.json.JSONObject json = new org.json.JSONObject();
                json.put("first", patient.getName() + ",您好! " + one.getSendName() + (one.getSendType()==2 ? "卫计委":"医生") +"给您发来了一篇患教文章");
                json.put("toUser", patient.getCode());
                json.put("article", one.getArticleId() + "");
                json.put("title", one.getAttachedTitle());
                json.put("doctorName", one.getSendName()+(one.getSendType()==2 ? "卫计委":"医生"));
                json.put("represented", patient.getCode());//被代理人
                json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
                json.put("remark", org.springframework.util.StringUtils.isEmpty(one.getAttachedMessage()) ? "  " : one.getAttachedMessage());
                json.put("articleUrl",one.getArticleUrl());
                if (StringUtils.isNotBlank(patient.getOpenid())) {
                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 9,
                            patient.getOpenid(),
                            patient.getName(),
                            json);
                }
                //发送代理人
                JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient.getCode(), patient.getOpenid());
                if (jsonArray != null && jsonArray.length() > 0) {
                    for (int i = 0; i < jsonArray.length(); i++) {
                        org.json.JSONObject j = jsonArray.getJSONObject(i);
                        Patient member = (Patient) j.get("member");
                        json.remove("toUser");
                        json.put("toUser", member.getCode());
                        json.remove("first");
                        try {
                            json.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.isNull("relation") ? 1 : j.getInt("relation"), patient.getName()));
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                        if (StringUtils.isNotBlank(member.getOpenid())) {
                            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 9, member.getOpenid(), patient.getName(), json);
                        }
                    }
                }
            } catch (Exception e) {
                logger.error("patient:" + patient.getCode() + "," + e.getMessage());
            }
//        });
    }
}
//package com.yihu.wlyy.activemq;
//
//import com.yihu.es.entity.HealthEduArticlePatient;
//import com.yihu.wlyy.entity.patient.Patient;
//import com.yihu.wlyy.service.app.consult.ConsultService;
//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.ImUtill;
//import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
//import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
//import net.sf.json.JSONObject;
//import org.apache.commons.lang3.StringUtils;
//import org.json.JSONArray;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Component;
//
//import javax.jms.JMSException;
//import javax.jms.Message;
//import javax.jms.MessageListener;
//import javax.jms.TextMessage;
//import java.util.List;
//
///**
// * Created by chenweida on 2017/9/9.
// * 健康教育文章监听
// */
//@Component
//public class HealthArtListener implements MessageListener {
//    private Logger logger = LoggerFactory.getLogger(HealthArtListener.class);
//
//    @Autowired
//    private WeiXinOpenIdUtils weiXinOpenIdUtils;
//    @Autowired
//    private PushMsgTask pushMsgTask;
//    @Autowired
//    private PatientService patientService;
//    @Autowired
//    private ConsultService consultService;
//    @Autowired
//    private WeiXinAccessTokenUtils weiXinAccessTokenUtils;
//
//    @Override
//    public void onMessage(Message message) {
//        try {
//            TextMessage textMessage = (TextMessage) message;
//            HealthEduArticlePatient healthEduArticlePatient = (HealthEduArticlePatient)JSONObject.toBean(JSONObject.fromObject(textMessage.getText()),HealthEduArticlePatient.class);
////            logger.info(jo.toString());
//            sendWxTemplateAndIM(healthEduArticlePatient);
//            //返回服务器表示消息消费成功
//            message.acknowledge();
//        } catch (JMSException e) {
//            e.printStackTrace();
//        }
//    }
//
//
//    //发送到IM和微信消息模板
//    private void sendWxTemplateAndIM(HealthEduArticlePatient one) {
//        String endMsg = "";//"为了您的健康," + doctor.getName() + "医生给您发送了一篇患教文章,请仔细查阅,如有问题,可随时咨询医生。";
//
////        healthEduArticlePatients.stream().forEach(one -> {
//            Patient patient = patientService.findByCode(one.getPatient());
//            try {
//                //卫纪委发送不推IM
//                if (1 == one.getSendType()) {
//                    consultService.sendMucMessageBySingnType(one.getSendCode(), one.getSendName(), patient.getCode(), "{\"title\":\"" + one.getAttachedTitle() + "\",\"type\":0,\"id\":\"" + one.getId() + "\",\"img\":\"" + one.getAttachedPic() + "\",\"content\":\"为了您的健康,我给您发送了一篇文章,请咨询查阅,如有问题,可随时与我沟通\"}", "4", patient.getName());
//                    if (StringUtils.isNotBlank(one.getAttachedMessage())) {
//                        //发送备注
//                        consultService.sendMucMessageBySingnType(one.getSendCode(), one.getSendName(), patient.getCode(), one.getAttachedMessage(), ImUtill.CONTENT_TYPE_TEXT, patient.getName());
//                    }
//                }
//                // 推送消息给微信端
//                org.json.JSONObject json = new org.json.JSONObject();
//                json.put("first", patient.getName() + ",您好! " + one.getSendName() + (one.getSendType()==2 ? "卫计委":"医生") +"给您发来了一篇患教文章");
//                json.put("toUser", patient.getCode());
//                json.put("article", one.getArticleId() + "");
//                json.put("title", one.getAttachedTitle());
//                json.put("doctorName", one.getSendName()+(one.getSendType()==2 ? "卫计委":"医生"));
//                json.put("represented", patient.getCode());//被代理人
//                json.put("date", DateUtil.dateToStrLong(DateUtil.getNowDate()));
//                json.put("remark", org.springframework.util.StringUtils.isEmpty(one.getAttachedMessage()) ? "  " : one.getAttachedMessage());
//                json.put("articleUrl",one.getArticleUrl());
//                if (StringUtils.isNotBlank(patient.getOpenid())) {
//                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 9,
//                            patient.getOpenid(),
//                            patient.getName(),
//                            json);
//                }
//                //发送代理人
//                JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient.getCode(), patient.getOpenid());
//                if (jsonArray != null && jsonArray.length() > 0) {
//                    for (int i = 0; i < jsonArray.length(); i++) {
//                        org.json.JSONObject j = jsonArray.getJSONObject(i);
//                        Patient member = (Patient) j.get("member");
//                        json.remove("toUser");
//                        json.put("toUser", member.getCode());
//                        json.remove("first");
//                        try {
//                            json.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.isNull("relation") ? 1 : j.getInt("relation"), patient.getName()));
//                        } catch (Exception e) {
//                            e.printStackTrace();
//                        }
//                        if (StringUtils.isNotBlank(member.getOpenid())) {
//                            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 9, member.getOpenid(), patient.getName(), json);
//                        }
//                    }
//                }
//            } catch (Exception e) {
//                logger.error("patient:" + patient.getCode() + "," + e.getMessage());
//            }
////        });
//    }
//}

+ 90 - 90
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/StartListener.java

@ -1,90 +1,90 @@
package com.yihu.wlyy.activemq;
import com.yihu.wlyy.util.SpringUtil;
import org.apache.activemq.ActiveMQSession;
import org.apache.activemq.command.ActiveMQQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jms.connection.CachingConnectionFactory;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.jms.MessageListener;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by chenweida on 2017/9/9.
 */
@Component
public class StartListener {
    private static Map<String, DefaultMessageListenerContainer> holder = new HashMap<String, DefaultMessageListenerContainer>();
    private Logger logger = LoggerFactory.getLogger(StartListener.class);
    @Value("${activemq.queue.healtHarticleQueue}")
    private String healtHarticleQueue;
    @Value("${activemq.consumers.count}")
    private Integer count;
    @Autowired
    private HealthArtListener healthArtListener;
    @Autowired
    private CachingConnectionFactory cachingConnectionFactory;
    @PostConstruct
    public void startListener() {
        startHealthArticQueueListener();
    }
    /**
     * 启动健康教育消费
     */
    private void startHealthArticQueueListener() {
        try {
            //启动监听
            startReceiverByQueueName(healthArtListener, healtHarticleQueue);
            logger.info("start HealthArtListener success");
        } catch (Exception e) {
            logger.error("start HealthArtListener error");
        }
    }
    /**
     * 启动
     *
     * @param receiver
     * @param queueName
     */
    private void startReceiverByQueueName(MessageListener receiver, String queueName) {
        if (holder.get(queueName) != null) {
            return;
        }
        ActiveMQQueue destination = new ActiveMQQueue(queueName);
        DefaultMessageListenerContainer listenerContainer = new DefaultMessageListenerContainer();
        // 监听容器属性的配置
        listenerContainer.setConnectionFactory(cachingConnectionFactory);
        // 设置目的地
        listenerContainer.setDestination(destination);
        // 设置监听器
        listenerContainer.setMessageListener(receiver);
        // 设置消费者集群数
        int consumers = count;
        listenerContainer.setConcurrentConsumers(2);
        listenerContainer.setMaxConcurrentConsumers(consumers);
        // 设置监听队列还是主题 默认是队列
        listenerContainer.setPubSubNoLocal(false);
        // listenerContainer.setAcceptMessagesWhileStopping(true);
        // 设置应答模式 默认是4
        listenerContainer.setSessionAcknowledgeMode(ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE);
        // 设置是否启动事物 默认不开启
        listenerContainer.setSessionTransacted(false);
        // 将监听容器保存在holder中
        holder.put(queueName, listenerContainer);
        listenerContainer.initialize();
        // 启动监听
        listenerContainer.start();
    }
}
//package com.yihu.wlyy.activemq;
//
//import com.yihu.wlyy.util.SpringUtil;
//import org.apache.activemq.ActiveMQSession;
//import org.apache.activemq.command.ActiveMQQueue;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.jms.connection.CachingConnectionFactory;
//import org.springframework.jms.listener.DefaultMessageListenerContainer;
//import org.springframework.stereotype.Component;
//
//import javax.annotation.PostConstruct;
//import javax.jms.MessageListener;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * Created by chenweida on 2017/9/9.
// */
//@Component
//public class StartListener {
//    private static Map<String, DefaultMessageListenerContainer> holder = new HashMap<String, DefaultMessageListenerContainer>();
//    private Logger logger = LoggerFactory.getLogger(StartListener.class);
//
//    @Value("${activemq.queue.healtHarticleQueue}")
//    private String healtHarticleQueue;
//    @Value("${activemq.consumers.count}")
//    private Integer count;
//    @Autowired
//    private HealthArtListener healthArtListener;
//    @Autowired
//    private CachingConnectionFactory cachingConnectionFactory;
//
//    @PostConstruct
//    public void startListener() {
//        startHealthArticQueueListener();
//    }
//
//    /**
//     * 启动健康教育消费
//     */
//    private void startHealthArticQueueListener() {
//        try {
//            //启动监听
//            startReceiverByQueueName(healthArtListener, healtHarticleQueue);
//            logger.info("start HealthArtListener success");
//        } catch (Exception e) {
//            logger.error("start HealthArtListener error");
//        }
//    }
//
//    /**
//     * 启动
//     *
//     * @param receiver
//     * @param queueName
//     */
//    private void startReceiverByQueueName(MessageListener receiver, String queueName) {
//        if (holder.get(queueName) != null) {
//            return;
//        }
//        ActiveMQQueue destination = new ActiveMQQueue(queueName);
//
//        DefaultMessageListenerContainer listenerContainer = new DefaultMessageListenerContainer();
//        // 监听容器属性的配置
//        listenerContainer.setConnectionFactory(cachingConnectionFactory);
//        // 设置目的地
//        listenerContainer.setDestination(destination);
//        // 设置监听器
//        listenerContainer.setMessageListener(receiver);
//        // 设置消费者集群数
//        int consumers = count;
//        listenerContainer.setConcurrentConsumers(2);
//        listenerContainer.setMaxConcurrentConsumers(consumers);
//        // 设置监听队列还是主题 默认是队列
//        listenerContainer.setPubSubNoLocal(false);
//        // listenerContainer.setAcceptMessagesWhileStopping(true);
//        // 设置应答模式 默认是4
//        listenerContainer.setSessionAcknowledgeMode(ActiveMQSession.INDIVIDUAL_ACKNOWLEDGE);
//        // 设置是否启动事物 默认不开启
//        listenerContainer.setSessionTransacted(false);
//        // 将监听容器保存在holder中
//        holder.put(queueName, listenerContainer);
//        listenerContainer.initialize();
//        // 启动监听
//        listenerContainer.start();
//    }
//}

+ 70 - 70
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/ActiveMQConfig.java

@ -1,70 +1,70 @@
package com.yihu.wlyy.config;
import com.yihu.wlyy.activemq.HealthArtListener;
import com.yihu.wlyy.util.SpringUtil;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.ActiveMQSession;
import org.apache.activemq.command.ActiveMQQueue;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.jms.annotation.EnableJms;
import org.springframework.jms.connection.CachingConnectionFactory;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.listener.DefaultMessageListenerContainer;
import javax.annotation.PostConstruct;
import javax.jms.MessageListener;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by chenweida on 2017/9/9.
 * 生产者配置
 */
@EnableJms
@Configuration
public class ActiveMQConfig {
   @Value("${activemq.username}")
    private String username;
    @Value("${activemq.password}")
    private String password;
    @Value("${activemq.url}")
    private String url;
    @Bean
    public ActiveMQConnectionFactory activeMQConnectionFactory() {
        ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(username, password, url);
        //设置异步发送
        activeMQConnectionFactory.setUseAsyncSend(true);
        return activeMQConnectionFactory;
    }
    /**
     * 缓存session链接
     *
     * @return
     */
    @Bean
    @Primary
    public CachingConnectionFactory CachingConnectionFactory() {
        CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
        //目标ConnectionFactory对应真实的可以产生JMS Connection的ConnectionFactory
        cachingConnectionFactory.setTargetConnectionFactory(activeMQConnectionFactory());
        //Session缓存数量,这里属性也可以直接在这里配置
        cachingConnectionFactory.setSessionCacheSize(100);
        return cachingConnectionFactory;
    }
    @Bean
    public JmsTemplate jmsTemplate() {
        JmsTemplate jmsTemplate = new JmsTemplate();
        jmsTemplate.setConnectionFactory(CachingConnectionFactory());
        return jmsTemplate;
    }
}
//package com.yihu.wlyy.config;
//
//import com.yihu.wlyy.activemq.HealthArtListener;
//import com.yihu.wlyy.util.SpringUtil;
//import org.apache.activemq.ActiveMQConnectionFactory;
//import org.apache.activemq.ActiveMQSession;
//import org.apache.activemq.command.ActiveMQQueue;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//import org.springframework.jms.annotation.EnableJms;
//import org.springframework.jms.connection.CachingConnectionFactory;
//import org.springframework.jms.core.JmsTemplate;
//import org.springframework.jms.listener.DefaultMessageListenerContainer;
//
//import javax.annotation.PostConstruct;
//import javax.jms.MessageListener;
//import java.util.HashMap;
//import java.util.Map;
//
///**
// * Created by chenweida on 2017/9/9.
// * 生产者配置
// */
//@EnableJms
//@Configuration
//public class ActiveMQConfig {
//   @Value("${activemq.username}")
//    private String username;
//    @Value("${activemq.password}")
//    private String password;
//    @Value("${activemq.url}")
//    private String url;
//
//    @Bean
//    public ActiveMQConnectionFactory activeMQConnectionFactory() {
//        ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory(username, password, url);
//        //设置异步发送
//        activeMQConnectionFactory.setUseAsyncSend(true);
//        return activeMQConnectionFactory;
//    }
//
//    /**
//     * 缓存session链接
//     *
//     * @return
//     */
//    @Bean
//    @Primary
//    public CachingConnectionFactory CachingConnectionFactory() {
//        CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
//        //目标ConnectionFactory对应真实的可以产生JMS Connection的ConnectionFactory
//        cachingConnectionFactory.setTargetConnectionFactory(activeMQConnectionFactory());
//        //Session缓存数量,这里属性也可以直接在这里配置
//        cachingConnectionFactory.setSessionCacheSize(100);
//        return cachingConnectionFactory;
//    }
//
//    @Bean
//    public JmsTemplate jmsTemplate() {
//        JmsTemplate jmsTemplate = new JmsTemplate();
//        jmsTemplate.setConnectionFactory(CachingConnectionFactory());
//
//        return jmsTemplate;
//    }
//
//}

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

@ -966,10 +966,11 @@ public class JwPrescriptionService {
                                followupResultMap.put("CONTROL_CONSTITUTOR",CONTROL_CONSTITUTOR);//基卫控制目标操作者
                            }
                            
                        }else{
                            logger.info("随访记录上传失败,控制目标操作者CODE为空: 操作者为" + followupResultMap.containsKey("CONTROL_CONSTITUTOR"));
                            continue;
                        }
//                        else{
//                            logger.info("随访记录上传失败,控制目标操作者CODE为空: 操作者为" + followupResultMap.containsKey("CONTROL_CONSTITUTOR"));
//                            continue;
//                        }
                    }
@ -1080,7 +1081,8 @@ public class JwPrescriptionService {
                        continue;
                    }
                } catch (Exception e) {
                    logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err"+e.getMessage());
                    e.printStackTrace();
                    logger.info("随访记录上传失败,随访主表ID:" + followup.getId().toString()+",err"+e.toString());
                    continue;
                }
            }
@ -1092,8 +1094,8 @@ public class JwPrescriptionService {
     */
    public String getSickArchiveFlag(String idcard)  throws Exception {
        String re = "0";//0 未建档,非0为档案号
        String url = jwUrl + "/third/sign/uploadEhrSickChroDaysFollowUpRecord";
        
        String url = jwUrl + "/third/archives/getSickArchiveRecord";
    
        List<NameValuePair> params = new ArrayList<>();
        params.add(new BasicNameValuePair("idcard", idcard));
        String response = httpClientUtil.post(url, params, "UTF-8");