ソースを参照

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

humingfen 6 年 前
コミット
81ddc81c93
17 ファイル変更376 行追加110 行削除
  1. 56 9
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java
  2. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java
  3. 189 35
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  4. 9 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java
  5. 3 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/PatientHealthIndexDao.java
  6. 17 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/util/DateUtil.java
  7. 12 5
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  8. 8 2
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/IotDeviceService.java
  9. 17 17
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/FamilyDao.java
  10. 23 19
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java
  11. 2 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml
  12. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/jkedu/repository/JkeduArticleDao.java
  13. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java
  14. 14 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java
  15. 11 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  16. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java
  17. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/message/GcOtherMessageController.java

+ 56 - 9
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java

@ -18,6 +18,7 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@ -28,7 +29,7 @@ import java.util.Map;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
@RestController
@Controller
@RequestMapping(value = "/synergy/customer", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "集美客服系统")
public class CustomerSynergyManageController extends BaseController {
@ -50,6 +51,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/getWorkOrderInfo", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "获取协同服务工单信息")
    @ResponseBody
    public String getWorkOrderInfo(@ApiParam(name="workorderCode",value="协同服务工单code")
                                @RequestParam(required = true)String workorderCode,
                                @ApiParam(name="patient",value="居民code")
@ -66,6 +68,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/dealWorkOrder",method = RequestMethod.POST)
    @ApiOperation(value = "处理协同服务")
    @ResponseBody
    public String dealWorkOrder(@ApiParam(name="code",value="协同服务工单code")
                                    @RequestParam(required = true)String code,
                                @ApiParam(name="jsonData",value="接收负责人或者退回理由")
@ -87,6 +90,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/getCustomers", method = RequestMethod.GET)
    @ApiOperation(value = "获取客服列表")
    @ResponseBody
    public String getCustomers(){
        try {
            List<User> list = synergyManageService.getCustomers();
@ -100,6 +104,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/labels", method = RequestMethod.GET)
    @ApiOperation("根据分组类型查找标签")
    @ResponseBody
    public String labels(
            @ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true)
            @RequestParam(value = "labelType", required = true) String labelType) {
@ -113,6 +118,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/unitLabels", method = RequestMethod.GET)
    @ApiOperation("根据地区查找卫计委下属单位标签")
    @ResponseBody
    public String unitLabels(@ApiParam(name = "currentRoleCode", value = "地点对应的code")
                             @RequestParam(value = "currentRoleCode", required = true) String currentRoleCode,
                             @ApiParam(name = "currentRoleLevel", value = "1省2城市3区县", required = false)
@ -127,6 +133,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "workorderList", method = RequestMethod.GET)
    @ApiOperation("客服系统-协同服务列表")
    @ResponseBody
    public String workorderList(@ApiParam(name = "userCode", value = "客服code", required = false)
                                @RequestParam(value = "userCode", required = false)String userCode,
                                @ApiParam(name = "keywords", value = "输入医生姓名、姓名、社保卡、身份证号码", required = false)
@ -182,6 +189,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/takeWorkorderNum", method = RequestMethod.GET)
    @ApiOperation(value = "获取协同服务取号信息")
    @ResponseBody
    public String takeWorkorderNum(@ApiParam(name="workorderCode",value="协同服务工单code",required = false)
                                @RequestParam(required = true)String workorderCode,
                                @ApiParam(name="townCode",value="所属区县",required = false)
@ -208,6 +216,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/reminderList", method = RequestMethod.GET)
    @ApiOperation(value = "获取催单列表")
    @ResponseBody
    public String reminderList(@ApiParam(name="userCode",value="客服code",required = false)
                               @RequestParam(required = false)String userCode,
                               @ApiParam(name="receiveType",value="客服角色(1、客服,2、客服管理员)",required = false)
@ -233,6 +242,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/workorderRate", method = RequestMethod.GET)
    @ApiOperation(value = "任务进度")
    @ResponseBody
    public String workorderRate(@ApiParam(name="userCode",value="客服code",required = false)
                                @RequestParam(required = false)String userCode,
                                @ApiParam(name="workorderCode",value="协同服务工单code",required = true)
@ -252,6 +262,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "getCallLabelList",method = RequestMethod.GET)
    @ApiOperation(value = "显示所有通话标签")
    @ResponseBody
    public String getCallLabelList(){
        try{
            String sql ="SELECT `code`,`value`,sort FROM system_dict WHERE dict_name='"+CALL_LABEL+"'";
@ -264,6 +275,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "saveCallLabel",method = RequestMethod.POST)
    @ApiOperation(value = "保存所有通话标签")
    @ResponseBody
    public String saveCallLabel(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value = "callCode")String callCode,
                                @ApiParam(name="callLabels",value="通话标签,多个用逗号隔开")@RequestParam(value = "callLabels",required = false)String callLabels){
        try{
@ -281,6 +293,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "getCallInfo",method = RequestMethod.GET)
    @ApiOperation(value = "获取通话的详情")
    @ResponseBody
    public String getCallTypeAndContent(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value ="callCode")String callCode){
        try{
            CallRecord callRecord = callRecordDao.findByCode(callCode);
@ -293,6 +306,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "saveCallInfo",method = RequestMethod.POST)
    @ApiOperation(value = "保存通话记录详情")
    @ResponseBody
    public String saveCallInfo(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value ="callCode")String callCode,
                                @ApiParam(name="serviceType",value="服务类型,多个用逗号隔开")@RequestParam(value = "serviceType",required = false)String serviceType,
                               @ApiParam(name="serviceContent",value="服务记录")@RequestParam(value = "serviceContent",required = false)String serviceContent){
@ -311,15 +325,20 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/taskSubmit", method = RequestMethod.POST)
    @ApiOperation(value = "协同任务提交")
    public String taskSubmit(@ApiParam(name="workorderCode",value="协同服务工单code",required = true)
    @ResponseBody
    public String taskSubmit(@ApiParam(name="userCode",value="客服code",required = false)
                             @RequestParam(required = false)String userCode,
                             @ApiParam(name="workorderCode",value="协同服务工单code",required = true)
                             @RequestParam(required = true)String workorderCode,
                             @ApiParam(name="dealResultRemark",value="说明",required = false)
                             @RequestParam(required = false)String dealResultRemark,
                             @ApiParam(name="accessoryJson",value="附件的json",required = true)
                             @RequestParam(required = true)String accessoryJson){
        try{
            synergyManageService.taskSubmit(workorderCode,dealResultRemark,accessoryJson);
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            synergyManageService.taskSubmit(userCode,workorderCode,dealResultRemark,accessoryJson);
            return write(200,"提交成功");
        }catch (Exception e){
            error(e);
@ -329,13 +348,15 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "/createServicerLog",method = RequestMethod.POST)
    @ApiOperation(value = "添加协同服务日志")
    @ResponseBody
    public String dealWorkOrder(@ApiParam(name="servicerLogDO",value="协同服务日志")
                                @RequestParam(name = "servicerLogDO",required = true)String servicerLogDO){
        try {
            ManageSynergyWorkorderServicerLogDO synergyWorkorderServicerLogDO = objectMapper.readValue(servicerLogDO,ManageSynergyWorkorderServicerLogDO.class);
            synergyWorkorderServicerLogService.create(synergyWorkorderServicerLogDO);
            synergyWorkorderServicerLogService.create(synergyWorkorderServicerLogDO,getUID());
            return write(200,"保存成功");
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
@ -344,6 +365,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "getDealList",method = RequestMethod.GET)
    @ApiOperation(value = "通话详情获取待办事项")
    @ResponseBody
    public String getDealList(@ApiParam(name="idcard",value="居民身份证")@RequestParam(value ="idcard")String idcard){
        try{
@ -392,6 +414,7 @@ public class CustomerSynergyManageController extends BaseController {
     */
    @RequestMapping(value = "/findDictByName", method = RequestMethod.GET)
    @ApiOperation(value = "药品列表")
    @ResponseBody
    public String findDictByName(@ApiParam(name = "name", value = "药品名称(中文或拼音首字母查询)", defaultValue = "胰岛素")
                                 @RequestParam(value = "name", required = false) String name,
                                 @ApiParam(name = "isinsulin", value = "是否过滤胰岛素:1非胰岛素,2胰岛素", defaultValue = "")
@ -470,6 +493,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "customerIndex",method = RequestMethod.GET)
    @ApiOperation(value = "客服首页")
    @ResponseBody
    public String customerIndex(@ApiParam(name="userCode",value="客服code")@RequestParam(value ="userCode")String userCode){
        try{
            return write(200,"获取成功!","data",synergyManageService.customerIndex(userCode));
@ -479,9 +503,9 @@ public class CustomerSynergyManageController extends BaseController {
        }
    }
    @RequestMapping(value = "exportWorkorder", method = RequestMethod.GET,produces = "application/json;charset=UTF-8")
    @RequestMapping(value = "exportWorkorder", method = RequestMethod.GET)
    @ApiOperation("客服系统-协同服务列表")
    public String exportWorkorder(@ApiParam(name = "userCode", value = "客服code", required = false)
    public void exportWorkorder(@ApiParam(name = "userCode", value = "客服code", required = false)
                                @RequestParam(value = "userCode", required = false)String userCode,
                                @ApiParam(name = "keywords", value = "输入医生姓名、姓名、社保卡、身份证号码", required = false)
                                @RequestParam(value = "keywords", required = false)String keywords,
@ -525,15 +549,14 @@ public class CustomerSynergyManageController extends BaseController {
            synergyManageService.exportWorkorder(userCode,keywords,workorderType,
                    isMyTask,status,priority,timeout,workorderCode,principal,serviceStartTime,serviceEndTime,
                    patientName,ssc,idcard,userType,isAcceptTask,userName,hospitalName,response);
            return write(200, "获取成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/addWorkorderCustomerLog", method = RequestMethod.POST)
    @ApiOperation(value = "添加客户操作记录")
    @ResponseBody
    public String addWorkorderCustomerLog(@ApiParam(name="workorderCode",value="协同服务工单code",required = true)
                             @RequestParam(required = true)String workorderCode,
                             @ApiParam(name="workorderServiceCode",value="协同服务工单的服务对象code",required = true)
@ -558,6 +581,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "adminIndex",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页.")
    @ResponseBody
    public String adminIndex(){
        try{
            return write(200,"获取成功!","data",synergyManageService.adminIndex());
@ -569,6 +593,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "intervalOnLine",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页-今日在线服务趋势")
    @ResponseBody
    public String intervalOnLine(){
        try{
            return write(200,"获取成功!","data",synergyManageService.intervalOnLine());
@ -580,6 +605,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "TodayCustomerActivy",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页-客服今日活动")
    @ResponseBody
    public String TodayCustomerActivy(){
        try{
            return write(200,"获取成功!","data",synergyManageService.TodayCustomerActivy());
@ -591,6 +617,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "uploadAccessory",method = RequestMethod.POST)
    @ApiOperation(value = "上传附件")
    @ResponseBody
    public String uploadAccessory(HttpServletRequest request){
        try{
            Map<String,Object> map = synergyManageService.uploadAccessory(request);
@ -603,6 +630,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "accessoryList",method = RequestMethod.GET)
    @ApiOperation(value = "获取附件")
    @ResponseBody
    public String accessoryList(@ApiParam(name="workorderCode",value="协同服务code",required = true)
                                 @RequestParam(required = true)String workorderCode){
        try{
@ -616,6 +644,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "deleteFile",method = RequestMethod.POST)
    @ApiOperation(value = "删除附件")
    @ResponseBody
    public String deleteFile(@ApiParam(name="storagePath",value="文件的全部路径 如:group1/M00/00/00/wKgRsVjtwpSAXGwkAAAweEAzRjw471.jpg",required = true)
                             @RequestParam(required = true)String storagePath){
        try{
@ -629,6 +658,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "getArticalById",method = RequestMethod.GET)
    @ApiOperation(value = "获取健康文章详情")
    @ResponseBody
    public String getArticalById(@ApiParam(name="articalId",value="文章id",required = true)
                             @RequestParam(required = true)String articalId){
        try{
@ -642,6 +672,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "deleteWorkorder",method = RequestMethod.POST)
    @ApiOperation(value = "删除工单")
    @ResponseBody
    public String deleteWorkorder(@ApiParam(name="workorderCode",value="工单code",required = true)
                                 @RequestParam(required = true)String workorderCode){
        try{
@ -652,5 +683,21 @@ public class CustomerSynergyManageController extends BaseController {
            return write(-1,"删除失败!");
        }
    }
    @RequestMapping(value = "/getTaskByIdcard", method = RequestMethod.GET)
    @ApiOperation(value = "根据身份证号获取协同服务居民信息")
    @ResponseBody
    public String takeWorkorderNum(@ApiParam(name="workorderCode",value="协同服务工单code",required = true)
                                   @RequestParam(required = true)String workorderCode,
                                   @ApiParam(name="idcard",value="身份证号",required = true)
                                   @RequestParam(required = true)String idcard){
        try {
            Map<String,Object> resultMap = synergyManageService.getTaskByIdcard(workorderCode,idcard);
            return write(200,"获取成功","data", resultMap);
        }catch (Exception e){
            error(e);
            return error(-1,"获取失败");
        }
    }
}

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java

@ -31,4 +31,8 @@ public interface ManageSynergyWorkorderServicerDao extends PagingAndSortingRepos
    ManageSynergyWorkorderServicerDO findByCode(String code);
    List<ManageSynergyWorkorderServicerDO> findByWorkorderCode(String workorderCode);
    @Modifying
    @Query("update ManageSynergyWorkorderServicerDO s set s.executorCode = ?2,s.executorName=?3,s.executorType=?4 where s.workorderCode = ?1 and s.executorCode is not null")
    Integer updateWorkorderServicer(String workorderCode,String userCode,String userName,Integer userType);
}

+ 189 - 35
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -456,20 +456,35 @@ public class SynergyManageService extends BaseJpaService {
            whereSql+=" and s.hospital='"+hospitalCode+"' ";
        }
        String labelSql ="";
        if(StringUtils.isNotEmpty(diseaseCode)||StringUtils.isNotEmpty(healthCode)||StringUtils.isNotEmpty(serveCode)){
            leftSql +=" LEFT JOIN wlyy_sign_patient_label_info i on i.patient=s.service_patient_code and i.status=1 " ;
            if(StringUtils.isNotEmpty(diseaseCode)){
                labelSql+=" or (i.label='"+diseaseCode+"' and i.label_type='3') ";//疾病类型
            }
            if(StringUtils.isNotEmpty(healthCode)){
                labelSql+=" or (i.label='"+healthCode+"' and i.label_type='2') ";//健康情况
            }
            if(StringUtils.isNotEmpty(serveCode)){
                labelSql+=" or (i.label='"+serveCode+"' and i.label_type='1') ";//服务类型
            }
//        if(StringUtils.isNotEmpty(diseaseCode)||StringUtils.isNotEmpty(healthCode)||StringUtils.isNotEmpty(serveCode)){
//            leftSql +=" LEFT JOIN wlyy_sign_patient_label_info i on i.patient=s.service_patient_code and i.status=1 " ;
//            if(StringUtils.isNotEmpty(diseaseCode)){
//                labelSql+=" or (i.label='"+diseaseCode+"' and i.label_type='3') ";//疾病类型
//            }
//            if(StringUtils.isNotEmpty(healthCode)){
//                labelSql+=" or (i.label='"+healthCode+"' and i.label_type='2') ";//健康情况
//            }
//            if(StringUtils.isNotEmpty(serveCode)){
//                labelSql+=" or (i.label='"+serveCode+"' and i.label_type='1') ";//服务类型
//            }
//        }
//        if(StringUtils.isNotEmpty(labelSql)){
//            whereSql+= " and ( "+labelSql.substring(3)+" )";
//        }
        if(StringUtils.isNotEmpty(serveCode)){
            leftSql+=" JOIN wlyy_sign_family f on f.patient=s.service_patient_code and f.status=1 " +
                    " JOIN wlyy_sign_family_server r on r.sign_code=f.code ";
            whereSql+=" and r.server_type='"+serveCode+"' ";
        }
        if(StringUtils.isNotEmpty(healthCode)||StringUtils.isNotEmpty(diseaseCode)){
            leftSql+=" JOIN (SELECT t.patient,GROUP_CONCAT(',',t.label_type,t.label,',') label FROM wlyy_sign_patient_label_info t " +
                    "JOIN manage_synergy_workorder_servicer v on v.service_patient_code=t.patient and v.workorder_code = '"+workorderCode+"' where t. STATUS = 1 GROUP BY t.patient ) aa on aa.patient=s.service_patient_code  ";
        }
        if(StringUtils.isNotEmpty(healthCode)){
            whereSql+=" and aa.label LIKE '%,2"+healthCode+",%' ";
        }
        if(StringUtils.isNotEmpty(labelSql)){
            whereSql+= " and ( "+labelSql.substring(3)+" )";
        if(StringUtils.isNotEmpty(diseaseCode)){
            whereSql+=" and aa.label LIKE '%,3"+diseaseCode+",%' ";
        }
        if(isFollow!=null&&isFollow==1){//跟进
            leftSql+=" LEFT JOIN manage_synergy_workorder_servicer_log ll on ll.service_patient_code=s.code ";
@ -1139,7 +1154,7 @@ public class SynergyManageService extends BaseJpaService {
    @Transactional
    public void taskSubmit(String workorderCode,String dealResultRemark,String accessoryJson) throws Exception{
    public void taskSubmit(String userCode,String workorderCode,String dealResultRemark,String accessoryJson) throws Exception{
        JSONArray jsonArray = new JSONArray(accessoryJson);
        String fileName;
        String url;
@ -1156,6 +1171,8 @@ public class SynergyManageService extends BaseJpaService {
            accessoryList.add(manageSynergyAccessoryDO);
        }
        manageSynergyAccessoryDao.save(accessoryList);
        User user = userDao.findByCode(userCode);
        workorderServicerDao.updateWorkorderServicer(workorderCode,userCode,user.getName(),1);
        ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
        manageSynergyWorkorderDO.setDealResultRemark(dealResultRemark);
        manageSynergyWorkorderDO.setStatus(3);
@ -1204,6 +1221,7 @@ public class SynergyManageService extends BaseJpaService {
                                String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask,String userName,String hospitalName,
                                HttpServletResponse response) throws Exception{
        WritableWorkbook wwb = null;
        OutputStream os = null;
        try{
            String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1  " ;
@ -1316,28 +1334,31 @@ public class SynergyManageService extends BaseJpaService {
            response.setCharacterEncoding("utf-8");
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "synergyManageList.xls"));
            OutputStream os = response.getOutputStream();
            os = response.getOutputStream();
            wwb = Workbook.createWorkbook(os);
            WritableSheet ws = Workbook.createWorkbook(os).createSheet("sheet",1);
            WritableSheet ws = wwb.createSheet("sheet",1);
            List<String> header = null;
            if(isAcceptTask==1){//我接收的任务
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","创建时间","服务对象","工单状态","需求方","负责人","服务内容"));
            if(isAcceptTask==1||isAcceptTask==4){//我接收的任务
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","创建时间","服务对象","工单状态","需求方","负责人"));
            }else if(isAcceptTask==2){//我派发的任务
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","创建时间","服务对象","工单状态","家庭医生","所属机构","服务内容"));
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","创建时间","服务对象","工单状态","家庭医生","所属机构"));
            }else if(isAcceptTask==3){
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","服务时间","服务对象","备注","需求方"));
            }
            int i = 0;
            for (String h : header) {
                Label label = new Label(0, i, h);
                ws.addCell(label);
                addCell(ws, 0, i, h);//表名,行,列,header
                i++;
            }
            Integer workorderTypeR = null;
            String workorderTypeName = null;
            Date createTime = null;
            i=0;
            Date serviceTime =null;
            i=1;
            for(Map<String,Object> one:list){
                workorderTypeR = (Integer) one.get("workorder_type");
                workorderTypeR = (Integer) one.get("type");
                createTime = (Date)one.get("create_time");
                serviceTime = (Date)one.get("service_time");
                addCell(ws, i, 0, one.get("code")+"","");
                switch (workorderTypeR){
                    case 0: workorderTypeName="咨询";break;
@ -1348,17 +1369,22 @@ public class SynergyManageService extends BaseJpaService {
                    case 5: workorderTypeName="疾病筛查";break;
                }
                addCell(ws, i, 1, workorderTypeName,"");
                addCell(ws, i, 2, DateUtil.dateToStr(createTime,"yyyy--MM-dd HH:mm:ss"),"");
                if(isAcceptTask==1){//我接收的任务
                if(isAcceptTask==3){
                    addCell(ws, i, 2, DateUtil.dateToStr(serviceTime,"yyyy--MM-dd HH:mm:ss"),"");
                }else{
                    addCell(ws, i, 2, DateUtil.dateToStr(createTime,"yyyy--MM-dd HH:mm:ss"),"");
                }
                if(isAcceptTask==1||isAcceptTask==3||isAcceptTask==4){//我接收的任务
                    String[] servicer = (one.get("servicer_key")+"").split(",");
                    Integer servicerCount = (Integer) one.get("servicer_count");
                    addCell(ws, i, 1, servicer[0]+"等"+servicerCount+"人","");
                    addCell(ws, i, 3, servicer[0]+"等"+servicerCount+"人","");
                }else if(isAcceptTask==2){//我派发的任务
                    String[] servicer = (one.get("servicer_key")+"").split(",");
                    addCell(ws, i, 1, servicer[0],"");
                    addCell(ws, i, 3, servicer[0],"");
                }
                Integer statusR = (Integer) one.get("status");
//                addCell(ws, i, 4, statusName,"");
                String statusName="";
                Integer statusR = (Integer) one.get("status");
                switch (statusR){
                    case 0:statusName="草稿";break;
                    case 1:statusName="未接受";break;
@ -1366,23 +1392,32 @@ public class SynergyManageService extends BaseJpaService {
                    case 3:statusName="处理完成";break;
                    case 4:statusName="退回";break;
                }
                addCell(ws, i, 3, statusName,"");
                addCell(ws, i, 4, one.get("create_user_name")+"","");
                if(isAcceptTask==1){//我接收的任务
                if(isAcceptTask==3){
                    addCell(ws, i, 4, one.get("remark")+"","");
                }else{
                    addCell(ws, i, 4, statusName,"");
                }
                addCell(ws, i, 5, one.get("create_user_name")+"","");//需求方
                if(isAcceptTask==1||isAcceptTask==4){//我接收的任务
                    List<ManageSynergyWorkorderExecutorDO> managerList = workorderExecutorDao.findByWorkorderCode(one.get("code")+"",1);
                    String managerName = managerList.size()>0?managerList.get(0).getExecutorName():"";
                    addCell(ws, i, 5, managerName,"");//负责人
                    addCell(ws, i, 6, managerName,"");//负责人
                }else if(isAcceptTask==2) {//我派发的任务
                    addCell(ws, i, 5, one.get("hospital_name")+"","");//所属机构
                    addCell(ws, i, 6, one.get("hospital_name")+"","");//所属机构
                }
                addCell(ws, i, 5, one.get("content")+"","");
//                if(isAcceptTask!=3){
//
//                    addCell(ws, i, 7, one.get("content")+"","");//服务内容
//                }
                i++;
            }
            wwb.write();
        }catch (Exception e) {
            e.printStackTrace();
            if(os!=null)os.close();
            throw e;
        }finally {
            if (wwb != null) wwb.close();
        }
    }
@ -1397,6 +1432,11 @@ public class SynergyManageService extends BaseJpaService {
        }
        ws.addCell(label);
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column,  String data) throws WriteException {
        Label label = new Label(column ,row, data);
        ws.addCell(label);
    }
    public List<Map<String,Object>> getDealList(String idcard){
        Patient patient = patientDao.findByIdcard(idcard);
@ -1890,7 +1930,7 @@ public class SynergyManageService extends BaseJpaService {
        String endTime = today+" 23:59:59";
        /*startTime="2017-11-15 00:00:00";
        endTime="2017-11-22 23:59:59";*/
        String sql="SELECT" +
        /*String sql="SELECT" +
                " u.`code`,"+
                " u.`name`," +
                " u.`online` as onlineType," +
@ -1906,6 +1946,31 @@ public class SynergyManageService extends BaseJpaService {
                " AND r.answer_status=1"+
                " GROUP BY" +
                " u.`code`," +
                " r.type";*/
        String sql="SELECT" +
                " u.`code`," +
                " u.`name`," +
                " u.`online` AS onlineType," +
                " r.type," +
                " IF (r.type IS NOT NULL, COUNT(*), 0) AS num" +
                " FROM" +
                " wlyy_user u" +
                " LEFT JOIN (" +
                " SELECT" +
                "  type," +
                "  user_code," +
                "  user_name" +
                "  FROM" +
                "  manage_call_record" +
                "  WHERE" +
                "  create_time >= '"+startTime+"'" +
                "  AND create_time <= '"+endTime+"'" +
                "  AND answer_status = 1" +
                " ) r ON u.`code` = r.user_code" +
                " WHERE" +
                " u.type = 4" +
                " GROUP BY" +
                " u.`code`," +
                " r.type";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> toList =  new ArrayList<>();
@ -1927,6 +1992,10 @@ public class SynergyManageService extends BaseJpaService {
                    resultMap.put("jieruCount",0);
                    resultMap.put("waihuCount",map.get("num"));
                }
                if ("null".equals(type) || StringUtils.isEmpty(type)){
                    resultMap.put("jieruCount",0);
                    resultMap.put("waihuCount",0);
                }
                toList.add(resultMap);
            }else {
                int count =0;
@ -1953,6 +2022,10 @@ public class SynergyManageService extends BaseJpaService {
                            resultMap.put("jieruCount",0);
                            resultMap.put("waihuCount",map.get("num"));
                        }
                        if ("null".equals(type)  || StringUtils.isEmpty(type)){
                            resultMap.put("jieruCount",0);
                            resultMap.put("waihuCount",0);
                        }
                        toList.add(resultMap);
                    }
                }
@ -2017,4 +2090,85 @@ public class SynergyManageService extends BaseJpaService {
        return workOrderDao.findByCode(workorderCode);
    }
    public Map<String,Object> getTaskByIdcard(String workorderCode,String idcard){
        String sql=" select w.*,s.mobile,s.service_patient_name,s.service_patient_code,s.code as servicerCode,s.town_name,s.hospital_name,w.create_user_name"+
                " from manage_synergy_workorder_servicer s "+
                " LEFT JOIN manage_synergy_workorder w on s.workorder_code=w.code " +
                " where w.code='"+workorderCode+"' and s.idcard='"+idcard+"'" ;
        List<Map<String,Object>> workorderList = jdbcTemplate.queryForList(sql);
        Map<String,Object> resultMap = new HashMap<>();
        Map<String,Object> workorderMap = workorderList.get(0);
        //居民信息
        resultMap.put("mobile",workorderMap.get("mobile"));//电话号码
        resultMap.put("patientName",workorderMap.get("service_patient_name"));//居民姓名
        Integer callNum = customerLogDao.callNumByWorkorder(workorderMap.get("servicerCode")+"");
        resultMap.put("callNum",callNum);//已呼叫次数
        resultMap.putAll(this.getPatientInfo(workorderMap.get("service_patient_code") + ""));
        Patient patient =patientDao.findByCode(workorderMap.get("service_patient_code")+"");
        Integer sex = patient.getSex();
        String sexName ="";
        if(sex==1){
            sexName="男";
        }else if(sex==2){
            sexName="女";
        }else{
            sexName="未知";
        }
        resultMap.put("sex",sexName);//性别
        Integer age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
        resultMap.put("age",age);//年龄
        resultMap.put("townName",workorderMap.get("town_name"));//所属区县
        resultMap.put("hospitalName",workorderMap.get("hospital_name"));//所属社区
        SignFamily signFamily = signFamilyDao.findSignByPatient(workorderMap.get("service_patient_code")+"");
        resultMap.put("signDoctor",signFamily.getDoctorName());//签约医生(即:工单创建医生)
        resultMap.put("healthDoctor",signFamily.getDoctorHealthName());//健管师
        List<SignPatientLabelInfo> labelDiseaseType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(workorderMap.get("service_patient_code")+"",  "3", 1);
        String diseaseType="";
        List<String> diseaseTypeList= new ArrayList<>();
        for(SignPatientLabelInfo one:labelDiseaseType){
            diseaseType+=","+one.getLabelName();
            diseaseTypeList.add(one.getLabel());
        }
        resultMap.put("diseaseType",StringUtils.isNotEmpty(diseaseType)?diseaseType.substring(1):"");//疾病类型
        resultMap.put("diseaseTypeCode",diseaseTypeList);//疾病类型code
        List<SignPatientLabelInfo> labelHealthType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(workorderMap.get("service_patient_code")+"",  "2", 1);
        String healthType="";
        for(SignPatientLabelInfo one:labelHealthType){
            healthType+=","+one.getLabelName();
        }
        resultMap.put("healthType",StringUtils.isNotEmpty(healthType)?healthType.substring(1):"");//健康情况
        String serveType="";
//            List<SignPatientLabelInfo> labelServeType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(workorderMap.get("service_patient_code")+"",  "2", 1);
//            for(SignPatientLabelInfo one:labelServeType){
//                serveType+=","+one.getLabelName();
//            }
        List<Map<String,Object>> signTypes = jdbcTemplate.queryForList("SELECT s.server_type_name,s.server_type FROM wlyy_sign_family_server s right join wlyy_sign_family f on s.sign_code=f.code WHERE f.patient='"+workorderMap.get("service_patient_code")+"' and f.status=1 and f.expenses_status='1' ");
        for(Map<String,Object> one:signTypes){
            serveType+=","+(one.get("server_type_name")!=null?one.get("server_type_name"):"");
        }
        resultMap.put("serveType",StringUtils.isNotEmpty(serveType)?serveType.substring(1):"");
//            resultMap.put("serveType",StringUtils.isNotEmpty(serveType)?serveType.substring(1):"");//服务类型
        resultMap.put("workorder",workorderMap.get("code"));//工单编号
        resultMap.put("patientCode",workorderMap.get("service_patient_code"));//居民code
        resultMap.put("doctorCode",workorderMap.get("create_user"));//创建人(医生)code
        //获取提交记录
        String servicerCode = workorderMap.get("servicerCode")+"";
        resultMap.put("servicerCode", servicerCode);
        List<ManageSynergyWorkorderServicerLogDO> list = manageSynergyWorkorderServicerLogDao.findByWorkorderServiceCode(servicerCode);
        if(list.size()>0){
            ManageSynergyWorkorderServicerLogDO log = list.get(0);
            Map<String,Object> m = new HashMap<>();
            m.put("personal",log.getPersonal());//是否为本人
            m.put("callCode",log.getCallCode());//通话记录code
            m.put("callStatus",log.getCallStatus());//通话状态(1、正常通话,2、无人接听,3、拒接,4、占线,5、关机,6、停机,7、无法接通,8、空号错号)
            m.put("emphasis",log.getEmphasis());//是否重点患者(1、重点患者,2、非重点患者)
            m.put("followUp",log.getFollowUp());//是否跟进(1、无需跟进,2、待跟进)
            m.put("remark",log.getRemark());//备注
            m.put("returnVisit",log.getReturnVisit());//回访(1、有效回访,2、无效回访)
            resultMap.put("servicerLog",m);
            resultMap.put("haveNum",1);
        }
        return resultMap;
    }
}

+ 9 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java

@ -4,10 +4,12 @@ package com.yihu.wlyy.service.synergy;/**
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerLogDO;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.UserDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerLogDao;
@ -41,6 +43,8 @@ public class SynergyWorkorderServicerLogService extends BaseJpaService {
    private PatientDao patientDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private UserDao userDao;
@ -49,11 +53,15 @@ public class SynergyWorkorderServicerLogService extends BaseJpaService {
     *
     * @param synergyWorkorderServicerLogDO
     */
    public void create(ManageSynergyWorkorderServicerLogDO synergyWorkorderServicerLogDO){
    public void create(ManageSynergyWorkorderServicerLogDO synergyWorkorderServicerLogDO,String userCode){
        synergyWorkorderServicerLogDO.setCreateTime(new Date());
        ManageSynergyWorkorderServicerLogDO workorderServicerLogDO = manageSynergyWorkorderServicerLogDao.save(synergyWorkorderServicerLogDO);
        User user = userDao.findByCode(userCode);
        ManageSynergyWorkorderServicerDO workorderServicerDO = workorderServicerDao.findByWorkOrderCodeAndPatientCode1(workorderServicerLogDO.getWorkorderCode(),workorderServicerLogDO.getWorkorderServiceCode());
        workorderServicerDO.setStatus(3);
        workorderServicerDO.setExecutorCode(user.getCode());
        workorderServicerDO.setExecutorName(user.getName());
        workorderServicerDO.setExecutorType(2);
        workorderServicerDao.save(workorderServicerDO);
        String sql = "select * from manage_synergy_workorder_servicer where workorder_code = '"+workorderServicerLogDO.getWorkorderCode()+"' and status IN(1,2)";
        List<ManageSynergyWorkorderServicerDO> workorderServicerDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ManageSynergyWorkorderServicerDO.class));

+ 3 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/PatientHealthIndexDao.java

@ -64,5 +64,8 @@ public interface PatientHealthIndexDao
	@Query("select a from PatientHealthIndex a where a.user = ?1 and a.deviceSn = ?2 and a.value1 = ?3 and a.type = ?4 and a.recordDate >= ?5 and a.recordDate<=?6 and a.del = '1' ")
	List<PatientHealthIndex> findByTypeInHalfMinute(String patient, String deviceSn, String value1, Integer type, Date minDate,Date maxDate);
	@Query("select a from PatientHealthIndex a where a.user = ?1 and a.deviceSn = ?2 and a.value1 = ?3 and a.value2=?7 and a.value3=?8 and a.type = ?4 and a.recordDate >= ?5 and a.recordDate<=?6 and a.del = '1' ")
	List<PatientHealthIndex> findByTypeInHalfMinuteAllValue(String patient, String deviceSn, String value1, Integer type, Date minDate,Date maxDate,String value2,String value3);
}

+ 17 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/util/DateUtil.java

@ -1599,4 +1599,21 @@ public class DateUtil {
        SimpleDateFormat formatter = new SimpleDateFormat(DEFAULT_DATE_YMD_FORMAT);
        return formatter.format(currentTime);
    }
    /**
     * 时间前推或后推天数(负数前推正数后推)
     * date 基准时间
     */
    public static java.util.Date getPreDays(java.util.Date date, int days) {
        java.util.Date day = null;
        try {
            Calendar c = Calendar.getInstance();
            c.setTime(date);
            c.add(Calendar.DATE, days);
            day = c.getTime();
        } catch (Exception e) {
        }
        return day;
    }
}

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

@ -487,18 +487,25 @@ public class DeviceService extends BaseService{
        if (device!=null) {
            /************设备数据重复推送处理 start**********************/
            String value1 = data;
            String value2="";
            String value3="";
            if("2".equals(type)){
                String[] value = data.split(",");
                if (value.length > 0) {
                    value1 = value[0];     //收缩压
                    value2 = value[1];
                    value3 = value[2];
                }
            }
            if (value1.equals(value2) && value2.equals(value3)){
                return null;
            }
//            List<PatientHealthIndex> list = patientHealthIndexDao.findByType(device.getUser(),deviceSn,value1,Integer.parseInt(type),time);
            long maxtime = time.getTime()+30*1000;
            long mintime = time.getTime()-30*1000;
            Date minDate = new Date(mintime);
            Date maxDate = new Date(maxtime);
            List<PatientHealthIndex> list = iotDeviceService.findByType(device.getUser(),deviceSn,value1,Integer.parseInt(type),time,minDate,maxDate);
            /*long maxtime = time.getTime()+30*1000;
            long mintime = time.getTime()-30*1000;*/
            Date minDate = DateUtil.getPreDays(time,-3);
            Date maxDate = DateUtil.getPreDays(time,3);
            List<PatientHealthIndex> list = iotDeviceService.findByType(device.getUser(),deviceSn,value1,value2,value3,Integer.parseInt(type),time,minDate,maxDate);
            if(list!=null&&list.size()>0){
                DeviceInfo deviceInfo = new DeviceInfo();
                deviceInfo.setDeviceData(json.toString());

+ 8 - 2
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/IotDeviceService.java

@ -130,12 +130,18 @@ public class IotDeviceService extends BaseService{
     * @param time
     * @return
     */
    public List<PatientHealthIndex> findByType(String user,String deviceSn,String value1,Integer type,Date time,Date timeMin,Date timeMax){
    public List<PatientHealthIndex> findByType(String user,String deviceSn,String value1,String value2,String value3,Integer type,Date time,Date timeMin,Date timeMax){
        if(isUploadIot()){
            return findRepeat(user,deviceSn,value1,type,time);
        }else {
            //return  patientHealthIndexDao.findByType(user,deviceSn,value1,type,time);
            return  patientHealthIndexDao.findByTypeInHalfMinute(user,deviceSn,value1,type,timeMin,timeMax);
            List<PatientHealthIndex> list = new ArrayList<>();
            if (type==1){
                list =  patientHealthIndexDao.findByTypeInHalfMinute(user,deviceSn,value1,type,timeMin,timeMax);
            }else if (type==2){
                list = patientHealthIndexDao.findByTypeInHalfMinuteAllValue(user,deviceSn,value1,type,timeMin,timeMax,value2,value3);
            }
            return list;
        }
    }

+ 17 - 17
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/FamilyDao.java

@ -1,17 +1,17 @@
package com.yihu.wlyy.sign.dao;/**
 * Created by nature of king on 2018/8/9.
 */
import com.yihu.wlyy.sign.entity.FamilyLianQian;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author wangzhinan
 * @create 2018-08-09 10:52
 * @desc 家庭成员
 **/
public interface FamilyDao extends PagingAndSortingRepository<FamilyLianQian, Long>, JpaSpecificationExecutor<FamilyLianQian> {
   /* @Query("from FamilyLianQian a  where a.idcard = ?1 ")
    FamilyLianQian findByIdCard(String idcard);*/
}
//package com.yihu.wlyy.sign.dao;/**
// * Created by nature of king on 2018/8/9.
// */
//
//import com.yihu.wlyy.sign.entity.FamilyLianQian;
//import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
//import org.springframework.data.repository.PagingAndSortingRepository;
//
///**
// * @author wangzhinan
// * @create 2018-08-09 10:52
// * @desc 家庭成员
// **/
//public interface FamilyDao extends PagingAndSortingRepository<FamilyLianQian, Long>, JpaSpecificationExecutor<FamilyLianQian> {
//   /* @Query("from FamilyLianQian a  where a.idcard = ?1 ")
//    FamilyLianQian findByIdCard(String idcard);*/
//}

+ 23 - 19
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java

@ -66,6 +66,7 @@ public class ChildVaccinImmuneService extends BaseService {
	@Transactional(rollbackFor = Exception.class)
	public int getChildImmuneVaccinEveryDay()throws Exception{
		int result = 0;
        String nowShotDay = DateUtil.dateToStrShort(new Date());
		try {
			/*String sql ="SELECT" +
					" DISTINCT ci.`code`," +
@ -83,7 +84,6 @@ public class ChildVaccinImmuneService extends BaseService {
			List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
			for (Map<String,Object> map : list){
				String barcode = String.valueOf(map.get("barcode"));
				System.out.println("===============barcode=============="+barcode);
				String deptStr = immuneService.findDept(barcode);
				if (StringUtils.isNotBlank(deptStr)){
					JSONObject jsonObject = new JSONObject(deptStr);
@ -108,19 +108,19 @@ public class ChildVaccinImmuneService extends BaseService {
											count++;
										}
									}
									//原来有的疫苗要判断是否有超过预约时间的7天,并且看提醒是否超过7天,超过7天可以重新提醒
									if (count>0 && childImmuneVaccin.getIsOut()==1){
										if (DateUtil.getPreDays(childImmuneVaccin.getJzrq(),7).before(new Date())){
											//过了预约时间7天,更新为isOut=0,则不能预约了
											//childImmuneVaccinDao.updateIsOutByCode(childImmuneVaccin.getCode());
											String uSql ="UPDATE wlyy_child_immune_vaccin SET is_out=0  AND `code`='"+childImmuneVaccin.getCode()+"'";
											jdbcTemplate.update(uSql);
										}else {
											//判断是否过了7天提醒时间
											String afterAlertSevenDay = DateUtil.dateToStr(DateUtil.getPreDays(childImmuneVaccin.getAlert_time(),7),DateUtil.YYYY_MM_DD);
											String nowShotDay = DateUtil.dateToStrShort(new Date());
                                    //原来有的疫苗要判断是否有超过预约时间的7天,并且看提醒是否超过7天,超过7天可以重新提醒
                                    if (count>0 && childImmuneVaccin.getIsOut()==1){
                                        String afterJzrqSevenDay = DateUtil.dateToStr(DateUtil.getPreDays(childImmuneVaccin.getJzrq(),7),DateUtil.YYYY_MM_DD);
                                        String afterAlertSevenDay = DateUtil.dateToStr(DateUtil.getPreDays(childImmuneVaccin.getAlert_time(),7),DateUtil.YYYY_MM_DD);
                                        if ( DateUtil.strToDate(afterJzrqSevenDay,DateUtil.YYYY_MM_DD).before(DateUtil.strToDate(nowShotDay,DateUtil.YYYY_MM_DD))){
                                            //过了预约时间7天,更新为isOut=0,则不能预约了
                                            //childImmuneVaccinDao.updateIsOutByCode(childImmuneVaccin.getCode());
                                            String uSql ="UPDATE wlyy_child_immune_vaccin SET is_out=0  where `code`='"+childImmuneVaccin.getCode()+"'";
                                            jdbcTemplate.update(uSql);
                                        }else {
                                            //判断是否过了7天提醒时间
											if (childImmuneVaccin.getAlert_tag()==1 && DateUtil.strToDate(afterAlertSevenDay,DateUtil.YYYY_MM_DD).before(DateUtil.strToDate(nowShotDay,DateUtil.YYYY_MM_DD))) {
												String updateSql = "UPDATE wlyy_child_immune_vaccin SET alert_tag=0  AND `code`='" + childImmuneVaccin.getCode() + "'";
												String updateSql = "UPDATE wlyy_child_immune_vaccin SET alert_tag=0  where `code`='" + childImmuneVaccin.getCode() + "'";
												jdbcTemplate.update(updateSql);
											}
										}
@ -158,8 +158,8 @@ public class ChildVaccinImmuneService extends BaseService {
										childImmuneVaccin.setAlert_tag(0);
										childImmuneVaccin.setDel(0);
										childImmuneVaccin.setCreate_time(new Date());
										if (DateUtil.getPreDays(DateUtil.strToDate(vaccinJsonJSONArray.getJSONObject(j).getString("jzRq")),7).before(new Date())){
											//过了预约时间7天,更新为isOut=0,则不能预约了
                                        String afterJzrqSevenDay = DateUtil.dateToStr(DateUtil.getPreDays(childImmuneVaccin.getJzrq(),7),DateUtil.YYYY_MM_DD);
                                        if ( DateUtil.strToDate(afterJzrqSevenDay,DateUtil.YYYY_MM_DD).before(DateUtil.strToDate(nowShotDay,DateUtil.YYYY_MM_DD))){	//过了预约时间7天,更新为isOut=0,则不能预约了
											childImmuneVaccin.setIsOut(0);
										}else {
											childImmuneVaccin.setIsOut(1);
@ -236,6 +236,8 @@ public class ChildVaccinImmuneService extends BaseService {
                    jsonObject.put("childName", map.get("name"));//儿童姓名
                    jsonObject.put("childCode", map.get("child_info_code"));//儿童code
                    jsonObject.put("vaccinName", map.get("ymmc"));//疫苗名称
                    jsonObject.put("jzrq",map.get("jzrq"));//接种日期
                    jsonObject.put("jzzc",map.get("jzzc"));//接种针次
                    jsonArray.put(jsonObject);
                }
            }
@ -260,7 +262,9 @@ public class ChildVaccinImmuneService extends BaseService {
			String childName = jsonObject.getString("childName");
			String vaccinName = jsonObject.getString("vaccinName");
			String vaccinCode = jsonObject.getString("vaccinCode");
			String sql ="SELECT" +
			String jzrq = jsonObject.getString("jzrq");
            String jzzc = jsonObject.getString("jzzc");
            String sql ="SELECT" +
					" cfi.relation," +
					" p.`code`," +
					" p.`name`," +
@ -270,7 +274,7 @@ public class ChildVaccinImmuneService extends BaseService {
					" LEFT JOIN wlyy_patient p ON cfi.family_code = p.`code`" +
					" WHERE" +
					" cfi.child_code = '"+childCode+"'" +
					" AND cfi.del = 0 and (p.openid is not null or p.openid !='')";
					" AND cfi.del = 0 and (p.openid is not null or p.openid !='') AND p.`code`='0fab4dd67e074e16ac86db6b6c15233e'";
			List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
			if (list.size()==0){
				return -10000;
@ -285,10 +289,10 @@ public class ChildVaccinImmuneService extends BaseService {
							WechatTemplateConfig temp = templateConfigDao.findByScene("template_doctor_survey", "dsymjztx");
							JSONObject json = new JSONObject();
                            json.put("toUser",String.valueOf(map.get("code")));
                            json.put("keyword1", temp.getKeyword1());
                            json.put("keyword1", temp.getKeyword1().replace("key1",vaccinName).replace("key2",jzzc));
                            json.put("keyword2", temp.getKeyword2().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
                            json.put("remark", temp.getRemark());
                            json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName));
                            json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName).replace("key3",jzrq));
                            json.put("url",temp.getUrl().replace("key1",childCode));
                            logger.info("weiTempJOSN:"+json.toString());
							pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);

+ 2 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml

@ -128,10 +128,12 @@ es:
    HealthEduArticlePatient: health_edu_article_patient
    Statistics: wlyy_quota_prod
    FollowUp: wlyy_followup
    patientRemindRecord: wlyy_patient_remind_record_prod
  type:
    HealthEduArticlePatient: health_edu_article_patient
    Statistics: wlyy_quota_prod
    FollowUpContent: wlyy_followup_content
    patientRemindRecord: wlyy_patient_remind_record_prod
  host:  http://59.61.92.90:9065,http://59.61.92.90:9067
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/jkedu/repository/JkeduArticleDao.java

@ -15,4 +15,7 @@ public interface JkeduArticleDao
		extends PagingAndSortingRepository<NewArticleModel, Long>, JpaSpecificationExecutor<NewArticleModel> {
	@Query("select n from NewArticleModel n where n.isOld=1")
	List<NewArticleModel> findOldArticle();
	@Query("select n from NewArticleModel n where n.articleId = ?1")
	NewArticleModel findByCode(String articleId );
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildImmuneVaccinDao.java

@ -33,6 +33,6 @@ public interface ChildImmuneVaccinDao extends PagingAndSortingRepository<ChildIm
	@Query("update ChildImmuneVaccin  c set c.alert_tag=?2 where c.code=?1")
	int updateAlertTagByCode(String code,int tag);
	@Query("select p from ChildImmuneVaccin p where p.barcode=?1 and p.del=0 and p.ymsx=1")
	@Query("select p from ChildImmuneVaccin p where p.barcode=?1 and p.del=0 and p.ymsx=1 order by p.jzrq")
	List<ChildImmuneVaccin> getChildImmuneVaccinByBarcodeAndYmsx(String barcode);
}

+ 14 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -136,10 +136,10 @@ public class ChildFamilyImmuneService extends BaseService {
		String sql = "select DISTINCT t.*,m.child_name,m.birthday,m.childCode from wlyy_child_immune_vaccin t " +
				" inner join ( " +
				" select a.*,b.name as family_name ,c.name as child_name,c.barcode as barcode ,c.birthday as birthday,c.`code` AS childCode from  wlyy_child_family_immune a " +
				" inner join (select patient,name from wlyy_sign_family where type in (1,2) and `status` = 1 and expenses_status = 1 and doctor = '"+doctorcode+"' or doctor_health='"+doctorcode+"') b " +
				" inner join (select patient,name from wlyy_sign_family where type in (1,2) and `status` = 1 and expenses_status = 1 and (doctor = '"+doctorcode+"' or doctor_health='"+doctorcode+"')) b " +
				" on a.family_code = b.patient " +
				" left join wlyy_child_info c on c.`code` = a.child_code " +
				") m on m.barcode = t.barcode where t.ymsx=1";
				") m on m.barcode = t.barcode where t.ymsx=1 order by t.jzrq";
		if (limitType==1){
			int start = (pageNo-1)*pageSize;
			sql +=" limit "+start+","+pageSize;
@ -189,7 +189,7 @@ public class ChildFamilyImmuneService extends BaseService {
	 * @param barcode
	 * @return
	 */
	public List<ChildImmuneVaccin> getChildImmuneVaccinByBarcode(String barcode){
	public List<ChildImmuneVaccin> getChildImmuneVaccinByBarcode(String barcode)throws Exception{
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcodeAndYmsx(barcode);
	}
@ -222,6 +222,8 @@ public class ChildFamilyImmuneService extends BaseService {
			String childName = jsonObject.getString("childName");
			String vaccinName = jsonObject.getString("vaccinName");
			String vaccinCode = jsonObject.getString("vaccinCode");
            String jzrq = jsonObject.getString("jzrq");
            String jzzc = jsonObject.getString("jzzc");
			String sql ="SELECT" +
					" cfi.relation," +
					" p.`code`," +
@ -247,10 +249,10 @@ public class ChildFamilyImmuneService extends BaseService {
							WechatTemplateConfig temp = templateConfigDao.findByScene("template_doctor_survey", "ymjztx");
							JSONObject json = new JSONObject();
							json.put("toUser",String.valueOf(map.get("code")));
							json.put("keyword1", temp.getKeyword1());
							json.put("keyword1", temp.getKeyword1().replace("key1",vaccinName).replace("key2",jzzc));
							json.put("keyword2", temp.getKeyword2().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
							json.put("remark", temp.getRemark());
							json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName));
							json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName).replace("key3",jzrq));
							json.put("url",temp.getUrl().replace("key1",childCode));
							logger.info("weiTempJOSN:"+json.toString());
							pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 11,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
@ -288,7 +290,8 @@ public class ChildFamilyImmuneService extends BaseService {
		if (StringUtils.isEmpty(alertDataJsonStr)){
			return -1;
		}
		Doctor doctorObj = doctorDao.findByCode(doctor);
		return alertImmVacclinByChildInfoCodes("["+alertDataJsonStr+"]",doctor);
		/*Doctor doctorObj = doctorDao.findByCode(doctor);
		String doctorName = "";
		String doctorLevel = "";
		if (doctorObj!=null){
@ -309,6 +312,8 @@ public class ChildFamilyImmuneService extends BaseService {
		String childName = jsonObject.getString("childName");
		String vaccinName = jsonObject.getString("vaccinName");
		String vaccinCode = jsonObject.getString("vaccinCode");
		String jzrq = jsonObject.getString("jzrq");
        String jzzc = jsonObject.getString("jzzc");
		String sql ="SELECT" +
				" cfi.relation," +
				" p.`code`," +
@ -367,7 +372,7 @@ public class ChildFamilyImmuneService extends BaseService {
		}
		//保存到es的提醒日志表中
		esSavePatientRemindRecord(patientRemindRecordESDOList);
		return 200;
		return 200;*/
	}
@ -403,6 +408,8 @@ public class ChildFamilyImmuneService extends BaseService {
                    jsonObject.put("childName", map.get("child_name"));//儿童姓名
                    jsonObject.put("childCode", map.get("childCode"));//儿童code
                    jsonObject.put("vaccinName", map.get("ymmc"));//疫苗名称
                    jsonObject.put("jzrq",map.get("jzrq"));//接种日期
                    jsonObject.put("jzzc",map.get("jzzc"));//接种针次
                    jsonArray.put(jsonObject);
                }
			}

+ 11 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -2,15 +2,15 @@ package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.yihu.edu.entity.dataClean.NewArticleModel;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.jkedu.repository.JkeduArticleDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.education.HealthEduArticleDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -54,7 +54,7 @@ public class SynergyManageService extends BaseService {
    @Autowired
    private HospitalDao hospitalDao;
    @Autowired
    private HealthEduArticleDao healthEduArticleDao;
    private JkeduArticleDao jkeduArticleDao;
    public JSONObject getWorkOrderInfo(String workorderCode, String patient, Integer role) throws Exception {
        Map<String, Object> param = new HashedMap();
@ -141,6 +141,9 @@ public class SynergyManageService extends BaseService {
            array.add(object);
        }
        buffer.deleteCharAt(buffer.length()-1);
        if (buffer.length()>5){
            buffer.deleteCharAt(buffer.length() -(buffer.length()-5));
        }
        com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
        object.put("type",type);
        object.put("serviceTime",serviceDate);
@ -169,12 +172,12 @@ public class SynergyManageService extends BaseService {
            }
            DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            followup.setFollowupDate(dateFormat.parse(serviceDate+":00"));
            followup.setFollowupType(followupType);
            followup.setFollowupType("3");
            followup.setFollowupClass(followupClass);
            followup.setOrgCode(doctor1.getHospital());
            followup.setOrgName(doctor1.getHospitalName());
            followup.setDataFrom("2");
            followup.setStatus("2");
            followup.setStatus("3");
            followup.setCreater(doctor1.getCode());
            followup.setCreateTime(new Date());
            followup = followUpDao.save(followup);
@ -189,9 +192,9 @@ public class SynergyManageService extends BaseService {
            object.put("createUserRole",1);
        }else if (type == 1){
            object.put("relationCode",objectId);
            HealthEduArticle healthEduArticle = healthEduArticleDao.findByCode(objectId);
            if (healthEduArticle != null){
                object.put("relationCodeName",healthEduArticle.getTitle());
            NewArticleModel articleModel = jkeduArticleDao.findByCode(objectId);
            if (articleModel != null){
                object.put("relationCodeName",articleModel.getArticleTitle());
            }
            object.put("createUserRole",1);
        }else if (type == 5){

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

@ -115,6 +115,7 @@ public class DoctorImmController extends BaseController {
					json.put("sex",IdCardUtil.getSexForIdcard_new(idCard));//性别
					json.put("jzzc",map.get("jzzc"));//接种针次
					json.put("ymkc",map.get("ymkc"));//true:可约,false:不可约
					json.put("jzrq",map.get("jzrq"));//接种日期
					jsonArray.put(json);
				}
			}
@ -147,7 +148,7 @@ public class DoctorImmController extends BaseController {
	@RequestMapping(value = "/alertImmVacclinByChildInfoCodes", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒居民疫苗接种(作废)")
	@ApiOperation(value = "医生提醒居民疫苗接种(作废).")
	public String alertImmVacclinByChildInfoCodes(@ApiParam(name = "alertDataJsonStr", value = "[{\"childCode\":\"123\",\"childName\":\"张三\",\"vaccinCode\":\"asd123\",\"vaccinName\":\"疫苗名称\"}]", defaultValue = "")
										   @RequestParam(value = "alertDataJsonStr", required = true) String alertDataJsonStr){
		try {
@ -161,7 +162,7 @@ public class DoctorImmController extends BaseController {
	@RequestMapping(value = "/alertImmVacclinByChildInfoCode", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒居民疫苗接种")
	public String alertImmVacclinByChildInfoCode(@ApiParam(name = "alertDataJsonStr", value = "{\"childCode\":\"123\",\"childName\":\"张三\",\"vaccinCode\":\"asd123\",\"vaccinName\":\"疫苗名称\"}", defaultValue = "")
	public String alertImmVacclinByChildInfoCode(@ApiParam(name = "alertDataJsonStr", value = "{\"childCode\":\"123\",\"childName\":\"张三\",\"vaccinCode\":\"asd123\",\"vaccinName\":\"疫苗名称\",\"jzrq\":\"接种日期\",\"jzzc\":\"接种针次\"}", defaultValue = "")
												  @RequestParam(value = "alertDataJsonStr", required = true) String alertDataJsonStr){
		try {
			int result = childFamilyImmuneService.alertImmVacclinByChildInfoCode(alertDataJsonStr,getUID());

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/message/GcOtherMessageController.java

@ -73,7 +73,7 @@ public class GcOtherMessageController {
            ) {
        try {
            Patient patient =  patientDao.findBySsc(cardNo);
            /*Patient patient =  patientDao.findBySsc(cardNo);
            SignFamily signFamily = null;
            if (patient!=null){
                signFamily = signFamilyDao.findByPatient(patient.getCode());
@ -100,9 +100,9 @@ public class GcOtherMessageController {
                System.out.println("消息模板id----"+templateId);
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }
            /*if ("3502110100".equals(signFamily.getHospital())){
            *//*if ("3502110100".equals(signFamily.getHospital())){
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }*/
            }*//*
            //秀萍
            if ("oULM4xPHQO1MYOPJdI9AtVKx3fIo".equals(patient.getOpenid())){
                System.out.println("------------start send message--------------");
@ -113,7 +113,7 @@ public class GcOtherMessageController {
                System.out.println("接收者id----"+patient.getOpenid());
                System.out.println("消息模板id----"+templateId);
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }
            }*/
            return new BaseResultModel(BaseResultModel.statusEm.success.getCode(),BaseResultModel.statusEm.success.getMessage());
        } catch (Exception e) {
            e.printStackTrace();