Kaynağa Gözat

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

yeshijie 7 yıl önce
ebeveyn
işleme
1c4a8e75b7
17 değiştirilmiş dosya ile 261 ekleme ve 130 silme
  1. 11 2
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  2. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  3. 13 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  4. 10 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  5. 10 5
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  6. 11 11
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java
  7. 32 32
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/NoticeImUtill.java
  8. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java
  9. 15 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java
  10. 12 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  11. 42 44
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  12. 20 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java
  13. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java
  14. 27 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java
  15. 3 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcEduArticleController.java
  16. 39 12
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java
  17. 11 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java

+ 11 - 2
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java

@ -18,7 +18,7 @@ public class CallRecord extends IdEntity {
    private Integer type; //1.呼入,2.呼出
    private String  callerNumber; //主叫号码
    private String  recipientNumber;//被叫号码
    private Integer  answerStatus;//接听状态: 1.接通,2. 队列中放弃,3.接通
    private Integer  answerStatus;//接听状态: 1.接通,2. 队列中放弃,3.未接通
    private Integer  serviceType; //服务类型:1.医生转接 2.代理咨询
    private String  serviceContent; //服务内容
    private Date createTime; //创建时间
@ -34,7 +34,8 @@ public class CallRecord extends IdEntity {
    private String  ssc; //社保卡号
    private String  doctor; //签约医生code
    private String  doctorName; //签约医生姓名
    private Long  adminTeamCode;
    private Long  adminTeamCode; //团队id
    private Integer transferState;//转接状态1.成功 2.失败
    public String getCode() {
        return code;
@ -205,4 +206,12 @@ public class CallRecord extends IdEntity {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    public Integer getTransferState() {
        return transferState;
    }
    public void setTransferState(Integer transferState) {
        this.transferState = transferState;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -14,7 +14,7 @@ import java.util.Date;
@Table(name = "manage_call_service")
public class CallService extends IdEntity {
    private String code; //服务编号
    private String code; //服务编号.
    private String callCode; //关联通话记录
    private String patient; //服务对象(患者code)
    private String patientName; // 服务对象名称(患者名称)

+ 13 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java

@ -231,9 +231,10 @@ public class CustomerController extends BaseController {
    public String  updateCallRecordService(@ApiParam(name="code",value="通话记录code")@RequestParam(required = true)String code,
                                           @ApiParam(name="phone",value="服务对象电话号码")@RequestParam(required = true)String phone,
                                           @ApiParam(name="serviceType",value="服务类型:1.医生转接 2.代理咨询")@RequestParam(required = true)Integer serviceType,
                                           @ApiParam(name="serviceContent",value="服务内容")@RequestParam(required = false) String serviceContent){
                                           @ApiParam(name="serviceContent",value="服务内容")@RequestParam(required = false) String serviceContent,
                                           @ApiParam(name="transferState",value="1.成功,2.失败")@RequestParam(required = true) Integer transferState){
        try {
            return write(200,"保存成功","data",customerService.updateCallRecordService(code,phone,serviceType,serviceContent));
            return write(200,"保存成功","data",customerService.updateCallRecordService(code,phone,serviceType,serviceContent,transferState));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
@ -349,4 +350,14 @@ public class CustomerController extends BaseController {
        }
    }
    @RequestMapping(value = "/delCallService", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "删除协同服务")
    public String delCallService(@ApiParam(name="code",value="协同服务编号")@RequestParam(required = true)String code){
        try {
            return write(200,"操作成功","data",customerService.delCallService(code));
        }catch (Exception e){
            error(e);
            return error(-1,"操作成功");
        }
    }
}

+ 10 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java

@ -34,7 +34,8 @@ public class CallRecord extends IdEntity {
    private String  ssc; //社保卡号
    private String  doctor; //签约医生code
    private String  doctorName; //签约医生姓名
    private Long  adminTeamCode;
    private Long  adminTeamCode; //团队id
    private Integer transferState;//转接状态1.成功 2.失败
    public String getCode() {
        return code;
@ -205,4 +206,12 @@ public class CallRecord extends IdEntity {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
    public Integer getTransferState() {
        return transferState;
    }
    public void setTransferState(Integer transferState) {
        this.transferState = transferState;
    }
}

+ 10 - 5
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java

@ -20,6 +20,7 @@ import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.aspectj.weaver.ast.Call;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -220,7 +221,7 @@ public class CustomerService extends BaseService{
		return "1";
	}
	public Map<String,Object> updateCallRecordService(String code,String phone,Integer serviceType,String serviceContent){
	public Map<String,Object> updateCallRecordService(String code,String phone,Integer serviceType,String serviceContent,Integer transferState){
		CallRecord callRecord = callRecordDao.findByCode(code);
		List<Patient> list =  patientDao.findByMobile(phone);
@ -253,7 +254,7 @@ public class CustomerService extends BaseService{
		callRecord.setServiceType(serviceType);
		callRecord.setServiceContent(serviceContent);
		callRecord.setAdminTeamCode(sf.getAdminTeamId());
		callRecord.setTransferState(transferState);
		CallRecord call = callRecordDao.save(callRecord);
		rs.put("state",1);
@ -307,7 +308,7 @@ public class CustomerService extends BaseService{
				" manage_call_record r " +
				" WHERE " +
				" 1 = 1 ";
		sql = setCallRecordSql( sqltotal, callerNumber,recipientNumber, answerStatus, serviceType ,userName,jobNo, startDate, endDate);
		sql = setCallRecordSql( sql, callerNumber,recipientNumber, answerStatus, serviceType ,userName,jobNo, startDate, endDate);
		sql += " ORDER BY r.call_time DESC LIMIT "+(page-1)*size+","+size;
		List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
@ -496,7 +497,7 @@ public class CustomerService extends BaseService{
				" s.patient_name AS patientName, " +
				" s.doctor, " +
				" s.doctor_name AS doctorName, " +
				" s.server_type As serverType, " +
				" s.type As type, " +
				" s.state, " +
				" s.server_content AS serverContent, " +
				" s.create_time AS createTime, " +
@ -567,7 +568,11 @@ public class CustomerService extends BaseService{
		return rs;
	}
	public String delCallService(String code){
		CallService c = callServiceDao.findByCode(code);
		callServiceDao.delete(c);
		return "1";
	}

+ 11 - 11
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java

@ -39,17 +39,17 @@ public class PrescriptionStatusConvert implements Convert {
    }
    public String getStatusCode(Integer status) {
        if (status == 100) {
            return Contant.prescriptionStatus.status_1; //已完成
        } else if (status == -2) {
            return Contant.prescriptionStatus.status_2; //已取消
        } else if (status == -1) {
            return Contant.prescriptionStatus.status_3;//审核不通过
        } else if (status >= 0 && status < 100) {
            return Contant.prescriptionStatus.status_4; //进行中
        } else if (status == -3 || status == -4 || status == -5) {
            return Contant.prescriptionStatus.status_5;//其他原因取消
        } else {
        if (status >= 0 && status < 100) {
            return Contant.prescriptionStatus.status_1;
        } else if (status==100) {
            return Contant.prescriptionStatus.status_2;
        } else if (status==-2) {
            return Contant.prescriptionStatus.status_3;
        } else if (status==-1) {
            return Contant.prescriptionStatus.status_4;
        } else if (status==-3||status==-4||status==-5) {
            return Contant.prescriptionStatus.status_5;
        } else{
            return "0";
        }
    }

+ 32 - 32
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/util/NoticeImUtill.java

@ -150,23 +150,23 @@ public class NoticeImUtill {
        return messages;
    }
    public static JSONObject getTopicMessage(String baseUrl,String topicId,String startMsgId,String endMsgId,int page,int pagesize,String uid){
        String url = baseUrl
                + "api/v2/sessions/topic/"+topicId+"/messages?topic_id="+topicId+"&end="+startMsgId
                +"&start="+(endMsgId==null?"":endMsgId)+"&page="+page+"&pagesize="+pagesize+"&user="+uid;
        try{
            String ret = HttpClientUtil.get(url, "UTF-8");
            JSONObject obj = new JSONObject(ret);
            if(obj.getInt("status")==-1){
                throw new RuntimeException(obj.getString("message"));
            }else{
                return  obj.getJSONObject("data");
            }
        }catch (Exception e){
            return null;
        }
    }
//    public static JSONObject getTopicMessage(String baseUrl,String topicId,String startMsgId,String endMsgId,int page,int pagesize,String uid){
//        String url = baseUrl
//                + "api/v2/sessions/topic/"+topicId+"/messages?topic_id="+topicId+"&end="+startMsgId
//                +"&start="+(endMsgId==null?"":endMsgId)+"&page="+page+"&pagesize="+pagesize+"&user="+uid;
//        try{
//            String ret = HttpClientUtil.get(url, "UTF-8");
//            JSONObject obj = new JSONObject(ret);
//            if(obj.getInt("status")==-1){
//                throw new RuntimeException(obj.getString("message"));
//            }else{
//                return  obj.getJSONObject("data");
//            }
//        }catch (Exception e){
//            return null;
//        }
//
//    }
    /**
     * 删除对应的成员信息在MUC模式中
@ -201,21 +201,21 @@ public class NoticeImUtill {
     * @param topicId
     * @return
     */
    public static JSONObject getTopic(String baseUrl,String topicId) throws  Exception{
        String url =baseUrl
                + "api/v2/sessions/topics/"+topicId+"?topic_id="+topicId;
        try{
            String ret = HttpClientUtil.get(url,"utf-8");
            JSONObject obj = new JSONObject(ret);
            if(obj.getInt("status")==-1){
                throw new RuntimeException("获取议题失败!");
            }else{
                return obj;
            }
        }catch (Exception e){
            throw new RuntimeException("获取议题失败!");
        }
    }
//    public static JSONObject getTopic(String baseUrl,String topicId) throws  Exception{
//        String url =baseUrl
//                + "api/v2/sessions/topics/"+topicId+"?topic_id="+topicId;
//        try{
//            String ret = HttpClientUtil.get(url,"utf-8");
//            JSONObject obj = new JSONObject(ret);
//            if(obj.getInt("status")==-1){
//                throw new RuntimeException("获取议题失败!");
//            }else{
//                return obj;
//            }
//        }catch (Exception e){
//            throw new RuntimeException("获取议题失败!");
//        }
//    }
}

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -100,4 +100,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    @Query("from Message a where a.type = 12 and a.state=0 and a.del='1' and a.over='0' and receiver = ?1  ")
    List<Message> findByReceiverCallService(String doctor);
    @Query("select a from Message a where a.receiver = ?1 and a.type=?2 ")
    List<Message> getMessageByType(String doctor, Integer type, Pageable pageRequest);
}

+ 15 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/message/MessageService.java

@ -166,6 +166,20 @@ public class MessageService extends BaseService {
            prescriptionJson.put("amount", 0);
        }
        //协同服务
        List<Message> callServiceMes =  messageDao.findByReceiverCallService(doctor);
        JSONObject callServiceMesJson = new JSONObject();
        if (callServiceMes != null && callServiceMes.size() > 0) {
            callServiceMesJson.put("amount", callServiceMes.size());
            JSONObject callJson = new JSONObject();
            callJson.put("title", callServiceMes.get(0).getTitle());
            callJson.put("type", callServiceMes.get(0).getType());
            callJson.put("msg", callServiceMes.get(0).getContent());
            callJson.put("msgTime", DateUtil.dateToStrLong(callServiceMes.get(0).getCreateTime()));
            callServiceMesJson.put("lastMessage", callJson);
        } else {
            callServiceMesJson.put("amount", 0);
        }
        JSONObject json = new JSONObject();
        json.put("imMsgCount", getImMsgAmount(doctor));//IM消息数量
@ -173,6 +187,7 @@ public class MessageService extends BaseService {
        json.put("healthIndex", indexJson);//健康指标
        json.put("system", systemJson);//系统消息
        json.put("prescription", prescriptionJson);//续方消息
        json.put("callService", callServiceMesJson);//协同服务消息
        return json;
    }

+ 12 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java

@ -25,6 +25,7 @@ import java.util.*;
 * 订单物流相关。
 */
@Service
@Transactional
public class PrescriptionExpressageService extends BaseService {
    @Autowired
    private PrescriptionExpressageDao prescriptionExpressageDao;
@ -560,17 +561,21 @@ public class PrescriptionExpressageService extends BaseService {
            //更新二维码(isUse)
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeDao.finByCode(prescriptionCode);
            //修改取药码code为已经使用
            prescriptionDispensaryCode.setIsUse(1);
            prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
            if(prescriptionDispensaryCode!=null){
                //修改取药码code为已经使用
                prescriptionDispensaryCode.setIsUse(1);
                prescriptionDispensaryCodeDao.save(prescriptionDispensaryCode);
            }
            //更新配送信息
            PrescriptionExpressage prescriptionExpressage = prescriptionExpressageDao.findByPrescriptionCode(prescriptionDispensaryCode.getPrescriptionCode());
            prescriptionExpressage.setHospitalDoctor(doctor);
            prescriptionExpressage.setHospitalDoctorCode(d.getCode());
            prescriptionExpressage.setFetchingMedicineTime(new Date());
            prescriptionExpressageDao.save(prescriptionExpressage);
            if(prescriptionExpressage!=null){
                prescriptionExpressage.setHospitalDoctor(doctor);
                prescriptionExpressage.setHospitalDoctorCode(d.getCode());
                prescriptionExpressage.setFetchingMedicineTime(new Date());
                prescriptionExpressageDao.save(prescriptionExpressage);
            }
            return "1";
        }
        return "0";

+ 42 - 44
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -3106,28 +3106,29 @@ public class StatisticsESService {
            total = elasticsearchUtil.findOneDateQuotaLevel1NoSlaveKey1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL);
        }
        //进行中
        //进行中
        if (StringUtils.isNotBlank(disease)) {
            processing = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "4").get(0);
            processing = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "1").get(0);
        } else {
            processing = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, "4");
            processing = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, "1");
        }
        //已完成
        if (StringUtils.isNotBlank(disease)) {
            finished = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "1").get(0);
            finished = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "2").get(0);
        } else {
            finished = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, "1");
            finished = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, "2");
        }
        //已经取消
        if (StringUtils.isNotBlank(disease)) {
            canceled = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "2").get(0);
            canceled = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "3").get(0);
        } else {
            canceled = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, "2");
            canceled = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, "3");
        }
        //审核不通过
        if (StringUtils.isNotBlank(disease)) {
            unPass = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "3").get(0);
            unPass = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, disease, "4").get(0);
        } else {
            unPass = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, "3");
            unPass = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, "4");
        }
        //其他原因取消
        if (StringUtils.isNotBlank(disease)) {
@ -3448,8 +3449,6 @@ public class StatisticsESService {
     * @return
     */
    public List<Map<String, Object>> getPrescriptionTotalHistogram(int level, String area, String disease, String type) throws Exception {
        //转换type 前端type和ES生成的数据字典对不上
        type = changeType(type);
        //因为一个处方可能有多个疾病状态 所以分开2个指标
        String index58 = "58";//统计长处方总数疾病和状态维度
        String index64 = "64";//统计长处方总数状态维度
@ -3476,15 +3475,23 @@ public class StatisticsESService {
            if ("1".equals(type)) {
                //总数
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2NoSlaveKey2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL, SaveModel.interval_month, disease);
            } else {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL,  SaveModel.interval_month, disease, String.valueOf(Integer.valueOf(type) - 1));
            }  else if ("2".equals(type) || "3".equals(type) || "4".equals(type))  {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL,  SaveModel.interval_month, disease,type);
            }else if ("5".equals(type))  {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL,  SaveModel.interval_month, disease,"1");
            }else if ("6".equals(type))  {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index58, SaveModel.timeLevel_ZL,  SaveModel.interval_month, disease,"5");
            }
        } else {
            if ("1".equals(type)) {
                //总数
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1NoSlaveKey1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month);
            } else {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month,String.valueOf(Integer.valueOf(type) - 1));
            } else if ("2".equals(type) || "3".equals(type) || "4".equals(type)) {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month,type);
            }else if ("5".equals(type)) {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month,"1");
            } else if ("6".equals(type)) {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index64, SaveModel.timeLevel_ZL,  SaveModel.interval_month,"5");
            }
        }
        //把数据设置到初始化的Map里面去
@ -3504,28 +3511,6 @@ public class StatisticsESService {
        return new ArrayList<>(rs.values());
    }
    /**
     * @param type 1.总量,2.进行中,3.已完成,4.居民取消,5.审核不通过,6.其他原因取消
     * @return  1.总量,2.已完成,3.居民取消,4.审核不通过,5.进行中,6.其他原因取消
     */
    private String changeType(String type) {
        if ("2".equals(type)) {
            return "5";
        }
        if ("3".equals(type)) {
            return "2";
        }
        if ("4".equals(type)) {
            return "3";
        }
        if ("5".equals(type)) {
            return "4";
        }
        if ("6".equals(type)) {
            return "6";
        }
        return type;
    }
    /**
     * @param level    等级 1 省 2 市 3 区县 4 机构 5团队
@ -3538,7 +3523,6 @@ public class StatisticsESService {
     */
    public List<Map<String, Object>> getPrescriptionTotalLowLevel(int level, String lowlevel, String area, String disease, String type) throws Exception {
        //转换type 前端type和ES生成的数据字典对不上
        type = changeType(type);
        String quotaDate = elasticsearchUtil.getQuotaTime();
        //因为一个处方可能有多个疾病状态 所以分开2个指标
        String index58 = "58";//统计长处方总数疾病和状态维度
@ -3551,15 +3535,22 @@ public class StatisticsESService {
            if ("1".equals(type)) {
                //总数
                saveModels = elasticsearchUtil.findListDateQuotaLevel1NoSlaveKey1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, lowlevel);
            } else {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, lowlevel, String.valueOf(Integer.valueOf(type) - 1));
            } else if ("2".equals(type) || "3".equals(type) || "4".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, lowlevel, type);
            } else if ("5".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, lowlevel, "1");
            } else if ("6".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index64, SaveModel.timeLevel_DDL, lowlevel, "5");
            }
        } else {
            if ("1".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel2NoSlaveKey2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, lowlevel, disease);
            }
            {
                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, lowlevel, disease, String.valueOf(Integer.valueOf(type) - 1));
            } else if ("2".equals(type) || "3".equals(type) || "4".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, lowlevel, disease, type);
            } else if ("5".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, lowlevel, disease, "1");
            } else if ("6".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index58, SaveModel.timeLevel_DDL, lowlevel, disease, "5");
            }
        }
        if ("5".equals(lowlevel)) {
@ -3573,12 +3564,15 @@ public class StatisticsESService {
//                    lowlevel = String.valueOf(level + 1);
//                }
                if (SaveModel.townLevel.equals(lowlevel)) {
                    map=new HashMap<>();
                    map.put("code", one.getTown());
                    map.put("name", one.getTownName());
                } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                    map=new HashMap<>();
                    map.put("code", one.getHospital());
                    map.put("name", one.getHospitalName());
                } else if (SaveModel.teamLevel.equals(lowlevel)) {
                    map=new HashMap<>();
                    map.put("code", one.getTeam());
                    map.put("name", one.getTeamName());
                }
@ -3586,7 +3580,6 @@ public class StatisticsESService {
                rs.add(map);
            }
        } else {
            //统计数据为空时,自建结果集
            List<Town> townList = null;
            List<Hospital> hospitalList = null;
@ -3603,25 +3596,30 @@ public class StatisticsESService {
            }
            if (SaveModel.townLevel.equals(lowlevel)) {
                for (Town one : townList) {
                    map=new HashMap<>();
                    map.put("code", one.getCode());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    rs.add(map);
                }
            } else if (SaveModel.OrgLevel.equals(lowlevel)) {
                for (Hospital one : hospitalList) {
                    map=new HashMap<>();
                    map.put("code", one.getCode());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    rs.add(map);
                }
            } else if (SaveModel.teamLevel.equals(lowlevel)) {
                for (AdminTeam one : adminTeams) {
                    map=new HashMap<>();
                    map.put("code", one.getLeaderCode());
                    map.put("name", one.getName());
                    map.put("val", 0);
                    rs.add(map);
                }
            }
            rs.add(map);
        }
        Collections.sort(rs, new Comparator<Map<String, Object>>() {
            public int compare(Map<String, Object> o1, Map<String, Object> o2) {

+ 20 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java

@ -11,6 +11,9 @@ import com.yihu.wlyy.service.BaseService;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -92,9 +95,21 @@ public class CustomerService extends BaseService{
		return list;
	}
	public List<Message> getCallServiceMes(String doctor){
		List<Message> mes =  messageDao.findByReceiverCallService(doctor);
		return mes;
//	public List<Message> getCallServiceMes(String doctor,Integer page, Integer pagesize){
//		Sort sort = new Sort(Sort.Direction.DESC, "createTime");
//		// 分页信息
//		Pageable pageRequest = new PageRequest(page - 1, pagesize, sort);
//
//		List<Message> mes =  messageDao.findByReceiverCallService(doctor);
//		return mes;
//	}
	public List<Message> getCallServiceMes(String doctor,Integer page, Integer pagesize) throws Exception {
		// 排序
		Sort sort = new Sort(Sort.Direction.DESC, "createTime");
		// 分页信息
		Pageable pageRequest = new PageRequest(page - 1, pagesize, sort);
		return messageDao.getMessageByType(doctor,12, pageRequest);
	}
	public Map<String,Object> getCallServiceInfo(String code){
@ -147,11 +162,12 @@ public class CustomerService extends BaseService{
		//预约失败
		}else{
			cs.setState(2);
			cs.setDealState(3);
			cs.setDealTime(new Date());
			cs.setDealReason(dealReason);
			cs.setDealContent(dealContent);
		}
		callServiceDao.save(cs);
		return "1";
	}
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java

@ -384,7 +384,7 @@ public class ElasticsearchUtil {
                groupBy.append(",slaveKey1,slaveKey1Name");
            }
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital,hospitalName,slaveKey1,slaveKey1Name,sum(result1) result1,sum(result2),quotaDate result2 from " + esIndex + " where ");
            sql.append("select hospital,hospitalName,slaveKey1,slaveKey1Name,sum(result1) result1,sum(result2) result2,quotaDate from " + esIndex + " where ");
            groupBy.append("  group by hospital,hospitalName");
            if (!org.springframework.util.StringUtils.isEmpty(slaveKey1) || commonParams.equals(slaveKey1)) {
                groupBy.append(",slaveKey1,slaveKey1Name");

+ 27 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.doctor.call;
import com.yihu.wlyy.service.call.CustomerService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -8,10 +9,7 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Trick on 2017/11/14.
@ -23,6 +21,8 @@ public class CallRecordController extends BaseController {
    @Autowired
    private CustomerService customerService;
    @Autowired
    private JwSmjkService jwSmjkService;
    @RequestMapping(value = "/getCallServices", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "协同服务查询")
@ -49,9 +49,10 @@ public class CallRecordController extends BaseController {
    @RequestMapping(value = "/getCallServiceMes", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "获取协同服务消息")
    public String getCallServiceMes(){
    public String getCallServiceMes(@ApiParam(name="page",value="第几页")@RequestParam(required = false)Integer page,
                                    @ApiParam(name="pagesize",value="每页几条记录")@RequestParam(required = false)Integer pagesize){
        try {
            return write(200,"保存成功","data",customerService.getCallServiceMes(getUID()));
            return write(200,"保存成功","data",customerService.getCallServiceMes(getUID(),page,pagesize));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
@ -103,4 +104,24 @@ public class CallRecordController extends BaseController {
            return error(-1,"保存失败");
        }
    }
    /*************************************** 患者端查询 ******************************************************************/
    @RequestMapping(value = "GetRegList", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("获取患者预约信息列表接口--患者端")
    public String GetRegList(@ApiParam(name = "patient", value = "患者编号", defaultValue = "0cc6e4562de2437ab2dbbf51a9fc3b49")
                             @RequestParam(value = "patient", required = false) String patient) {
        try {
//            SimpleDateFormat sm = new SimpleDateFormat("yyyy-MM-dd");
//            Date nowDate = new Date();
//            Date oneMonthAfter = getMonthBefore(nowDate, -1);
//            Date threeMonthBefore = getMonthBefore(nowDate, 3);        //三个月历史记录
//            List<PatientReservation> list = guahaoXM.GetRegList(patient, sm.format(threeMonthBefore), sm.format(oneMonthAfter), threeMonthBefore, oneMonthAfter);
            String list = jwSmjkService.GetRegList(patient);
            return list;
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
}

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcEduArticleController.java

@ -32,7 +32,9 @@ import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
 * Created by chenweida on 2017/8/30...

+ 39 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java

@ -7,7 +7,6 @@ import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.education.HealthEduArticlePatientDao;
import com.yihu.wlyy.repository.patient.PatientDao;
@ -15,6 +14,7 @@ import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.health.HealthEduArticleOpHistoryService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.fzzb.HealthEducationArticleService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.web.third.gateway.vo.DictModel;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
@ -27,7 +27,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.text.SimpleDateFormat;
import java.util.*;
@ -391,27 +390,27 @@ public class GcEduArticleService {
        //全选的时候前端传0,后台要去数据库再查询一次
        if ("0".equals(labelUnit)) {
            //查找全部的下属单位
            String sql = "select Group_concat(code) code  from dm_hospital  where level=2 and town = '350211'" ;
            labelUnit = jdbcTemplate.queryForObject(sql,String.class);
            String sql = "select Group_concat(code) code  from dm_hospital  where level=2 and town = '350211'";
            labelUnit = jdbcTemplate.queryForObject(sql, String.class);
        }
        if ("0".equals(labelSex)) {
            //查找全部的性别
            labelSex="1,2";
            labelSex = "1,2";
        }
        if ("0".equals(labelServe)) {
            //查找全部的服务类型
            String sql="select Group_concat(s.code) from wlyy_sign_dict s where s.year='2017' order by s.sort asc";
            labelServe = jdbcTemplate.queryForObject(sql,String.class);
            String sql = "select Group_concat(s.code) from wlyy_sign_dict s where s.year='2017' order by s.sort asc";
            labelServe = jdbcTemplate.queryForObject(sql, String.class);
        }
        if ("0".equals(labelDisease)) {
            //查找全部的疾病标签
            String sql="select Group_concat(s.label_code)  from wlyy_sign_patient_label s where s.label_type=3 and status=1";
            labelDisease = jdbcTemplate.queryForObject(sql,String.class);
            String sql = "select Group_concat(s.label_code)  from wlyy_sign_patient_label s where s.label_type=3 and status=1";
            labelDisease = jdbcTemplate.queryForObject(sql, String.class);
        }
        if ("0".equals(labelHealth)) {
            //查找全部的健康情况
            String sql="select Group_concat(s.label_code)  from wlyy_sign_patient_label s where s.label_type=2 and status=1";
            labelHealth = jdbcTemplate.queryForObject(sql,String.class);
            String sql = "select Group_concat(s.label_code)  from wlyy_sign_patient_label s where s.label_type=2 and status=1";
            labelHealth = jdbcTemplate.queryForObject(sql, String.class);
        }
@ -532,9 +531,12 @@ public class GcEduArticleService {
            heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
            heapm.setCommentNumber(Integer.valueOf(article.getString("commentNumber")));//文章评论数
            heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
            heapm.setArticleCover(article.getString("articleCover"));//封面
            heapm.setComputeTime(computeTime(article.getString("insertTime")));
            // heapm.setTime();//时间  xx小时前  2017-10-11
            result.put(one.getArticleId(), heapm);
        }
        ;
        List<HealthEduArticlePatientModel> resultList = new ArrayList<>();
        for (Map.Entry<String, HealthEduArticlePatientModel> entry : result.entrySet()) {
            resultList.add(entry.getValue());
@ -542,6 +544,31 @@ public class GcEduArticleService {
        return resultList;
    }
    public static String computeTime(String create) {
        Date createDate = DateUtil.strToDate(create, "yyyy-MM-dd HH:mm:ss.SSS");
        Date nowDate = new Date();
        //计算2个时间差
        Long l = nowDate.getTime() - createDate.getTime();
        long hour = l / (60 * 60 * 1000); //小时
        long min = l / (60 * 1000);//分钟
        long s = l / 1000;//秒
        if(s<60){
            return s+"秒前";
        }
        if(min<60){
            return min+"分钟前";
        }
        if(hour<24){
            return hour+"小时前";
        }
        return DateUtil.dateToStr(createDate,"yyyy-MM-dd");
    }
    public static void main(String[] args) {
        System.out.println(computeTime("2017-11-16 13:32:00.010"));
    }
    public Long pushArticleLogsCount(String sendCode) {
        StringBuffer sql = new StringBuffer("select count(distinct articleId) count  from   " + esType +

+ 11 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java

@ -44,7 +44,9 @@ public class HealthEduArticlePatientModel {
    @ApiModelProperty(value = "文章点赞数", required = false, access = "response")
    private Integer pointNumber=0;//文章点赞数
    @ApiModelProperty(value = "封面图", required = false, access = "response")
    private String articleCover;//封面图
    private String articleCover="";//封面图
    private String computeTime;//时间
    public String getSendCode() {
        return sendCode;
@ -165,4 +167,12 @@ public class HealthEduArticlePatientModel {
    public void setArticleCover(String articleCover) {
        this.articleCover = articleCover;
    }
    public String getComputeTime() {
        return computeTime;
    }
    public void setComputeTime(String computeTime) {
        this.computeTime = computeTime;
    }
}