瀏覽代碼

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

LAPTOP-KB9HII50\70708 1 年之前
父節點
當前提交
f049d8c04a

+ 93 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/DsyyPrescriptionService.java

@ -0,0 +1,93 @@
package com.yihu.jw.hospital.prescription.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.wx.BasePatientWechatDo;
import com.yihu.jw.entity.base.wx.WxTemplateConfigDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.httplog.WlyyHttpLogDO;
import com.yihu.jw.entity.hospital.prescription.BaseNatAppointmentDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDO;
import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.BaseNatAppointmentDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.jw.utils.WebserviceUtil;
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
import com.yihu.jw.wechat.dao.WxTemplateConfigDao;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
@Service
@Transactional
public class DsyyPrescriptionService extends BaseJpaService<WlyyPrescriptionDO, PrescriptionDao> {
    private static Logger logger = LoggerFactory.getLogger(DsyyPrescriptionService.class);
    @Autowired
    private DsyyEntranceService dsyyEntranceService;
    //=============查询视图========================
    /**
     * 获取诊断
     *
     * @param pyCode
     * @return
     * @throws Exception
     */
    public JSONArray findIcd10(String pyCode) throws Exception {
        return dsyyEntranceService.findIcd10(pyCode);
    }
    /**
     * 获取药品字典
     *
     * @param chargeCode
     * @param pydm
     * @return
     * @throws Exception
     */
    public JSONArray findDrugs(String chargeCode,String pydm) throws Exception {
        return dsyyEntranceService.findDrugs(chargeCode,pydm);
    }
    /**
     * 获取频次字典
     *
     * @param pydm
     * @return
     * @throws Exception
     */
    public JSONArray getDrugFrequency() throws Exception {
        return dsyyEntranceService.getDrugFrequency();
    }
    /**
     * 获取给药方式
     * @param pydm
     * @return
     * @throws Exception
     */
    public JSONArray getDrugUse(String pydm) throws Exception {
        return dsyyEntranceService.getDrugUse(pydm);
    }
}

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

@ -14,6 +14,7 @@ import com.yihu.jw.entity.order.BusinessOrderDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.httplog.dao.WlyyHttpLogDao;
import com.yihu.jw.hospital.prescription.dao.BaseNatAppointmentDao;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.order.dao.BusinessOrderDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
@ -58,6 +59,9 @@ public class TasyNatService {
    @Autowired
    private BusinessOrderDao businessOrderDao;
    @Autowired
    private DsyyEntranceService dsyyEntranceService;
    public String getOperateUrl(){
        List<WlyyHospitalSysDictDO> list =  wlyyHospitalSysDictDao.findByDictName("TasyWebOperateService");
@ -1179,4 +1183,5 @@ public class TasyNatService {
        }
        return map;
    }
}

文件差異過大導致無法顯示
+ 1792 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/entrance/DsyyEntranceService.java


+ 325 - 4
business/es-service/src/main/java/com/yihu/jw/es/service/StatisticsEsService.java

@ -39,14 +39,12 @@ import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.format.TextStyle;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@ -7351,4 +7349,327 @@ public class StatisticsEsService {
        resultMap.put("todayFree", todayFree);//今日新增
        return resultMap;
    }
    /**
     * 获取开通网络问诊的医生和科室数量
     */
    public HashMap<String, Object> getNetworkDoctorAndDeptCount() throws Exception {
        String deptSql = "SELECT\n" +
                "	count( DISTINCT b.dept_code ) \n" +
                "FROM\n" +
                "	base_doctor a\n" +
                "	INNER JOIN base_doctor_hospital b ON a.id = b.doctor_code \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND a.del='1' AND b.del='1'\n" +
                "	AND a.outpatient_type IS NOT NULL \n" +
                "	AND a.outpatient_type <> '' \n" +
                "	AND b.dept_code IS NOT NULL ";
        String doctorSql = "SELECT\n" +
                "	count( DISTINCT a.id ) \n" +
                "FROM\n" +
                "	base_doctor a \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND a.del = '1' \n" +
                "	AND a.outpatient_type IS NOT NULL \n" +
                "	AND a.outpatient_type <> ''";
        CompletableFuture<Integer> future01 = CompletableFuture.supplyAsync(() -> {
            Integer integer = jdbcTemplate.queryForObject(deptSql, Integer.class);
            return integer;
        }, execute);
        CompletableFuture<Integer> future02 = CompletableFuture.supplyAsync(() -> {
            Integer integer = jdbcTemplate.queryForObject(doctorSql, Integer.class);
            return integer;
        }, execute);
        CompletableFuture.allOf(future01, future02).get();
        Integer deptCount = future01.get();
        Integer doctorCount = future02.get();
        HashMap<String, Object> resultMap = new HashMap<>();
        resultMap.put("deptCount", deptCount);
        resultMap.put("doctorCount", doctorCount);
        return resultMap;
    }
    /**
     * 查询患者行为动态
     */
    public List<Map<String, Object>> getPatientBehavior() throws ExecutionException, InterruptedException {
        String sql01 = "SELECT q.*,CONCAT('患者',q.patientName,'发起了',q.title)'description' FROM (\n" +
                "	SELECT\n" +
                "		patient_name 'patientName',\n" +
                "		CASE \n" +
                "			WHEN outpatient_type='1' THEN '在线复诊'\n" +
                "			WHEN outpatient_type='2' THEN '协同门诊'\n" +
                "			WHEN outpatient_type='3' AND type='1' THEN '图文咨询'\n" +
                "			WHEN outpatient_type='3' AND type='2' THEN '视频咨询'\n" +
                "		END 'title',\n" +
                "		DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%S') 'createTime'\n" +
                "	FROM\n" +
                "		wlyy_outpatient \n" +
                "	WHERE\n" +
                "		1 = 1 \n" +
                "		AND pay_status IN ( '1', '2' )\n" +
                "		ORDER BY create_time DESC LIMIT 5\n" +
                ")q";
        String sql02 = "SELECT q.*,CONCAT('患者',q.patientName,'购药成功了')'description' FROM (\n" +
                "	SELECT\n" +
                "	patient_name 'patientName',\n" +
                "  CASE \n" +
                "	 WHEN `status`='30' THEN '购药成功'\n" +
                "	END 'title',\n" +
                "	DATE_FORMAT( create_time, '%Y-%m-%d %H:%i:%S' ) 'createTime' \n" +
                "FROM\n" +
                "	wlyy_prescription \n" +
                "WHERE\n" +
                "	`status` = '30' ORDER BY create_time DESC LIMIT 5\n" +
                ")q";
        String sql03 = "SELECT q.*,CONCAT('患者',q.patientName,'出院转',q.title,'诊后管理') 'description' FROM (\n" +
                "	SELECT\n" +
                "	`name` 'patientName',disease_name 'title',DATE_FORMAT( create_time, '%Y-%m-%d %H:%i:%S' ) 'createTime'  \n" +
                "FROM\n" +
                "	wlyy_patient_rehabilitation_plan \n" +
                "ORDER BY\n" +
                "	create_time DESC \n" +
                "	LIMIT 5\n" +
                ")q";
        CompletableFuture<List<Map<String, Object>>> future01 = CompletableFuture.supplyAsync(() -> {
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql01);
            return list;
        }, execute);
        CompletableFuture<List<Map<String, Object>>> future02 = CompletableFuture.supplyAsync(() -> {
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql02);
            return list;
        }, execute);
        CompletableFuture<List<Map<String, Object>>> future03 = CompletableFuture.supplyAsync(() -> {
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql03);
            return list;
        }, execute);
        CompletableFuture.allOf(future01, future02, future03).get();
        List<Map<String, Object>> list01 = future01.get();
        List<Map<String, Object>> list02 = future02.get();
        List<Map<String, Object>> list03 = future03.get();
        // 合并列表
        List<Map<String, Object>> mergedList = new ArrayList<>(list01);
        mergedList.addAll(list02);
        mergedList.addAll(list03);
        // 按 createTime 排序
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        mergedList.sort((m1, m2) -> {
            String c1 = (String) m1.get("createTime");
            String c2 = (String) m2.get("createTime");
            LocalDateTime t1 = LocalDateTime.parse(c1, formatter);
            LocalDateTime t2 = LocalDateTime.parse(c2, formatter);
            return t2.compareTo(t1);
        });
        System.out.println(mergedList);
        return mergedList;
    }
    /**
     * 查询医生服务动态
     */
    public List<Map<String, Object>> getDoctorBehavior() throws Exception {
        String sql01 = "SELECT q.*,CONCAT(q.deptName,q.doctorName,'医生接诊了',q.patientName,'患者')'description' FROM (\n" +
                "	SELECT\n" +
                "	doctor_name 'doctorName',dept_name 'deptName',patient_name 'patientName',\n" +
                "	DATE_FORMAT(create_time, '%Y-%m-%d %H:%i:%S') 'createTime'\n" +
                "FROM\n" +
                "	wlyy_outpatient \n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND pay_status IN ( '1', '2' )\n" +
                "	ORDER BY create_time DESC LIMIT 5\n" +
                ")q";
        String sql02 = "SELECT q.*,CONCAT(q.deptName,q.doctorName,'医生为',q.patientName,'患者开具了处方')'description'  FROM (\n" +
                "	SELECT\n" +
                "	a.doctor_name 'doctorName',b.dept_name 'deptName',a.patient_name 'patientName',\n" +
                "	DATE_FORMAT(a.create_time, '%Y-%m-%d %H:%i:%S' ) 'createTime' \n" +
                "FROM\n" +
                "	wlyy_prescription a INNER JOIN base_doctor_hospital b ON a.doctor=b.doctor_code\n" +
                "WHERE\n" +
                "	a.`status` >= '30' ORDER BY a.create_time DESC LIMIT 10\n" +
                ")q";
        CompletableFuture<List<Map<String, Object>>> future01 = CompletableFuture.supplyAsync(() -> {
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql01);
            return list;
        }, execute);
        CompletableFuture<List<Map<String, Object>>> future02 = CompletableFuture.supplyAsync(() -> {
            List<Map<String, Object>> list = jdbcTemplate.queryForList(sql02);
            return list;
        }, execute);
        CompletableFuture.allOf(future01, future02).get();
        List<Map<String, Object>> list01 = future01.get();
        List<Map<String, Object>> list02 = future02.get();
        // 合并列表
        List<Map<String, Object>> mergedList = new ArrayList<>(list01);
        mergedList.addAll(list02);
        // 按 createTime 排序
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        mergedList.sort((m1, m2) -> {
            String c1 = (String) m1.get("createTime");
            String c2 = (String) m2.get("createTime");
            LocalDateTime t1 = LocalDateTime.parse(c1, formatter);
            LocalDateTime t2 = LocalDateTime.parse(c2, formatter);
            return t2.compareTo(t1);
        });
        System.out.println(mergedList);
        return mergedList;
    }
    /**
     * 图文问诊、视频问诊:两种方式,医生书写病历时有填写诊断 根据这个诊断排行
     */
    public List<Map<String, Object>> getReExaminationRanking() {
        String sql = "SELECT\n" +
                "	icd10,icd10_name,	count( 1 ) 'visitCount' \n" +
                "FROM\n" +
                "	wlyy_outpatient \n" +
                "WHERE 1=1\n" +
                "	AND pay_status IN ( '1', '2' ) \n" +
                "	AND outpatient_type='3' AND type IN('1','2')\n" +
                "	AND icd10_name IS NOT NULL \n" +
                "GROUP BY\n" +
                "	icd10,icd10_name \n" +
                "ORDER BY\n" +
                "	count(1) DESC\n" +
                "LIMIT 5";
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String, Object>> getDeptAndDoctor(ScreenQvo qvo) {
        List<Map<String, Object>> list = null;
        if ("1".equals(qvo.getType())) {
            //查询所有科室
            String sql = "SELECT distinct dept_code 'deptCode',dept_name 'deptName' FROM base_doctor_hospital WHERE del='1'";
            if (StringUtils.isNotBlank(qvo.getDeptName())) {
                sql += " and dept_name like  '%" + qvo.getDeptName() + "%'";
            }
            list = jdbcTemplate.queryForList(sql);
        }
        //根据科室或者名称查医生
        if ("2".equals(qvo.getType())) {
            String sql = "SELECT distinct b.id 'doctorId',b.`name` 'doctorName' FROM base_doctor_hospital a \n" +
                    "INNER JOIN base_doctor  b ON a.doctor_code=b.id \n" +
                    "WHERE  1=1 ";
            if (StringUtils.isNotBlank(qvo.getDeptCode())) {
                sql += " and a.dept_code = '" + qvo.getDeptCode() + "' ";
            }
            if (StringUtils.isNotBlank(qvo.getDoctorName())) {
                sql += " and b.`name` LIKE '%" + qvo.getDoctorName() + "%'";
            }
            list = jdbcTemplate.queryForList(sql);
        }
        return list;
    }
    /**
     * 查询服务评价详情
     */
    public List<Map<String, Object>> getDoctorSeverScopeDetail(ScreenQvo qvo) {
        String limitSql = "LIMIT " + (qvo.getPage() - 1) * qvo.getPageSize() + "," + qvo.getPageSize();
        String sql = "SELECT\n" +
                "	b.dept_code 'deptCode',b.dept_name 'deptName',c.id 'doctorId',c.`name` 'doctorName', AVG(a.score) 'score' \n" +
                "FROM\n" +
                "	base_evaluate_score a\n" +
                "	INNER JOIN base_doctor_hospital b ON a.doctor = b.doctor_code \n" +
                "	INNER JOIN base_doctor c ON b.doctor_code=c.id\n" +
                "WHERE\n" +
                "	1 = 1 \n";
        if (StringUtils.isNotBlank(qvo.getStartDate()) && StringUtils.isNotBlank(qvo.getEndDate())) {
            sql += " AND a.create_time >='" + qvo.getStartDate() + "' AND a.create_time <='" + qvo.getEndDate() + " 23:59:59' \n";
        }
        if (StringUtils.isNotBlank(qvo.getDeptCode())) {
            sql += " AND b.dept_code='" + qvo.getDeptCode() + "' ";
        }
        if (StringUtils.isNotBlank(qvo.getDoctorName())) {
            sql += "  AND c.`name` LIKE '%" + qvo.getDoctorName() + "%' ";
        }
        sql += " GROUP BY b.dept_code,c.id ";
        if (StringUtils.isNotBlank(qvo.getPageSwitch()) && "1".equals(qvo.getPageSwitch())) {
            sql += limitSql;
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
    public List<Map<String, Object>> getDoctorFreeDetail(ScreenQvo qvo) {
        String limitSql = "LIMIT " + (qvo.getPage() - 1) * qvo.getPageSize() + "," + qvo.getPageSize();
        String sql = "SELECT q.*,(q.drugFee+q.checkFree) 'totalFree' FROM (\n" +
                "SELECT\n" +
                "	p.doctor,p.doctor_name 'doctorName',a.dept_code 'deptCode',a.dept_name 'deptName', COALESCE(ROUND(SUM(p.drug_fee),2), 0) AS drugFee ,0 'checkFree'\n" +
                "FROM\n" +
                "	wlyy_prescription p\n" +
                "	INNER JOIN wlyy_outpatient o ON p.outpatient_id = o.id \n" +
                "	INNER JOIN base_doctor_hospital a ON p.doctor=a.doctor_code\n" +
                "WHERE\n" +
                "	1 = 1 \n" +
                "	AND p.STATUS >= 30\n";
        if (StringUtils.isNotBlank(qvo.getStartDate()) && StringUtils.isNotBlank(qvo.getEndDate())) {
            sql += "	AND p.create_time>='" + qvo.getStartDate() + "' AND a.create_time<='" + qvo.getEndDate() + " 23:59:59'\n";
        }
        if (StringUtils.isNotBlank(qvo.getDeptCode())) {
            sql += " AND a.dept_code='" + qvo.getDeptCode() + "' ";
        }
        if (StringUtils.isNotBlank(qvo.getDoctorName())) {
            sql += "  AND p.doctor_name LIKE '%" + qvo.getDoctorName() + "%' ";
        }
        sql += " GROUP BY a.dept_code,a.doctor_code\n" +
                "UNION ALL	\n" +
                "SELECT\n" +
                "	o.doctor,o.doctor_name 'doctorName',a.dept_code'deptCode', a.dept_name 'deptName',0 'drugFee',COALESCE(ROUND(SUM(bop.pay_price),2), 0)  AS checkFree \n" +
                "FROM\n" +
                "	wlyy_outpatient o\n" +
                "	INNER JOIN base_business_order_pay bop ON o.id = bop.relation_code \n" +
                "	INNER JOIN base_doctor_hospital a ON o.doctor=a.doctor_code\n" +
                "WHERE\n" +
                "	o.pay_status = 1 \n" +
                "	AND o.`status` IN ( 1, 2, 3 )\n";
        if (StringUtils.isNotBlank(qvo.getStartDate()) && StringUtils.isNotBlank(qvo.getEndDate())) {
            sql += "	AND o.create_time>='" + qvo.getStartDate() + "' AND o.create_time<='" + qvo.getEndDate() + " 23:59:59'\n";
        }
        if (StringUtils.isNotBlank(qvo.getDeptCode())) {
            sql += " AND a.dept_code='" + qvo.getDeptCode() + "' ";
        }
        if (StringUtils.isNotBlank(qvo.getDoctorName())) {
            sql += "  AND o.doctor_name LIKE '%" + qvo.getDoctorName() + "%' ";
        }
        sql += "	GROUP BY a.dept_code,a.doctor_code\n" +
                ")q WHERE 1=1 \n" +
                "GROUP BY q.deptCode,q.doctorName ORDER BY (q.drugFee+q.checkFree) DESC \n";
        if (StringUtils.isNotBlank(qvo.getPageSwitch()) && "1".equals(qvo.getPageSwitch())) {
            sql += limitSql;
        }
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
        return list;
    }
}

+ 10 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java

@ -1313,6 +1313,16 @@ public class BaseHospitalRequestMapping {
        public static final String commenSystemMessage  = "/commenSystemMessage";
    }
    public static class DsyyPrescription extends Basic {
        public static final String PREFIX  = "/DsyyPrescription";
        public static final String addMessage  = "/addMessage";
        public static final String updateMessage  = "/updateMessage";
        public static final String searchMessagePageList  = "/searchMessagePageList";
        public static final String queryById  = "/queryById";
        public static final String commenSystemMessage  = "/commenSystemMessage";
    }
    /**
     * 医生锦旗管理
     */

+ 66 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/hospital/statistics/ScreenQvo.java

@ -22,9 +22,34 @@ public class ScreenQvo {
   private int flag;//1本月 2近半年 3全年
   private String timeType;//查询时间范围 1 按天  3按月
   private String deptCode;//科室code
   private String deptName;//科室名称
   private String doctorName;//医生名称
   private int page;
   private int pageSize;
   private String pageSwitch;//1是0否  分页开关
   private String type;//类型
   public String getDeptName() {
      return deptName;
   }
   public void setDeptName(String deptName) {
      this.deptName = deptName;
   }
   public String getType() {
      return type;
   }
   public void setType(String type) {
      this.type = type;
   }
   public int getFlag() {
      return flag;
   }
@ -80,4 +105,44 @@ public class ScreenQvo {
   public void setTimeType(String timeType) {
      this.timeType = timeType;
   }
   public int getPage() {
      return page;
   }
   public void setPage(int page) {
      this.page = page;
   }
   public int getPageSize() {
      return pageSize;
   }
   public void setPageSize(int pageSize) {
      this.pageSize = pageSize;
   }
   public String getPageSwitch() {
      return pageSwitch;
   }
   public void setPageSwitch(String pageSwitch) {
      this.pageSwitch = pageSwitch;
   }
   public String getDeptCode() {
      return deptCode;
   }
   public void setDeptCode(String deptCode) {
      this.deptCode = deptCode;
   }
   public String getDoctorName() {
      return doctorName;
   }
   public void setDoctorName(String doctorName) {
      this.doctorName = doctorName;
   }
}

+ 36 - 39
starter/elasticsearch-starter/src/main/java/com/yihu/jw/elasticsearch/ElasticSearch7Pool.java

@ -1,7 +1,5 @@
package com.yihu.jw.elasticsearch;
import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.ElasticSearchDruidDataSourceFactory;
import com.alibaba.fastjson.JSON;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
@ -17,8 +15,6 @@ import org.elasticsearch.action.delete.DeleteRequest;
import org.elasticsearch.action.delete.DeleteResponse;
import org.elasticsearch.action.get.GetRequest;
import org.elasticsearch.action.get.GetResponse;
import org.elasticsearch.action.index.IndexRequest;
import org.elasticsearch.action.index.IndexResponse;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.action.support.master.AcknowledgedResponse;
@ -31,26 +27,21 @@ import org.elasticsearch.client.RestHighLevelClient;
import org.elasticsearch.client.indices.CreateIndexRequest;
import org.elasticsearch.client.indices.CreateIndexResponse;
import org.elasticsearch.client.indices.GetIndexRequest;
import org.elasticsearch.common.text.Text;
import org.elasticsearch.common.unit.TimeValue;
import org.elasticsearch.common.xcontent.XContentType;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.index.query.TermQueryBuilder;
import org.elasticsearch.search.SearchHit;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.elasticsearch.search.fetch.subphase.FetchSourceContext;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.sql.*;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.concurrent.TimeUnit;
/**
@ -67,11 +58,12 @@ public class ElasticSearch7Pool {
    private String password;
    @SuppressWarnings("deprecation")
    @Bean(name="restHighLevelClient")
    @Bean(name = "restHighLevelClient")
    public RestHighLevelClient restHighLevelClient() {
        String[] hosts = this.hosts.split(",");;
        String[] hosts = this.hosts.split(",");
        ;
        HttpHost[] httpHosts = new HttpHost[hosts.length];
        for(int i=0;i<hosts.length;i++) {
        for (int i = 0; i < hosts.length; i++) {
            httpHosts[i] = HttpHost.create(hosts[i]);
        }
        //设置密码
@ -100,22 +92,22 @@ public class ElasticSearch7Pool {
    }
    public ResultSet restHighLevelClientStream(String sql) throws Exception {
        Connection connection = DriverManager.getConnection("jdbc:es://http://172.26.0.55:9200","elastic","elastic");
        Connection connection = DriverManager.getConnection("jdbc:es://http://172.26.0.168:9100/","root","jkzlehr");
//        Connection connection = DriverManager.getConnection("jdbc:es://" + hosts, userName, password);
        Statement statement = connection.createStatement();
        ResultSet resultSet =  statement.executeQuery(sql);
        ResultSet resultSet = statement.executeQuery(sql);
//        connection.close();
//        statement.close();
        return resultSet;
    }
    /**
     * 创建索引
     *
     * @throws IOException
     */
    public void testCreateIndex(RestHighLevelClient restHighLevelClient,String index) throws IOException {
    public void testCreateIndex(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        //1. 创建索引请求
        CreateIndexRequest request = new CreateIndexRequest(index);
        //2. 客户端执行请求 IndicesClient,请求后获得响应
@ -126,9 +118,10 @@ public class ElasticSearch7Pool {
    /**
     * 查询是否存在索引
     *
     * @throws IOException
     */
    public void testExistIndex(RestHighLevelClient restHighLevelClient,String index) throws IOException {
    public void testExistIndex(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        GetIndexRequest request = new GetIndexRequest(index);
        boolean exists = restHighLevelClient.indices().exists(request, RequestOptions.DEFAULT);
        System.out.println(exists);
@ -137,7 +130,7 @@ public class ElasticSearch7Pool {
    /**
     * 删除索引
     */
    public void testDeleteIndex(RestHighLevelClient restHighLevelClient,String index) throws IOException {
    public void testDeleteIndex(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        //创建删除索引请求对象
        DeleteIndexRequest request = new DeleteIndexRequest(index);
        //客户端执行请求
@ -145,10 +138,11 @@ public class ElasticSearch7Pool {
        //输出是否删除成功
        System.out.println(response.isAcknowledged());
    }
    /**
     * 添加文档
     */
    public void addDocument(RestHighLevelClient restHighLevelClient,String index) throws IOException {
    public void addDocument(RestHighLevelClient restHighLevelClient, String index) throws IOException {
//        //获取对象
//        Goods goods = goodsDao.findById(12991976L);
//        //创建请求
@ -168,10 +162,11 @@ public class ElasticSearch7Pool {
    /**
     * 删除文档
     *
     * @throws IOException
     */
    public void testDeleteDocument(RestHighLevelClient restHighLevelClient,String index) throws IOException {
        DeleteRequest request = new DeleteRequest(index,"1");
    public void testDeleteDocument(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        DeleteRequest request = new DeleteRequest(index, "1");
        request.timeout("1s");
        DeleteResponse response = restHighLevelClient.delete(request, RequestOptions.DEFAULT);
        //DeleteResponse[index=siyi,type=_doc,id=1,version=3,result=deleted,shards=ShardInfo{total=2, successful=1, failures=[]}]
@ -181,8 +176,8 @@ public class ElasticSearch7Pool {
    }
    //3.3 修改文档
    public void testUpdateDocument(RestHighLevelClient restHighLevelClient,String index) throws IOException {
        UpdateRequest request = new UpdateRequest(index,"1");
    public void testUpdateDocument(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        UpdateRequest request = new UpdateRequest(index, "1");
        request.timeout("1s");
//        Goods goods = goodsDao.findById(12991976L);
//        goods.setTitle("xxxx");
@ -196,7 +191,7 @@ public class ElasticSearch7Pool {
    /**
     * 批量新增文档
     */
    public void testBulkRequest(RestHighLevelClient restHighLevelClient,String index) throws IOException {
    public void testBulkRequest(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        BulkRequest request = new BulkRequest();
        request.timeout("1s");
@ -216,11 +211,11 @@ public class ElasticSearch7Pool {
    /**
     *  当我们需要使用批量增删改数据时,只需要使用BulkRequest的add,delete,update中相应方法即可。
     * 当我们需要使用批量增删改数据时,只需要使用BulkRequest的add,delete,update中相应方法即可。
     * 获取文档,判断是否存在 get /index/doc/1
     */
    public void testIsExists(RestHighLevelClient restHighLevelClient,String index) throws IOException {
        GetRequest request = new GetRequest(index,"1");
    public void testIsExists(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        GetRequest request = new GetRequest(index, "1");
        //不获取返回的 _source的上下文了
        request.fetchSourceContext(new FetchSourceContext(false));
        request.storedFields("_none");
@ -230,18 +225,20 @@ public class ElasticSearch7Pool {
    /**
     * 获取文档信息
     *
     * @throws IOException
     */
    public void testGetDocument(RestHighLevelClient restHighLevelClient,String index) throws IOException {
        GetRequest request = new GetRequest(index,"1");
    public void testGetDocument(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        GetRequest request = new GetRequest(index, "1");
        GetResponse response = restHighLevelClient.get(request, RequestOptions.DEFAULT);
        System.out.println(response.getSourceAsString());
        System.out.println(response);
    }
    /**
     * 复杂查询
     */
    public void testSearch(RestHighLevelClient restHighLevelClient,String index) throws IOException {
    public void testSearch(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        SearchRequest request = new SearchRequest(index);
        //构建搜索条件
        SearchSourceBuilder builder = new SearchSourceBuilder();
@ -264,12 +261,12 @@ public class ElasticSearch7Pool {
    }
    /**
     *     当然,我们可以向直接操作ElasticSearch一样去构建查询条件。
     *
     *     在java中有对应的类来实现我们需要构造的查询条件。
     * 当然,我们可以向直接操作ElasticSearch一样去构建查询条件。
     * <p>
     * 在java中有对应的类来实现我们需要构造的查询条件。
     * 分页查询
     */
    public void testSearch2(RestHighLevelClient restHighLevelClient,String index) throws IOException {
    public void testSearch2(RestHighLevelClient restHighLevelClient, String index) throws IOException {
        SearchRequest request = new SearchRequest(index);
        //构建搜索条件
        SearchSourceBuilder builder = new SearchSourceBuilder();

+ 173 - 0
svr/svr-internet-hospital-entrance/src/main/java/com/yihu/jw/entrance/controller/DsyyController.java

@ -0,0 +1,173 @@
package com.yihu.jw.entrance.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.prescription.service.PrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.YkyyEntranceService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2020/1/19.
 */
@RestController
@RequestMapping(value ="/dsyy")
@Api(value = "第三医院视图解析", description = "第三医院视图解析", tags = {"第三医院视图解析"})
public class DsyyController extends EnvelopRestEndpoint {
    @Autowired
    private DsyyEntranceService dsyyEntranceService;
    @GetMapping(value = "/createSQLQuery")
    @ApiOperation(value = "视图统一查询")
    public ListEnvelop createSQLQuery(@ApiParam(name = "sql", value = "sql语句", required = true)
                                      @RequestParam(value = "sql",required = true)String sql,
                                      @ApiParam(name = "params", value = "入参", required = false)
                                      @RequestParam(value = "params",required = false)Map<String, Object> params,
                                      @ApiParam(name = "page", value = "第几页", required = false)
                                      @RequestParam(value = "page",required = false)Integer page,
                                      @ApiParam(name = "size", value = "分页大小", required = false)
                                      @RequestParam(value = "size",required = false)Integer size){
        return success(dsyyEntranceService.createSQLQuery(sql,params,page,size));
    }
    @GetMapping(value = "/jdbcSQLQuery")
    @ApiOperation(value = "视图统一查询")
    public ListEnvelop jdbcSQLQuery(@ApiParam(name = "sql", value = "sql语句", required = true)
                                      @RequestParam(value = "sql",required = true)String sql){
        return success(dsyyEntranceService.jdbcSQLQuery(sql));
    }
    @GetMapping(value = "/registered")
    @ApiOperation(value = "挂号(调his后台包)")
    public Envelop registered(@ApiParam(name = "doctor", value = "医生ID(必填)", required = false)
                                    @RequestParam(value = "doctor",required = false)String doctor,
                                    @ApiParam(name = "dept", value = "科室编码(必填)", required = false)
                                    @RequestParam(value = "dept",required = false)String dept,
                                    @ApiParam(name = "sickId", value = "病人id", required = false)
                                        @RequestParam(value = "sickId",required = false)String sickId,
                                    @ApiParam(name = "clinicclass", value = "挂号类别(必填)", required = false)
                                        @RequestParam(value = "clinicclass",required = false)String clinicclass,
                                    @ApiParam(name = "courierflag", value = "courierflag", required = false)
                                        @RequestParam(value = "courierflag",required = false)String courierflag) throws Exception {
        return success(dsyyEntranceService.registered( doctor,dept,sickId,clinicclass,courierflag));
    }
    @GetMapping(value = "/refundConsultation")
    @ApiOperation(value = "发送退号信息到his")
    public Envelop refundConsultation(@ApiParam(name = "applyNo", value = "挂号号", required = false)
                              @RequestParam(value = "applyNo",required = false)String applyNo,
                              @ApiParam(name = "PayCardNo", value = "就诊卡号", required = false)
                              @RequestParam(value = "PayCardNo",required = false)String PayCardNo) throws Exception {
        return success(dsyyEntranceService.refundConsultation(applyNo,PayCardNo));
    }
    @GetMapping(value = "/savePrescriptionToHospital")
    @ApiOperation(value = "互联网医院开处方信息更新到his")
    public Envelop savePrescriptionToHospital(@ApiParam(name = "IoFlag", value = "门诊住院标志", required = false)
                                @RequestParam(value = "IoFlag",required = false)String IoFlag,
                                @ApiParam(name = "PayCardNo", value = "就诊卡号", required = false)
                                @RequestParam(value = "PayCardNo",required = false)String PayCardNo,
                                @ApiParam(name = "NullahNumber", value = "挂号流水号", required = false)
                                @RequestParam(value = "NullahNumber",required = false)String NullahNumber,
                                @ApiParam(name = "ApplyDept", value = "执行科室", required = false)
                                @RequestParam(value = "ApplyDept",required = false)String ApplyDept,
                                @ApiParam(name = "ApplyDoctor", value = "开单医生", required = false)
                                @RequestParam(value = "ApplyDoctor",required = false)String ApplyDoctor,
                                @ApiParam(name = "ExecuteDept", value = "执行科室(药房)", required = false)
                                    @RequestParam(value = "ExecuteDept",required = false)String ExecuteDept,
                                @ApiParam(name = "infoJson", value = "药品列表", required = false)
                                    @RequestParam(value = "infoJson",required = false)String infoJson) throws Exception {
        JSONArray array  = JSONArray.parseArray(infoJson);
        List<WlyyPrescriptionInfoDO> prescriptionInfoDOList= new ArrayList<>();
        for (int i=0;i<array.size();i++){
            WlyyPrescriptionInfoDO infoDO = objectMapper.readValue(array.getJSONObject(i).toJSONString(),WlyyPrescriptionInfoDO.class);
            prescriptionInfoDOList.add(infoDO);
        }
        return success(dsyyEntranceService.savePrescriptionToHospital(IoFlag,PayCardNo,NullahNumber,
                ApplyDept,ApplyDoctor,ExecuteDept,prescriptionInfoDOList));
    }
    @GetMapping(value = "/delHisPrescriptionByHisNo")
    @ApiOperation(value = "作废处方")
    public Envelop delHisPrescriptionByHisNo(@ApiParam(name = "IoFlag", value = "门诊住院标志", required = false)
                                @RequestParam(value = "IoFlag",required = false)String IoFlag,
                                @ApiParam(name = "PayCardNo", value = "就诊卡号", required = false)
                                @RequestParam(value = "PayCardNo",required = false)String PayCardNo,
                                @ApiParam(name = "NullahNumber", value = "挂号流水号", required = false)
                                @RequestParam(value = "NullahNumber",required = false)String NullahNumber,
                                @ApiParam(name = "ApplyDept", value = "执行科室", required = false)
                                @RequestParam(value = "ApplyDept",required = false)String ApplyDept,
                                @ApiParam(name = "ApplyDoctor", value = "开单医生", required = false)
                                @RequestParam(value = "ApplyDoctor",required = false)String ApplyDoctor,
                                @ApiParam(name = "ExecuteDept", value = "执行科室(药房)", required = false)
                                @RequestParam(value = "ExecuteDept",required = false)String ExecuteDept,
                                @ApiParam(name = "PresNo", value = "必填,医嘱号", required = false)
                                @RequestParam(value = "PresNo",required = false)String PresNo) throws Exception {
        return success(dsyyEntranceService.delHisPrescriptionByHisNo(IoFlag,PayCardNo,NullahNumber,
                ApplyDept,ApplyDoctor,ExecuteDept,PresNo));
    }
    @GetMapping(value = "/saveDiagnosis")
    @ApiOperation(value = "保存诊断到his")
    public Envelop saveDiagnosis(@ApiParam(name = "applyNo", value = "挂号号", required = false)
                                             @RequestParam(value = "applyNo",required = false)String applyNo,
                                             @ApiParam(name = "DiagnosisName", value = "诊断名称", required = false)
                                             @RequestParam(value = "DiagnosisName",required = false)String DiagnosisName,
                                             @ApiParam(name = "DiagnosisCode", value = "诊断编码", required = false)
                                             @RequestParam(value = "DiagnosisCode",required = false)String DiagnosisCode) throws Exception {
        return success(dsyyEntranceService.saveDiagnosis(applyNo,DiagnosisName,DiagnosisCode));
    }
    @GetMapping(value = "/saveInspectToHospital")
    @ApiOperation(value = "组装检查检验项目参数到his")
    public Envelop saveInspectToHospital(@ApiParam(name = "IoFlag", value = "门诊住院标志", required = false)
                                              @RequestParam(value = "IoFlag",required = false)String IoFlag,
                                              @ApiParam(name = "PayCardNo", value = "就诊卡号", required = false)
                                              @RequestParam(value = "PayCardNo",required = false)String PayCardNo,
                                              @ApiParam(name = "NullahNumber", value = "挂号流水号", required = false)
                                              @RequestParam(value = "NullahNumber",required = false)String NullahNumber,
                                              @ApiParam(name = "ApplyDept", value = "执行科室", required = false)
                                              @RequestParam(value = "ApplyDept",required = false)String ApplyDept,
                                              @ApiParam(name = "ApplyDoctor", value = "开单医生", required = false)
                                              @RequestParam(value = "ApplyDoctor",required = false)String ApplyDoctor,
                                              @ApiParam(name = "inspectJson", value = "检查项目", required = false)
                                              @RequestParam(value = "inspectJson",required = false)String inspectJson) throws Exception {
        JSONArray array  = JSONArray.parseArray(inspectJson);
        List<WlyyInspectionDO> inspectionDOList= new ArrayList<>();
        for (int i=0;i<array.size();i++){
            WlyyInspectionDO inspectionDO = objectMapper.readValue(array.getJSONObject(i).toJSONString(),WlyyInspectionDO.class);
            inspectionDOList.add(inspectionDO);
        }
        return success(dsyyEntranceService.saveInspectToHospital(IoFlag,PayCardNo,NullahNumber,
                ApplyDept,ApplyDoctor,inspectionDOList));
    }
}

+ 69 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/DsyyPrescriptionCotroller.java

@ -0,0 +1,69 @@
package com.yihu.jw.hospital.endpoint.prescription;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionDiagnosisDao;
import com.yihu.jw.hospital.prescription.dao.PrescriptionInfoDao;
import com.yihu.jw.hospital.prescription.service.HcyyPrescriptionService;
import com.yihu.jw.hospital.prescription.service.entrance.DsyyEntranceService;
import com.yihu.jw.hospital.prescription.service.entrance.HcyyEntranceService;
import com.yihu.jw.im.service.ImService;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionDiagnosisVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Trick on 2020/3/18.
 */
@RestController
@RequestMapping(value = BaseHospitalRequestMapping.DsyyPrescription.PREFIX)
@Api(value = "第三医院平台服务", description = "第三医院平台服务", tags = {"第三医院平台服务"})
public class DsyyPrescriptionCotroller extends EnvelopRestEndpoint {
    @Autowired
    private HcyyEntranceService hcyyEntranceService;
    @Autowired
    private PrescriptionDao prescriptionDao;
    @Autowired
    private PrescriptionDiagnosisDao prescriptionDiagnosisDao;
    @Autowired
    private PrescriptionInfoDao prescriptionInfoDao;
    @Autowired
    private ImService imService;
    @Autowired
    private DsyyEntranceService dsyyEntranceService;
    @GetMapping(value = "/updateDept")
    @ApiOperation(value = "同步科室信息", notes = "同步科室信息")
    public ObjEnvelop getDeptInfo()throws Exception{
        return ObjEnvelop.getSuccess("ok",dsyyEntranceService.updateDept());
    }
    @GetMapping(value = "/updateDoctor")
    @ApiOperation(value = "同步医生信息", notes = "同步医生信息")
    public ObjEnvelop getDoctorInfo(@ApiParam(name = "idCard", value = "身份证号", required = false)
                                        @RequestParam(value = "idCard",required = false)String idcard)throws Exception{
        return ObjEnvelop.getSuccess("ok",dsyyEntranceService.updateDoctor(idcard));
    }
}

+ 10 - 8
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java

@ -143,6 +143,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private HcyyPrescriptionService hcyyPrescriptionService;
    @Autowired
    private MlwyyEntranceService mlwyyEntranceService;
    @Autowired
    private DsyyPrescriptionService dsyyPrescriptionService;
    @Value("${qywx.id}")
    private String qywxId;
@ -646,8 +648,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(tnPrescriptionService.getICD10(pyKey, false));
        } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
            return success(hcyyPrescriptionService.selectIcd10Dict(pyKey));
        } if (wxId.equalsIgnoreCase("xm_tasy_wx")) {
            return success(prescriptionService.getICD10(pyKey));
        } if (wxId.equalsIgnoreCase("xm_dsyy_wx")) {
            return success(dsyyPrescriptionService.findIcd10(pyKey));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -680,8 +682,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
        } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
            logger.info("pyKey"+pyKey);
            return success(hcyyPrescriptionService.selectDrugDict(pyKey,drugNo));
        } else if (wxId.equalsIgnoreCase("xm_tasy_wx")) {
            return success(prescriptionService.getDrugDictionary(drugNo, pyKey, winNo, groupNo));
        } else if (wxId.equalsIgnoreCase("xm_dsyy_wx")) {
            return success(dsyyPrescriptionService.findDrugs(drugNo, pyKey));
        }  else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -702,8 +704,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(tnPrescriptionService.getDrugUse(pyKey, demoFlag));
        } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
            return success(hcyyPrescriptionService.selectMedicineUsed(pyKey));
        } else if (wxId.equalsIgnoreCase("xm_tasy_wx")) {
            return success(prescriptionService.getDrugUse(drugNo, pyKey));
        } else if (wxId.equalsIgnoreCase("xm_dsyy_wx")) {
            return success(dsyyPrescriptionService.getDrugUse(pyKey));
        }else {
            return ListEnvelop.getError("尚未开发!");
        }
@ -722,8 +724,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return success(tnPrescriptionService.getDrugFrequency(demoFlag));
        } else if (wxId.equalsIgnoreCase("xm_hcyy_wx")) {
            return success(hcyyPrescriptionService.selectFrequencyDict());
        } else if (wxId.equalsIgnoreCase("xm_tasy_wx")) {
            return success(prescriptionService.getDrugFrequency());
        } else if (wxId.equalsIgnoreCase("xm_dsyy_wx")) {
            return success(dsyyPrescriptionService.getDrugFrequency());
        }else {
            return ListEnvelop.getError("尚未开发!");
        }

+ 126 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/statistics/EsStatisticsEndpoint.java

@ -13,6 +13,7 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -1526,4 +1527,129 @@ public class EsStatisticsEndpoint extends EnvelopRestEndpoint {
    }
    /**
     * 获取开通网络问诊的医生和科室数量
     */
    @GetMapping(value = "/getNetworkDoctorAndDeptCount")
    @ApiOperation(value = "获取开通网络问诊的医生和科室数量")
    public Envelop getNetworkDoctorAndDeptCount() {
        try {
            HashMap<String, Object> result = statisticsEsService.getNetworkDoctorAndDeptCount();
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failed("系统繁忙");
        }
    }
    /**
     * 查询患者行为动态
     */
    @GetMapping(value = "/getPatientBehavior")
    @ApiOperation(value = "查询患者行为动态")
    public Envelop getPatientBehavior() {
        try {
            List<Map<String, Object>> result = statisticsEsService.getPatientBehavior();
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failed("系统繁忙");
        }
    }
    /**
     * 查询医生服务动态
     */
    @GetMapping(value = "/getDoctorBehavior")
    @ApiOperation(value = "查询医生服务动态")
    public Envelop getDoctorBehavior() {
        try {
            List<Map<String, Object>> result = statisticsEsService.getDoctorBehavior();
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failed("系统繁忙");
        }
    }
    /**
     * 患者复诊诊断排行
     * 图文问诊、视频问诊:两种方式,医生书写病历时有填写诊断 根据这个诊断排行
     */
    @GetMapping(value = "/getReExaminationRanking")
    @ApiOperation(value = "患者复诊诊断排行")
    public Envelop getReExaminationRanking() {
        try {
            List<Map<String, Object>> result = statisticsEsService.getReExaminationRanking();
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failed("系统繁忙");
        }
    }
    /**
     * 查询所有科室和医生
     * strJson={"type":"1","deptName":"心脏"}
     * strJson={"type":"2","deptCode":"0000001","doctorName":"陈淑萍"}
     */
    @GetMapping(value = "/getDeptAndDoctor")
    @ApiOperation(value = "查询所有科室")
    public Envelop getDeptAndDoctor(@RequestParam(required = true) String strJson) {
        try {
            ScreenQvo qvo = JSON.parseObject(strJson, ScreenQvo.class);
            List<Map<String, Object>> result = statisticsEsService.getDeptAndDoctor(qvo);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failed("系统繁忙");
        }
    }
    /**
     * 查询服务评价详情
     * strJson={"startDate":"2020-07-18","endDate":"2023-11-29","deptCode":"1110000","deptName":"梁敬兴","pageSwitch":"1","page":1,"pageSize":10}
     */
    @GetMapping(value = "/getDoctorSeverScopeDetail")
    @ApiOperation(value = "查询服务评价详情")
    public Envelop getDoctorSeverScopeDetail(@RequestParam(required = true) String strJson) {
        try {
            ScreenQvo qvo = JSON.parseObject(strJson, ScreenQvo.class);
            List<Map<String, Object>> result = statisticsEsService.getDoctorSeverScopeDetail(qvo);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failed("系统繁忙");
        }
    }
    /**
     * 全院网络门诊收入明细
     * 参数:strJson={"startDate":"2020-07-18","endDate":"2023-11-29","deptCode":"1110000","deptName":"梁敬兴","pageSwitch":"1","page":1,"pageSize":10}
     */
    @GetMapping(value = "/getDoctorFreeDetail")
    @ApiOperation(value = "全院网络门诊收入明细")
    public Envelop getDoctorFreeDetail(@RequestParam(required = true) String strJson) {
        try {
            ScreenQvo qvo = JSON.parseObject(strJson, ScreenQvo.class);
            List<Map<String, Object>> result = statisticsEsService.getDoctorFreeDetail(qvo);
            return success(result);
        } catch (Exception e) {
            e.printStackTrace();
            return failed("系统繁忙");
        }
    }
}

+ 2 - 2
svr/svr-visit-behind/src/main/java/com/yihu/jw/hospital/module/rehabilitation/service/RehabilitationInfoService.java

@ -1060,10 +1060,10 @@ public class RehabilitationInfoService {
                    "INNER JOIN base_doctor  b ON a.doctor_code=b.id \n" +
                    "WHERE  1=1 ";
            if (StringUtils.isNotBlank(deptCode)) {
                sql += " and dept_code = '" + deptCode + "' ";
                sql += " and a.dept_code = '" + deptCode + "' ";
            }
            if (StringUtils.isNotBlank(doctorName)) {
                sql += " and b.`name` LIKE '%" + deptName + "%'";
                sql += " and b.`name` LIKE '%" + doctorName + "%'";
            }
            list = jdbcTemplate.queryForList(sql);
        }