Browse Source

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

humingfen 7 years ago
parent
commit
e0fe049c71

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

@ -1,6 +1,7 @@
package com.yihu.wlyy.sign.common.thread;
import com.yihu.wlyy.sign.common.util.DateUtil;
import com.yihu.wlyy.sign.common.util.SpringContextHolder;
import com.yihu.wlyy.sign.service.SignZYService;
import com.yihu.wlyy.sign.service.SystemDictService;
@ -15,7 +16,7 @@ public class LoadNewSignThread implements Runnable {
    int retryTime =  30000;
    //空闲时间
    Integer nightHours = 22;
    Integer nightHours = 23;
    Integer morningHours = 6;
    //默认线程间隔
@ -37,7 +38,7 @@ public class LoadNewSignThread implements Runnable {
                    {
                        Boolean running = systemDictService.getLoadRunning();
                        if(running) {
                            //System.out.print(DateUtil.dateToStrLong(now) + " 开始采集新增签约...\r\n");
                            System.out.print(DateUtil.dateToStrLong(now) + " 开始采集新增签约...\r\n");
                            try {
                                signZYService.loadNewSignFamilyThread();
                            }
@ -46,7 +47,7 @@ public class LoadNewSignThread implements Runnable {
                                e.printStackTrace();
                            }
                            //System.out.print(DateUtil.dateToStrLong(new Date()) + " 采集新增签约结束。\r\n");
                            System.out.print(DateUtil.dateToStrLong(new Date()) + " 采集新增签约结束。\r\n");
                        }
                        continue;

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

@ -20,7 +20,7 @@ public class LoadThread implements Runnable {
    Integer morningHours = 6;
    //默认线程间隔
    Integer sleepTime = 180;
    Integer sleepTime = 60;
    @Override
    public void run() {
@ -29,38 +29,38 @@ 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");
                    if(signZYService!=null && systemDictService!=null)
                    {
                        Boolean running = systemDictService.getLoadRunning();
                        sleepTime = systemDictService.getLoadSleepTime();
//                        sleepTime = systemDictService.getLoadSleepTime();
                        if(running) {
                            System.out.print(DateUtil.dateToStrLong(now) + " 开始采集签约...\r\n");
                            System.out.print(DateUtil.dateToStrLong(now) + " 开始采集签约(更新)...\r\n");
                            try {
                                signZYService.loadSignFamilyThread();
                                signZYService.loadSignFamilyThreadMore();
                            }
                            catch (Exception e)
                            {
                                e.printStackTrace();
                            }
                            System.out.print(DateUtil.dateToStrLong(new Date()) + " 采集签约结束。\r\n");
                            System.out.print(DateUtil.dateToStrLong(new Date()) + " 采集签约(更新)结束。\r\n");
                        }
                        Thread.sleep(sleepTime*1000);//间隔三分钟
                        Thread.sleep(sleepTime*1000);//间隔1分钟
                        continue;
                    }
                    else{
                        Thread.sleep(retryTime);
                        continue;
                    }
                }
                Thread.sleep(sleepTime*1000);
//                }
//
//                Thread.sleep(sleepTime*1000);
            } catch (Exception ex) {
                ex.printStackTrace();
                try {

+ 3 - 2
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/common/thread/UploadChargeThread.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.sign.common.thread;
import com.yihu.wlyy.sign.common.util.DateUtil;
import com.yihu.wlyy.sign.common.util.SpringContextHolder;
import com.yihu.wlyy.sign.service.ChargeZYService;
import com.yihu.wlyy.sign.service.SystemDictService;
@ -28,7 +29,7 @@ public class UploadChargeThread implements Runnable{
                {
                    Boolean running = systemDictService.getUploadChargeRunning();
                    if(running) {
//                        System.out.print(DateUtil.dateToStrLong(now) + " 上传缴费...\r\n");
                        System.out.print(DateUtil.dateToStrLong(now) + " 上传缴费...\r\n");
                        try {
                            service.uploadCharge();
                        }
@ -37,7 +38,7 @@ public class UploadChargeThread implements Runnable{
                            e.printStackTrace();
                        }
//                        System.out.print(DateUtil.dateToStrLong(new Date()) + " 上传缴费记录结束。\r\n");
                        System.out.print(DateUtil.dateToStrLong(new Date()) + " 上传缴费记录结束。\r\n");
                    }
                    Thread.sleep(sleepTime);

+ 3 - 2
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/common/thread/UploadRenewThread.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.sign.common.thread;
import com.yihu.wlyy.sign.common.util.DateUtil;
import com.yihu.wlyy.sign.common.util.SpringContextHolder;
import com.yihu.wlyy.sign.service.SignRenewZYService;
import com.yihu.wlyy.sign.service.SystemDictService;
@ -35,7 +36,7 @@ public class UploadRenewThread implements Runnable {
                {
                    Boolean running = systemDictService.getUploadRenewRunning();
                    if(running) {
                        //System.out.print(DateUtil.dateToStrLong(now) + " 开始上传续签记录...\r\n");
                        System.out.print(DateUtil.dateToStrLong(now) + " 开始上传续签记录...\r\n");
                        try {
                            service.uploadRenewSignFamily();
                        }
@ -44,7 +45,7 @@ public class UploadRenewThread implements Runnable {
                            e.printStackTrace();
                        }
                        //System.out.print(DateUtil.dateToStrLong(new Date()) + " 上传续签记录结束。\r\n");
                        System.out.print(DateUtil.dateToStrLong(new Date()) + " 上传续签记录结束。\r\n");
                    }
                    Thread.sleep(sleepTime);

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

@ -355,7 +355,7 @@ public class SignRenewZYService {
                }
                //////////////$$$$$ 20170616 hzp 特殊写死 /////////////////////////////////////
                String signYear = "2017";
	            String signYear = "2018";
                /*map.get("SIGN_YEAR");
                if(signYear.length()!=4)
                {
@ -879,7 +879,7 @@ public class SignRenewZYService {
                String patientBirthday = map.get("BIRTHDAY");  //患者生日
                String patientCardNo = map.get("CARD_NO");  //患者社保卡号
                ////////////// 20170616 hzp 特殊写死 $$$$$/////////////////////////////////////
                String signYear = "2017";//map.get("SIGN_YEAR"); //签约年份
                String signYear = "2018";//map.get("SIGN_YEAR"); //签约年份
                //社保卡号过长存-1
                if(!StringUtil.isEmpty(patientCardNo) && patientCardNo.length()>20)
                {
@ -1627,7 +1627,11 @@ public class SignRenewZYService {
                } else {
                    log.setNeedUpload("1");
                }
                log.setUploadLog(content + "\r\n" + msg);
                String errorMsg = content + "\r\n" + msg;
                if(errorMsg.length() > 4000){
                    errorMsg = errorMsg.substring(0,3990);
                }
                log.setUploadLog(errorMsg);
            }
            else //成功
            {

+ 241 - 19
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignZYService.java

@ -15,6 +15,10 @@ import org.springframework.stereotype.Service;
import java.io.*;
import java.util.*;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
/**
 * Created by hzp on 2016/9/9.
@ -339,7 +343,7 @@ public class SignZYService {
        String msg = "";
        SignFamily sign = null;
        //**续签对接临时方案***
        if(!"2017".equals(signYear))
        if(!"2018".equals(signYear))
        {
            return false;
        }
@ -348,6 +352,7 @@ public class SignZYService {
        try {
            if (map != null && map.containsKey("IDENTITY_CARD_NO")) {
                idcard = map.get("IDENTITY_CARD_NO");
//                System.out.println("开始同步基卫传递过来的签约数据(更新):居民身份证"+idcard);
                proId = map.get("PRO_ID");
                String chargeTime = map.get("CHARGE_TIME");//付款时间
                String flag = map.get("SUBSIDY_FLAG"); //是否补贴
@ -727,7 +732,6 @@ public class SignZYService {
        //签约变更记录表
        saveSignFamilyMapping(code, proId, signYear,idcard, action, isSuccess);
        return isSuccess;
    }
@ -1007,10 +1011,11 @@ public class SignZYService {
        String msg = "";
        try {
            
            if (map != null && map.containsKey("PRO_ID") && map.get("RELEASE_FLAG").equals("2"))
            {
                proId = map.get("PRO_ID");
//                System.out.println("开始同步基卫传递过来的解约数据:基卫pro_id"+proId);
                //通过proid获取code
                SignFamilyMapping mapping = signFamilyMappingDao.findByProId(proId);
                if(mapping==null || StringUtil.isEmpty(mapping.getCode()))
@ -1086,7 +1091,7 @@ public class SignZYService {
        //签约变更记录表
        saveSignFamilyMapping(null, proId, null, idcard, action, isSuccess);
//        System.out.println("开始同步基卫传递过来的解约数据:基卫pro_id"+proId+",同步成功");
        return isSuccess;
    }
@ -1215,31 +1220,101 @@ public class SignZYService {
     */
    public void loadSignFamilyThread() throws Exception
    {
        String startTime =  systemDictService.getLoadSignTime();   //上次执行时间
        /*Date start = DateUtil.getNextMin(DateUtil.strToDate(startTime), -1);   //重复采集前1分钟
        startTime = DateUtil.dateToStrLong(start);*/
        String endTime = DateUtil.dateToStrLong(new Date());
        System.out.print(DateUtil.getCurrentString()+ " update sign family start..");
        loadSignFamilyBatch(startTime, endTime);
        Date end = new Date();
        do {
            String startTime =  systemDictService.getLoadSignTime();   //上次执行时间
            Date start = DateUtil.getNextMin(DateUtil.strToDate(startTime), -1);   //重复采集前1分钟
            startTime = DateUtil.dateToStrLong(start);
    
            String endTime = DateUtil.dateToStrLong(new Date());
    
            System.out.println("采集时间:start="+startTime);
    
            end = DateUtil.getNextMin(DateUtil.strToDate(startTime), 30);//采集30分钟后的数据
            
            if(end.before(new Date())){
                endTime = DateUtil.dateToStrLong(end);
            }
            System.out.print(DateUtil.getCurrentString()+ " update sign family start..");
            loadSignFamilyBatch(startTime, endTime);
    
            //更新下次采集签约时间
            systemDictService.saveLoadSignTime(endTime);
        //更新下次采集签约时间
        systemDictService.saveLoadSignTime(endTime);
        }while (end.before(new Date()));
    }
    
    
    /**
     * 【线程】调用批量更新签约数据
     * 多线程同步
     * @throws Exception
     */
    public void loadSignFamilyThreadMore() throws Exception
    {
        Date end = new Date();
        do {
            String startTime =  systemDictService.getLoadSignTime();   //上次执行时间
            Date start = DateUtil.getNextMin(DateUtil.strToDate(startTime), -1);   //重复采集前1分钟
            startTime = DateUtil.dateToStrLong(start);
            
            String endTime = DateUtil.dateToStrLong(new Date());
            
            System.out.println("采集时间:start="+startTime);
            
            end = DateUtil.getNextMin(DateUtil.strToDate(startTime), 15);//采集15分钟后的数据
            
            if(end.before(new Date())){
                endTime = DateUtil.dateToStrLong(end);
            }
            System.out.print(DateUtil.getCurrentString()+ " update sign family start..");
            loadSignFamilyBatchMore(startTime, endTime);
            
            //更新下次采集签约时间
            systemDictService.saveLoadSignTime(endTime);
            
        }while (end.before(new Date()));
    }
    
    /**
     * 【线程】调用批量新增签约数据
     */
    public void loadNewSignFamilyThread() throws Exception
    {
    
        Date end = new Date();
//        do {
        String startTime =  systemDictService.getLoadNewSignTime();   //上次执行时间
        Date start = DateUtil.getNextMin(DateUtil.strToDate(startTime), -1);   //重复采集前1分钟
        startTime = DateUtil.dateToStrLong(start);
    
        String endTime = DateUtil.dateToStrLong(new Date());
    
        System.out.println("采集时间:start="+startTime);
    
        end = DateUtil.getNextMin(DateUtil.strToDate(startTime), 30);//采集30分钟后的数据
    
        if(end.before(new Date())){
            endTime = DateUtil.dateToStrLong(end);
        }
        System.out.println("采集时间:end="+endTime);
        loadNewSignFamilyBatch(startTime,endTime);
        //更新下次采集签约时间
        systemDictService.saveLoadNewSignTime(endTime);
        
//        }while (end.before(new Date()));
        
//        String startTime =  systemDictService.getLoadNewSignTime();   //上次执行时间
//        Date start = DateUtil.getNextMin(DateUtil.strToDate(startTime), -1);   //重复采集前1分钟
//        startTime = DateUtil.dateToStrLong(start);
//        String endTime = DateUtil.dateToStrLong(new Date());
//
//        loadNewSignFamilyBatch(startTime,endTime);
//
//        //更新下次采集签约时间
//        systemDictService.saveLoadNewSignTime(endTime);
    }
    /************************************* 公开接口 ************************************************/
@ -1616,6 +1691,153 @@ public class SignZYService {
        }
        return isSuccess;
    }
    
    
    /**
     * 遍历机构更新签约数据   (更新)--多线程同步
     */
    public void loadSignFamilyBatchMore(String startTime,String endTime) throws Exception
    {
        List<HospitalMapping> list = hospitalMappingDao.findJwOrg();
        long total =  0;
        long error = 0;
        if(list!=null && list.size()>0) //获取机构映射
        {
            for(HospitalMapping hm :list)
            {
                try {
                    String hospital = hm.getMappingCode();
                    String licence = hm.getLicence();
                    //获取某个时间段签约数据
                    String response =  zysoftService.getEhrOrgFamilySignInfo(startTime, endTime, hospital, licence,"0");
                    List<Map<String,String>> signList = zysoftService.getJwList(response);
                    
                    long htotal =  0;
                    long herror = 0;
                    if(signList!=null && signList.size()>0)
                    {
                        htotal =  signList.size();
    
                        System.out.print("遍历机构更新签约数据   (更新)"+startTime +"~" + endTime +"【"+hm.getName()+"】总采集"+htotal+"条:开始执行同步"+DateUtil.getCurrentString()+"..\r\n");
                        
                        //数据小于10条的直接走单线程处理
                        if(10 >= htotal){
                            //遍历数据
                            for(Map<String,String> signInfo:signList)
                            {
                                //判断是否解约
                                if(signInfo.get("RELEASE_FLAG")!=null && signInfo.get("RELEASE_FLAG").equals("2"))
                                {
                                    if(!releaseSignFamily(signInfo))
                                    {
                                        herror ++;
                                    }
                                }
                                else{
                                    if(!saveSignFamily(signInfo))
                                    {
                                        herror ++;
                                    }
                                }
                            }
                            total += htotal;
                            error += herror;
                        }else {
                         //数据大于10条的走多线程
                            long start = System.currentTimeMillis();
                            // 总数据条数
                            int dataSize = signList.size();
                            // 每10条数据开启一条线程
                            int threadSize = 10;
                            // 线程数
                            int threadNum = dataSize / threadSize + 1;
                            // 定义标记,过滤threadNum为整数
                            boolean special = dataSize % threadSize == 0;
    
    
                            System.out.print("遍历机构更新签约数据   (更新):线程数"+threadNum+"..\r\n");
    
                            // 创建一个线程池
                            ExecutorService exec = Executors.newFixedThreadPool(threadNum);
    
                            // 定义一个任务集合
                            List<Callable<Integer>> tasks = new ArrayList<Callable<Integer>>();
                            Callable<Integer> task = null;
                            List<Map<String,String>> cutList = null;
                            // 确定每条线程的数据
                            for (int i = 0; i < threadNum; i++) {
                                if (i == threadNum - 1) {
                                    if (special) {
                                        break;
                                    }
                                    cutList = signList.subList(threadSize * i, dataSize);
                                } else {
                                    cutList = signList.subList(threadSize * i, threadSize * (i + 1));
                                }
                                // System.out.println("第" + (i + 1) + "组:" + cutList.toString());
                                final List<Map<String,String>> listStr = cutList;
                                task = new Callable<Integer>() {
                                    @Override
                                    public Integer call() throws Exception {
                                        if(listStr!=null && listStr.size()>0)
                                        {
//                                            htotal =  signList.size();
                                            //遍历数据
                                            for(Map<String,String> signInfo:listStr)
                                            {
                                                //判断是否解约
                                                if(signInfo.get("RELEASE_FLAG")!=null && signInfo.get("RELEASE_FLAG").equals("2"))
                                                {
                                                    if(!releaseSignFamily(signInfo))
                                                    {
                                                        System.out.print("遍历机构更新签约数据   (更新):解约失败..\r\n");
//                                                        herror ++;
                                                    }
                                                }
                                                else{
                                                    if(!saveSignFamily(signInfo))
                                                    {
                                                        System.out.print("遍历机构更新签约数据   (更新):签约失败..\r\n");
//                                                        herror ++;
                                                    }
                                                }
                                            }
//                                            total += htotal;
//                                            error += herror;
                                        }
//                                        System.out.println(Thread.currentThread().getName() + "线程:");
                                        return 1;
                                    }
                                };
                                // 这里提交的任务容器列表和返回的Future列表存在顺序对应的关系
                                tasks.add(task);
                            }
                            List<Future<Integer>> results = exec.invokeAll(tasks);
                            for (Future<Integer> future : results) {
                                System.out.println(future.get());
                            }
                            // 关闭线程池
                            exec.shutdown();
                            System.out.println("线程任务执行结束");
                            System.err.println("执行任务消耗了 :" + (System.currentTimeMillis() - start) + "毫秒");
                         
                        }
                    }
                    System.out.print("遍历机构更新签约数据   (更新)"+startTime +"~" + endTime +"【"+hm.getName()+"】总采集"+htotal+"条,失败"+herror+"条。..\r\n");
                }
                catch (Exception e)
                {
                    System.out.print("遍历机构更新签约数据   (更新)"+startTime +"~" + endTime +"【"+hm.getName()+"】全部采集失败。..\r\n");
                }
            }
            
        }
        if(error != 0)
        {
            System.out.print("遍历机构更新签约数据   (更新)"+startTime +"~" + endTime +"批量更新签约数据,总条数"+total+"条,失败"+error+"条。..\r\n");
        }
    }
    /**
@ -1663,18 +1885,18 @@ public class SignZYService {
                        total += htotal;
                        error += herror;
                    }
                    //System.out.print(startTime +"~" + endTime +"【"+hm.getName()+"】总采集"+htotal+"条,失败"+herror+"条。");
                    System.out.print("遍历机构更新签约数据   (更新)"+startTime +"~" + endTime +"【"+hm.getName()+"】总采集"+htotal+"条,失败"+herror+"条。");
                }
                catch (Exception e)
                {
                    //System.out.print(startTime +"~" + endTime +"【"+hm.getName()+"】全部采集失败。");
                    System.out.print("遍历机构更新签约数据   (更新)"+startTime +"~" + endTime +"【"+hm.getName()+"】全部采集失败。");
                }
            }
        }
        if(error != 0)
        {
            //System.out.print(startTime +"~" + endTime +"批量更新签约数据,总条数"+total+"条,失败"+error+"条。");
            System.out.print("遍历机构更新签约数据   (更新)"+startTime +"~" + endTime +"批量更新签约数据,总条数"+total+"条,失败"+error+"条。");
        }
    }
@ -1723,18 +1945,18 @@ public class SignZYService {
                        total += htotal;
                        error += herror;
                    }
                    //System.out.print(startTime +"~" + endTime +"【"+hm.getName()+"】总采集"+htotal+"条,失败"+herror+"条。");
                    System.out.print("遍历机构更新签约数据   (新增)"+startTime +"~" + endTime +"【"+hm.getName()+"】总采集"+htotal+"条,失败"+herror+"条。");
                }
                catch (Exception e)
                {
                    //System.out.print(startTime +"~" + endTime +"【"+hm.getName()+"】全部采集失败。");
                    System.out.print("遍历机构更新签约数据   (新增)"+startTime +"~" + endTime +"【"+hm.getName()+"】全部采集失败。");
                }
            }
        }
        if(error != 0)
        {
            //System.out.print(startTime +"~" + endTime +"批量更新签约数据,总条数"+total+"条,失败"+error+"条。");
            System.out.print("遍历机构更新签约数据   (新增)"+startTime +"~" + endTime +"批量更新签约数据,总条数"+total+"条,失败"+error+"条。");
        }
    }

+ 3 - 3
patient-co/patient-co-wlyy/doc/技术文档/es/回访问卷新增索引.txt

@ -1,9 +1,9 @@
创建索引
POST  http://172.19.103.68:9200/wlyy_questionnaire_winning
POST  http://27.155.100.191:9200//wlyy_questionnaire_winning
查询索引
GET http://172.19.103.68:9200/wlyy_questionnaire_winning/
GET http://27.155.100.191:9200/wlyy_questionnaire_winning/
给索引加mapping
POST http://172.19.103.68:9200/wlyy_questionnaire_winning/wlyy_questionnaire_winning/_mapping
POST http://27.155.100.191:9200/wlyy_questionnaire_winning/wlyy_questionnaire_winning/_mapping
{
    "wlyy_questionnaire_winning": {
        "properties": {

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

@ -2091,15 +2091,14 @@ public class SignWebService extends BaseService {
    public JSONObject getOverDuePatients(String year, Long teamCode, String doctor, boolean isFollowWeChat,Integer page, Integer pageSize) {
        StringBuffer sql = new StringBuffer("SELECT IFNULL(year( from_days( datediff( now(), p.birthday))),'未知') age," +
                "t.patient code,t.idcard,t.name,t.mobile,t.openid,p.photo," +
                "t.ssc,t.type signType,p.sex ,t.expenses_status expensesStatus,c.disease " +
                "t.ssc,t.type signType,p.sex ,t.expenses_status expensesStatus " +
                " FROM wlyy_sign_family t " +
                " LEFT JOIN wlyy_patient p ON t.patient = p.code " +
                " LEFT JOIN (select patient,group_concat(label) disease,sum(label) lablesum from wlyy_sign_patient_label_info where label_type = 3 and status=1 GROUP BY patient) c on t.patient = c.patient " +
                " WHERE t.doctor ='" + doctor + "' AND t.admin_team_code =" + teamCode + " AND t.sign_year ='" + year + "' AND t.status =-4 ");
        if(isFollowWeChat){
            sql.append(" AND p.openid IS NOT NULL AND p.openid <>'' order by p.standard_status DESC ,p.disease_condition DESC,c.lablesum DESC DESC LIMIT " + page * pageSize + "," + pageSize);
            sql.append(" AND p.openid IS NOT NULL AND p.openid <>'' order by p.standard_status DESC ,p.disease_condition DESC LIMIT " + page * pageSize + "," + pageSize);
        }else{
            sql.append(" order by p.standard_status DESC ,p.disease_condition DESC,c.lablesum DESC,p.openid DESC LIMIT " + page * pageSize + "," + pageSize);
            sql.append(" order by p.standard_status DESC ,p.disease_condition DESC,p.openid DESC LIMIT " + page * pageSize + "," + pageSize);
        }
        
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql.toString());

+ 17 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java

@ -250,7 +250,7 @@ public class SurveyScreenResultService extends BaseService {
        //来自医生发放和自我评估不一样来源
        if (source==1){
            surveyScreenResult.setDoctor(doctor);
        }else {
        }/*else {
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
            if (signFamily!=null && StringUtils.isNotEmpty(signFamily.getDoctor())){
                surveyScreenResult.setDoctor(signFamily.getDoctor());
@ -259,7 +259,7 @@ public class SurveyScreenResultService extends BaseService {
                surveyScreenResult.setDoctor(signFamily.getDoctorHealth());
            }
        }
        }*/
        surveyScreenResult.setPatientCode(patientCode);
        if (patient!=null){
            surveyScreenResult.setPatientName(patient.getName());
@ -763,14 +763,16 @@ public class SurveyScreenResultService extends BaseService {
                            p = patientDao.findByCode(c);
                            name = p.getName();
                            openId = p.getOpenid();
                            json.put("keyword1", keyword1);
                            json.put("keyword2", sdf.format(new Date()));
                            json.put("survey", wxTemplateCode);
//                        String first = name + ",您好!为了给您提供更好的家庭医生健康服务,现有一份问卷需要您填写。";
                            json.put("survey", wxTemplateCode+"_"+doctor);
                            json.put("toUser", c);
                            json.put("url","jkpg/html/start-survey.html?survey="+wxTemplateCode+"_"+doctor);
//                          String first = name + ",您好!为了给您提供更好的家庭医生健康服务,现有一份问卷需要您填写。";
                            first = templateConfig.getFirst();
                            first = first.replace("key1",(name==null?"":name));
                            json.put("first", first);
                            json.put("remark", remark);
                            json.put("keyword1", keyword1);
                        } catch (JSONException e) {
                            continue;
                        }
@ -790,8 +792,10 @@ public class SurveyScreenResultService extends BaseService {
                                    if (StringUtils.isNotBlank(member.getOpenid())) {
                                        json.remove("toUser");
                                        json.put("toUser", member.getCode());
                                        json.put("url","jkpg/html/start-survey.html?survey="+wxTemplateCode+"_"+doctor);
                                        json.remove("first");
                                        try {
                                            json.put("keyword1", keyword1);
                                            json.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()) + first);
                                        } catch (Exception e) {
                                            e.printStackTrace();
@ -807,7 +811,13 @@ public class SurveyScreenResultService extends BaseService {
        }
//       =====================================================
//     获取标签数组
        JSONArray lables = jsonStr.getJSONArray("label");
        SurveyLabelInfo surveyLabelInfo = new SurveyLabelInfo();
        surveyLabelInfo.setCode(getCode());
        surveyLabelInfo.setRelationCode(surveyCode);
        surveyLabelInfo.setUseType(useType);
        surveyLabelInfo.setLabel(Integer.parseInt(templateLabel));
        SurveyLabelInfo ss = surveyLabelInfoDao.save(surveyLabelInfo);
       /* JSONArray lables = jsonStr.getJSONArray("label");
//        标签保存到wlyy_survey_label_info
        for (Object label : lables) {
            SurveyLabelInfo surveyLabelInfo = new SurveyLabelInfo();
@ -816,7 +826,7 @@ public class SurveyScreenResultService extends BaseService {
            surveyLabelInfo.setUseType(useType);
            surveyLabelInfo.setLabel(Integer.parseInt(label.toString()));
            SurveyLabelInfo ss = surveyLabelInfoDao.save(surveyLabelInfo);
        }
        }*/
//        获取问题数组
        JSONArray questions = jsonStr.getJSONArray("questions");
        for (Object question : questions) {

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/GuahaoXMService.java

@ -1242,8 +1242,8 @@ public class GuahaoXMService extends BaseService implements IGuahaoService {
            String startTime = map.get("startTime");
            String endTime = map.get("endTime");
            String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);
/* String response = "e07cfa6a-e134-4329-bb99-9b7dbffea79e|516|熊永强";*/
            /*String response = jwSmjkService.webRegisterByFamily(cardNo, patientName, clinicCard, sectionType, startTime, hospitalId, hosDeptId, hosDeptName, doctorId, doctorName,patientPhone);*/
            String response = UUID.randomUUID()+"|516|熊永强";
            re = CreateOrderAfter(response, hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, sectionType, startTime, endTime, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
        } else {
            throw new Exception("该排班信息错误或者不存在!");

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java

@ -142,6 +142,9 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
                                    @ApiParam(value = "建议code,多个逗号隔开")@RequestParam(value = "adviceCodes") String advicCcodes,
                                    @ApiParam(value = "其他建议")@RequestParam(value = "otherAdvice",required = false) String otherAdvice) {
        try {
            if (otherAdvice.length()>200){
                return write(-1,"其他建议的字数不得超过200字");
            }
            surveyScreenResultService.updateAfterFollowing(code,advicCcodes,otherAdvice);
            return write(200, "跟踪成功!");
        } catch (Exception e) {

+ 7 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/survey/PatientQuestionnaireController.java

@ -2,7 +2,9 @@ package com.yihu.wlyy.web.patient.survey;
import com.google.gson.JsonObject;
import com.yihu.es.entity.QuestionnaireWinningESDO;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.questionnaire.QuestionnaireUsers;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.questionnaire.QuestionnaireUsersDao;
import com.yihu.wlyy.rest.model.common.SimpleResult;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
@ -47,6 +49,8 @@ public class    PatientQuestionnaireController extends BaseController {
    private SurveyScreenResultService surveyScreenResultService;
    @Autowired
    private ManagerQuestionnaireService managerQuestionnaireService;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @RequestMapping(value = "getSurveySummary", method = RequestMethod.GET)
    @ApiOperation(value = "居民端获取问卷概述")
@ -171,7 +175,7 @@ public class    PatientQuestionnaireController extends BaseController {
    @ApiOperation(value = "保存用户答案")
    @ResponseBody
    public String saveAnswer( @RequestParam String jsonData,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "医生code")@RequestParam(value = "doctorCode",required = false)String doctorCode,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")int labelType,
                              @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source) {
@ -180,9 +184,9 @@ public class    PatientQuestionnaireController extends BaseController {
            JSONObject json = new JSONObject(jsonData);
            //如果是评分筛查还要保存最后记录
            if (labelType==5){
                return  write(200, "保存成功!","data",surveyScreenResultService.saveScreenResultAndAnswer(patientCode,getUID(),isAgain,source,json));
                return  write(200, "保存成功!","data",surveyScreenResultService.saveScreenResultAndAnswer(getRepUID(),doctorCode,isAgain,source,json));
            }else {
                managerQuestionnaireService.saveAnswer(patientCode, "",json);
                managerQuestionnaireService.saveAnswer(getRepUID(), "",json);
                return write(200, "保存成功!");
            }
        } catch (Exception e) {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/zysoft/BookingController.java

@ -606,7 +606,7 @@ public class BookingController extends WeixinBaseController {
                                      @ApiParam(name = "dname", value = "代预约医生名称", defaultValue = "组2全科医生")
                                      @RequestParam(value = "dname", required = true) String dname,
                                      @ApiParam(name="surveyCode",value = "筛选code",defaultValue = "a")
                                      @RequestParam(value = "surveyCode",required = true)String surveyCode) {
                                      @RequestParam(value = "surveyCode",required = false)String surveyCode) {
        try {
            String orderCode = guahaoXM.CreateOrderByDoctor(hospitalId, hospitalName, hosDeptId, hosDeptName, doctorId, doctorName, arrangeDate, patient, patientName, cardNo, clinicCard, patientPhone, dname, dcode,surveyCode);
            //获取预约信息查询是否挂号成功