Kaynağa Gözat

Merge branch 'dev' of trick9191/wlyy2.0 into dev

trick9191 5 yıl önce
ebeveyn
işleme
0c9ca064ea

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

@ -3134,9 +3134,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " d.id, " +
                    " d.id, " +
                    " d.`name`, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_code, " +
                    " h.org_name, " +
                    " h.dept_code, " +
                    " h.dept_name " +
                    " h.org_name " +
                    " FROM " +
                    " FROM " +
                    " base_doctor d " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -3153,9 +3151,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " d.id, " +
                    " d.id, " +
                    " d.`name`, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_code, " +
                    " h.org_name, " +
                    " h.dept_code, " +
                    " h.dept_name " +
                    " h.org_name " +
                    " FROM " +
                    " FROM " +
                    " base_doctor d " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -3171,9 +3167,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " d.id, " +
                    " d.id, " +
                    " d.`name`, " +
                    " d.`name`, " +
                    " h.org_code, " +
                    " h.org_code, " +
                    " h.org_name, " +
                    " h.dept_code, " +
                    " h.dept_name " +
                    " h.org_name " +
                    " FROM " +
                    " FROM " +
                    " base_doctor d " +
                    " base_doctor d " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
                    " JOIN base_doctor_hospital h ON d.id= h.doctor_code " +
@ -3206,8 +3200,8 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    WlyyDoctorWorkTimeDO t = new WlyyDoctorWorkTimeDO();
                    WlyyDoctorWorkTimeDO t = new WlyyDoctorWorkTimeDO();
                    t.setDoctor((String)doctor.get("id"));
                    t.setDoctor((String)doctor.get("id"));
                    t.setDoctorName((String)doctor.get("name"));
                    t.setDoctorName((String)doctor.get("name"));
                    t.setDept((String)doctor.get("dept_code"));
                    t.setDeptName((String)doctor.get("dept_name"));
//                    t.setDept((String)doctor.get("dept_code"));
//                    t.setDeptName((String)doctor.get("dept_name"));
                    t.setHospital((String)doctor.get("org_code"));
                    t.setHospital((String)doctor.get("org_code"));
                    t.setHospitalName((String)doctor.get("org_name"));
                    t.setHospitalName((String)doctor.get("org_name"));
                    t.setCreateTime(new Date());
                    t.setCreateTime(new Date());

+ 174 - 49
business/base-service/src/main/java/com/yihu/jw/internet/service/ykyy/YkyyInternetService.java

@ -22,6 +22,7 @@ import com.yihu.jw.utils.encode.AESUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import com.yihu.mysql.query.BaseJpaService;
import com.ylzinfo.ehc.common.utils.DateUtils;
import com.ylzinfo.ehc.common.utils.DateUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -278,7 +279,7 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
    }
    }
    // 3 医师基本信息	micc.upNsDoctorRecord   --- 完成
    // 3 医师基本信息	micc.upNsDoctorRecord   --- 完成
    public String upNsDoctorRecord(String startDate, String endDate,String keyId) throws Exception {
    public String upNsDoctorRecord(String keyId) throws Exception {
        String url = getUrl();
        String url = getUrl();
        String api = "micc.upNsDoctorRecord";
        String api = "micc.upNsDoctorRecord";
        String upid = getCode();
        String upid = getCode();
@ -308,12 +309,6 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                " where a.id = b.doctor_code" +
                " where a.id = b.doctor_code" +
                "   and b.dept_code is NOT NULL ";
                "   and b.dept_code is NOT NULL ";
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and a.update_time >=  '" + startDate + "' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and a.update_time < '" + endDate + "' ";
        }
        if(StringUtils.isNotBlank(keyId)){
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and a.id = '" + keyId + "' ";
            sql =  sql +  "  and a.id = '" + keyId + "' ";
        }
        }
@ -382,7 +377,7 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        }
        }
        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。";
        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,上传失败 : " + error + "条。格式错误:"+dataError+"条。";
        saveUpLog(upid,"3",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"),DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"),success,error,dataError,resInfo);
        saveUpLog(upid,"3",new Date(),new Date(),success,error,dataError,resInfo);
        return resInfo;
        return resInfo;
    }
    }
@ -434,22 +429,25 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "   p.register_date AS \"date\"" +
                "   p.register_date AS \"date\"" +
                "   FROM wlyy_outpatient p " +
                "   FROM wlyy_outpatient p " +
                " WHERE 1=1" ;
                " WHERE 1=1" ;
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and reg.create_time >=  '" + startDate + "' ";
            sql =  sql + "  and reg.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        }
        if(StringUtils.isNotBlank(endDate)){
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and reg.create_time < '" + endDate + "' ";
            sql =  sql +  "  and reg.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        }
        if(StringUtils.isNotBlank(keyId)){
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and  p.id = '" + keyId + "' ";
            sql =  sql +  "  and  p.id =:keyId ";
            params.put("keyId",keyId);
        }
        }
        List list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        total = list.size();
        total = list.size();
        for(int i=0; i< total; i++){
        for(int i=0; i< total; i++){
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap)list.get(i);
            Map<String,Object> info = list.get(i);
            JSONObject jb = new JSONObject();
            JSONObject jb = new JSONObject();
            Boolean errorFlag = false;
            Boolean errorFlag = false;
            try{
            try{
@ -608,27 +606,6 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        String token = upNsUserToken(url);
        String token = upNsUserToken(url);
//        String sql = "select " +
//                "      a.id AS \"id\", " +
//                "      c.name AS \"name\"," +
//                "      a.score AS \"score\"," +
//                "      a.patient_name AS \"patient_name\"," +
//                "      a.create_time AS \"create_time\"," +
//                "      content_table.content AS \"content\"," +
//                "      c.idcard AS \"docIdCard\", " +
//                "      d.dept_code AS \"dept_code\", " +
//                "      d.dept_name AS \"dept_name\" "+
//                "  from  base_evaluate_score a ," +
//                "     ( select " +
//                "        a.relation_code AS \"rcode\"," +
//                "        group_concat(a.content order by a.content desc)  as content" +
//                "      from base_evaluate a" +
//                "       group by a.relation_code ) content_table," +
//                "     base_doctor c," +
//                "     base_doctor_hospital d " +
//                " where content_table.rcode = a.id " +
//                "   and c.id = a.doctor" +
//                "   and c.id = d.doctor_code";
        String sql ="SELECT " +
        String sql ="SELECT " +
                " a.id AS \"id\", " +
                " a.id AS \"id\", " +
                " a.doctor_name AS \"name\", " +
                " a.doctor_name AS \"name\", " +
@ -643,23 +620,27 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
                "JOIN base_doctor d ON d.id = a.doctor " +
                "JOIN base_doctor d ON d.id = a.doctor " +
                "WHERE " +
                "WHERE " +
                " e.score_type = '4'";
                " e.score_type = '4'";
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and a.create_time >=  '" + startDate + "' ";
            sql =  sql + "  and a.create_time >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        }
        if(StringUtils.isNotBlank(endDate)){
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and a.create_time < '" + endDate + "' ";
            sql =  sql +  "  and a.create_time <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        }
        if(StringUtils.isNotBlank(keyId)){
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and a.id = '" + keyId + "' ";
            sql =  sql +  "  and  a.id =:keyId ";
            params.put("keyId",keyId);
        }
        }
        List list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        total = list.size();
        total = list.size();
        for(int i=0; i<list.size(); i++) {
        for(int i=0; i<list.size(); i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            Map<String,Object> info =list.get(i);
            Boolean errorFlag = false;
            Boolean errorFlag = false;
            JSONObject jb = new JSONObject();
            JSONObject jb = new JSONObject();
@ -761,21 +742,25 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
               "\ta.id = b.consult\n" +
               "\ta.id = b.consult\n" +
               "AND a.symptoms IS NOT NULL AND b.status=1";
               "AND a.symptoms IS NOT NULL AND b.status=1";
        Map<String,Object> params = new HashedMap();
        if(StringUtils.isNotBlank(startDate)){
        if(StringUtils.isNotBlank(startDate)){
            sql =  sql + "  and a.czrq >=  '" + startDate + "' ";
            sql =  sql + "  and a.czrq >=:startDate ";
            params.put("startDate",DateUtil.stringToDate(startDate,"yyyy-MM-dd HH:mm:ss"));
        }
        }
        if(StringUtils.isNotBlank(endDate)){
        if(StringUtils.isNotBlank(endDate)){
            sql =  sql +  "  and a.czrq < '" + endDate + "' ";
            sql =  sql +  "  and a.czrq <=:endDate";
            params.put("endDate",DateUtil.stringToDate(endDate,"yyyy-MM-dd HH:mm:ss"));
        }
        }
        if(StringUtils.isNotBlank(keyId)){
        if(StringUtils.isNotBlank(keyId)){
            sql =  sql +  "  and a.id = '" + keyId + "' ";
            sql =  sql +  "  and  a.id =:keyId ";
            params.put("keyId",keyId);
        }
        }
        List list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql,params);
        total = list.size();
        total = list.size();
        for(int i=0; i<total; i++) {
        for(int i=0; i<total; i++) {
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap) list.get(i);
            Map<String,Object> info = list.get(i);
            String sqlMessage ="SELECT\n" +
            String sqlMessage ="SELECT\n" +
                    "\tM .SENDER_NAME AS \"sender_name\",\n" +
                    "\tM .SENDER_NAME AS \"sender_name\",\n" +
                    "\tM .\"TIMESTAMP\" AS \"timestamp\",\n" +
                    "\tM .\"TIMESTAMP\" AS \"timestamp\",\n" +
@ -1446,6 +1431,7 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
        int error = 0;
        int error = 0;
        int dataError = 0;
        int dataError = 0;
        //5.统计预约量
        String yyghSql = "SELECT " +
        String yyghSql = "SELECT " +
                "   count(1) AS \"yyghtotal\"" +
                "   count(1) AS \"yyghtotal\"" +
                " FROM wlyy_outpatient p " +
                " FROM wlyy_outpatient p " +
@ -1464,15 +1450,154 @@ public class YkyyInternetService extends BaseJpaService<InternetUpErrorLogDO, In
            yyghtotal = hibenateUtils.objTransformLong(yygh.get(0).get("yyghtotal"));
            yyghtotal = hibenateUtils.objTransformLong(yygh.get(0).get("yyghtotal"));
        }
        }
        //7.医生评价
        String yypjSql ="SELECT " +
                "   count(1) AS \"yypjtotal\"" +
                " FROM " +
                " base_evaluate_score a " +
                " JOIN base_evaluate e ON a.id = e.relation_code " +
                " JOIN base_doctor d ON d.id = a.doctor " +
                " WHERE " +
                " e.score_type = '4'";
        if(StringUtils.isNotBlank(startDate)){
            yypjSql =  yypjSql + "  and a.create_time >=  '" + startDate + "' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            yypjSql =  yypjSql +  "  and a.create_time < '" + endDate + "' ";
        }
        List<Map<String,Object>> yypj = hibenateUtils.createSQLQuery(yypjSql);
        Long yypjtotal = 0L;
        if(yyghtotal!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            yypjtotal = hibenateUtils.objTransformLong(yypj.get(0).get("yypjtotal"));
        }
        //8.统计网络咨询
        String wlzxSql = "SELECT\n" +
                "   count(1) AS \"wlzxtotal\"" +
                "FROM\n" +
                "\twlyy_consult a ,\n" +
                "\twlyy_consult_team b \n" +
                "JOIN base_doctor c ON c.id = b.doctor \n" +
                "JOIN base_patient d ON d.id = b.patient \n" +
                "JOIN base_doctor_hospital e ON e.doctor_code = b.doctor \n" +
                "JOIN topics t ON t.id = b.consult\n" +
                "WHERE\n" +
                "\ta.id = b.consult\n" +
                "AND a.symptoms IS NOT NULL AND b.status=1";
        if(StringUtils.isNotBlank(startDate)){
            wlzxSql =  wlzxSql + "  and a.czrq >=  '" + startDate + "' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            wlzxSql =  wlzxSql +  "  and a.czrq < '" + endDate + "' ";
        }
        List<Map<String,Object>> wlzx = hibenateUtils.createSQLQuery(wlzxSql);
        Long wlzxtotal = 0L;
        if(yyghtotal!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            wlzxtotal = hibenateUtils.objTransformLong(wlzx.get(0).get("wlzxtotal"));
        }
        //9.网络诊疗服务
        String wlzlSql = "select " +
                "   count(1) AS \"wlzltotal\"" +
                "  from wlyy_outpatient a " +
                "      join base_doctor b on b.id = a.doctor" +
                "      join base_patient c on c.id = a.patient" +
                " where a.register_no is NOT NULL and a.dept is not null " +
                " and a.register_date is not null " ;
        if(StringUtils.isNotBlank(startDate)){
            wlzlSql =  wlzlSql + "  and a.create_time >=  '" + startDate + "' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            wlzlSql =  wlzlSql +  "  and a.create_time < '" + endDate + "' ";
        }
        List<Map<String,Object>> wlzl = hibenateUtils.createSQLQuery(wlzlSql);
        Long wlzltotal = 0L;
        if(yyghtotal!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            wlzltotal = hibenateUtils.objTransformLong(wlzl.get(0).get("wlzltotal"));
        }
        //10.电子处方
        String dzcfsql = "select " +
                "   count(1) AS \"dzcftotal\"" +
                "  from  wlyy_prescription a" +
                "     JOIN base_patient b on a.patient_code = b.id " +
                "     JOIN base_doctor c on a.doctor = c.id " +
                "     JOIN wlyy_outpatient p on p.id = a.outpatient_id  " +
                "  where  c.idcard is not null  and a.real_order is not null and p.icd10 is not null ";
        if(StringUtils.isNotBlank(startDate)){
            dzcfsql =  dzcfsql + "  and a.create_time >=  '" + startDate + "' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            dzcfsql =  dzcfsql +  "  and a.create_time < '" + endDate + "' ";
        }
        List<Map<String,Object>> dzcf = hibenateUtils.createSQLQuery(dzcfsql);
        Long dzcftotal = 0L;
        if(yyghtotal!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            dzcftotal = hibenateUtils.objTransformLong(dzcf.get(0).get("dzcftotal"));
        }
        //11.电子处方药品明细
        String infosql = "select " +
                "   count(1) AS \"infototal\"" +
                "  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";
        if(StringUtils.isNotBlank(startDate)){
            infosql =  infosql + "  and b.create_time >=  '" + startDate + "' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            infosql =  infosql +  "  and b.create_time < '" + endDate + "' ";
        }
        List<Map<String,Object>> info = hibenateUtils.createSQLQuery(infosql);
        Long infototal = 0L;
        if(yyghtotal!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            infototal = hibenateUtils.objTransformLong(info.get(0).get("infototal"));
        }
        //12.过程图片
        String gctpsql = "SELECT " +
                "   count(1) AS \"gctptotal\"" +
                " FROM wlyy_outpatient p " +
                " WHERE p.disease_img is not null ";
        if(StringUtils.isNotBlank(startDate)){
            gctpsql =  gctpsql + "  and p.create_time >=  '" + startDate + "' ";
        }
        if(StringUtils.isNotBlank(endDate)){
            gctpsql =  gctpsql +  "  and p.create_time < '" + endDate + "' ";
        }
        List<Map<String,Object>> gctp = hibenateUtils.createSQLQuery(gctpsql);
        Long gctptotal = 0L;
        if(yyghtotal!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            gctptotal = hibenateUtils.objTransformLong(gctp.get(0).get("gctptotal"));
        }
        JSONObject jb = new JSONObject();
        JSONObject jb = new JSONObject();
        Boolean errorFlag = false;
        Boolean errorFlag = false;
        try {
        try {
            jb.put("id_ws_invoke_total",upid);
            jb.put("id_ws_invoke_total",upid);
            jb.put("organ_code", orgCode);
            jb.put("organ_code", orgCode);
            jb.put("organ_name",orgName);
            jb.put("organ_name",orgName);
            jb.put("protocol_type", "1");
            jb.put("protocol_name", "用户协议信息");
            jb.put("upload_time", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
            jb.put("wsyy_upload_count", yyghtotal);
            jb.put("yspj_upload_count", yypjtotal);
            jb.put("wlzx_upload_count", wlzxtotal);
            jb.put("wlzl_upload_count", wlzltotal);
            jb.put("dzcf_upload_count", dzcftotal);
            jb.put("ypmx_upload_count", infototal);
            jb.put("gctp_upload_count", gctptotal);
            jb.put("ywsj", DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss"));
        }catch (Exception e){
        }catch (Exception e){
            errorFlag = true;
            errorFlag = true;

+ 1 - 1
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/web/quota/JobController.java

@ -415,7 +415,7 @@ public class JobController extends BaseController {
                    break; //可选
                    break; //可选
                case "2.3" :
                case "2.3" :
                    //语句
                    //语句
                    ykyyInternetService.upNsDoctorRecord(null,null,null);
                    ykyyInternetService.upNsDoctorRecord(null);
                    break; //可选
                    break; //可选
                case "2.5" :
                case "2.5" :
                    //语句
                    //语句