瀏覽代碼

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

yeshijie 7 年之前
父節點
當前提交
e014f522b1
共有 28 個文件被更改,包括 463 次插入114 次删除
  1. 10 5
      common/common-entity/pom.xml
  2. 10 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimSports.java
  3. 6 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/security/Token.java
  4. 19 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/WlyyDeviceController.java
  5. 14 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DmDeviceService.java
  6. 19 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java
  7. 19 2
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_create_js.jsp
  8. 22 4
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_modify_js.jsp
  9. 1 1
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/common/thread/LoadNewSignThread.java
  10. 8 8
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/common/thread/LoadThread.java
  11. 3 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/SignFamilyRenewLogDao.java
  12. 45 38
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/ChargeZYService.java
  13. 1 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignRenewZYService.java
  14. 35 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  15. 11 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  16. 9 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  17. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java
  18. 13 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  19. 21 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java
  20. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java
  21. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwArchivesService.java
  22. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/applets/AppletsService.java
  23. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  24. 124 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemDataRedis.java
  25. 33 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java
  26. 9 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java
  27. 10 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  28. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

+ 10 - 5
common/common-entity/pom.xml

@ -64,11 +64,16 @@
            <groupId>com.alibaba</groupId>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <artifactId>fastjson</artifactId>
        </dependency>
        </dependency>
 <!--       <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
            <version>1.3.5.RELEASE</version>
        </dependency>-->
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
        </dependency>
        <!--       <dependency>
                   <groupId>org.springframework.boot</groupId>
                   <artifactId>spring-boot-starter-data-elasticsearch</artifactId>
                   <version>1.3.5.RELEASE</version>
               </dependency>-->
    </dependencies>
    </dependencies>
</project>
</project>

+ 10 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimSports.java

@ -20,6 +20,7 @@ public class PatientAimSports extends IdEntity {
    private Integer dailyStepCount;     //运动步数
    private Integer dailyStepCount;     //运动步数
    private String bmiMax;              //bmi标准上限
    private String bmiMax;              //bmi标准上限
    private String bmiMin;              //bmi标准下线
    private String bmiMin;              //bmi标准下线
    private String createDate;      //上传日期
    private Date createTime;       //创建时间
    private Date createTime;       //创建时间
@ -84,4 +85,13 @@ public class PatientAimSports extends IdEntity {
        this.createTime = createTime;
        this.createTime = createTime;
    }
    }
    @Basic
    @Column(name = "create_date")
    public String getCreateDate() {
        return createDate;
    }
    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }
}
}

+ 6 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/security/Token.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.entity.security;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.IdEntity;
import net.sf.json.JSONObject;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
@ -78,4 +79,9 @@ public class Token extends IdEntity {
		this.del = del;
		this.del = del;
	}
	}
	public String toJson(){
		JSONObject jsonObject = JSONObject.fromObject(this);
		return jsonObject.toString();
	}
}
}

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

@ -3,6 +3,8 @@ package com.yihu.wlyy.controller.manager.device;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.WlyyDevice;
import com.yihu.wlyy.device.entity.WlyyDevice;
import com.yihu.wlyy.entity.DmDevice;
import com.yihu.wlyy.service.manager.device.DmDeviceService;
import com.yihu.wlyy.service.manager.device.WlyyDeviceService;
import com.yihu.wlyy.service.manager.device.WlyyDeviceService;
import jxl.Workbook;
import jxl.Workbook;
import jxl.read.biff.BiffException;
import jxl.read.biff.BiffException;
@ -29,9 +31,11 @@ import java.util.List;
@Controller
@Controller
@RequestMapping("admin/device")
@RequestMapping("admin/device")
public class WlyyDeviceController extends BaseController {
public class WlyyDeviceController extends BaseController {
    @Autowired
    @Autowired
    private WlyyDeviceService deviceService;
    private WlyyDeviceService deviceService;
    @Autowired
    private DmDeviceService dmDeviceService;
    @Autowired
    @Autowired
    private ObjectMapper objectMapper;
    private ObjectMapper objectMapper;
@ -72,6 +76,20 @@ public class WlyyDeviceController extends BaseController {
        }
        }
    }
    }
    //设备型号列表
    @RequestMapping(value = "modelList",method = RequestMethod.POST)
    @ResponseBody
    public String findAll(){
        try{
            List<DmDevice> list = dmDeviceService.findAll();
            return  write(200,"操作成功","data",list);
        }catch (Exception ex){
            error(ex);
            return error(-1, "操作失败!");
        }
    }
    @RequestMapping(value = "device")
    @RequestMapping(value = "device")
    @ResponseBody
    @ResponseBody
    public String getDevice(@RequestParam(value = "id") Long id){
    public String getDevice(@RequestParam(value = "id") Long id){
@ -142,7 +160,6 @@ public class WlyyDeviceController extends BaseController {
        return deviceService.existDeviceCode(deviceCode);
        return deviceService.existDeviceCode(deviceCode);
    }
    }
    
    
    
    //导出设备报表
    //导出设备报表
    @RequestMapping(value="toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    @RequestMapping(value="toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public void exportList(
    public void exportList(

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

@ -1,9 +1,21 @@
package com.yihu.wlyy.service.manager.device;
package com.yihu.wlyy.service.manager.device;
import com.yihu.wlyy.entity.DmDevice;
import com.yihu.wlyy.repository.DmDeviceDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
/**
 * Created by Administrator on 2017/1/18.
 * Created by humingfen on 2018/8/17.
 */
 */
@Service
public class DmDeviceService {
public class DmDeviceService {
    @Autowired
    private DmDeviceDao dmDeviceDao;
    public List<DmDevice> findAll() {
        return (List<DmDevice>)dmDeviceDao.findAll();
    }
}
}

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

@ -183,6 +183,9 @@ public class WlyyDeviceService {
                    manufacturer.setManufacturerName(device.getManufacturer());
                    manufacturer.setManufacturerName(device.getManufacturer());
                    manufacturer.setCzrq(new Date());
                    manufacturer.setCzrq(new Date());
                    deviceManufacturerDao.save(manufacturer);
                    deviceManufacturerDao.save(manufacturer);
                }else {
                    device.setManufacturerCode(manufacturer.getManufacturerCode());
                    device.setManufacturer(manufacturer.getManufacturerName());
                }
                }
            }
            }
            device.setIsGrant(0);
            device.setIsGrant(0);
@ -354,8 +357,22 @@ public class WlyyDeviceService {
                device.setGrantOrgCode(data);
                device.setGrantOrgCode(data);
            }
            }
        });
        });
        //根据仪器名称设定绑定次数
        //发放时间
        dataMap.put(21, new ExcelData() {
        dataMap.put(21, new ExcelData() {
            @Override
            public void transform(String data) {
                if(StringUtils.isNotBlank(data)) {
                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    try {
                        device.setGrantTime(simpleDateFormat.parse(data));
                    } catch (ParseException e) {
                        e.printStackTrace();
                    }
                }
            }
        });
        //根据仪器名称设定绑定次数
        dataMap.put(22, new ExcelData() {
            @Override
            @Override
            public void transform(String data) {
            public void transform(String data) {
                if(device.getBindingCount() == null) {
                if(device.getBindingCount() == null) {
@ -367,6 +384,7 @@ public class WlyyDeviceService {
                }
                }
            }
            }
        });
        });
        return dataMap;
        return dataMap;
    }
    }

+ 19 - 2
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_create_js.jsp

@ -19,7 +19,8 @@
				    /*
				    /*
				     *设备厂商列表
				     *设备厂商列表
				     */
				     */
				    manufacturerList: '/admin/manufacturer/findAll'
				    manufacturerList: '/admin/manufacturer/findAll',
                    deviceModelList: '/admin/device/modelList'
                },
                },
				init: function () {
				init: function () {
                    this.initComboBox();
                    this.initComboBox();
@ -31,7 +32,7 @@
					$("#inp_tel").ligerTextBox({width: 240})//联系电话
					$("#inp_tel").ligerTextBox({width: 240})//联系电话
					$("#inp_serverIp").ligerTextBox({width: 240})//服务IP地址
					$("#inp_serverIp").ligerTextBox({width: 240})//服务IP地址
					$("#inp_deviceName").ligerTextBox({width: 240})//设备名称
					$("#inp_deviceName").ligerTextBox({width: 240})//设备名称
					$("#inp_deviceModel").ligerTextBox({width: 240})//设备型号
					// $("#inp_deviceModel").ligerTextBox({width: 240})//设备型号
					$("#inp_deviceCode").ligerTextBox({width: 240})//设备唯一标识
					$("#inp_deviceCode").ligerTextBox({width: 240})//设备唯一标识
					$("#inp_sim").ligerTextBox({width: 240})//设备sim码
					$("#inp_sim").ligerTextBox({width: 240})//设备sim码
					//$("#inp_manufacturer").ligerTextBox({width: 240})//厂家名称
					//$("#inp_manufacturer").ligerTextBox({width: 240})//厂家名称
@ -56,6 +57,16 @@
                            });
                            });
                        }
                        }
                        that.initInpCat( d, that);
                        that.initInpCat( d, that);
                    });
                    this.rAjax( this.url.deviceModelList,{} ,function (data) {
                        var d = [];
                        for (var i = 0; i < data.data.length; i++) {
                            d.push({
                                text: data.data[i].name,
                                id: data.data[i].model
                            });
                        }
                        that.initModel( d, that);
                    })
                    })
                },
                },
                //设备厂商下拉框
                //设备厂商下拉框
@ -64,6 +75,12 @@
                        data: d,
                        data: d,
                    });
                    });
                },
                },
                //设备型号下拉框
                initModel: function(d, me) {
				    $("#inp_deviceModel").ligerComboBox({
                        data: d
                    })
                },
				//绑定事件
				//绑定事件
				bindEvents: function () {
				bindEvents: function () {

+ 22 - 4
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_modify_js.jsp

@ -19,6 +19,7 @@
				//变量
				//变量
				$form: $("#div_patient_info_form"),
				$form: $("#div_patient_info_form"),
                $manufacturer: $("#sel_manufacturer"),
                $manufacturer: $("#sel_manufacturer"),
                $deviceModel: $("#inp_deviceModel"),
				init: function () {
				init: function () {
                    _this = this;
                    _this = this;
                    this.$form.attrScan();
                    this.$form.attrScan();
@ -29,7 +30,7 @@
					$("#inp_tel").ligerTextBox({width: 240})//联系电话
					$("#inp_tel").ligerTextBox({width: 240})//联系电话
					$("#inp_serverIp").ligerTextBox({width: 240})//服务IP地址
					$("#inp_serverIp").ligerTextBox({width: 240})//服务IP地址
					$("#inp_deviceName").ligerTextBox({width: 240})//设备名称
					$("#inp_deviceName").ligerTextBox({width: 240})//设备名称
					$("#inp_deviceModel").ligerTextBox({width: 240})//设备型号
					// $("#inp_deviceModel").ligerTextBox({width: 240})//设备型号
					$("#inp_deviceCode").ligerTextBox({width: 240})//设备唯一标识
					$("#inp_deviceCode").ligerTextBox({width: 240})//设备唯一标识
					$("#inp_sim").ligerTextBox({width: 240})//设备sim
					$("#inp_sim").ligerTextBox({width: 240})//设备sim
					// $("#inp_manufacturer").ligerTextBox({width: 240})//厂家名称
					// $("#inp_manufacturer").ligerTextBox({width: 240})//厂家名称
@ -52,11 +53,27 @@
                            if (ajaxHeaderName) {
                            if (ajaxHeaderName) {
                                xhr.setRequestHeader(ajaxHeaderName, ajaxHeaderValue);
                                xhr.setRequestHeader(ajaxHeaderName, ajaxHeaderValue);
                            }
                            }
                        },
                        }
                    });
                    });
                    //厂商下拉框刷新
                    //设备型号下拉框
                    _this.deviceModelBox = _this.$deviceModel.ligerComboBox({
                        url: ctx + "/admin/device/modelList",
                        parms: {},
                        dataParmName: "data",
                        textField: "name",
                        valueField: "model",
                        isMultiSelect: false,
                        ajaxBeforeSend: function (xhr) {
                            if (ajaxHeaderName) {
                                xhr.setRequestHeader(ajaxHeaderName, ajaxHeaderValue);
                            }
                        }
                    });
                    //下拉框刷新
                    _this.reloadManufacturerBox = function () {
                    _this.reloadManufacturerBox = function () {
                        deviceInfo.manufacturerBox.reload();
                        deviceInfo.manufacturerBox.reload();
                        deviceInfo.deviceModelBox.reload();
                    };
                    };
                },
                },
@ -83,7 +100,6 @@
									serverIp: data.serverIp,
									serverIp: data.serverIp,
									deviceName: data.deviceName,
									deviceName: data.deviceName,
									sim: data.sim,
									sim: data.sim,
									deviceModel: data.deviceModel,
									deviceCode: data.deviceCode,
									deviceCode: data.deviceCode,
									address: data.address,
									address: data.address,
									representative: data.representative,
									representative: data.representative,
@ -94,6 +110,7 @@
								});
								});
								//填值
								//填值
								_this.manufacturerBox.selectValue(data.manufacturerId);
								_this.manufacturerBox.selectValue(data.manufacturerId);
								_this.deviceModelBox.selectValue(data.deviceModel)
							} else {
							} else {
								$.Notice.error(result.msg);
								$.Notice.error(result.msg);
							}
							}
@ -160,6 +177,7 @@
						//厂家名称
						//厂家名称
						values.manufacturerId = self.manufacturerBox.getValue();
						values.manufacturerId = self.manufacturerBox.getValue();
                        values.manufacturer = self.manufacturerBox.getText();
                        values.manufacturer = self.manufacturerBox.getText();
                        values.deviceModel = self.deviceModelBox.getValue();
						if (!validator.validate()) {
						if (!validator.validate()) {
							return;
							return;
						}
						}

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

@ -13,7 +13,7 @@ import java.util.Date;
 * */
 * */
public class LoadNewSignThread implements Runnable {
public class LoadNewSignThread implements Runnable {
    int retryTime =  30000;
    int retryTime =  10000;
    //空闲时间
    //空闲时间
    Integer nightHours = 23;
    Integer nightHours = 23;

+ 8 - 8
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/common/thread/LoadThread.java

@ -13,11 +13,11 @@ import java.util.Date;
 */
 */
public class LoadThread implements Runnable {
public class LoadThread implements Runnable {
    int retryTime =  30000;
    int retryTime =  10000;
    //空闲时间
    //空闲时间
    Integer nightHours = 22;
    Integer morningHours = 6;
    Integer nightHours = 23;
    Integer morningHours = 5;
    //默认线程间隔
    //默认线程间隔
    Integer sleepTime = 60;
    Integer sleepTime = 60;
@ -29,8 +29,8 @@ public class LoadThread implements Runnable {
                Date now = new Date();
                Date now = new Date();
                //判断非空闲时候
                //判断非空闲时候
//                if(now.getHours()>=morningHours &&  now.getHours() < nightHours)
//                {
                if(now.getHours()>=morningHours &&  now.getHours() < nightHours)
                {
                    //签约更新
                    //签约更新
                    SignZYService signZYService = (SignZYService) SpringContextHolder.getSpringBean("SignZYService");
                    SignZYService signZYService = (SignZYService) SpringContextHolder.getSpringBean("SignZYService");
                    SystemDictService systemDictService = (SystemDictService) SpringContextHolder.getSpringBean("SystemDictService");
                    SystemDictService systemDictService = (SystemDictService) SpringContextHolder.getSpringBean("SystemDictService");
@ -58,9 +58,9 @@ public class LoadThread implements Runnable {
                        Thread.sleep(retryTime);
                        Thread.sleep(retryTime);
                        continue;
                        continue;
                    }
                    }
//                }
//
//                Thread.sleep(sleepTime*1000);
                }
                Thread.sleep(sleepTime*1000);
            } catch (Exception ex) {
            } catch (Exception ex) {
                ex.printStackTrace();
                ex.printStackTrace();
                try {
                try {

+ 3 - 0
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/SignFamilyRenewLogDao.java

@ -45,4 +45,7 @@ public interface SignFamilyRenewLogDao extends PagingAndSortingRepository<SignFa
    @Query("select a.proId from SignFamilyRenewLog a where a.signCode=?1")
    @Query("select a.proId from SignFamilyRenewLog a where a.signCode=?1")
    String getProId(String signCode);
    String getProId(String signCode);
    
    @Query("select a.renewProId from SignFamilyRenewLog a where a.signCode=?1")
    String getreProId(String signCode);
}
}

+ 45 - 38
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/ChargeZYService.java

@ -146,47 +146,54 @@ public class ChargeZYService {
    
    
                jsonObject.put("INSUR_PRO_ID",charge.getMiRegisterNo());//医保签约号
                jsonObject.put("INSUR_PRO_ID",charge.getMiRegisterNo());//医保签约号
//                params.put("INSUR_PRO_ID", charge.getMiRegisterNo());  //医保签约号
//                params.put("INSUR_PRO_ID", charge.getMiRegisterNo());  //医保签约号
                if("1".equals(sign.getRenewFlag())||"2".equals(sign.getRenewFlag())){
                    proId = signFamilyRenewLogDao.getProId(signCode);
                    if(StringUtils.isBlank(proId) || "0".equals(proId)){
                        
                        if("1".equals(sign.getSignSource())){
                            //如果是在基卫签约则需要更新同步
                            SignFamilyMapping signFamilyMapping = signFamilyMappingDao.findByCode(signCode);
                            signFamilyMapping.setNeedUpdate("1");
                            signFamilyMappingDao.save(signFamilyMapping);
                        }else{
                            //如果是网络签约则需要上传同步
                            SignFamilyRenewLog signFamilyRenewLog = signFamilyRenewLogDao.findBySignCode(signCode);
                            signFamilyRenewLog.setNeedUpload("1");
                            signFamilyRenewLogDao.save(signFamilyRenewLog);
                        }
    
    
                        //暂停30秒
                        Thread.sleep(30000);
                        return true;
                    }
                }else {
                    proId = signFamilyMappingDao.getProId(signCode);
                    if(StringUtils.isBlank(proId) || "0".equals(proId)){
    
                        SignFamilyMapping signFamilyMapping = signFamilyMappingDao.findByCode(signCode);
                        if("1".equals(sign.getSignSource())){
                            //如果是在基卫签约则需要更新同步
                            signFamilyMapping.setNeedUpdate("1");
                        }else{
                            //如果是网络签约则需要上传同步
                            signFamilyMapping.setNeedUpload("1");
                        }
                        signFamilyMappingDao.save(signFamilyMapping);
    
                        //暂停30秒
                        Thread.sleep(30000);
                        return true;
                proId = signFamilyMappingDao.getProId(signCode);
                if(StringUtils.isBlank(proId)){
                    proId = signFamilyRenewLogDao.getProId(signCode);
                    if(StringUtils.isBlank(proId)){
                        proId = signFamilyRenewLogDao.getreProId(signCode);
                    }
                    }
                }
                }
//                if("1".equals(sign.getRenewFlag())||"2".equals(sign.getRenewFlag())){
//                    proId = signFamilyRenewLogDao.getProId(signCode);
//                    if(StringUtils.isBlank(proId) || "0".equals(proId)){
//
//                        if("1".equals(sign.getSignSource())){
//                            //如果是在基卫签约则需要更新同步
//                            SignFamilyMapping signFamilyMapping = signFamilyMappingDao.findByCode(signCode);
//                            signFamilyMapping.setNeedUpdate("1");
//                            signFamilyMappingDao.save(signFamilyMapping);
//                        }else{
//                            //如果是网络签约则需要上传同步
//                            SignFamilyRenewLog signFamilyRenewLog = signFamilyRenewLogDao.findBySignCode(signCode);
//                            signFamilyRenewLog.setNeedUpload("1");
//                            signFamilyRenewLogDao.save(signFamilyRenewLog);
//                        }
//
//                        //暂停30秒
//                        Thread.sleep(30000);
//                        return true;
//                    }
//                }else {
//                    proId = signFamilyMappingDao.getProId(signCode);
//                    if(StringUtils.isBlank(proId) || "0".equals(proId)){
//
//                        SignFamilyMapping signFamilyMapping = signFamilyMappingDao.findByCode(signCode);
//                        if("1".equals(sign.getSignSource())){
//                            //如果是在基卫签约则需要更新同步
//                            signFamilyMapping.setNeedUpdate("1");
//                        }else{
//                            //如果是网络签约则需要上传同步
//                            signFamilyMapping.setNeedUpload("1");
//                        }
//                        signFamilyMappingDao.save(signFamilyMapping);
//
//                        //暂停30秒
//                        Thread.sleep(30000);
//                        return true;
//                    }
//                }
    
    
                jsonObject.put("PRO_ID",proId);////标志(智业签约主键)
                jsonObject.put("PRO_ID",proId);////标志(智业签约主键)
//                params.put("PRO_ID", proId);  //标志(智业签约主键)
//                params.put("PRO_ID", proId);  //标志(智业签约主键)

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

@ -1793,6 +1793,7 @@ public class SignRenewZYService {
                }
                }
                mapping.setRenewUploadTime(new Date());
                mapping.setRenewUploadTime(new Date());
                mapping.setRenewProId(proId);
                mapping.setRenewProId(proId);
                mapping.setProId(proId);
                signFamilyMappingDao.save(mapping);
                signFamilyMappingDao.save(mapping);
            }
            }

+ 35 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java

@ -6,10 +6,12 @@ import com.yihu.wlyy.logs.InterfaceCallLogs;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemDataRedis;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -34,6 +36,9 @@ public class DoctorInterceptor extends BaseInterceptor {
    public static String status = "1";
    public static String status = "1";
    @Autowired
    public SystemDataRedis systemDataRedis;
    @Override
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        boolean flag = true;
        boolean flag = true;
@ -121,19 +126,33 @@ public class DoctorInterceptor extends BaseInterceptor {
            Token token = null;
            Token token = null;
            Map<String, Token> tempMap = null;
            Map<String, Token> tempMap = null;
            //1.50 登录缓存存储为redis
            if (platform == 2) {
            if (platform == 2) {
                tempMap = SystemData.doctorTokens;
                //tempMap = SystemData.doctorTokens;
                token = systemDataRedis.getDoctorToken(uid);
            } else if (platform == 4) {
            } else if (platform == 4) {
                tempMap = SystemData.doctorPCTokens;
                //tempMap = SystemData.doctorPCTokens;
                token = systemDataRedis.getDoctorPCToken(uid);
            }else if(platform ==5){
            }else if(platform ==5){
                tempMap = SystemData.doctorWXTokens;
                //tempMap = SystemData.doctorWXTokens;
                token = systemDataRedis.getDoctorWXToken(uid);
            }
            }
            token = tempMap.get(uid);
            //token = tempMap.get(uid);
            if (token == null) {
            if (token == null) {
                token = tokenDao.findByPatient(uid, platform);
                token = tokenDao.findByPatient(uid, platform);
                if (token != null) {
                if (token != null) {
                    // 加入缓存
                    // 加入缓存
                    tempMap.put(uid, token);
                    if (platform == 2) {
                        //tempMap = SystemData.doctorTokens;
                        systemDataRedis.setDoctorToken(token);
                    } else if (platform == 4) {
                        //tempMap = SystemData.doctorPCTokens;
                        systemDataRedis.setDoctorPCToken(token);
                    }else if(platform ==5){
                        //tempMap = SystemData.doctorWXTokens;
                        systemDataRedis.setDoctorWXToken(token);
                    }
                }
                }
            }
            }
            //  2、医生端app,3、微信公众号wechat,4、医生端pc,或者 PC端取药系统  或者对外系统
            //  2、医生端app,3、微信公众号wechat,4、医生端pc,或者 PC端取药系统  或者对外系统
@ -155,8 +174,17 @@ public class DoctorInterceptor extends BaseInterceptor {
                    if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
                    if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
                        // 今天未更新,则更新缓存
                        // 今天未更新,则更新缓存
                        token.setCzrq(new Date());
                        token.setCzrq(new Date());
                        // 更新内存
                        tempMap.put(uid, token);
                        //1.5.0更新redis缓存
                        if (platform == 2) {
                            systemDataRedis.setDoctorToken(token);
                        } else if (platform == 4) {
                            systemDataRedis.setDoctorPCToken(token);
                        }else if(platform ==5){
                            systemDataRedis.setDoctorWXToken(token);
                        }
//                        // 更新内存
//                        tempMap.put(uid, token);
                        // 更新数据库
                        // 更新数据库
                        tokenDao.save(token);
                        tokenDao.save(token);
                    }
                    }

+ 11 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -5,10 +5,12 @@ import com.yihu.wlyy.logs.InterfaceCallLogs;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemDataRedis;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
@ -29,6 +31,8 @@ import java.util.Date;
public class PatientInterceptor extends BaseInterceptor {
public class PatientInterceptor extends BaseInterceptor {
    private Logger logger = LoggerFactory.getLogger(PatientInterceptor.class);
    private Logger logger = LoggerFactory.getLogger(PatientInterceptor.class);
    @Autowired
    private SystemDataRedis systemDataRedis;
    public static String status = "1";
    public static String status = "1";
@ -67,16 +71,18 @@ public class PatientInterceptor extends BaseInterceptor {
            if (StringUtils.isEmpty(imei)) {
            if (StringUtils.isEmpty(imei)) {
                imei = openid;
                imei = openid;
            }
            }
            //1.5.0 获取token redis
            Token token = null;
            Token token = null;
            if (platform == 3) {
            if (platform == 3) {
                token = SystemData.patientTokens.get(user);
                token = systemDataRedis.getPatientToken(user);
//                token = SystemData.patientTokens.get(user);
            }
            }
            if (token == null) {
            if (token == null) {
                token = tokenDao.findByPatient(user, platform);
                token = tokenDao.findByPatient(user, platform);
                // 加入缓存
                // 加入缓存
                if (platform == 3) {
                if (platform == 3) {
                    SystemData.patientTokens.put(user, token);
                    systemDataRedis.setPatientToken(token);
                    //SystemData.patientTokens.put(user, token);
                }
                }
            }
            }
            if (token == null || StringUtils.isEmpty(tokenStr) || (token.getPlatform() != 1 && token.getPlatform() != 3)) {
            if (token == null || StringUtils.isEmpty(tokenStr) || (token.getPlatform() != 1 && token.getPlatform() != 3)) {
@ -95,7 +101,8 @@ public class PatientInterceptor extends BaseInterceptor {
                        token.setCzrq(new Date());
                        token.setCzrq(new Date());
                        // 更新内存
                        // 更新内存
                        if (platform == 3) {
                        if (platform == 3) {
                            SystemData.patientTokens.put(user, token);
                            systemDataRedis.setPatientToken(token);
                            //SystemData.patientTokens.put(user, token);
                        }
                        }
                        // 更新数据库
                        // 更新数据库
                        tokenDao.save(token);
                        tokenDao.save(token);

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

@ -179,6 +179,9 @@ public class FamilyContractService extends BaseService {
    @Autowired
    @Autowired
    private SignFamilyServerDao signFamilyServerDao;
    private SignFamilyServerDao signFamilyServerDao;
    @Value("${spring.profiles}")
    private String profiles;
    public SignFamily findSignFamilyByCode(String code) {
    public SignFamily findSignFamilyByCode(String code) {
        return signFamilyDao.findByCode(code);
        return signFamilyDao.findByCode(code);
    }
    }
@ -4614,11 +4617,12 @@ public class FamilyContractService extends BaseService {
    }
    }
    public String getSickArchiveFlag(String patient) throws Exception {
    public String getSickArchiveFlag(String patient) throws Exception {
        Patient p = patientDao.findByCode(patient);
        String rs = jwArchivesService.getSickArchiveFlag(p.getIdcard());
        String rs = "1";
        logger.info("======getSickArchiveFlag.profiles:"+profiles);
        if("prod".equals(profiles)){
            Patient p = patientDao.findByCode(patient);
            rs = jwArchivesService.getSickArchiveFlag(p.getIdcard());
        }
        return rs;
        return rs;
    }
    }

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java

@ -649,6 +649,8 @@ public class AdminTeamService extends BaseService {
            JSONObject doctorInfo = new JSONObject();
            JSONObject doctorInfo = new JSONObject();
            doctorInfo.put("name",d.getName());
            doctorInfo.put("name",d.getName());
            doctorInfo.put("code",d.getCode());
            doctorInfo.put("code",d.getCode());
            doctorInfo.put("dept_name",d.getDeptName());
            doctorInfo.put("job_name",d.getJobName());
            doctors.add(doctorInfo);
            doctors.add(doctorInfo);
        }
        }
        result.put("members",doctors);
        result.put("members",doctors);

+ 13 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java

@ -17,10 +17,7 @@ import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientRecordLogDao;
import com.yihu.wlyy.repository.patient.PatientRecordLogDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.security.TokenDao;
import com.yihu.wlyy.repository.security.TokenDao;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.EncodesUtil;
import com.yihu.wlyy.util.IdcardInfoExtractor;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
@ -60,6 +57,8 @@ public class PatientService extends TokenService {
    TokenDao tokenDao;
    TokenDao tokenDao;
    @Autowired
    @Autowired
    JdbcTemplate jdbcTemplate;
    JdbcTemplate jdbcTemplate;
    @Autowired
    private SystemDataRedis systemDataRedis;
    private Clock clock = Clock.DEFAULT;
    private Clock clock = Clock.DEFAULT;
    //可续签月份
    //可续签月份
@ -122,9 +121,11 @@ public class PatientService extends TokenService {
            for (Token token : tokens) {
            for (Token token : tokens) {
                i++;
                i++;
                Patient p = patientDao.findByCode(token.getUser());
                Patient p = patientDao.findByCode(token.getUser());
                //1.5.0 redis token
                if (p == null || i <= last) {
                if (p == null || i <= last) {
                    tokenDao.delete(token);
                    tokenDao.delete(token);
                    SystemData.patientTokens.remove(token.getUser());
                    systemDataRedis.delToken(SystemDataRedis.patientTokens,token.getUser());
                    //SystemData.patientTokens.remove(token.getUser());
                    continue;
                    continue;
                }
                }
//                p.setOpenid("");
//                p.setOpenid("");
@ -132,7 +133,9 @@ public class PatientService extends TokenService {
                signFamilyDao.updateOpenidByPatient("", p.getCode());
                signFamilyDao.updateOpenidByPatient("", p.getCode());
                patientDao.save(p);
                patientDao.save(p);
                tokenDao.delete(token);
                tokenDao.delete(token);
                SystemData.patientTokens.remove(p.getCode());
                systemDataRedis.delToken(SystemDataRedis.patientTokens,token.getUser());
//                SystemData.patientTokens.remove(p.getCode());
                break;
                break;
            }
            }
        }
        }
@ -1145,7 +1148,10 @@ public class PatientService extends TokenService {
            patientRecordLogDao.save(patientRecordLog);
            patientRecordLogDao.save(patientRecordLog);
            //清登录缓存
            //清登录缓存
            SystemData.patientTokens.remove(patient.getCode());
            //SystemData.patientTokens.remove(patient.getCode());
            //1.5.0清楚redis缓存
            systemDataRedis.delToken(SystemDataRedis.patientTokens,patient.getCode());
        }
        }
        patientDao.clearOpenidByOpenid(openid);
        patientDao.clearOpenidByOpenid(openid);
        return "";
        return "";

+ 21 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java

@ -7,6 +7,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemDataRedis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
@ -21,6 +22,8 @@ public class TokenService extends BaseService {
	public TokenDao tokenDao;
	public TokenDao tokenDao;
	@Autowired
	@Autowired
	private PatientDao patientDao;
	private PatientDao patientDao;
	@Autowired
	private SystemDataRedis systemDataRedis;
	/**
	/**
	 * 生成token
	 * 生成token
@ -56,14 +59,19 @@ public class TokenService extends BaseService {
			throw new Exception("Token生成失败");
			throw new Exception("Token生成失败");
		}
		}
		// 更新token缓存
		// 更新token缓存
		//1.5.0 更新redis token缓存
		if (platform == 3) {
		if (platform == 3) {
			SystemData.patientTokens.put(user, token);
			systemDataRedis.setPatientToken(token);
			//SystemData.patientTokens.put(user, token);
		} else if (platform == 2) {
		} else if (platform == 2) {
			SystemData.doctorTokens.put(user, token);
			systemDataRedis.setDoctorToken(token);
			//SystemData.doctorTokens.put(user, token);
		}else if(platform == 4){
		}else if(platform == 4){
			SystemData.doctorPCTokens.put(user,token);
			systemDataRedis.setDoctorPCToken(token);
			//SystemData.doctorPCTokens.put(user,token);
		}else if(platform == 5){
		}else if(platform == 5){
			SystemData.doctorWXTokens.put(user,token);
			systemDataRedis.setDoctorWXToken(token);
			//SystemData.doctorWXTokens.put(user,token);
		}
		}
		return token;
		return token;
	}
	}
@ -89,8 +97,10 @@ public class TokenService extends BaseService {
		if (token == null) {
		if (token == null) {
			throw new Exception("Token生成失败");
			throw new Exception("Token生成失败");
		}
		}
		//1.5.0 redis token
		// 更新token缓存
		// 更新token缓存
		SystemData.patientTokens.put(user, token);
		//SystemData.patientTokens.put(user, token);
		systemDataRedis.setPatientToken(token);
		return token;
		return token;
	}
	}
@ -103,11 +113,14 @@ public class TokenService extends BaseService {
	public void delToken(int platform, String uid) throws Exception {
	public void delToken(int platform, String uid) throws Exception {
		// 删除老的token
		// 删除老的token
		tokenDao.deleteByUser(uid);
		tokenDao.deleteByUser(uid);
		// 更新token缓存
		// 1.5.0 更新token缓存 redis
		if (platform == 3) {
		if (platform == 3) {
			SystemData.patientTokens.remove(uid);
			//1.5.0 删除居民Token
			systemDataRedis.delToken(SystemDataRedis.patientTokens,uid);
			//SystemData.patientTokens.remove(uid);
		} else if (platform == 2) {
		} else if (platform == 2) {
			SystemData.doctorTokens.remove(uid);
			systemDataRedis.delToken(SystemDataRedis.doctorTokens,uid);
			//SystemData.doctorTokens.remove(uid);
		}
		}
	}
	}

+ 9 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java

@ -23,6 +23,7 @@ import com.yihu.wlyy.repository.specialist.SpecialDiseaseDao;
import com.yihu.wlyy.repository.specialist.TeamDiseaseRelationDao;
import com.yihu.wlyy.repository.specialist.TeamDiseaseRelationDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpResponse;
@ -81,6 +82,8 @@ public class SpecialistService extends BaseService {
    private PushMsgTask pushMsgTask;
    private PushMsgTask pushMsgTask;
    @Autowired
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private AdminTeamService memberService;
    public String setPatientLabelInfo(List<SignPatientLabelInfo> list) {
    public String setPatientLabelInfo(List<SignPatientLabelInfo> list) {
        if (list != null && list.size() > 0) {
        if (list != null && list.size() > 0) {
@ -621,6 +624,12 @@ public class SpecialistService extends BaseService {
            JSONObject json = rs.getJSONObject("obj");
            JSONObject json = rs.getJSONObject("obj");
            List<PatientDiseaseServer> patientDiseaseServers =  patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(code,"1");
            List<PatientDiseaseServer> patientDiseaseServers =  patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(code,"1");
            json.put("diseaseServer",patientDiseaseServers);
            json.put("diseaseServer",patientDiseaseServers);
            
            //根据团队ID获取医生列表
            Long teamCode = json.getLong("teamCode");
            List<Doctor> members = memberService.getMembers(teamCode);
            json.put("doctors",members);
            
            return json;
            return json;
        }
        }
        return null;
        return null;

+ 1 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwArchivesService.java

@ -809,8 +809,7 @@ public class JwArchivesService {
    /**
    /**
     *  查询居民是否有建立健康档案接口
     *  查询居民是否有建立健康档案接口
     */
     */
    public String getSickArchiveFlag(String idcard)  throws Exception
    {
    public String getSickArchiveFlag(String idcard)  throws Exception {
        String re = "0";//0 未建档,非0为档案号
        String re = "0";//0 未建档,非0为档案号
        String url = jwUrl + "/third/archives/getSickArchiveFlag";
        String url = jwUrl + "/third/archives/getSickArchiveFlag";

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/applets/AppletsService.java

@ -6,6 +6,7 @@ import com.yihu.wlyy.repository.patient.PatientAimSportsDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.health.bank.TaskService;
import com.yihu.wlyy.service.app.health.bank.TaskService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.SecretUtils;
import com.yihu.wlyy.util.SecretUtils;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import com.yihu.wlyy.util.http.HttpUtils;
@ -138,6 +139,7 @@ public class AppletsService extends BaseService {
            patientAimSports.setDailyStepCount(step);
            patientAimSports.setDailyStepCount(step);
            patientAimSports.setCreateTime(new Date());
            patientAimSports.setCreateTime(new Date());
            patientAimSports.setPatientcode(patient);
            patientAimSports.setPatientcode(patient);
            patientAimSports.setCreateDate(DateUtil.getStringDateShort());
            patientAimSportsDao.save(patientAimSports);
            patientAimSportsDao.save(patientAimSports);
        }
        }

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -328,10 +328,10 @@ public class OnePayService {
            if (signFamily != null) {
            if (signFamily != null) {
//                //签约人Code
//                //签约人Code
                String signDoctorCode = signFamily.getSignDoctorCode();
                String doctorCode = signFamily.getDoctor();
                String people = signFamily.getPatient();
                String people = signFamily.getPatient();
                Doctor doctor = doctorDao.findByCode(signDoctorCode);
                Doctor doctor = doctorDao.findByCode(doctorCode);
                Patient user = patientDao.findByCode(people);
                Patient user = patientDao.findByCode(people);
    
    
                JSONObject familyContent =  new JSONObject();
                JSONObject familyContent =  new JSONObject();
@ -342,17 +342,17 @@ public class OnePayService {
                familyContent.put("moRegTelephone", user.getMobile());//签约人联系电话
                familyContent.put("moRegTelephone", user.getMobile());//签约人联系电话
                familyContent.put("moRegOrgNo", sbCode); //签约机构 限长4
                familyContent.put("moRegOrgNo", sbCode); //签约机构 限长4
                familyContent.put("moRegDocNo", doctor.getIdcard());//签约医生编号 限长18 身份证号
                familyContent.put("moRegDocNo", doctor.getIdcard());//签约医生编号 限长18 身份证号
                familyContent.put("moRegDocName", signFamily.getSignDoctorName()); //签约医生姓名
                familyContent.put("moRegDocName", signFamily.getDoctorName()); //签约医生姓名
//                familyContent.put("moRegTime", format.format(signFamily.getBegin())); //签约时间
//                familyContent.put("moRegTime", format.format(signFamily.getBegin())); //签约时间
                familyContent.put("moRegTime", format.format(new Date())); //签约时间 v1.4.0更改
                familyContent.put("moRegTime", format.format(new Date())); //签约时间 v1.4.0更改
                familyContent.put("moRegEndTime", format.format(signFamily.getEnd())); //签约截止时间
                familyContent.put("moRegEndTime", format.format(signFamily.getEnd())); //签约截止时间
                familyContent.put("moRegTear", signFamily.getSignYear());//签约年度
                familyContent.put("moRegTear", signFamily.getSignYear());//签约年度
                familyContent.put("moRegSource", signFamily.getSignSource()); //签约来源
                familyContent.put("moRegSource", signFamily.getSignSource()); //签约来源
                familyContent.put("moCollectOrgNo", sbCode); //扣费机构 签约机构
                familyContent.put("moCollectOrgNo", sbCode); //扣费机构 签约机构
                familyContent.put("moCollectorNo", signFamily.getSignDoctorName());//扣费人 签约医生姓名
                familyContent.put("moCollectorNo", signFamily.getDoctorName());//扣费人 签约医生姓名
                familyContent.put("benefitType", signFamily.getExpensesType()); //补贴类型
                familyContent.put("benefitType", signFamily.getExpensesType()); //补贴类型
                familyContent.put("moBookOrgNo", sbCode);//登记机构 签约机构
                familyContent.put("moBookOrgNo", sbCode);//登记机构 签约机构
                familyContent.put("moBookerNo", signFamily.getSignDoctorName()); //登记人 签约医生姓名
                familyContent.put("moBookerNo", signFamily.getDoctorName()); //登记人 签约医生姓名
                familyContent.put("moBookTime", format.format(signFamily.getBegin())); //登记时间 签约时间
                familyContent.put("moBookTime", format.format(signFamily.getBegin())); //登记时间 签约时间
    
    
                JSONObject moServiceType = new JSONObject();//服务类型
                JSONObject moServiceType = new JSONObject();//服务类型

+ 124 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemDataRedis.java

@ -0,0 +1,124 @@
package com.yihu.wlyy.util;
import com.yihu.wlyy.entity.security.Token;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;
import java.util.Set;
/**
 * Created by Trick on 2018/8/20.
 * 1.5.0 版本 将token 存储在redis
 */
@Component
public class SystemDataRedis {
    @Autowired
    private StringRedisTemplate redisTemplate;
    /**
     * tokenTypeName
     */
    public final static String doctorTokens = "doctorTokens";//医生缓存
    public final static String doctorPCTokens = "doctorPCTokens";//pc端缓存
    public final static String patientTokens = "patientTokens";//居民缓存
    public final static String doctorWXTokens = "doctorWXTokens";//医生微信缓存
//====设置token========
    /**
     * 设置医生缓存
     * @param token
     */
    public String setDoctorToken(Token token){
        return setToken(doctorTokens,token);
    }
    /**
     * 设置pc端缓存
     * @param token
     */
    public String setDoctorPCToken(Token token){
       return setToken(doctorPCTokens,token);
    }
    /**
     * 设置居民缓存
     * @param token
     */
    public String setPatientToken(Token token){
        return setToken(patientTokens,token);
    }
    /**
     *  设置医生微信缓存
     * @param token
     */
    public String setDoctorWXToken(Token token){
        return setToken(doctorWXTokens,token);
    }
//====设置token==end===
//====获取token========
    public Token getDoctorToken(String uid){
        return getToken(doctorTokens,uid);
    }
    public Token getDoctorPCToken(String uid){
        return getToken(doctorPCTokens,uid);
    }
    public Token getPatientToken(String uid){
        return getToken(patientTokens,uid);
    }
    public Token getDoctorWXToken(String uid){
        return getToken(doctorWXTokens,uid);
    }
//=====获取token===end===
    /**
     * 设置token
     * @param tokenTypeName
     * @param token
     */
    public String setToken(String tokenTypeName,Token token){
        JSONObject json = JSONObject.fromObject(token);
        String key = "token:"+tokenTypeName+":"+token.getUser();
        redisTemplate.opsForValue().set(key,json.toString());
        return json.toString();
    }
    /**
     * 获取token
     * @param tokenTypeName
     * @param uid
     * @return
     */
    public Token getToken(String tokenTypeName,String uid) {
        String tokenJosn = redisTemplate.opsForValue().get("token:" + tokenTypeName + ":" + uid);
        Token token = (Token)JSONObject.toBean(JSONObject.fromObject(tokenJosn),Token.class);
        return token;
    }
    /**
     * 删除token
     * @param tokenTypeName
     * @param uid
     * @return
     */
    public void delToken(String tokenTypeName,String uid){
        String key = "token:"+tokenTypeName+":"+uid;
        redisTemplate.delete(key);
    }
    public int getTokenMember(String tokenTypeName){
        Set set =  redisTemplate.keys("token:" + tokenTypeName+":*");
        if(set!=null&&set.size()>0){
            return set.size();
        }
        return 0;
    }
}

+ 33 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java

@ -12,10 +12,7 @@ import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.common.account.RoleService;
import com.yihu.wlyy.service.common.account.RoleService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.account.TokenService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.service.common.login.LoginLogService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.util.RSAUtils;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
@ -75,6 +72,9 @@ public class LoginController extends BaseController {
    @Autowired
    @Autowired
    private DoctorInfoService doctorInfoService;
    private DoctorInfoService doctorInfoService;
    @Autowired
    private SystemDataRedis systemDataRedis;
    /**
    /**
     * 公钥生成并返回接口
     * 公钥生成并返回接口
@ -438,13 +438,15 @@ public class LoginController extends BaseController {
                // response.getWriter().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!"));
                // response.getWriter().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!"));
                return error(-1, "系统异常,操作失败");
                return error(-1, "系统异常,操作失败");
            }
            }
            Token token = SystemData.doctorTokens.get(uid);
            //1.5.0 存储redis缓存
            Token token = systemDataRedis.getDoctorToken(uid);
            //Token token = SystemData.doctorTokens.get(uid);
            if (token == null) {
            if (token == null) {
                token = tokenDao.findByToken(tokenStr);
                token = tokenDao.findByToken(tokenStr);
                if (token != null) {
                if (token != null) {
                    // 加入缓存
                    // 加入缓存
                    SystemData.doctorTokens.put(uid, token);
                    systemDataRedis.setDoctorToken(token);
                    //SystemData.doctorTokens.put(uid, token);
                }
                }
            }
            }
            if (token == null || token.getPlatform() != 2) {
            if (token == null || token.getPlatform() != 2) {
@ -466,7 +468,8 @@ public class LoginController extends BaseController {
                        // 今天未更新,则更新缓存
                        // 今天未更新,则更新缓存
                        token.setCzrq(new Date());
                        token.setCzrq(new Date());
                        // 更新内存
                        // 更新内存
                        SystemData.doctorTokens.put(uid, token);
                        systemDataRedis.setDoctorToken(token);
                        //SystemData.doctorTokens.put(uid, token);
                        // 更新数据库
                        // 更新数据库
                        tokenDao.save(token);
                        tokenDao.save(token);
                    }
                    }
@ -560,5 +563,27 @@ public class LoginController extends BaseController {
        }
        }
    }
    }
    @RequestMapping(value = "setTokenTest", method = RequestMethod.POST)
    @ResponseBody
    public String setToken(String uid){
        Token token = new Token();
        token.setToken("123456");
        token.setDel("1");
        token.setCzrq(new Date());
        token.setUser(uid);
        return write(200,systemDataRedis.setDoctorPCToken(token));
    }
    @RequestMapping(value = "getTokenTest", method = RequestMethod.POST)
    @ResponseBody
    public String getToken(String uid){
        return write(200,systemDataRedis.getDoctorPCToken(uid).toJson());
    }
    @RequestMapping(value = "getTokenNumberTest", method = RequestMethod.POST)
    @ResponseBody
    public String getTokenNumber(){
        return write(200,systemDataRedis.getTokenMember(SystemDataRedis.doctorTokens)+"");
    }
}
}

+ 9 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java

@ -12,6 +12,7 @@ import com.yihu.wlyy.service.common.util.ManageUtilService;
import com.yihu.wlyy.service.common.util.SignTeamAndGroupRunnable;
import com.yihu.wlyy.service.common.util.SignTeamAndGroupRunnable;
import com.yihu.wlyy.util.SpringUtil;
import com.yihu.wlyy.util.SpringUtil;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemDataRedis;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -50,6 +51,8 @@ public class ManagerUtilController extends BaseController {
    JdbcTemplate jdbcTemplate;
    JdbcTemplate jdbcTemplate;
    @Autowired
    @Autowired
    ConsultTeamDoctorDao consultTeamDoctorDao;
    ConsultTeamDoctorDao consultTeamDoctorDao;
    @Autowired
    SystemDataRedis systemDataRedis;
    /*********************************************患者疾病相关******************************************/
    /*********************************************患者疾病相关******************************************/
    /**
    /**
@ -268,9 +271,12 @@ public class ManagerUtilController extends BaseController {
    public String online_num() {
    public String online_num() {
        try {
        try {
            JSONObject jo = new JSONObject();
            JSONObject jo = new JSONObject();
            jo.put("doctor_online", SystemData.doctorTokens.size());
            jo.put("pc_online", SystemData.doctorPCTokens.size());
            jo.put("patient_online", SystemData.patientTokens.size());
//            jo.put("doctor_online", SystemData.doctorTokens.size());
//            jo.put("pc_online", SystemData.doctorPCTokens.size());
//            jo.put("patient_online", SystemData.patientTokens.size());
            jo.put("doctor_online", systemDataRedis.getTokenMember(SystemDataRedis.doctorTokens));
            jo.put("pc_online", systemDataRedis.getTokenMember(SystemDataRedis.doctorPCTokens));
            jo.put("patient_online", systemDataRedis.getTokenMember(SystemDataRedis.patientTokens));
            return write(200, "启动成功","data",jo);
            return write(200, "启动成功","data",jo);
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);

+ 10 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -76,6 +76,8 @@ public class PatientController extends WeixinBaseController {
    private WeiXinTagUtil weiXinTagUtil;
    private WeiXinTagUtil weiXinTagUtil;
    @Autowired
    @Autowired
    private RSAUtils rsaUtils;
    private RSAUtils rsaUtils;
    @Autowired
    private SystemDataRedis systemDataRedis;
    /**
    /**
     * 患者基本信息查询接口
     * 患者基本信息查询接口
@ -393,7 +395,10 @@ public class PatientController extends WeixinBaseController {
            } else {
            } else {
                //patient.setOpenid("");
                //patient.setOpenid("");
                //patientInfoService.updateUser(patient);
                //patientInfoService.updateUser(patient);
                Token token = SystemData.patientTokens.get(getUID());
                //1.5.0 token存储redis
                //Token token = SystemData.patientTokens.get(getUID());
                Token token = systemDataRedis.getPatientToken(getUID());
                if (token == null) {
                if (token == null) {
                    token = tokenDao.findByPatient(getUID(), 3);
                    token = tokenDao.findByPatient(getUID(), 3);
                }
                }
@ -404,7 +409,10 @@ public class PatientController extends WeixinBaseController {
                token.setDel("0");
                token.setDel("0");
                tokenDao.save(token);
                tokenDao.save(token);
                SystemData.patientTokens.remove(getUID());
                systemDataRedis.delToken(SystemDataRedis.patientTokens,getUID());
//                SystemData.patientTokens.remove(getUID());
                //清空患者的微信标签
                //清空患者的微信标签
                weiXinTagUtil.deleteTagWithOpenid(patient.getOpenid(),patient.getWxtagid());
                weiXinTagUtil.deleteTagWithOpenid(patient.getOpenid(),patient.getWxtagid());
                patient.setIsWxtag(Patient.isWchatTage.no.getValue());
                patient.setIsWxtag(Patient.isWchatTage.no.getValue());

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -25,6 +25,7 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Controller;
@ -62,6 +63,7 @@ public class FamilyContractController extends WeixinBaseController {
    private RSAUtils rsaUtils;
    private RSAUtils rsaUtils;
    @Autowired
    @Autowired
    private CommonUtil CommonUtil;
    private CommonUtil CommonUtil;
    /**
    /**
     * 得到患者的签约的医生的信息
     * 得到患者的签约的医生的信息
     *
     *