Browse Source

Merge branch 'dev' of http://192.168.1.220:10080/Amoy2/wlyy2.0 into dev

wangjun 4 years ago
parent
commit
ec68371d81

+ 8 - 10
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java

@ -668,15 +668,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("expressage", null);
        }
        if (!wechatId.equalsIgnoreCase("xm_ykyy_wx")) {
            //物流配送新
            List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
            List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
            if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
                rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
            } else {
                rs.put("expressageLogs", null);
            }
        //物流配送新
        List<WlyyPrescriptionExpressageLogDO> expressageLogDOs = prescriptionExpressageLogDao.queryByOutpatientIdOrderByCreateTimeDesc(outpatientId);
        List<WlyyPrescriptionExpressageLogVO> expressageLogVOs = new ArrayList<>();
        if (expressageLogDOs != null && expressageLogDOs.size() > 0) {
            rs.put("expressageLogs", convertToModels(expressageLogDOs, expressageLogVOs, WlyyPrescriptionExpressageLogVO.class));
        } else {
            rs.put("expressageLogs", null);
        }
        //预约记录
@ -9735,7 +9733,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        nvps.add(new BasicNameValuePair("accid", userId));
        YxTokenMappingDO yxTokenMappingDO1 = new YxTokenMappingDO();
        String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
        logger.info("返回日志"+response);
        logger.info("重置云信"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){

+ 138 - 99
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/YkyyEntranceService.java

@ -1988,114 +1988,115 @@ public class YkyyEntranceService {
        Integer icd10Flag = 0;
        //诊断删除v_hlwys_mz_jzls
        if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
            String deleteSql = "delete from v_hlwys_mz_jzls where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
        if (!StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
           /* String deleteSql = "delete from v_hlwys_mz_jzls where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
            Map<String,Object> params = new HashedMap();
            params.put("sql",deleteSql);
            HttpResponse response = HttpUtils.doGet(updateUrl,params);
            if (response.getStatus()==200){
                logger.info("表v_hlwys_mz_jzls删除成功!");
            }
        }
        List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code,1);
        if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
            WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
            //就诊历史表HLWYS_MZ_JZLS
            HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
            hlwYsMzJzLsDO.setJZXH(0);
            hlwYsMzJzLsDO.setGHXH(GHXH);
            hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
            hlwYsMzJzLsDO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
            hlwYsMzJzLsDO.setYSDM(doctorMappingDO.getMappingCode());
            hlwYsMzJzLsDO.setKSSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
            hlwYsMzJzLsDO.setJSSJ(DateUtil.getNight23());
            hlwYsMzJzLsDO.setJZZT(9);
            hlwYsMzJzLsDO.setJZLX(3);//就诊类型
            hlwYsMzJzLsDO.setZDMC(diagnosisDO.getName());
            hlwYsMzJzLsDO.setMQZD(diagnosisDO.getName());
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
            }
            //V_HLW_ICD10.FLAG
            JSONArray jsonArray2 = findHisIcd10(diagnosisDO.getCode());
            if(jsonArray2!=null&&jsonArray2.size()>0){
                //获取居民信息
                JSONObject json = jsonArray2.getJSONObject(0);
                icd10Flag = json.getInteger("FLAG");
            }*/
            List<WlyyPrescriptionDiagnosisDO> diagnosisDOs = prescriptionDiagnosisDao.findByPrescriptionId(code,1);
            if(diagnosisDOs!=null&&diagnosisDOs.size()>0){
                WlyyPrescriptionDiagnosisDO diagnosisDO = diagnosisDOs.get(0);
                //就诊历史表HLWYS_MZ_JZLS
                HlwYsMzJzLsDO hlwYsMzJzLsDO = new HlwYsMzJzLsDO();
                hlwYsMzJzLsDO.setJZXH(0);
                hlwYsMzJzLsDO.setGHXH(GHXH);
                hlwYsMzJzLsDO.setBRBH(Integer.parseInt(patientMappingDO.getMappingCode()));
                hlwYsMzJzLsDO.setKSDM(Integer.parseInt(wlyyPrescriptionVO.getDept()));
                hlwYsMzJzLsDO.setYSDM(doctorMappingDO.getMappingCode());
                hlwYsMzJzLsDO.setKSSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));
                hlwYsMzJzLsDO.setJSSJ(DateUtil.getNight23());
                hlwYsMzJzLsDO.setJZZT(9);
                hlwYsMzJzLsDO.setJZLX(3);//就诊类型
                hlwYsMzJzLsDO.setZDMC(diagnosisDO.getName());
                hlwYsMzJzLsDO.setMQZD(diagnosisDO.getName());
                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                    hlwYsMzJzLsDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
                }
                //V_HLW_ICD10.FLAG
                JSONArray jsonArray2 = findHisIcd10(diagnosisDO.getCode());
                if(jsonArray2!=null&&jsonArray2.size()>0){
                    //获取居民信息
                    JSONObject json = jsonArray2.getJSONObject(0);
                    icd10Flag = json.getInteger("FLAG");
            }
            hlwYsMzJzLsDO.setZYZD(icd10Flag);
            String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
            Map<String,Object> params2 = new HashedMap();
            params2.put("json",jsonString2);
            params2.put("table","HlwYsMzJzLsDO");
            logger.info("HlwYsMzJzLsDO:"+jsonString2);
            HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
            if (response2.getStatus()==200){
                String content = response2.getContent();
                logger.info("content"+content);
                //获取就诊序号,更新处方表数据
                JSONObject jsonObject = JSONObject.parseObject(content);
                JSONObject object = jsonObject.getJSONObject("obj");
                if (object!=null){
                    Integer jzxh = object.getInteger("jzxh");
                    wlyyPrescriptionVO.setAdmNo(jzxh+"");
                    logger.info("JZXH=========="+jzxh);
                    List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
                    if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                        WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                        wlyyPrescriptionDO.setAdmNo(jzxh+"");
                        prescriptionDao.save(wlyyPrescriptionDO);
                }
                hlwYsMzJzLsDO.setZYZD(icd10Flag);
                String jsonString2 = JSONObject.toJSONString(hlwYsMzJzLsDO);
                Map<String,Object> params2 = new HashedMap();
                params2.put("json",jsonString2);
                params2.put("table","HlwYsMzJzLsDO");
                logger.info("HlwYsMzJzLsDO:"+jsonString2);
                HttpResponse response2 = HttpUtils.doGet(saveUrl,params2);
                if (response2.getStatus()==200){
                    String content = response2.getContent();
                    logger.info("content"+content);
                    //获取就诊序号,更新处方表数据
                    JSONObject jsonObject = JSONObject.parseObject(content);
                    JSONObject object = jsonObject.getJSONObject("obj");
                    if (object!=null){
                        Integer jzxh = object.getInteger("jzxh");
                        wlyyPrescriptionVO.setAdmNo(jzxh+"");
                        logger.info("JZXH=========="+jzxh);
                        List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
                        if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                            WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                            wlyyPrescriptionDO.setAdmNo(jzxh+"");
                            prescriptionDao.save(wlyyPrescriptionDO);
                        }
                    }
                    logger.info("表hlwYsMzJzLsDO同步成功!");
                }
                logger.info("表hlwYsMzJzLsDO同步成功!");
            }
            //删除疾病诊断表HLWYS_MZ_JBZD
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                String deleteSql = "delete from v_hlwys_mz_jbzd where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
                Map<String,Object> params = new HashedMap();
                params.put("sql",deleteSql);
                HttpResponse response = HttpUtils.doGet(updateUrl,params);
                if (response.getStatus()==200){
                    logger.info("表v_hlwys_mz_jbzd删除成功!");
                //删除疾病诊断表HLWYS_MZ_JBZD
                /*if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                    String deleteSql = "update v_hlwys_mz_jbzd set  zfpb=1,  where jzxh = '"+wlyyPrescriptionVO.getAdmNo()+"'";
                    Map<String,Object> params = new HashedMap();
                    params.put("sql",deleteSql);
                    HttpResponse response = HttpUtils.doGet(updateUrl,params);
                    if (response.getStatus()==200){
                        logger.info("表v_hlwys_mz_jbzd删除成功!");
                    }
                }*/
                //疾病诊断表HLWYS_MZ_JBZD
                HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
                //hlwYsMzJbzdDO.setJLBH(0);
                hlwYsMzJbzdDO.setYSDM(doctorMappingDO.getMappingCode());
                hlwYsMzJbzdDO.setICD(diagnosisDO.getCode());
                hlwYsMzJbzdDO.setMSZD(diagnosisDO.getName());
                hlwYsMzJbzdDO.setJBBH(icd10Flag);
                hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
                hlwYsMzJbzdDO.setZDLB(11);//诊断类别
                hlwYsMzJbzdDO.setZDSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//诊断时间
                hlwYsMzJbzdDO.setZFPB(0);//作废标志
                hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
                hlwYsMzJbzdDO.setQZSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//确诊时间
                hlwYsMzJbzdDO.setJBMC(diagnosisDO.getName());//诊断名称
                hlwYsMzJbzdDO.setZDLX(1);//诊断类型
                hlwYsMzJbzdDO.setTJBZ(1);//提交标志
                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                    hlwYsMzJbzdDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
                }
            }
            //疾病诊断表HLWYS_MZ_JBZD
            HlwYsMzJbzdDO hlwYsMzJbzdDO = new HlwYsMzJbzdDO();
            //hlwYsMzJbzdDO.setJLBH(0);
            hlwYsMzJbzdDO.setYSDM(doctorMappingDO.getMappingCode());
            hlwYsMzJbzdDO.setICD(diagnosisDO.getCode());
            hlwYsMzJbzdDO.setMSZD(diagnosisDO.getName());
            hlwYsMzJbzdDO.setJBBH(icd10Flag);
            hlwYsMzJbzdDO.setBRBH(Integer.valueOf(patientMappingDO.getMappingCode()));
            hlwYsMzJbzdDO.setZDLB(11);//诊断类别
            hlwYsMzJbzdDO.setZDSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//诊断时间
            hlwYsMzJbzdDO.setZFPB(0);//作废标志
            hlwYsMzJbzdDO.setQZBZ(0);//确诊标志
            hlwYsMzJbzdDO.setQZSJ(DateUtil.strToDate(DateUtil.dateToStr(wlyyPrescriptionVO.getCreateTime(),"yyyy-MM-dd HH:mm:ss")));//确诊时间
            hlwYsMzJbzdDO.setJBMC(diagnosisDO.getName());//诊断名称
            hlwYsMzJbzdDO.setZDLX(1);//诊断类型
            hlwYsMzJbzdDO.setTJBZ(1);//提交标志
            if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getAdmNo())){
                hlwYsMzJbzdDO.setJZXH(Integer.parseInt(wlyyPrescriptionVO.getAdmNo()));
            }
            String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
            Map<String,Object> params1 = new HashedMap();
            params1.put("json",jsonString1);
            params1.put("table","HlwYsMzJbzdDO");
            logger.info("HlwYsMzJbzdDO:"+jsonString1);
            HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
            if (response1.getStatus()==200){
                String content = response1.getContent();
                logger.info("content"+content);
                logger.info("表hlwYsMzJbzdDO同步成功!");
                String jsonString1 = JSONObject.toJSONString(hlwYsMzJbzdDO);
                Map<String,Object> params1 = new HashedMap();
                params1.put("json",jsonString1);
                params1.put("table","HlwYsMzJbzdDO");
                logger.info("HlwYsMzJbzdDO:"+jsonString1);
                HttpResponse response1 = HttpUtils.doGet(saveUrl,params1);
                if (response1.getStatus()==200){
                    String content = response1.getContent();
                    logger.info("content"+content);
                    logger.info("表hlwYsMzJbzdDO同步成功!");
                }
            }
        }
    }
    public WlyyPrescriptionVO synPrecriptionHis(WlyyPrescriptionVO wlyyPrescriptionVO,String code) throws Exception {
@ -2187,6 +2188,41 @@ public class YkyyEntranceService {
                    }
                }else {
                    cfsb = wlyyPrescriptionVO.getRealOrder();
                    String sql = "update v_ms_dd01 t set t.ZFPB=1,t.ZFSJ=to_date('"+DateUtil.getStringDate()+"','yyyy-mm-dd hh24:mi:ss')  where  t.CFSB ='"+cfsb+"' ";
                    Map<String,Object> params1 = new HashedMap();
                    params1.put("sql",sql);
                    HttpResponse response = HttpUtils.doGet(updateUrl,params1);
                    if (response.getStatus()==200){
                        logger.info("表v_ms_dd01作废成功!");
                        HttpResponse response1 = HttpUtils.doGet(saveUrl,params);
                        if (response1.getStatus()==200){
                            logger.info("content"+response1.getContent());
                            String content = response1.getContent();
                            JSONObject jsonObject = JSONObject.parseObject(content);
                            JSONObject object = jsonObject.getJSONObject("obj");
                            if (object!=null){
                                cfsb = object.getString("cfsb");
                                cfhm = object.getString("cfhm");
                                logger.info("kaishi=========="+cfsb);
                                List<WlyyPrescriptionDO> wlyyPrescriptionDOS = prescriptionDao.findById(code);
                                if (wlyyPrescriptionDOS!=null&&wlyyPrescriptionDOS.size()!=0){
                                    WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                                    wlyyPrescriptionDO.setRealOrder(cfsb);
                                    wlyyPrescriptionDO.setOrderId(hlwCf01DO.getGUID());
                                    wlyyPrescriptionDO.setOriginRealOrder(cfhm);
                                    prescriptionDao.save(wlyyPrescriptionDO);
                                }
                            }
                            logger.info("表HLW_CF01同步成功!");
                        }else {
                            logger.info("表HLW_CF01同步失败!"+response.getErrorMsg());
                        }
                    }
                   /* hlwCf01DO.setZFPB(1);
                    hlwCf01DO.setZFSJ(new Date());
                    HttpResponse response = HttpUtils.doGet(updateEntityUrl,params);
                    if (response.getStatus()==200){
                        logger.info("content"+response.getContent());
@ -2194,14 +2230,14 @@ public class YkyyEntranceService {
                    }else {
                        logger.info("表HLW_CF01更新失败!"+response.getErrorMsg());
                    }
                    }*/
                }
                logger.info("处方:"+cfsb);
                if (StringUtils.isEmpty(cfsb)){
                    throw new Exception("添加失败");
                }
                if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getRealOrder())){
               /* if (StringUtils.isNoneBlank(wlyyPrescriptionVO.getRealOrder())){
                    String deleteSql = "delete from v_ms_dd02 where cfsb = '"+wlyyPrescriptionVO.getRealOrder()+"'";
                    Map<String,Object> params1 = new HashedMap();
                    params1.put("sql",deleteSql);
@ -2209,7 +2245,7 @@ public class YkyyEntranceService {
                    if (response.getStatus()==200){
                        logger.info("表v_ms_dd02删除成功!");
                    }
                }
                }*/
                List<WlyyPrescriptionInfoVO> wlyyPrescriptionInfoVOS =wlyyPrescriptionVO.getInfoVOs();
                for (WlyyPrescriptionInfoVO wlyyPrescriptionInfoVO:wlyyPrescriptionInfoVOS){
                    try {
@ -2218,7 +2254,9 @@ public class YkyyEntranceService {
                    hlwCf02DO.setCFSB(Integer.parseInt(cfsb));
                    hlwCf02DO.setYPXH(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugNo()));
                    logger.info("drugNo"+hlwCf02DO.getYPXH());
                    hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                    if (wlyyPrescriptionInfoVO.getDrugPlace()!=null){
                        hlwCf02DO.setYPCD(Integer.parseInt(wlyyPrescriptionInfoVO.getDrugPlace()));
                    }
                    hlwCf02DO.setXMLX(1);
                    hlwCf02DO.setCFTS(1);
                    hlwCf02DO.setYPSL(Double.parseDouble(wlyyPrescriptionInfoVO.getQuantity()));
@ -2304,6 +2342,7 @@ public class YkyyEntranceService {
    public String updateHisStatus(String sql) throws Exception {
        Map<String,Object> params1 = new HashedMap();
        params1.put("sql",sql);
        logger.info("his支付"+sql);
        HttpResponse response1 = HttpUtils.doGet(updateUrl,params1);
        logger.info(response1.getContent());
        if (response1.getStatus()==200){

+ 6 - 5
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetCommonService.java

@ -41,7 +41,7 @@ import sun.misc.BASE64Encoder;
import java.io.*;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.text.DecimalFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -1285,7 +1285,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                "  from wlyy_prescription_info a " +
                "     JOIN wlyy_prescription b " +
                "     on b.id = a.prescription_id" +
                "  where  a.dosage is not null and b.real_order is not null";
                "  where  a.dosage is not null and b.real_order is not null and a.del=1 ";
        Map<String,Object> params = new HashedMap();
@ -1298,7 +1298,7 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and  a.id =:keyId ";
            sql =  sql +  "  and  a.prescription_id =:keyId ";
            params.put("keyId",keyId);
        }
@ -1331,9 +1331,10 @@ public class InternetCommonService extends BaseJpaService<InternetUpErrorLogDO,
                jb.put("single_price",info.get("pack_retprice") == null? 0: info.get("pack_retprice"));
                Double pack_retprice = Double.parseDouble(info.get("pack_retprice").toString());
                Long quantity = Long.parseLong((String)info.get("quantity"));
                DecimalFormat decimalFormat = new DecimalFormat("0.00");
                Double price = pack_retprice.doubleValue()*quantity;
                jb.put("drug_total_price",price);
                logger.info("price"+decimalFormat.format(price));
                jb.put("drug_total_price",decimalFormat.format(price));
                jb.put("comments", "");
                jb.put("anti_comments", "");
                jb.put("dec_meth_name", "");

+ 11 - 2
business/base-service/src/main/java/com/yihu/jw/order/BusinessOrderService.java

@ -843,6 +843,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                        WlyyPrescriptionDO wlyyPrescriptionDO = wlyyPrescriptionDOS.get(0);
                        wlyyPrescriptionDO.setStatus(30);
                        wlyyPrescriptionDO.setPayStatus(1);
                        wlyyPrescriptionDO.setPayTime(new Date());
                        prescriptionDao.save(wlyyPrescriptionDO);
                        prescriptionLogService.addPrescriptionLog(wlyyPrescriptionDO.getId(),30,1,wlyyPrescriptionDO.getPatientCode(),wlyyPrescriptionDO.getPatientName(),"",new Date());
                        try {
@ -853,12 +854,16 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                            if (null!=expressList&&expressList.size()>0){
                                WlyyPrescriptionExpressageDO wlyyPrescriptionExpressageDO = expressList.get(0);
                                if (null!=wlyyPrescriptionExpressageDO&&wlyyPrescriptionExpressageDO.getOneselfPickupFlg()==1){
                                    String condition ="";
                                    if (StringUtils.isNoneBlank(wlyyPrescriptionDO.getAdmNo())){
                                        condition = " t.JZXH = '"+wlyyPrescriptionDO.getAdmNo()+"' and ";
                                    }
                                    //同步his写入自取信息
                                    String updatesql = "update v_ms_dd01 t set t.PSFS = 0 ,t.FKZT=1 ,t.SJR= '"+wlyyPrescriptionExpressageDO.getName()+"' ," +
                                            " t.SJRDH = '"+wlyyPrescriptionExpressageDO.getMobile()+"' ,"+
                                            " t.SJRDZ = '"+wlyyPrescriptionExpressageDO.getAddress()+"' ,"+
                                            " t.YFSB = '"+wlyyPrescriptionExpressageDO.getHospitalCode()+"'"+
                                            " where t.JZXH = '"+wlyyPrescriptionDO.getAdmNo()+"' and t.CFSB ='"+wlyyPrescriptionDO.getRealOrder()+"'";
                                            " where "+condition+" t.CFSB ='"+wlyyPrescriptionDO.getRealOrder()+"'";
                                    ykyyEntranceService.updateHisStatus(updatesql);
                                    logger.info("自取写入更新his");
                                }else {
@ -872,6 +877,10 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                                    if (org.apache.commons.lang3.StringUtils.isNotBlank(realOrder)){
                                            sfResult = prescriptionService.getSFExpressInfoNew(admNo,realOrder,"");
                                    }
                                    String condition ="";
                                    if (StringUtils.isNoneBlank(admNo)){
                                        condition = " t.JZXH = '"+admNo+"' and";
                                    }
                                    if (!"".equals(sfResult)) {
                                        JSONObject json = JSONObject.parseObject(sfResult.toString());
                                        String sfOrder =  json.getString("mailNo");
@ -879,7 +888,7 @@ public class BusinessOrderService extends BaseJpaService<BusinessOrderDO,Busines
                                        String updatesql = "update v_ms_dd01 t set t.PSFS = 1 ,t.FKZT=1 ,t.YFSB = 6 ,t.KDDH ='"+sfOrder+"',t.SJR = '"+wlyyPrescriptionExpressageDO.getName()+"' ," +
                                                " t.SJRDH = '"+wlyyPrescriptionExpressageDO.getMobile()+"' ,"+
                                                " t.SJRDZ = '"+wlyyPrescriptionExpressageDO.getAddress()+"'"+
                                                " where t.JZXH = '"+admNo+"' and t.CFSB ='"+realOrder+"'";
                                                " where "+condition+" t.CFSB ='"+realOrder+"'";
                                        ykyyEntranceService.updateHisStatus(updatesql);
                                        logger.info("更新his成功");
                                    }

+ 103 - 2
business/base-service/src/main/java/com/yihu/jw/wechat/service/WxTemplateService.java

@ -8,6 +8,7 @@ import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.*;
import com.yihu.jw.entity.base.yx.YxTokenMappingDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
@ -31,6 +32,7 @@ import com.yihu.jw.utils.CheckSumBuilder;
import com.yihu.jw.utils.RSAEncrypt;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.wechat.dao.*;
import com.yihu.jw.yx.dao.YxTokenMappingDao;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
@ -104,6 +106,8 @@ public class WxTemplateService {
    private HttpClientUtil httpClientUtil;
    @Autowired
    private OutpatientDao outpatientDao;
    @Autowired
    private YxTokenMappingDao yxTokenMappingDao;
    
@ -153,7 +157,7 @@ public class WxTemplateService {
                        String miniprogramUrl = "";
                        config.setFirst(config.getFirst().replace("key1",sender_name+titleName));
                        if (wechatId.equalsIgnoreCase("xm_ykyy_wx")){
                            String token = yxToken(reciver_id,reciver_name);
                            String token = yxToken2(reciver_id,reciver_name);
                            miniprogramUrl = "pages/room/yunxin?role=patient&token="+token+"&uid="+basePatientDO.getId();
                            config.setPagepath(miniprogramUrl);
                        }
@ -185,7 +189,7 @@ public class WxTemplateService {
        return "success";
    }
    public String yxToken(String userId,String channelName){
  /*  public String yxToken(String userId,String channelName){
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
@ -216,6 +220,103 @@ public class WxTemplateService {
            }
        }
        return null;
    }*/
    public String yxToken2(String userId,String channelName){
        YxTokenMappingDO yxTokenMappingDO = yxTokenMappingDao.findMappingByAccid(userId);
        if (yxTokenMappingDO!=null){
            return yxTokenMappingDO.getToken();
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://api.netease.im/nimserver/user/create.action";
        Map<String,Object> httpPost = new HashedMap();
        // 设置请求的header
        httpPost.put("AppKey", appKey);
        httpPost.put("Nonce", nonce);
        httpPost.put("CurTime", curTime);
        httpPost.put("CheckSum", checkSum);
        httpPost.put("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        nvps.add(new BasicNameValuePair("accid", userId));
        YxTokenMappingDO yxTokenMappingDO1 = new YxTokenMappingDO();
        if (StringUtils.isNoneBlank(channelName)){
            nvps.add(new BasicNameValuePair("name",channelName));
            yxTokenMappingDO1.setName(channelName);
        }
        String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
        logger.info("返回日志"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
                com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("info"));
                if (StringUtils.isNoneBlank(jsonObject1.getString("token"))){
                    yxTokenMappingDO1.setAccid(userId);
                    yxTokenMappingDO1.setToken(jsonObject1.getString("token"));
                    yxTokenMappingDao.save(yxTokenMappingDO1);
                }
                return jsonObject1.getString("token");
            }else if (jsonObject.getString("code").equalsIgnoreCase("414")&&jsonObject.getString("desc").contains("already")){
                return  refreshToken(userId);
            }
        }
        return null;
    }
    /**
     * 重置云信token
     * @param userId
     * @return
     */
    public String refreshToken(String userId){
        YxTokenMappingDO yxTokenMappingDO = yxTokenMappingDao.findMappingByAccid(userId);
        if (yxTokenMappingDO!=null){
            return yxTokenMappingDO.getToken();
        }
        WlyyHospitalSysDictDO sysDictDO = hospitalSysDictDao.findById("YXAPPKEY");
        WlyyHospitalSysDictDO hospitalSysDictDO =  hospitalSysDictDao.findById("YXAPPSECRET");
        if (sysDictDO==null){
            return  "找不到对应的key";
        }
        String appKey = sysDictDO.getDictValue();
        String appSecret = hospitalSysDictDO.getDictValue();
        String nonce =  randomInt(10);
        String curTime = String.valueOf((new Date()).getTime() / 1000L);
        String checkSum = CheckSumBuilder.getCheckSum(appSecret, nonce ,curTime);//参考 计算CheckSum的java代码
        String url = "https://api.netease.im/nimserver/user/refreshToken.action";
        Map<String,Object> httpPost = new HashedMap();
        // 设置请求的header
        httpPost.put("AppKey", appKey);
        httpPost.put("Nonce", nonce);
        httpPost.put("CurTime", curTime);
        httpPost.put("CheckSum", checkSum);
        httpPost.put("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
        List<NameValuePair> nvps = new ArrayList<NameValuePair>();
        nvps.add(new BasicNameValuePair("accid", userId));
        YxTokenMappingDO yxTokenMappingDO1 = new YxTokenMappingDO();
        String response = httpClientUtil.headerPost(url,nvps,"UTF-8",httpPost);
        logger.info("重置云信"+response);
        if(StringUtils.isNoneBlank(response)){
            com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(response);
            if (jsonObject.getString("code").equalsIgnoreCase("200")){
                com.alibaba.fastjson.JSONObject jsonObject1 = com.alibaba.fastjson.JSONObject.parseObject(jsonObject.getString("info"));
                if (StringUtils.isNoneBlank(jsonObject1.getString("token"))){
                    yxTokenMappingDO1.setAccid(userId);
                    yxTokenMappingDO1.setToken(jsonObject1.getString("token"));
                    yxTokenMappingDao.save(yxTokenMappingDO1);
                }
                return jsonObject1.getString("token");
            }
        }
        return null;
    }
    /**

+ 16 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java

@ -266,6 +266,22 @@ public class WlyyUserDetailsService extends JdbcDaoSupport implements UserDetail
                    user.setLocked(false);
                    user.setLockedDate(null);
                    users.add(user);
                    BasePatientDO patientDO = patientDao.findByIdcardAndDel(idcard,"1");
                    WlyyPatientFamilyMemberDO basePatientFamilyMemberDO = familyMemberDao.findFamilyMemberByPatientAndRelationCode(patientDO.getId(),"7");
                    if (basePatientFamilyMemberDO==null){
                        basePatientFamilyMemberDO = new WlyyPatientFamilyMemberDO();
                        basePatientFamilyMemberDO.setPatient(patientDO.getId());
                        basePatientFamilyMemberDO.setFamilyRelation("7");
                        basePatientFamilyMemberDO.setFamilyRelationName("自己");
                        basePatientFamilyMemberDO.setCardType("身份证");
                        basePatientFamilyMemberDO.setCardNo(patientDO.getIdcard());
                        basePatientFamilyMemberDO.setCreateTime(new Date());
                        basePatientFamilyMemberDO.setUpdateTime(new Date());
                        basePatientFamilyMemberDO.setIsAuthorize(1);
                        basePatientFamilyMemberDO.setIsDel(1);
                        basePatientFamilyMemberDO.setFamilyMember(patientDO.getId());
                        familyMemberDao.save(basePatientFamilyMemberDO);
                    }
                }else if("xm_zsyy_wx".equals(getWechatId())){
                    JSONObject jsonObject=new JSONObject();

+ 50 - 0
svr/svr-internet-hospital-entrance/src/main/resources/application.yml

@ -282,6 +282,56 @@ express:
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
---
# 眼科医院前置机
spring:
  profiles: jwOracleProd
  datasource:
    driver-class-name: oracle.jdbc.driver.OracleDriver
    url: jdbc:oracle:thin:@192.168.20.55:1521:orcl
    username: system
    password: hxyk9573
  jpa:
    properties:
      hibernate:
        dialect: org.hibernate.dialect.Oracle10gDialect
        show_sql: true
    database: oracle
# mq 是否获取his数据,flag代表获取演示数据,false代表获取his真实数据
demo:
  flag: false
#支付支付
pay:
  flag: true
hospital:
  url: https://wx.xmzsh.com
  mqUser: JKZL
  mqPwd: 123456
  SourceSysCode: S60
  TargetSysCode: S01
im:
  im_list_get: http://172.16.1.42:3000/
  data_base_name: im
fastDFS:
  fastdfs_file_url: http://192.0.33.26:8888/
fast-dfs:
  tracker-server: 192.168.103.159:22122 #服务器地址
#是否开启i健康接口 0关闭,1开启
testPattern:
  sign: 0
wlyy:
  url: http://www.xmtyw.cn/wlyytest/
wechat:
  id: xm_ykyy_wx  # base库中,wx_wechat 的id字段
  flag: false #演示环境  true走Mysql数据库  false走Oracle
express:
  sf_url: http://bsp-oisp.sf-express.com/bsp-oisp/sfexpressService
  sf_code: WH000091
  sf_check_word: SFAHKAOFAAITyjt7890
---
#心脏中心前置机配置
spring:
  profiles: xzprod_in

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/service/channel/UnSettledHISPrescriptionService.java

@ -190,7 +190,7 @@ public class UnSettledHISPrescriptionService {
                        String doctor = pre.get(0).get("DOCTOR").toString();
                        String doctorName = pre.get(0).get("DOCTOR_NAME").toString();
                        //修改处方状态
                        String updateSql = "update WLYY_PRESCRIPTION set status = 11 where id = '"+prescriptionId+"'";
                        String updateSql = "update WLYY_PRESCRIPTION set status = 11,check_status=1,check_reason='处方驳回' where id = '"+prescriptionId+"'";
                        hibenateUtils.updateBySql(updateSql);
                        com.alibaba.fastjson.JSONObject msgObj = new com.alibaba.fastjson.JSONObject();
                        msgObj.put("outpatientid",outpatientId);

File diff suppressed because it is too large
+ 11 - 3
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java


+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -1741,12 +1741,12 @@ public class MonitorPlatformService  {
                Map<String, String> json = null;
                if (map.get("address")!=null){
                    if (org.apache.commons.lang3.StringUtils.isNoneBlank(map.get("address").toString())) {
                        json = LatitudeUtils.getGeocoderLatitude(map.get("address").toString().replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                        json = LatitudeUtils.getGeocoderLatitude(("福建省厦门市"+map.get("address").toString()).replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                    }
                }
                if (json==null||map.get("address")==null){
                    if (map.get("hospital_name")!=null){
                        if (!org.apache.commons.lang3.StringUtils.isNoneBlank(map.get("hospital_name").toString())) {
                        if (org.apache.commons.lang3.StringUtils.isNoneBlank(map.get("hospital_name").toString())) {
                            json = LatitudeUtils.getGeocoderLatitude(("福建省厦门市"+map.get("hospital_name").toString()).replace("G.", "").replace("(糖友网)", "").replace("(高友网)", ""));
                        }
                    }