Browse Source

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

trick9191 7 years ago
parent
commit
ca9c34e116

+ 6 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/SaveHelper.java

@ -21,5 +21,11 @@ public class SaveHelper {
        return SpringUtil.getBean(ElastricSearchSave.class).save(sms);
    }
    public Boolean update(List<SaveModel> sms) {
        return SpringUtil.getBean(ElastricSearchSave.class).update(sms);
    }
}

+ 59 - 4
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElastricSearchSave.java

@ -2,9 +2,11 @@ package com.yihu.wlyy.statistics.etl.save.es;
import com.yihu.wlyy.statistics.vo.SaveModel;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestResult;
import io.searchbox.core.Bulk;
import io.searchbox.core.BulkResult;
import io.searchbox.core.Index;
import io.searchbox.core.Update;
import net.sf.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -38,14 +40,23 @@ public class ElastricSearchSave {
            //得到链接
            JestClient jestClient = elasticFactory.getJestClient();
            int success = 0;
            int error = 0;
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (SaveModel obj : sms) {
                Index index = new Index.Builder(obj).build();
                bulk.addAction(index);
                try {
                    obj.setCreateTime(new Date());
                    Index index = new Index.Builder(obj).build();
                    bulk.addAction(index);
                } catch (Exception e) {
                    logger.error(e.getMessage());
                }
            }
            BulkResult br = jestClient.execute(bulk.build());
            logger.info("save data count:" + sms.size());
            logger.info("save flag:" + br.isSucceeded());
            logger.info("update flag:" + br.isSucceeded());
            logger.info("update success:" + success);
            logger.info("update error:" + error);
            return br.isSucceeded();
        } catch (Exception e) {
            logger.error(" save error :" + e.getMessage());
@ -53,4 +64,48 @@ public class ElastricSearchSave {
        return null;
    }
    public Boolean update(List<SaveModel> sms) {
        try {
            //得到链接
            JestClient jestClient = elasticFactory.getJestClient();
            int success = 0;
            int error = 0;
            boolean isSuccessed = true;
//            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
//            for (SaveModel obj : sms) {
//                try {
//                    obj.setCreateTime(new Date());
//                    Update index = new Update.Builder(obj).index(esIndex).type(esType).id(obj.getId()).build();
//                    bulk.addAction(index);
//                    success++;
//                } catch (Exception e) {
//                    error++;
//                }
//            }
            for (SaveModel obj : sms) {
                try {
                    obj.setCreateTime(new Date());
                    Update index = new Update.Builder(obj).index(esIndex).type(esType).id(obj.getId()).build();
                    JestResult result = jestClient.execute(index);
                    if (result.isSucceeded()) {
                        success++;
                    } else {
                        error++;
                        isSuccessed = false;
                    }
                } catch (Exception e) {
                    error++;
                    isSuccessed = false;
                }
            }
            logger.info("update success:" + success);
            logger.info("update error:" + error);
            return isSuccessed;
        } catch (Exception e) {
            logger.error(" update error :" + e.getMessage());
        }
        return null;
    }
}

+ 16 - 5
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java

@ -117,7 +117,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
        if ("2".equals(timeLevel)) {
            //按年度到达量
            startTime = this.year + "-06-30 17:00:00";
        }else{
        } else {
            //增量
            this.startTime = new LocalDate(new DateTime().minusDays(1)).toString("yyyy-MM-dd") + " 17:00:00"; //2017-06-01 17:00:00
        }
@ -136,7 +136,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
        List<QuartzJobConfig> list = quartzJobConfigDao.findByIds();
        list.stream().forEach(one -> {
            try {
                logger.info("========================quotaCode:" + one.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+",timeLevel:"+timeLevel+" start========================");
                logger.info("========================quotaCode:" + one.getId() + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + ",timeLevel:" + timeLevel + " start========================");
                QuartzJobLog tjQuotaLog = new QuartzJobLog();
                tjQuotaLog.setJobId(one.getId());
                tjQuotaLog.setJobStartTime(new Date());
@ -160,7 +160,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
                tjQuotaLog.setJobEndTime(new Date());
                tjQuotaLog.setJobContent(JSONArray.fromObject(filterModel.getErrorModels()).toString());
                saveLog(tjQuotaLog);
                logger.info("========================quotaCode:" + one.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+" start========================");
                logger.info("========================quotaCode:" + one.getId() + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + " start========================");
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -207,15 +207,26 @@ public class CurrentMysqlToEsQuotaJob implements Job {
                    obj.setResult2(newResult.getResult2());
                    obj.setCreateTime(new Date());
                }
                sms=quarySaveModels;
                sms = quarySaveModels;
                return updateDate(sms);
            } else {
                return saveDate(sms);
            }
            return saveDate(sms);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
    private boolean updateDate(List<SaveModel> sms) {
        try {
            return SpringUtil.getBean(SaveHelper.class).update(sms);
        } catch (Exception e) {
            logger.error("save error:" + e.getMessage());
        }
        return false;
    }
    @Transactional
    private void saveLog(QuartzJobLog tjQuotaLog) {
        quartzJobLogDao.save(tjQuotaLog);

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionDispensaryCodeService.java

@ -119,7 +119,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    }
    @Transactional
    public void saveQRCode(String token,String prescriptionCode) throws Exception {
    public void saveQRCode(String prescriptionCode) throws Exception {
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        //取药类型:1 自取 2快递配送 3健管师配送
        Integer type = prescription.getDispensaryType();
@ -127,7 +127,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
        PrescriptionDispensaryCode p1 = prescriptionDispensaryCodeDao.findByPrescriptionCodeAndIsUseAndType(prescriptionCode,0,1);
        if(p1==null){
            p1 = savePatientQRCode(token,prescriptionCode);
            p1 = savePatientQRCode(prescriptionCode);
        }
        if(p1==null){
            throw new Exception("二维码生成失败!");
@ -136,7 +136,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            PrescriptionDispensaryCode p2 = prescriptionDispensaryCodeDao.findByPrescriptionCodeAndIsUseAndType(prescriptionCode,0,2);
            if(p2==null){
                p2 = saveQRCode(p1.getCode(),token,prescriptionCode,2);
                p2 = saveQRCode(p1.getCode(),prescriptionCode,2);
            }
            if(p2==null){
                throw new Exception("二维码生成失败!");
@ -144,7 +144,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
            PrescriptionDispensaryCode p3 = prescriptionDispensaryCodeDao.findByPrescriptionCodeAndIsUseAndType(prescriptionCode,0,3);
            if(p3==null){
                p3 = saveQRCode(p1.getCode(),token,prescriptionCode,3);
                p3 = saveQRCode(p1.getCode(),prescriptionCode,3);
            }
            if(p3==null){
                throw new Exception("二维码生成失败!");
@ -154,7 +154,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    //生成居民端取药码
    @Transactional
    public PrescriptionDispensaryCode savePatientQRCode(String token,String prescriptionCode) throws Exception {
    public PrescriptionDispensaryCode savePatientQRCode(String prescriptionCode) throws Exception {
        //获取年月日8位数
        Calendar cal  = Calendar.getInstance();
        String year = String.valueOf(cal.get(Calendar.YEAR));
@ -192,7 +192,7 @@ public class PrescriptionDispensaryCodeService extends BaseService {
    //生成配送员(健管师)(2、取药码  2、配送码)
    @Transactional
    public PrescriptionDispensaryCode saveQRCode(String code,String token,String prescriptionCode,Integer type) throws Exception {
    public PrescriptionDispensaryCode saveQRCode(String code,String prescriptionCode,Integer type) throws Exception {
        String jgsCode= "";
        synchronized (obj2){
            boolean bl = true;

+ 9 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/model/Charge.java

@ -21,7 +21,15 @@ public class Charge {
    private String userName;  // 用户姓名
    private String idType;  // 证件号码
    private String idNo;  // 证件类型
    //private String responseContent;  //扣费详情
    private String responseContent;  //扣费详情
    public String getResponseContent() {
        return responseContent;
    }
    public void setResponseContent(String responseContent) {
        this.responseContent = responseContent;
    }
    public String getTradeStatus() {
        return tradeStatus;

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -53,7 +53,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
            @ApiParam(required = true, name = "prescriptionCode", value = "处方code") @RequestParam(value = "prescriptionCode", required = true) String prescriptionCode) {
        try {
            prescriptionDispensaryCodeService.saveQRCode(getAccessToken(), prescriptionCode);
            prescriptionDispensaryCodeService.saveQRCode(prescriptionCode);
            return write(200, "生成二维码成功!");
        } catch (Exception e) {
            error(e);
@ -75,7 +75,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
//        String token = getAccessToken();
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.savePatientQRCode(getAccessToken(), prescriptionCode);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.savePatientQRCode(prescriptionCode);
            if (prescriptionDispensaryCode == null) {
                return error(-1, "生成居民取药码失败!");
            } else {
@ -100,7 +100,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
            @RequestParam(value = "code", required = true) String code) {
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code, getAccessToken(), prescriptionCode, 2);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code, prescriptionCode, 2);
            if (prescriptionDispensaryCode == null) {
                return error(-1, "生成配送员取药码失败!");
            } else {
@ -126,7 +126,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
            @RequestParam(value = "code", required = true) String code) {
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code, getAccessToken(), prescriptionCode, 3);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code,prescriptionCode, 3);
            if (prescriptionDispensaryCode == null) {
                return error(-1, "生成配送员配送码失败!");
            } else {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/HealthServiceController.java

@ -37,7 +37,7 @@ public class HealthServiceController extends WeixinBaseController {
			response.sendRedirect(server_url + "wx/html/home/html/login.html?type=1&openid=" + json.get("msg").toString());
		} else if (Integer.parseInt(json.get("status").toString()) == 200) {
//			String json2 = json.get("data").toString();
//			String paramUrl = getParamUrl(json2, 1);
//			String paramUrl = getParamUrl(json2, 1);12
			response.sendRedirect(server_url + "wx/html/zxwz/html/online-consulting.html");
		} else {
			response.sendRedirect(server_url + "wx/health_service/404.html");

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/wechat/readMe.MD

@ -0,0 +1,2 @@
集美区标签
正式库103 测试库105

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_jimei.txt

@ -87,6 +87,6 @@
	 ]
  }],
    "matchrule":{
      "tag_id":"105"
      "tag_id":"103"
      }
}