소스 검색

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

liuwenbin 7 년 전
부모
커밋
7a9c10fd3e
48개의 변경된 파일905개의 추가작업 그리고 149개의 파일을 삭제
  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. 5 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/SystemDictDao.java
  6. 14 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DmDeviceService.java
  7. 19 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java
  8. 19 2
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_create_js.jsp
  9. 22 4
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_modify_js.jsp
  10. 17 2
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java
  11. 24 2
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java
  12. 5 0
      patient-co-service/wlyy_sign/pom.xml
  13. 1 1
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/common/thread/LoadNewSignThread.java
  14. 8 8
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/common/thread/LoadThread.java
  15. 3 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/SignFamilyRenewLogDao.java
  16. 45 38
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/ChargeZYService.java
  17. 1 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignRenewZYService.java
  18. 35 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/DoctorInterceptor.java
  19. 11 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java
  20. 44 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  21. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceLogService.java
  22. 49 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java
  23. 9 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  24. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignFamilyServiceService.java
  25. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  26. 10 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  27. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java
  28. 13 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/PatientService.java
  29. 21 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/TokenService.java
  30. 52 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistService.java
  31. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java
  32. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwArchivesService.java
  33. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/applets/AppletsService.java
  34. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  35. 42 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java
  36. 124 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/SystemDataRedis.java
  37. 33 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java
  38. 9 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java
  39. 64 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  40. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java
  41. 21 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java
  42. 41 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java
  43. 10 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java
  44. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java
  45. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java
  46. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  47. 14 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/specialist/ThirdSpecialistController.java
  48. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

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

@ -64,11 +64,16 @@
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </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>
</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 String bmiMax;              //bmi标准上限
    private String bmiMin;              //bmi标准下线
    private String createDate;      //上传日期
    private Date createTime;       //创建时间
@ -84,4 +85,13 @@ public class PatientAimSports extends IdEntity {
        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.yihu.wlyy.entity.IdEntity;
import net.sf.json.JSONObject;
import javax.persistence.Entity;
import javax.persistence.Table;
@ -78,4 +79,9 @@ public class Token extends IdEntity {
		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.yihu.wlyy.controller.BaseController;
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 jxl.Workbook;
import jxl.read.biff.BiffException;
@ -29,9 +31,11 @@ import java.util.List;
@Controller
@RequestMapping("admin/device")
public class WlyyDeviceController extends BaseController {
    @Autowired
    private WlyyDeviceService deviceService;
    @Autowired
    private DmDeviceService dmDeviceService;
    @Autowired
    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")
    @ResponseBody
    public String getDevice(@RequestParam(value = "id") Long id){
@ -142,7 +160,6 @@ public class WlyyDeviceController extends BaseController {
        return deviceService.existDeviceCode(deviceCode);
    }
    
    
    //导出设备报表
    @RequestMapping(value="toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public void exportList(

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

@ -19,4 +19,9 @@ public interface SystemDictDao extends PagingAndSortingRepository<SystemDict, Lo
    @Query("select s.value from SystemDict s where s.dictName=?1 and s.code =?2")
    String findByDictNameAndCode2(String dictName, String code);
    @Query("select s.value from SystemDict s where s.dictName=?1 and s.code =?2")
    String findByDictNameAndCode3(String dictName, String code);
}

+ 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;
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 {
    @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.setCzrq(new Date());
                    deviceManufacturerDao.save(manufacturer);
                }else {
                    device.setManufacturerCode(manufacturer.getManufacturerCode());
                    device.setManufacturer(manufacturer.getManufacturerName());
                }
            }
            device.setIsGrant(0);
@ -354,8 +357,22 @@ public class WlyyDeviceService {
                device.setGrantOrgCode(data);
            }
        });
        //根据仪器名称设定绑定次数
        //发放时间
        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
            public void transform(String data) {
                if(device.getBindingCount() == null) {
@ -367,6 +384,7 @@ public class WlyyDeviceService {
                }
            }
        });
        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 () {
                    this.initComboBox();
@ -31,7 +32,7 @@
					$("#inp_tel").ligerTextBox({width: 240})//联系电话
					$("#inp_serverIp").ligerTextBox({width: 240})//服务IP地址
					$("#inp_deviceName").ligerTextBox({width: 240})//设备名称
					$("#inp_deviceModel").ligerTextBox({width: 240})//设备型号
					// $("#inp_deviceModel").ligerTextBox({width: 240})//设备型号
					$("#inp_deviceCode").ligerTextBox({width: 240})//设备唯一标识
					$("#inp_sim").ligerTextBox({width: 240})//设备sim码
					//$("#inp_manufacturer").ligerTextBox({width: 240})//厂家名称
@ -56,6 +57,16 @@
                            });
                        }
                        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,
                    });
                },
                //设备型号下拉框
                initModel: function(d, me) {
				    $("#inp_deviceModel").ligerComboBox({
                        data: d
                    })
                },
				//绑定事件
				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"),
                $manufacturer: $("#sel_manufacturer"),
                $deviceModel: $("#inp_deviceModel"),
				init: function () {
                    _this = this;
                    this.$form.attrScan();
@ -29,7 +30,7 @@
					$("#inp_tel").ligerTextBox({width: 240})//联系电话
					$("#inp_serverIp").ligerTextBox({width: 240})//服务IP地址
					$("#inp_deviceName").ligerTextBox({width: 240})//设备名称
					$("#inp_deviceModel").ligerTextBox({width: 240})//设备型号
					// $("#inp_deviceModel").ligerTextBox({width: 240})//设备型号
					$("#inp_deviceCode").ligerTextBox({width: 240})//设备唯一标识
					$("#inp_sim").ligerTextBox({width: 240})//设备sim
					// $("#inp_manufacturer").ligerTextBox({width: 240})//厂家名称
@ -52,11 +53,27 @@
                            if (ajaxHeaderName) {
                                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 () {
                        deviceInfo.manufacturerBox.reload();
                        deviceInfo.deviceModelBox.reload();
                    };
                },
@ -83,7 +100,6 @@
									serverIp: data.serverIp,
									deviceName: data.deviceName,
									sim: data.sim,
									deviceModel: data.deviceModel,
									deviceCode: data.deviceCode,
									address: data.address,
									representative: data.representative,
@ -94,6 +110,7 @@
								});
								//填值
								_this.manufacturerBox.selectValue(data.manufacturerId);
								_this.deviceModelBox.selectValue(data.deviceModel)
							} else {
								$.Notice.error(result.msg);
							}
@ -160,6 +177,7 @@
						//厂家名称
						values.manufacturerId = self.manufacturerBox.getValue();
                        values.manufacturer = self.manufacturerBox.getText();
                        values.deviceModel = self.deviceModelBox.getValue();
						if (!validator.validate()) {
							return;
						}

+ 17 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java

@ -289,7 +289,7 @@ public class JMController {
		}
	}
	@RequestMapping(value = "/imm/findWzymBymykh",method = RequestMethod.POST)
	/*@RequestMapping(value = "/imm/findWzymBymykh",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:获取计划免疫接种记录")
	public Result findWzymBymykh()
@ -302,7 +302,7 @@ public class JMController {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
	}*/
	@RequestMapping(value = "/imm/findMyVaccin",method = RequestMethod.POST)
	@ResponseBody
@ -334,4 +334,19 @@ public class JMController {
			return Result.error(ex.getMessage());
		}
	}
	@RequestMapping(value = "/imm/findWzymBymykh",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation("计免:根据免疫卡号查询接种记录")
	public Result findWzymBymykh(@RequestParam(value = "etmykh")String etmykh)
	{
		try {
			String data = jmService.findWzymBymykh(etmykh);
			return Result.success("获取接种记录成功!",data);
		} catch (Exception ex) {
			ex.printStackTrace();
			return Result.error(ex.getMessage());
		}
	}
}

+ 24 - 2
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/service/JMService.java

@ -42,6 +42,7 @@ public class JMService {
    private String FIND_MY_VACCIN="findMyVaccin";
    private String FIND_CHILDREN = "findChildren";
    private String FIND_DEPT="findDept";//获取接种门诊
    private String FIND_WZYM_BY_MYKH="findWzymBymykh";
    private String redis_key ="imm:imm_token_key";
@ -472,7 +473,7 @@ public class JMService {
     * 获取计划免疫接种记录
     * @return
     */
    public String findWzymBymykh() throws Exception  {
    /*public String findWzymBymykh() throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", "findWzymBymykh");
@ -480,7 +481,7 @@ public class JMService {
        params.put("_token", "118328844");
        params.put("etmykh", "0052182708");
        return ylzImmGetSecond(apiString,"计免预约-获取计划免疫接种记录",params);
    }
    }*/
    /**
     * 获取计划免疫接种记录
@ -516,6 +517,27 @@ public class JMService {
        return ylzImmGetSecond(FIND_DEPT,"计免预约-获取接种门诊",params);
    }
    /**
     * 根据免疫卡号查询接种记录
     * @param etmykh
     * @return
     * @throws Exception
     */
    public String findWzymBymykh(String etmykh) throws Exception  {
        String result = "";
        Map<String,String> params = new HashMap<>();
        params.put("act", FIND_WZYM_BY_MYKH);
        params.put("accId", accId);
        params.put("token", getTokenCheck());
        params.put("etmykh", etmykh);
        //params.put("etmykh", "0052182708");
        /*params.put("act", "findWzymBymykh");
        params.put("accId", "q9Bt3TE00KaigEW5EJVIMA==");
        params.put("_token", "118328844");
        params.put("etmykh", "0052182708");*/
        return ylzImmGetSecond(FIND_WZYM_BY_MYKH,"计免预约-获取接种记录",params);
    }
    public String getTokenCheck() throws Exception{
        String token = "";
        if (!redisTemplate.hasKey(redis_key)){

+ 5 - 0
patient-co-service/wlyy_sign/pom.xml

@ -23,6 +23,11 @@
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-entity</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>

+ 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 {
    int retryTime =  30000;
    int retryTime =  10000;
    //空闲时间
    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 {
    int retryTime =  30000;
    int retryTime =  10000;
    //空闲时间
    Integer nightHours = 22;
    Integer morningHours = 6;
    Integer nightHours = 23;
    Integer morningHours = 5;
    //默认线程间隔
    Integer sleepTime = 60;
@ -29,8 +29,8 @@ public class LoadThread implements Runnable {
                Date now = new Date();
                //判断非空闲时候
//                if(now.getHours()>=morningHours &&  now.getHours() < nightHours)
//                {
                if(now.getHours()>=morningHours &&  now.getHours() < nightHours)
                {
                    //签约更新
                    SignZYService signZYService = (SignZYService) SpringContextHolder.getSpringBean("SignZYService");
                    SystemDictService systemDictService = (SystemDictService) SpringContextHolder.getSpringBean("SystemDictService");
@ -58,9 +58,9 @@ public class LoadThread implements Runnable {
                        Thread.sleep(retryTime);
                        continue;
                    }
//                }
//
//                Thread.sleep(sleepTime*1000);
                }
                Thread.sleep(sleepTime*1000);
            } catch (Exception ex) {
                ex.printStackTrace();
                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")
    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());//医保签约号
//                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);////标志(智业签约主键)
//                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.setRenewProId(proId);
                mapping.setProId(proId);
                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.SystemConf;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemDataRedis;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
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.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
@ -34,6 +36,9 @@ public class DoctorInterceptor extends BaseInterceptor {
    public static String status = "1";
    @Autowired
    public SystemDataRedis systemDataRedis;
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        boolean flag = true;
@ -121,19 +126,33 @@ public class DoctorInterceptor extends BaseInterceptor {
            Token token = null;
            Map<String, Token> tempMap = null;
            //1.50 登录缓存存储为redis
            if (platform == 2) {
                tempMap = SystemData.doctorTokens;
                //tempMap = SystemData.doctorTokens;
                token = systemDataRedis.getDoctorToken(uid);
            } else if (platform == 4) {
                tempMap = SystemData.doctorPCTokens;
                //tempMap = SystemData.doctorPCTokens;
                token = systemDataRedis.getDoctorPCToken(uid);
            }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) {
                token = tokenDao.findByPatient(uid, platform);
                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端取药系统  或者对外系统
@ -155,8 +174,17 @@ public class DoctorInterceptor extends BaseInterceptor {
                    if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
                        // 今天未更新,则更新缓存
                        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);
                    }

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

+ 44 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -2785,4 +2785,48 @@ public class ConsultTeamService extends ConsultService {
        return json;
    }
    /**
     * 返回json
     * @param sessionType
     * @param content
     * @return
     */
    public String getMessageById(String sessionType,String content,String title){
        com.alibaba.fastjson.JSONObject re = new com.alibaba.fastjson.JSONObject();
        re.put("title",title);
        content = "'"+content.replace(",","','")+"'";
        String tableName = "";
        switch (sessionType){
            case "1":
            case "8":
                tableName = "muc_messages";
                break;
            case "2":
                tableName = "p2p_messages";
                break;
            default:
                tableName = "group_messages";
                break;
        }
        String sql = "select id, session_id, sender_id, sender_name, content_type, content, timestamp from " + imdb+"."+
                tableName + " where id in("+content+") order by timestamp desc ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
        for(int i=0;i<list.size();i++){
            Map<String,Object> map = list.get(i);
            com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
            json.put("id",map.get("id"));
            json.put("session_id",map.get("session_id"));
            json.put("sender_id",map.get("sender_id"));
            json.put("sender_name",map.get("sender_name"));
            json.put("content_type",map.get("content_type"));
            json.put("content",map.get("content"));
            json.put("timestamp",map.get("timestamp"));
            ja.add(json);
        }
        re.put("list",ja);
        return re.toString();
    }
}

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceLogService.java

@ -90,10 +90,10 @@ public class PatientDeviceLogService extends BaseService {
                "  SELECT sf.name, pd.* FROM wlyy_patient_device_log pd" +
                "  LEFT JOIN wlyy_sign_family sf ON pd.patient = sf.patient" +
                "  WHERE" +
                "  pd.is_del = 1 and (sf.doctor= '" +doctor+"' or sf.doctor_health = '"+doctor+"') and sf.`status`>0"+
                "  pd.is_del = 1 and (sf.doctor= '"+doctor+"' or sf.doctor_health = '"+doctor+"') and sf.`status`>0"+
                "  ORDER BY" +
                "  create_time DESC) a" +
                " GROUP BY a.device_sn) b" +
                "  pd.create_time DESC) a" +
                " GROUP BY a.device_sn,a.patient) b" +
                " LEFT JOIN dm_device dd ON b.device_id = dd.id where 1=1 ";
        resultList = jdbcTemplate.queryForList(sql);
        resultMap.put("tatalCount",resultList.size());

+ 49 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/bank/TaskService.java

@ -187,6 +187,55 @@ public class TaskService {
        params.put("taskPatientDetail",object.toJSONString());
        try {
            response = httpClientUtil.httpPost(url,params);
            JSONObject result = JSONObject.parseObject(response);
            String status = result.getString("status");
           /* if (status.equalsIgnoreCase("200")){
                try {
                    //@TODO 获取积分调用发送微信模板接口
                    String openId = patient.getOpenid();
                    String name = patient.getName();
                    org.json.JSONObject sendJson = new org.json.JSONObject();
                    String first = "";
                    String remark = "";
                    String urlresult = "";
                    WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_healthbank_activity","bmcgtx");
                    first = templateConfig.getFirst();
                    remark = templateConfig.getRemark();
//                    String keyword1 = templateConfig.getKeyword1();
                    sendJson.put("keyword1", integrateresult);
                    sendJson.put("keyword2", DateUtil.getStringDate());
                    sendJson.put("keyword3", total);
                    sendJson.put("first", first);
                    sendJson.put("remark", remark);
                    urlresult = templateConfig.getUrl();
                    urlresult = urlresult.replace("key1",(integrateresult==null?"":integrateresult));
                    sendJson.put("url", urlresult);//带参数的模板跳转链接
                    System.out.println(sendJson.toString());
                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 23, openId, name, sendJson);
//	                    //发送代理人
//	                    jsonArray = weiXinOpenIdUtils.getAgentOpenId(patient, openId);
//	                    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");
//			                    int start = url.indexOf("&toUser=");
//			                    int end = url.indexOf("&", start + 1);
//			                    String touser = url.substring(start, end);
//			                    url = url.replace(touser, "&toUser=" + member.getCode());
//			                    //name患者姓名
//			                    sendJson.put("first", weiXinOpenIdUtils.getTitleMes(people, (int) j.get("relation"), name) + first);
//			                    sendJson.put("url", url);
//			                    pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 19, member.getOpenid(), name, sendJson);
//		                    }
//	                    }
                }catch (Exception e){
                    logger.info("健康银行居民新增积分,微信模板消息发送失败:"+e.getMessage());
//	                        e.printStackTrace();
                }
            }*/
        }catch (Exception e){
            e.printStackTrace();

+ 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
    private SignFamilyServerDao signFamilyServerDao;
    @Value("${spring.profiles}")
    private String profiles;
    public SignFamily findSignFamilyByCode(String code) {
        return signFamilyDao.findByCode(code);
    }
@ -4614,11 +4617,12 @@ public class FamilyContractService extends BaseService {
    }
    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;
    }

+ 11 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignFamilyServiceService.java

@ -229,6 +229,17 @@ public class SignFamilyServiceService {
        List<SignFamily> signFamilies = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SignFamily.class));
        return signFamilies.get(0);
    }
    
    public SignFamily getSignFamilyByPatient(String patient) {
        String sql = "select * from wlyy_sign_family s where s.patient='" + patient + "' and s.`status`>0 and s.expenses_status=1  ";
        List<SignFamily> signFamilies = jdbcTemplate.query(sql, new BeanPropertyRowMapper(SignFamily.class));
        if(signFamilies.isEmpty()){
            return null;
        }else{
            return signFamilies.get(0);
        }
        
    }
    /**
     * 给患者批量删除服务

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

@ -272,7 +272,7 @@ public class SignWebService extends BaseService {
                " from " +
                " ( select patient_apply_date,renew_flag,code,patient,doctor,status,id,apply_date,reason,begin,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len from wlyy_sign_family where (doctor = ? or doctor_health = ?)  and status > ? and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1) and (b.`name` like ? or b.mobile like ? ) "+
                " where a.patient = b.code and (a.expenses_status = '0' or a.len < 1 or a.expenses_status = '3') and (b.`name` like ? or b.mobile like ? ) "+
                "order by applyDate desc limit " + page * pageSize + "," + pageSize;
        // 已解约查询语句
@ -349,7 +349,7 @@ public class SignWebService extends BaseService {
                    " AND doctor IS NULL " +
                    " AND STATUS = 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0' " +
                    " AND (expenses_status = '0' or expenses_status = '3')" +
                    " ) AS waitSignCount, " +
                    "( " +
                    " SELECT " +
@ -384,7 +384,7 @@ public class SignWebService extends BaseService {
                    "  doctor = '"+doctor+"' " +
                    " AND STATUS = 0 " +
                    " AND type = 2 " +
                    " AND expenses_status = '0' " +
                    " AND (expenses_status = '0' or expenses_status = '3') " +
                    " ) AS waitSignCount, " +
                    "( " +
                    " SELECT " +

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

@ -6212,27 +6212,27 @@ public class StatisticsESService {
        List<SaveModel> esModelList = new ArrayList<>();
        if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
            String time = getStatisticsTime();
            String time = DateUtil.getStringDateShort();
            String sql ="SELECT" +
                    " pd.doctor team," +
                    " pd.doctor_name teamName," +
                    " COUNT(1) result1" +
                    " FROM" +
                    " wlyy_patient_device pd," +
                    " wlyy_sign_family sf" +
                    " device.wlyy_devices dw" +
                    " WHERE" +
                    " pd.user_idcard = sf.idcard" +
                    " AND sf.type = 2" +
                    " pd.device_sn = dw.device_code" +
                    " AND pd.del = 0" +
                    " AND sf. STATUS IN (1, 2)" +
                    " AND pd.czrq < '"+time+"'" +
                    " AND sf.sign_year = '"+year+"'";
                    " AND pd.category_code IN (1, 2)" +
                    " AND pd.czrq>='2018-06-30 17:00:00'"+
                    " AND pd.czrq < '"+time+" 17:00:00'" +
                    " AND LEFT(pd.czrq,4)= '"+year+"'";
            if(level==3){
                sql +=" AND LEFT(sf.hospital,6)= '"+area+"'";
                sql +=" AND LEFT(dw.grant_org_code,6)= '"+area+"'";
            }else if (level==4){
                sql +=" AND sf.hospital = '"+area+"'";
                sql +=" AND dw.grant_org_code = '"+area+"'";
            }
            sql +=" GROUP BY team,teamName";
            sql +=" GROUP BY team";
            esModelList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SaveModel.class));
        }else {
            esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(date, area, level, index, SaveModel.timeLevel_DDL, low_level);

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

@ -649,6 +649,9 @@ public class AdminTeamService extends BaseService {
            JSONObject doctorInfo = new JSONObject();
            doctorInfo.put("name",d.getName());
            doctorInfo.put("code",d.getCode());
            doctorInfo.put("dept_name",d.getDeptName());
            doctorInfo.put("job_name",d.getJobName());
            doctorInfo.put("photo",d.getPhoto());
            doctors.add(doctorInfo);
        }
        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.SignFamilyDao;
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.json.JSONArray;
import org.json.JSONObject;
@ -60,6 +57,8 @@ public class PatientService extends TokenService {
    TokenDao tokenDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    private SystemDataRedis systemDataRedis;
    private Clock clock = Clock.DEFAULT;
    //可续签月份
@ -122,9 +121,11 @@ public class PatientService extends TokenService {
            for (Token token : tokens) {
                i++;
                Patient p = patientDao.findByCode(token.getUser());
                //1.5.0 redis token
                if (p == null || i <= last) {
                    tokenDao.delete(token);
                    SystemData.patientTokens.remove(token.getUser());
                    systemDataRedis.delToken(SystemDataRedis.patientTokens,token.getUser());
                    //SystemData.patientTokens.remove(token.getUser());
                    continue;
                }
//                p.setOpenid("");
@ -132,7 +133,9 @@ public class PatientService extends TokenService {
                signFamilyDao.updateOpenidByPatient("", p.getCode());
                patientDao.save(p);
                tokenDao.delete(token);
                SystemData.patientTokens.remove(p.getCode());
                systemDataRedis.delToken(SystemDataRedis.patientTokens,token.getUser());
//                SystemData.patientTokens.remove(p.getCode());
                break;
            }
        }
@ -1145,7 +1148,10 @@ public class PatientService extends TokenService {
            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);
        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.MD5;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemDataRedis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -21,6 +22,8 @@ public class TokenService extends BaseService {
	public TokenDao tokenDao;
	@Autowired
	private PatientDao patientDao;
	@Autowired
	private SystemDataRedis systemDataRedis;
	/**
	 * 生成token
@ -56,14 +59,19 @@ public class TokenService extends BaseService {
			throw new Exception("Token生成失败");
		}
		// 更新token缓存
		//1.5.0 更新redis token缓存
		if (platform == 3) {
			SystemData.patientTokens.put(user, token);
			systemDataRedis.setPatientToken(token);
			//SystemData.patientTokens.put(user, token);
		} else if (platform == 2) {
			SystemData.doctorTokens.put(user, token);
			systemDataRedis.setDoctorToken(token);
			//SystemData.doctorTokens.put(user, token);
		}else if(platform == 4){
			SystemData.doctorPCTokens.put(user,token);
			systemDataRedis.setDoctorPCToken(token);
			//SystemData.doctorPCTokens.put(user,token);
		}else if(platform == 5){
			SystemData.doctorWXTokens.put(user,token);
			systemDataRedis.setDoctorWXToken(token);
			//SystemData.doctorWXTokens.put(user,token);
		}
		return token;
	}
@ -89,8 +97,10 @@ public class TokenService extends BaseService {
		if (token == null) {
			throw new Exception("Token生成失败");
		}
		//1.5.0 redis token
		// 更新token缓存
		SystemData.patientTokens.put(user, token);
		//SystemData.patientTokens.put(user, token);
		systemDataRedis.setPatientToken(token);
		return token;
	}
@ -103,11 +113,14 @@ public class TokenService extends BaseService {
	public void delToken(int platform, String uid) throws Exception {
		// 删除老的token
		tokenDao.deleteByUser(uid);
		// 更新token缓存
		// 1.5.0 更新token缓存 redis
		if (platform == 3) {
			SystemData.patientTokens.remove(uid);
			//1.5.0 删除居民Token
			systemDataRedis.delToken(SystemDataRedis.patientTokens,uid);
			//SystemData.patientTokens.remove(uid);
		} else if (platform == 2) {
			SystemData.doctorTokens.remove(uid);
			systemDataRedis.delToken(SystemDataRedis.doctorTokens,uid);
			//SystemData.doctorTokens.remove(uid);
		}
	}

+ 52 - 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.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.http.HttpResponse;
@ -81,6 +82,8 @@ public class SpecialistService extends BaseService {
    private PushMsgTask pushMsgTask;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private AdminTeamService memberService;
    public String setPatientLabelInfo(List<SignPatientLabelInfo> list) {
        if (list != null && list.size() > 0) {
@ -621,6 +624,12 @@ public class SpecialistService extends BaseService {
            JSONObject json = rs.getJSONObject("obj");
            List<PatientDiseaseServer> patientDiseaseServers =  patientDiseaseServerDao.findBySpecialistRelationCodeAndDel(code,"1");
            json.put("diseaseServer",patientDiseaseServers);
            
            //根据团队ID获取医生列表
            Long teamCode = json.getLong("teamCode");
            List<Doctor> members = memberService.getMembers(teamCode);
            json.put("doctors",members);
            
            return json;
        }
        return null;
@ -749,5 +758,48 @@ public class SpecialistService extends BaseService {
        }
        return false;
    }
    
    public JSONArray findDoctorAndDoctorHealthBySpecialDoctor(String doctor) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("doctor", doctor);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findDoctorAndDoctorHealthBySpecialDoctor", param);
        if(StringUtils.isNotBlank(response.getContent())) {
            JSONObject rs = new JSONObject(response.getContent());
            if ("succes".equals(rs.getString("message"))) {
                return rs.getJSONArray("obj");
            }
        }
        return null;
    }
	
	public Long findSpecialistSignFamilyPatientCout(String specialdoctor, String familydoctor)throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("specialdoctor", specialdoctor);
        param.put("familydoctor", familydoctor);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/findSpecialistSignFamilyPatientCout", param);
        if(StringUtils.isNotBlank(response.getContent())) {
            JSONObject rs = new JSONObject(response.getContent());
            if ("succes".equals(rs.getString("message"))) {
                return rs.getLong("obj");
            }
        }
        return 0L;
	}
    
    public JSONArray getSpecialistSignFamilyPatientByName(String specialdoctor, String familydoctor, String nameKey, Integer page, Integer size) throws Exception{
    
        Map<String, Object> param = new HashedMap();
        param.put("specialdoctor", specialdoctor);
        param.put("familydoctor", familydoctor);
        param.put("nameKey", nameKey);
        param.put("page", page);
        param.put("size", size);
        HttpResponse response = HttpUtils.doGet(specialistUrl + "svr-specialist/getSpecialistSignFamilyPatientByName", param);
        JSONObject rs = new JSONObject(response.getContent());
        if ("succes".equals(rs.getString("message"))) {
            return rs.getJSONArray("obj");
        }
        return null;
    }
}

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java

@ -760,4 +760,20 @@ public class ImmuneService {
			throw new Exception("获取免疫接种机构列表息失败!");
		}
	}
	/**
	 * 计免:获取计划免疫接种记录
	 * @param barcode 新生儿条码
	 * @return
	 * @throws Exception
	 */
	public String findWzymBymykh(String barcode) throws Exception{
		String url = jwUrl + "/third/jm/imm/findWzymBymykh";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("barCode", barcode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		return response;
	}
}

+ 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 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.service.BaseService;
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.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
@ -138,6 +139,7 @@ public class AppletsService extends BaseService {
            patientAimSports.setDailyStepCount(step);
            patientAimSports.setCreateTime(new Date());
            patientAimSports.setPatientcode(patient);
            patientAimSports.setCreateDate(DateUtil.getStringDateShort());
            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) {
//                //签约人Code
                String signDoctorCode = signFamily.getSignDoctorCode();
                String doctorCode = signFamily.getDoctor();
                String people = signFamily.getPatient();
                Doctor doctor = doctorDao.findByCode(signDoctorCode);
                Doctor doctor = doctorDao.findByCode(doctorCode);
                Patient user = patientDao.findByCode(people);
    
                JSONObject familyContent =  new JSONObject();
@ -342,17 +342,17 @@ public class OnePayService {
                familyContent.put("moRegTelephone", user.getMobile());//签约人联系电话
                familyContent.put("moRegOrgNo", sbCode); //签约机构 限长4
                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(new Date())); //签约时间 v1.4.0更改
                familyContent.put("moRegEndTime", format.format(signFamily.getEnd())); //签约截止时间
                familyContent.put("moRegTear", signFamily.getSignYear());//签约年度
                familyContent.put("moRegSource", signFamily.getSignSource()); //签约来源
                familyContent.put("moCollectOrgNo", sbCode); //扣费机构 签约机构
                familyContent.put("moCollectorNo", signFamily.getSignDoctorName());//扣费人 签约医生姓名
                familyContent.put("moCollectorNo", signFamily.getDoctorName());//扣费人 签约医生姓名
                familyContent.put("benefitType", signFamily.getExpensesType()); //补贴类型
                familyContent.put("moBookOrgNo", sbCode);//登记机构 签约机构
                familyContent.put("moBookerNo", signFamily.getSignDoctorName()); //登记人 签约医生姓名
                familyContent.put("moBookerNo", signFamily.getDoctorName()); //登记人 签约医生姓名
                familyContent.put("moBookTime", format.format(signFamily.getBegin())); //登记时间 签约时间
    
                JSONObject moServiceType = new JSONObject();//服务类型

+ 42 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ImUtill.java

@ -17,6 +17,48 @@ public class ImUtill {
    @Value("${im.im_list_get}")
    private String im_host;
    public enum ContentType {
        plainText("信息", "1"),
        image("图片信息", "2"),
        audio("创建处方", "3"),
        article("文章信息", "4"),
        goTo("跳转信息,求组其他医生或者邀请其他医生发送的推送消息", "5"),
        topicBegin("议题开始", "6"),
        topicEnd("议题结束", "7"),
        personalCard("个人名片", "18"),
        messageForward("消息转发", "19"),
        topicInto("进入议题", "14"),
        video("视频", "12"),
        system("系统消息", "13"),
        prescriptionCheck("续方审核消息消息", "15"),
        prescriptionBloodStatus("续方咨询血糖血压咨询消息", "16"),
        prescriptionFollowupContent("续方咨询随访问卷消息", "17");
        private String name;
        private String value;
        ContentType(String name, String value) {
            this.name = name;
            this.value = value;
        }
        public String getName() {
            return name;
        }
        public void setName(String name) {
            this.name = name;
        }
        public String getValue() {
            return value;
        }
        public void setValue(String value) {
            this.value = value;
        }
    }
    /**
     * 获取医生统计数据
     * status reply 为空值是是该医生总咨询量

+ 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.TokenService;
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 io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
@ -75,6 +72,9 @@ public class LoginController extends BaseController {
    @Autowired
    private DoctorInfoService doctorInfoService;
    @Autowired
    private SystemDataRedis systemDataRedis;
    /**
     * 公钥生成并返回接口
@ -438,13 +438,15 @@ public class LoginController extends BaseController {
                // response.getWriter().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!"));
                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) {
                token = tokenDao.findByToken(tokenStr);
                if (token != null) {
                    // 加入缓存
                    SystemData.doctorTokens.put(uid, token);
                    systemDataRedis.setDoctorToken(token);
                    //SystemData.doctorTokens.put(uid, token);
                }
            }
            if (token == null || token.getPlatform() != 2) {
@ -466,7 +468,8 @@ public class LoginController extends BaseController {
                        // 今天未更新,则更新缓存
                        token.setCzrq(new Date());
                        // 更新内存
                        SystemData.doctorTokens.put(uid, token);
                        systemDataRedis.setDoctorToken(token);
                        //SystemData.doctorTokens.put(uid, 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.util.SpringUtil;
import com.yihu.wlyy.util.SystemData;
import com.yihu.wlyy.util.SystemDataRedis;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -50,6 +51,8 @@ public class ManagerUtilController extends BaseController {
    JdbcTemplate jdbcTemplate;
    @Autowired
    ConsultTeamDoctorDao consultTeamDoctorDao;
    @Autowired
    SystemDataRedis systemDataRedis;
    /*********************************************患者疾病相关******************************************/
    /**
@ -268,9 +271,12 @@ public class ManagerUtilController extends BaseController {
    public String online_num() {
        try {
            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);
        } catch (Exception e) {
            error(e);

+ 64 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -8,9 +8,11 @@ import com.yihu.wlyy.entity.discussion.WlyyTalkGroup;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroupMember;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamilyServer;
import com.yihu.wlyy.entity.patient.prescription.Prescription;
import com.yihu.wlyy.repository.consult.ConsultDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.patient.SignFamilyServerDao;
import com.yihu.wlyy.repository.prescription.PrescriptionDao;
import com.yihu.wlyy.service.app.account.DoctorInfoService;
@ -34,11 +36,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -48,7 +46,7 @@ import java.util.Map;
 *
 * @author George
 */
@Controller
@RestController
@RequestMapping(value = "/doctor/consult", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "三师咨询")
public class DoctorConsultController extends WeixinBaseController {
@ -70,7 +68,7 @@ public class DoctorConsultController extends WeixinBaseController {
    @Autowired
    private CommonUtil CommonUtil;
    @Autowired
    private ImUtill ImUtill;
    private ImUtill imUtill;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
@ -83,6 +81,8 @@ public class DoctorConsultController extends WeixinBaseController {
    private PrescriptionDiagnosisService prescriptionDiagnosisService;
    @Autowired
    private FollowUpService followUpService;
    @Autowired
    private SignFamilyDao signFamilyDao;
    /**
     * 三师咨询列表查询
@ -1113,7 +1113,7 @@ public class DoctorConsultController extends WeixinBaseController {
            if (consultModel == null) {
                return error(-1, "咨询记录不存在!");
            }
            JSONObject messageObj = ImUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getUID());
            JSONObject messageObj = imUtill.getTopicMessage(consultModel.getConsult(), consultModel.getStartMsgId(), consultModel.getEndMsgId(), page, pagesize, getUID());
            return write(200, "查询成功", "list", messageObj);
        } catch (Exception e) {
            error(e);
@ -1215,4 +1215,60 @@ public class DoctorConsultController extends WeixinBaseController {
            return error(-1,"获取失败");
        }
    }
    @RequestMapping(value = "sendBusinessCard",method = RequestMethod.POST)
    @ApiOperation("发送居民的名片")
    public String sendBusinessCard(@ApiParam(name = "patient", value = "居民code", defaultValue = "")
                                   @RequestParam(value = "patient", required = true) String patient,
                                   @ApiParam(name = "sessionId", value = "会话id", defaultValue = "")
                                   @RequestParam(value = "sessionId", required = true) String sessionId,
                                   @ApiParam(name = "businessType", value = "businessType", defaultValue = "1")
                                   @RequestParam(value = "businessType", required = true) String businessType){
        try {
            String doctorCode = getUID();
            Doctor doctor = doctorService.findDoctorByCode(doctorCode);
            Patient p = patientService.findByCode(patient);
            com.alibaba.fastjson.JSONObject content = new com.alibaba.fastjson.JSONObject();
            content.put("name",p.getName());
            content.put("patient",patient);
            content.put("photo",p.getPhoto());
            content.put("age",IdCardUtil.getAgeForIdcard(p.getIdcard()));
            content.put("sex",IdCardUtil.getSexForIdcard(p.getIdcard()));
            SignFamily signFamily = signFamilyDao.findByPatient(patient);
            if(signFamily!=null){
                content.put("hospitalName",signFamily.getHospitalName());
            }
            imUtill.sendImMsg(doctorCode,doctor.getName(),sessionId,ImUtill.ContentType.personalCard.getValue(),content.toString(),businessType);
            return success("发送成功");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"发送失败");
        }
    }
    @RequestMapping(value = "messageForward",method = RequestMethod.POST)
    @ApiOperation("请求转发消息")
    public String messageForward(@ApiParam(name = "senderId", value = "发送者id", defaultValue = "")
                                     @RequestParam(value = "senderId", required = true) String senderId,
                                 @ApiParam(name = "senderName", value = "发送者姓名", defaultValue = "")
                                     @RequestParam(value = "senderName", required = true) String senderName,
                                 @ApiParam(name = "sessionId", value = "会话id", defaultValue = "")
                                     @RequestParam(value = "sessionId", required = true) String sessionId,
                                 @ApiParam(name = "content", value = "会话内容", defaultValue = "")
                                     @RequestParam(value = "content", required = true) String content,
                                 @ApiParam(name = "title", value = "会话标题", defaultValue = "")
                                     @RequestParam(value = "title", required = true) String title,
                                 @ApiParam(name = "sessionType", value = "原会话的会话类型", defaultValue = "")
                                     @RequestParam(value = "sessionType", required = true) String sessionType,
                                 @ApiParam(name = "businessType", value = "businessType", defaultValue = "1")
                                     @RequestParam(value = "businessType", required = true) String businessType){
        try{
            String message = consultTeamService.getMessageById(sessionType,content,title);
            imUtill.sendImMsg(senderId,senderName,sessionId,ImUtill.ContentType.messageForward.getValue(),message,businessType);
            return success("发送成功");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"发送失败");
        }
    }
}

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

@ -122,8 +122,19 @@ public class DoctorDeviceController extends BaseController {
			PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
			// 设置操作医生标识
			device.setDoctor(getUID());
			Doctor doctor = doctorService.findDoctorByCode(getUID());
			if (doctor!=null){
				device.setDoctorName(doctor.getName());
			}
			//首绑和设备类型判断  判断是否可以增加积分
			Map<String,Object> checkMap = patientDeviceService.checkBindingFirstAndType(device);
			boolean flag = (Boolean)checkMap.get("flag");
			//绑定
			patientDeviceService.saveDevice(device);
			patientDeviceLogService.savePatientDeviceLog(device,device.getDeviceSn(),1,1);
			//修改设备表中{"1":"0", "2":"0"}绑定次数 和其他绑定信息,
			deviceDetailService.updateAfterBinding(device,new Date(),flag);
			return success("设备保存成功!");
		}

+ 21 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java

@ -1,9 +1,11 @@
package com.yihu.wlyy.web.doctor.imm;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfoVO;
import com.yihu.wlyy.service.imm.ChildFamilyImmuneService;
import com.yihu.wlyy.service.imm.ChildInfoService;
import com.yihu.wlyy.service.third.guahao.ImmuneService;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -14,10 +16,7 @@ import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -35,6 +34,8 @@ public class DoctorImmController extends BaseController {
	private ChildFamilyImmuneService childFamilyImmuneService;
	@Autowired
	private ChildInfoService childInfoService;
	@Autowired
	private ImmuneService immuneService;
	
	/**
	 * 家庭免疫成员查询
@ -160,6 +161,21 @@ public class DoctorImmController extends BaseController {
			return error(-1, "查询失败");
		}
	}
	
	@RequestMapping(value = "/imm/findWzymBymykh", method = RequestMethod.GET)
	@ResponseBody
	@ObserverRequired
	@ApiOperation("计免:获取计划免疫接种记录")
	public String findWzymBymykh (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "0052248552")
								  @RequestParam(value = "barCode", required = true) String barCode){
		try{
			String re = immuneService.findWzymBymykh(barCode);
			return write(200, "查询成功","data",re);
		}catch (Exception e){
			error(e);
			return error(-1, e.getMessage());
		}
	}
	
}

+ 41 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/specialist/SpecialistController.java

@ -312,5 +312,46 @@ public class SpecialistController extends WeixinBaseController {
            return error(-1, "请求失败");
        }
    }
    
    @RequestMapping(value = "/findDoctorAndDoctorHealthBySpecialDoctor", method = RequestMethod.GET)
    @ApiOperation(value = "获取当前专科医生有关联的家庭医生和健管师列表")
    public String findDoctorAndDoctorHealthBySpecialDoctor(
            @ApiParam(name = "doctor", value = "专科医生code") @RequestParam(required = true)String doctor){
        try {
            return write(200, "获取成功", "data", specialistService.findDoctorAndDoctorHealthBySpecialDoctor(doctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    
    @RequestMapping(value = "/findSpecialistSignFamilyPatientCout", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科医生家庭医生共管居民数目")
    public String findSpecialistSignFamilyPatientCout(
            @ApiParam(name = "specialdoctor", value = "专科医生") @RequestParam(required = true)String specialdoctor,
            @ApiParam(name = "familydoctor", value = "家庭医生") @RequestParam(required = true)String familydoctor) {
        try {
            return write(200, "获取成功", "data", specialistService.findSpecialistSignFamilyPatientCout(specialdoctor,familydoctor));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    
    @RequestMapping(value = "/getSpecialistSignFamilyPatientByName", method = RequestMethod.GET)
    @ApiOperation(value = "搜索专科医生家庭医生共管居民")
    public String getSpecialistSignFamilyPatientByName(
            @ApiParam(name = "specialdoctor", value = "专科医生") @RequestParam(required = true)String specialdoctor,
            @ApiParam(name = "familydoctor", value = "家庭医生") @RequestParam(required = true)String familydoctor,
            @ApiParam(name = "nameKey", value = "居民姓名模糊") @RequestParam(required = false)String nameKey,
            @ApiParam(name = "page", value = "第几页,1开始") @RequestParam(required = true)Integer page,
            @ApiParam(name = "size", value = "每页大小") @RequestParam(required = true)Integer size) {
        try {
            return write(200, "获取成功", "data", specialistService.getSpecialistSignFamilyPatientByName(specialdoctor,familydoctor,nameKey,page,size));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 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;
    @Autowired
    private RSAUtils rsaUtils;
    @Autowired
    private SystemDataRedis systemDataRedis;
    /**
     * 患者基本信息查询接口
@ -393,7 +395,10 @@ public class PatientController extends WeixinBaseController {
            } else {
                //patient.setOpenid("");
                //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) {
                    token = tokenDao.findByPatient(getUID(), 3);
                }
@ -404,7 +409,10 @@ public class PatientController extends WeixinBaseController {
                token.setDel("0");
                tokenDao.save(token);
                SystemData.patientTokens.remove(getUID());
                systemDataRedis.delToken(SystemDataRedis.patientTokens,getUID());
//                SystemData.patientTokens.remove(getUID());
                //清空患者的微信标签
                weiXinTagUtil.deleteTagWithOpenid(patient.getOpenid(),patient.getWxtagid());
                patient.setIsWxtag(Patient.isWchatTage.no.getValue());

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java

@ -612,6 +612,22 @@ public class PatientBookingController extends WeixinBaseController{
        }
        return json;
    }
    @RequestMapping(value = "/imm/findWzymBymykh", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取计划免疫接种记录")
    public String findWzymBymykh (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "0052248552")
                                   @RequestParam(value = "barCode", required = true) String barCode){
        try{
            String re = immuneService.findWzymBymykh(barCode);
            return write(200, "查询成功","data",re);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    /**
     *-----------------计划免疫预约相关接口--------------END

+ 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.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
@ -62,6 +63,7 @@ public class FamilyContractController extends WeixinBaseController {
    private RSAUtils rsaUtils;
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 得到患者的签约的医生的信息
     *

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -591,7 +591,7 @@ public class EsStatisticsController extends BaseController {
                        result.put("index_" + idx, statisticsESService.getLowLevelTotalTeamLeader(date, area, level, idx, sort, lowLevel, year));
                    } else if (idx.equals("72")) {
                        result.put("index_" + idx, statisticsESService.getLowLevelTotalOnlineTeamLeader(date, area, level, idx, sort, lowLevel, year, ""));
                    }else if (idx.equals("20")){
                    }else if (idx.equals("20") && Integer.valueOf(year)>=2018){
                        result.put("index_" + idx, statisticsESService.getDeviceLowLevelTotal(date, area, level, idx, sort, lowLevel, year));
                    }else {
                        result.put("index_" + idx, statisticsESService.getLowLevelTotal(date, area, level, idx, sort, lowLevel, year));

+ 14 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/specialist/ThirdSpecialistController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.third.specialist;
import com.yihu.wlyy.service.app.sign.SignFamilyServiceService;
import com.yihu.wlyy.service.specialist.SpecialistService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -22,6 +23,8 @@ public class ThirdSpecialistController extends BaseController{
    @Autowired
    private SpecialistService specialistService;
    @Autowired
    private SignFamilyServiceService signFamilyServiceService;
    @RequestMapping(value = "/findSpecialistTeamInfo", method = RequestMethod.GET)
    @ApiOperation(value = "获取专科医生所在团队信息")
@ -45,4 +48,15 @@ public class ThirdSpecialistController extends BaseController{
            return error(-1, "请求失败");
        }
    }
    
    @RequestMapping(value = "/getPatientSignInfo", method = RequestMethod.GET)
    @ApiOperation(value = "获取团队专病服务信息")
    public String getPatientSignInfo(@ApiParam(name = "patient", value = "居民CODE") @RequestParam(required = true)String patient) {
        try {
            return write(200, "获取成功", "data", signFamilyServiceService.getSignFamilyByPatient(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

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

@ -37,7 +37,7 @@ im:
#专病配置
specialist:
  url: http://172.19.103.33:9797/svr-wlyy-specialist
  url: http://172.19.103.33:9797/svr-wlyy-specialist/
#  url: http://localhost:10051/
#物联网配置
iot: