Prechádzať zdrojové kódy

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

Trick 5 rokov pred
rodič
commit
a52138c0a6
20 zmenil súbory, kde vykonal 1100 pridanie a 93 odobranie
  1. 26 0
      business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorRoleDao.java
  2. 4 4
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 0 5
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/service/SurveyService.java
  4. 18 0
      business/base-service/src/main/java/com/yihu/jw/internet/dao/MedicalSkillOrdersDao.java
  5. 142 0
      business/base-service/src/main/java/com/yihu/jw/internet/entity/MedicalSkillOrdersDO.java
  6. 160 28
      business/base-service/src/main/java/com/yihu/jw/internet/service/InternetService.java
  7. 48 0
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  8. 5 0
      business/sms-service/pom.xml
  9. 118 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/ZhongShanSMSService.java
  10. 419 0
      business/sms-service/src/main/java/com/yihu/jw/sms/util/ZhongShanSMSUtils.java
  11. 3 3
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeCategoryDO.java
  12. 12 2
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  13. 4 0
      svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/InternetUpdateJob.java
  14. 6 0
      svr/svr-internet-hospital/pom.xml
  15. 2 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDao.java
  16. 2 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeCategoryDao.java
  17. 9 2
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java
  18. 101 43
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  19. 18 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  20. 3 1
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeCategoryService.java

+ 26 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/dao/BaseDoctorRoleDao.java

@ -0,0 +1,26 @@
package com.yihu.jw.doctor.dao;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 
 * 医生与业务模块角色关联信息 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年10月25日 	Created
 *
 * </pre>
 * @since 1.
 */
public interface BaseDoctorRoleDao extends PagingAndSortingRepository<BaseDoctorRoleDO, Integer>, JpaSpecificationExecutor<BaseDoctorRoleDO>  {
    
    List<BaseDoctorRoleDO> findByRoleCode(String roleCode);
}

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

@ -1740,12 +1740,12 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
               BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
               rs.put("winNo",org.getWinNo());
               rs.put("deptName",hospitalDOs.get(0).getDeptName());
                rs.put("deptCode",hospitalDOs.get(0).getDeptCode());
                rs.put("dept",hospitalDOs.get(0).getDeptCode());
            }else{
               rs.put("hospital",null);
               rs.put("winNo",null);
               rs.put("deptName",null);
                rs.put("deptCode",null);
                rs.put("dept",null);
            }
@ -2251,7 +2251,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "AND room.reservation_time>='"+date+" 00:00:00' AND room.reservation_time<='"+date+" 23:59:59' " +
                "GROUP BY room.doctor";
        List<Map<String,Object>> onlinelist = jdbcTemplate.queryForList(onlineSql);
        if(waitinglist!=null&&waitinglist.size()>0){
        if(onlinelist!=null&&onlinelist.size()>0){
            //根据身份证计算年龄
            for(Map<String,Object> onlineObj :onlinelist){
                String doctor = (String) onlineObj.get("doctor");
@ -2397,7 +2397,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
    
        if(StringUtils.isNotBlank(outpatientType)){
            sql+=" AND d.outpatient_type like '%"+outpatientType+"%' ";
            sql+=" AND d.outpatient_type = '"+outpatientType+"' ";
        }
    
        if(StringUtils.isNotBlank(keyName)){

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

@ -1,8 +1,6 @@
package com.yihu.jw.hospital.survey.service;
import com.alibaba.fastjson.JSON;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.hospital.doctor.WlyyDoctorWorkTimeDO;
import com.yihu.jw.entity.hospital.survey.*;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.survey.dao.*;
@ -13,14 +11,11 @@ import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.util.common.IdCardUtil;
import com.yihu.jw.util.common.PercentageUtil;
import com.yihu.jw.utils.EntityUtils;
import com.yihu.jw.utils.StringUtil;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.nativejdbc.OracleJdbc4NativeJdbcExtractor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

+ 18 - 0
business/base-service/src/main/java/com/yihu/jw/internet/dao/MedicalSkillOrdersDao.java

@ -0,0 +1,18 @@
package com.yihu.jw.internet.dao;
import com.yihu.jw.internet.entity.MedicalSkillOrdersDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by cws on 2019/9/10.
 */
public interface MedicalSkillOrdersDao extends PagingAndSortingRepository<MedicalSkillOrdersDO, String>, JpaSpecificationExecutor<MedicalSkillOrdersDO> {
    @Query("from MedicalSkillOrdersDO a where a.appTime >= ?1 and a.appTime < ?2")
    List<MedicalSkillOrdersDO> findMedicalSkillOrdersByAppTime(String startDate, String endDate);
}

+ 142 - 0
business/base-service/src/main/java/com/yihu/jw/internet/entity/MedicalSkillOrdersDO.java

@ -0,0 +1,142 @@
package com.yihu.jw.internet.entity;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@Entity
@Table(name = "medical_skill_orders")
public class MedicalSkillOrdersDO extends UuidIdentityEntity implements Serializable {
    @Column(name = "cd_org")
    private String cdOrg;
    @Column(name = "app_time")
    private String appTime;
    @Column(name = "app_dep_code")
    private String appDepCode;
    @Column(name = "app_class_code")
    private String appClassCode;
    @Column(name = "id_doctor")
    private String idDoctor;
    @Column(name = "fg_handle")
    private String fgHandle;
    @Column(name = "handle_time")
    private String handleTime;
    @Column(name = "pt_name")
    private String ptName;
    @Column(name = "ge_code")
    private String geCode;
    @Column(name = "card_type")
    private String cardType;
    @Column(name = "id_no")
    private String idNo;
    @Column(name = "pt_tel")
    private String ptTel;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getCdOrg() {
        return cdOrg;
    }
    public void setCdOrg(String cdOrg) {
        this.cdOrg = cdOrg;
    }
    public String getAppTime() {
        return appTime;
    }
    public void setAppTime(String appTime) {
        this.appTime = appTime;
    }
    public String getAppDepCode() {
        return appDepCode;
    }
    public void setAppDepCode(String appDepCode) {
        this.appDepCode = appDepCode;
    }
    public String getAppClassCode() {
        return appClassCode;
    }
    public void setAppClassCode(String appClassCode) {
        this.appClassCode = appClassCode;
    }
    public String getIdDoctor() {
        return idDoctor;
    }
    public void setIdDoctor(String idDoctor) {
        this.idDoctor = idDoctor;
    }
    public String getFgHandle() {
        return fgHandle;
    }
    public void setFgHandle(String fgHandle) {
        this.fgHandle = fgHandle;
    }
    public String getHandleTime() {
        return handleTime;
    }
    public void setHandleTime(String handleTime) {
        this.handleTime = handleTime;
    }
    public String getPtName() {
        return ptName;
    }
    public void setPtName(String ptName) {
        this.ptName = ptName;
    }
    public String getGeCode() {
        return geCode;
    }
    public void setGeCode(String geCode) {
        this.geCode = geCode;
    }
    public String getCardType() {
        return cardType;
    }
    public void setCardType(String cardType) {
        this.cardType = cardType;
    }
    public String getIdNo() {
        return idNo;
    }
    public void setIdNo(String idNo) {
        this.idNo = idNo;
    }
    public String getPtTel() {
        return ptTel;
    }
    public void setPtTel(String ptTel) {
        this.ptTel = ptTel;
    }
}

+ 160 - 28
business/base-service/src/main/java/com/yihu/jw/internet/service/InternetService.java

@ -6,7 +6,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.message.BaseMessageDO;
import com.yihu.jw.entity.base.org.BaseOrgDO;
import com.yihu.jw.internet.dao.IntUpErrorLogDao;
import com.yihu.jw.internet.dao.MedicalSkillOrdersDao;
import com.yihu.jw.internet.entity.InternetUpErrorLogDO;
import com.yihu.jw.internet.entity.MedicalSkillOrdersDO;
import com.yihu.jw.internet.wsapi.Wsapi;
import com.yihu.jw.internet.wsapi.WsapiProxy;
import com.yihu.jw.message.dao.MessageDao;
@ -31,6 +33,9 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
    @Autowired
    private InternetUpErrorLogService internetUpErrorLogService;
    @Autowired
    private MedicalSkillOrdersDao medicalSkillOrdersDao;
    static String userName = "xmzsyy";
    static String psw = "7j7s9e";
    static String appId = "ws007";
@ -237,7 +242,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        return res;
    }
    // 3 医师基本信息	micc.upNsDoctorRecord   --- 条件付完成  差医师的职务信息的适配未处理
    // 3 医师基本信息	micc.upNsDoctorRecord   --- 完成
    public String upNsDoctorRecord(String startDate, String endDate) throws Exception {
        String api = "micc.upNsDoctorRecord";
        String res = "";
@ -253,7 +258,9 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
                "  from base_doctor a\n" +
                "      ,base_doctor_hospital b\n" +
                " where a.id = b.doctor_code\n"  +
                "   and b.dept_code != '' \n" ;
                "   and b.dept_code != '' \n" +
                "   and b.doctor_duty_code  not in('4107','054','1313','1413','1415','018','1412','4105','1212','1312','4103','1315','1217','1215','3301','005',\n" +
                "'1213','3501','017','020','058','002','1417','1214','1317','4101','4106') \n" ;
        if(startDate.length() > 0){
            sql =  sql + "  and a.update_time >=  '" + startDate + "' ";
        }
@ -269,6 +276,8 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
            LinkedCaseInsensitiveMap info = (LinkedCaseInsensitiveMap)list.get(i);
            String[] dept = depToSubject(info.get("dept_code").toString());
            // 中山医院 监管平台  职务字典强转
            String[] dutyInfo = classToduty(info.get("doctor_duty_code").toString());
            JSONObject jb = new JSONObject();
            jb.put("organ_code", orgCode);
@ -285,7 +294,7 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
            jb.put("doo_tel", info.get("mobile")== null ? "":info.get("mobile"));
            jb.put("title_rec_date", "1900-01-01");
            jb.put("prac_type", "1");   // 因为上传的是医师的信息,所以该字段全部默认设置为 1 医师
            jb.put("title_code", "231");  // 需要与监管平台的字典进行映射
            jb.put("title_code", dutyInfo[0].toString());  // 需要与监管平台的字典进行映射
            jb.put("first_compeny_code", orgCode);
            jb.put("first_compeny_name", orgName);
            jb.put("secd_compeny_code", "");
@ -399,35 +408,58 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        return resInfo;
    }
    // 6 在线医技预约 	micc.upMedicalOnline --- 无该业务,不对应
    public String upMedicalOnline() throws Exception {
    // 6 在线医技预约 	micc.upMedicalOnline --- 完成
    public String upMedicalOnline(String startDate, String endDate) throws Exception {
        String api = "micc.upMedicalOnline";
        String token = upNsUserToken();
        String res = "";
        int total = 0;
        int success = 0;
        int error = 0;
        JSONObject jb = new JSONObject();
        jb.put("id", "");
        jb.put("cd_org", "");
        jb.put("cd_area", "");
        jb.put("cd_orgSub", "");
        jb.put("app_time", "");
        jb.put("app_dep_code", "");
        jb.put("app_class_code", "");
        jb.put("id_doctor", "");
        jb.put("fg_handle", "");
        jb.put("handle_time", "");
        jb.put("pt_name", "");
        jb.put("ge_code", "");
        jb.put("card_type", "");
        jb.put("id_no", "");
        jb.put("pt_tel", "");
        jb.put("crt_date", "");
        JSONArray jsonArray = new JSONArray();
        jsonArray.add(jb);
        String res = postToInter(token,api, jsonArray);
        List<MedicalSkillOrdersDO> medicalSkillOrdersDOs= medicalSkillOrdersDao.findMedicalSkillOrdersByAppTime(startDate,endDate);
        if(medicalSkillOrdersDOs != null && medicalSkillOrdersDOs.size() > 0){
            total = medicalSkillOrdersDOs.size();
            for(MedicalSkillOrdersDO medicalSkillOrdersDO :medicalSkillOrdersDOs ){
                String[] dept = depToSubject(medicalSkillOrdersDO.getAppDepCode().toString());
                String docInterId = achNsDoctorRecord(medicalSkillOrdersDO.getIdDoctor());
                JSONObject jb = new JSONObject();
                jb.put("id",orgCode + medicalSkillOrdersDO.getId());
                jb.put("cd_org", orgCode);
                jb.put("cd_area", orgArea);
                jb.put("cd_orgSub", orgSub);
                jb.put("app_time",medicalSkillOrdersDO.getAppTime().toString());
                jb.put("app_dep_code", dept[0].toString());
                jb.put("app_class_code", medicalSkillOrdersDO.getAppClassCode());
                jb.put("id_doctor", docInterId);
                jb.put("fg_handle", medicalSkillOrdersDO.getFgHandle());
                jb.put("handle_time", medicalSkillOrdersDO.getHandleTime());
                jb.put("pt_name", medicalSkillOrdersDO.getPtName());
                jb.put("ge_code", medicalSkillOrdersDO.getGeCode());
                jb.put("card_type", "1");
                jb.put("id_no", medicalSkillOrdersDO.getIdNo());
                jb.put("pt_tel", medicalSkillOrdersDO.getPtTel());
                jb.put("crt_date",DateUtil.dateToStrLong(DateUtil.getNow()));
                JSONArray jsonArray = new JSONArray();
                jsonArray.add(jb);
                res = postToInter(token,api, jsonArray);
                JSONObject resJson = (JSONObject) JSONObject.parse(res);
                if("200".equals(resJson.get("msg").toString())){
                    success++;
                }else{
                    saveErrorLog("6",medicalSkillOrdersDO.getId().toString(),res);
                    error++;
                }
            }
        }
        return res;
        String resInfo = "此次共上传:" + total + "条数据,其中成功 :" + success + "条,失败 : " + error + "条。";
        return resInfo;
    }
    // 7 医生评价信息	micc.upNsDoctorScore  --- 完成
@ -1061,5 +1093,105 @@ public class InternetService extends BaseJpaService<InternetUpErrorLogDO, IntUpE
        internetUpErrorLogService.save(internetUpErrorLogDO);
    }
    // 基于中山医院的职务字典,强转为监管平台的字典(该部分过滤掉字典与监管理无法匹配的部分)
    public static  String[]  classToduty(String duty){
        String[] res = new String[2];
        switch (duty) {
            case "1303":
                res[0] = "243";
                res[1] = "主管药师";
            case "1304":
                res[0] = "243";
                res[1] = "主管药师";
            case "1101":
                res[0] = "231";
                res[1] = "主任医师";
            case "065":
                res[0] = "231";
                res[1] = "主任医师";
            case "1201":
                res[0] = "232";
                res[1] = "副主任医师";
            case "067":
                res[0] = "232";
                res[1] = "副主任医师";
            case "1301":
                res[0] = "233";
                res[1] = "主治医师";
            case "066":
                res[0] = "233";
                res[1] = "主治医师";
            case "1310":
                res[0] = "233";
                res[1] = "主治医师";
            case "1401":
                res[0] = "234";
                res[1] = "医师";
            case "061":
                res[0] = "234";
                res[1] = "医师";
            case "1501":
                res[0] = "235";
                res[1] = "医士";
            case "1103":
                res[0] = "241";
                res[1] = "主任药师";
            case "1104":
                res[0] = "241";
                res[1] = "主任药师";
            case "1203":
                res[0] = "242";
                res[1] = "副主任药师";
            case "1403":
                res[0] = "244";
                res[1] = "药师";
            case "1404":
                res[0] = "244";
                res[1] = "药师";
            case "1503":
                res[0] = "245";
                res[1] = "药士";
            case "1102":
                res[0] = "251";
                res[1] = "主任护师";
            case "1204":
                res[0] = "252";
                res[1] = "副主护师";
            case "1302":
                res[0] = "253";
                res[1] = "主管护师";
            case "1402":
                res[0] = "254";
                res[1] = "护师";
            case "1502":
                res[0] = "255";
                res[1] = "护士";
            case "1107":
                res[0] = "261";
                res[1] = "主任技师";
            case "1207":
                res[0] = "262";
                res[1] = "副主任技师";
            case "1307":
                res[0] = "263";
                res[1] = "主管技师";
            case "056":
                res[0] = "263";
                res[1] = "主管技师";
            case "1407":
                res[0] = "264";
                res[1] = "技师";
            case "006":
                res[0] = "264";
                res[1] = "技师";
            case "053":
                res[0] = "264";
                res[1] = "技师";
            case "1202":
                res[0] = "252";
                res[1] = "副主护师";
        }
        return  res;
    }
}

+ 48 - 0
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -4,7 +4,9 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.doctor.dao.BaseDoctorDao;
import com.yihu.jw.doctor.dao.BaseDoctorRoleDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorRoleDO;
import com.yihu.jw.entity.base.im.ConsultDo;
import com.yihu.jw.entity.base.im.ConsultTeamDo;
import com.yihu.jw.entity.base.im.ConsultTeamDoctorDo;
@ -145,6 +147,9 @@ public class ImService {
	@Autowired
	private WlyyHttpLogDao wlyyHttpLogDao;
	
	@Autowired
	private BaseDoctorRoleDao baseDoctorRoleDao;
	
	
	
	/**
@ -1069,6 +1074,8 @@ public class ImService {
				object.put("socket_sms_type",5);
				object.put("relation_code",wlyyOutpatientDO.getId());
				imUtil.sendMessage(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getPatient(),"1",object.toString());
				//医生接诊发送导诊护士外层消息
				this.sendOutpatientGuaidanceMessage(wlyyOutpatientDO);
			}else if("2".equals(wlyyOutpatientDO.getOutpatientType())){
				//协同门诊
				System.out.println("发送外层SOCKET消息:协同门诊");
@ -1076,12 +1083,39 @@ public class ImService {
				object.put("socket_sms_type",5);
				object.put("relation_code",wlyyOutpatientDO.getId());
				imUtil.sendMessage(wlyyOutpatientDO.getDoctor(),wlyyOutpatientDO.getGeneralDoctor(),"1",object.toString());
				//医生接诊发送导诊护士外层消息
				this.sendOutpatientGuaidanceMessage(wlyyOutpatientDO);
			}
			
			return result;
		}
	}
	
	/**
	 * 医生接诊发送导诊护士外层消息
	 * @param wlyyOutpatientDO
	 */
	private void sendOutpatientGuaidanceMessage(WlyyOutpatientDO wlyyOutpatientDO ){
		
		System.out.println("发送导诊护士外层SOCKET消息:医生接诊");
		JSONObject object = new JSONObject();
		object.put("socket_sms_type",7);
		object.put("relation_code","");
		object.put("msg_time",DateUtil.dateToStrLong(new Date()));
		String msgStr = wlyyOutpatientDO.getDoctorName()+"医生诊室 "+wlyyOutpatientDO.getPatientName();
		if("1".equals(wlyyOutpatientDO.getOutpatientType())){
			msgStr = msgStr + "  已开始复诊";
		}else if("2".equals(wlyyOutpatientDO.getOutpatientType())){
			msgStr = msgStr + "  已开始协同门诊";
		}
		object.put("msg",msgStr);
		
		List<BaseDoctorRoleDO> assistantList =  baseDoctorRoleDao.findByRoleCode("assistant");
		for (BaseDoctorRoleDO baseDoctorRoleDO:assistantList){
			imUtil.sendMessage(wlyyOutpatientDO.getDoctor(),baseDoctorRoleDO.getDoctorCode(),"1",object.toString());
		}
	}
	
	
	/**
	 * 居民结束咨询
@ -1626,4 +1660,18 @@ public class ImService {
	public String updateParticipant(String sessionid, String userid, String olduserid)throws Exception {
		return imUtil.updateParticipant(sessionid,userid,olduserid);
	}
	
	/**
	 *会话发送消息
	 * @param sender_id
	 * @param sender_name
	 * @param session_id
	 * @param content_type
	 * @param content
	 * @param business_type
	 * @return
	 */
	public String patientGuaidenceAppend(String sender_id, String sender_name, String session_id,String content_type, String content, String business_type)throws Exception  {
		return imUtil.sendImMsg(sender_id, sender_name,session_id, content_type, content, "1");
	}
}

+ 5 - 0
business/sms-service/pom.xml

@ -36,6 +36,11 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>ImApi</artifactId>
            <version>1</version>
        </dependency>
        <!--   poi xml导入导出工具 end -->
    </dependencies>
</project>

+ 118 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/ZhongShanSMSService.java

@ -0,0 +1,118 @@
package com.yihu.jw.sms.service;
import com.jasson.im.api.APIClient;
import org.springframework.stereotype.Service;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.Vector;
/**
 * 中山医院短信网关
 * @author huangwenjie
 */
@Service
public class ZhongShanSMSService {
	private String url = "wap.sohu.com";
	private String host = "172.16.1.35";
	private String dbName = "mas";
	private String apiId = "jkzl";
	private String name = "jkzl";
	private String pwd = "jkzl";
	private APIClient handler = new APIClient();
	
	public void init()
	{
		int connectRe = handler.init(host, name, pwd, apiId,dbName);
		if(connectRe == APIClient.IMAPI_SUCC)
			info("初始化成功");
		else if(connectRe == APIClient.IMAPI_CONN_ERR)
			info("连接失败");
		else if(connectRe == APIClient.IMAPI_API_ERR)
			info("apiID不存在");
		if(connectRe != APIClient.IMAPI_SUCC)
		{
			usage();
			System.exit(-1);
		}
	}
	
	/**
	 * 中山医院发送短信
	 * @param mobileStr 手机号(多个以英文逗号相连)
	 * @param content 短信内容
	 * @return
	 */
	public int ZhongShangSendSMS (String mobileStr,String content){
		init();
		
		int result = 0;
		
		//处理手机号
		Vector mobileList = new Vector();
		StringTokenizer st = new StringTokenizer(mobileStr, ",");
		while(st.hasMoreElements())
		{
			String tmp = (String)st.nextElement();
			if( tmp.indexOf("-") != -1 )
			{
				long min = Long.parseLong(tmp.substring(0, tmp.indexOf("-")));
				long max = Long.parseLong(tmp.substring(tmp.indexOf("-") + 1));
				
				long i  = min;
				while(i <= max)
				{
					mobileList.addElement(Long.toString(i));
					i ++;
				}
			}
			else
			{
				mobileList.addElement(tmp);
			}
		}
		int len = mobileList.size();
		String[] mobiles = new String[len];
		for(int i = 0 ; i < len ; i++)
		{
			mobiles[i] = (String)mobileList. elementAt(i);
		}
		Random random = new Random();
//		result = handler.sendSM(mobiles, content, smId, Long.parseLong(tmpSrcID));
		result = handler.sendSM(mobiles, content, 0, random.nextInt(100));
		
		if(result == APIClient.IMAPI_SUCC)
		{
			System.out.println("发送成功\n");
		}
		else if(result == APIClient.IMAPI_INIT_ERR)
			System.out.println("未初始化");
		else if(result == APIClient.IMAPI_CONN_ERR)
			System.out.println("数据库连接失败");
		else if(result == APIClient.IMAPI_DATA_ERR)
			System.out.println("参数错误");
		else if(result == APIClient.IMAPI_DATA_TOOLONG)
			System.out.println("消息内容太长");
		else if(result == APIClient.IMAPI_INS_ERR)
			System.out.println("数据库插入错误");
		else
			System.out.println("出现其他错误");
		
		return result;
	}
	
	public void info(Object obj)
	{
		System.out.println(obj);
	}
	
	public void usage()
	{
		info("Usage : java ApiTestDemo [-h host] [-n name] [-p password] [-i apiCode]");
		info("\t-h host        信息机地址");
		info("\t-n name        API登陆名");
		info("\t-p password    API登陆密码");
		info("\t-i apiCode     API编码");
		
	}
}

+ 419 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/util/ZhongShanSMSUtils.java

@ -0,0 +1,419 @@
package com.yihu.jw.sms.util;
import com.jasson.im.api.APIClient;
import com.jasson.im.api.MOItem;
import com.jasson.im.api.RPTItem;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.Vector;
/**
 * 中山医院短信发送工具类
 * @author huangwenjie
 */
public class ZhongShanSMSUtils {
	
	private String cmd = "11";
	private String mobileStr = "13600136666,13800138888";
	private String content = "短信发送测试内容 via  IM JAVA API ";
	private long smId = 1;
	private int smType = 0;
	private String url = "wap.sohu.com";
	private String host = "172.16.1.35";
	private String dbName = "mas";
	private String apiId = "jkzl";
	private String name = "jkzl";
	private String pwd = "jkzl";
	private APIClient handler = new APIClient();
	BufferedReader in = null;
	
	public ZhongShanSMSUtils(String[] args)
	{
		super();
		parseCmd(args);
		init();
		in = new BufferedReader(new InputStreamReader(System.in),512);
	}
	
	public void init()
	{
		int connectRe = handler.init(host, name, pwd, apiId,dbName);
		if(connectRe == APIClient.IMAPI_SUCC)
			info("初始化成功");
		else if(connectRe == APIClient.IMAPI_CONN_ERR)
			info("连接失败");
		else if(connectRe == APIClient.IMAPI_API_ERR)
			info("apiID不存在");
		if(connectRe != APIClient.IMAPI_SUCC)
		{
			usage();
			System.exit(-1);
		}
	}
	public void release()
	{
		handler.release();
		Thread.currentThread().interrupt();
	}
	
	public void testSend()
	{
		SendTask task = new SendTask();
		task.start();
	}
	public void sendSM()
	{
		String tmpMobile = null;
		String tmpContent = null;
		String tmpTypeStr = null;
		String tmpSrcID = null ;
		int tmpType = 0;
		String tmpUrl = null;
		
		info("请输入srcID,按回车结束:");
		tmpSrcID = readLine();
		if( tmpSrcID == null || tmpSrcID.trim().length() == 0 || getInt(tmpSrcID.trim()) == Integer.MIN_VALUE )
		{
			tmpSrcID = "" + smId;
		}
		
		info("请输入手机号码,多个号码用英文逗号隔开,按回车结束:");
		tmpMobile = readLine();
		if( tmpMobile == null || tmpMobile.trim().length() == 0 )
		{
			tmpMobile = mobileStr;
		}
		
		info("请输入短信内容,按回车结束:");
		tmpContent = readLine();
		if( tmpContent == null || tmpContent.trim().length() == 0)
		{
			tmpContent = content;
		}
		info("请输入短信类型是否为WAP PUSH消息,按回车结束:Y/N[N]");
		tmpTypeStr = readLine();
		if( tmpTypeStr != null && tmpTypeStr.trim().equalsIgnoreCase("Y"))
		{
			tmpType = 1;
			info("请输入短信类型是否为WAP PUSH消息,按回车结束:Y/N[N]");
			tmpUrl = readLine();
			if( tmpUrl == null || tmpUrl.trim().length() == 0)
			{
				tmpUrl = url;
				
			}
		}
		else
		{
			tmpType = smType;;
		}
		Vector mobileList = new Vector();
		StringTokenizer st = new StringTokenizer(tmpMobile, ",");
		while(st.hasMoreElements())
		{
			String tmp = (String)st.nextElement();
			if( tmp.indexOf("-") != -1 )
			{
				long min = Long.parseLong(tmp.substring(0, tmp.indexOf("-")));
				long max = Long.parseLong(tmp.substring(tmp.indexOf("-") + 1));
				
				long i  = min;
				while(i <= max)
				{
					mobileList.addElement(Long.toString(i));
					i ++;
				}
			}
			else
			{
				mobileList.addElement(tmp);
			}
		}
		int len = mobileList.size();
		String[] mobiles = new String[len];
		for(int i = 0 ; i < len ; i++)
		{
			mobiles[i] = (String)mobileList. elementAt(i);
		}
		//System.arraycopy(mobileList, 0, mobiles, 0, mobileList.size());
		//mobiles = (String[]) mobileList.toArray(mobiles);
		
		
		
		int result = 0;
		if(tmpType == 1)
		{
			if(url == null || url.length() == 0)
			{
				info("请输入Wap Push的链接地址!");
				return;
			}
			result = handler.sendSM(mobiles, tmpContent, smId, Long.parseLong(tmpSrcID), url);
		}else
		{
			result = handler.sendSM(mobiles, tmpContent, smId , Long.parseLong(tmpSrcID));
		}
		if(result == APIClient.IMAPI_SUCC)
		{
			info("发送成功\n");
		}
		else if(result == APIClient.IMAPI_INIT_ERR)
			info("未初始化");
		else if(result == APIClient.IMAPI_CONN_ERR)
			info("数据库连接失败");
		else if(result == APIClient.IMAPI_DATA_ERR)
			info("参数错误");
		else if(result == APIClient.IMAPI_DATA_TOOLONG)
			info("消息内容太长");
		else if(result == APIClient.IMAPI_INS_ERR)
			info("数据库插入错误");
		else
			info("出现其他错误");
	}
	
	public void recvSM()
	{
		MOItem[] mos = handler.receiveSM();
		int len = 0, i = 0;
		StringBuffer sb = new StringBuffer("");
		if(mos == null)
		{
			info("未初始化或接收失败");
			return;
		}
		else if(mos.length == 0)
		{
			info("没有MO短信");
		}
		else
		{
			len = mos.length;
			while(i < len)
			{
				sb.append("手机号码: ");
				sb.append(mos[i].getMobile() + " ");
				sb.append("短信内容: ");
				sb.append(mos[i].getContent());
				sb.append("MO时间: ");
				sb.append(mos[i].getMoTime());
				sb.append("\n");
				i++;
			}
			
			info(sb.toString() );
		}
	}
	public void recvRPT()
	{
		RPTItem[] rpts = handler.receiveRPT();
		int len = 0, i = 0;
		StringBuffer sb = new StringBuffer("");
		if(rpts == null)
		{
			info("未初始化或接收失败");
			return;
		}
		else if(rpts.length == 0)
		{
			info("没有回执");
		}
		else
		{
			len = rpts.length;
			while(i < len)
			{
				sb.append("手机: ");
				sb.append(rpts[i].getMobile() + " ");
				sb.append("回执编码: ");
				sb.append(rpts[i].getCode() + " ");
				sb.append("回执描述: ");
				sb.append(rpts[i].getDesc() + " ");
				sb.append("回执时间: ");
				sb.append(rpts[i].getRptTime() + " ");
				sb.append("\n");
				i++;
			}
			info(sb.toString());
		}
	}
	public void error(Object obj , Throwable thr)
	{
		info(obj);
		thr.printStackTrace();
	}
	public void info(Object obj)
	{
		System.out.println(obj);
	}
	public String readLine()
	{
		String line = null;
		try
		{
			line = in.readLine();
		}
		catch(IOException e)
		{
			error("",e);
		}
		return line;
	}
	public int getInt(String str)
	{
		int ret = Integer.MIN_VALUE;
		try
		{
			ret = Integer.parseInt(str);
		}catch(NumberFormatException e)
		{
			ret = Integer.MIN_VALUE;
		}
		return ret;
	}
	public void usage()
	{
		info("Usage : java ApiTestDemo [-h host] [-n name] [-p password] [-i apiCode]");
		info("\t-h host        信息机地址");
		info("\t-n name        API登陆名");
		info("\t-p password    API登陆密码");
		info("\t-i apiCode     API编码");
		
	}
	public void menu()
	{
		info("\n------------------------------");
		info("1\t 发送短信");
		info("2\t 发送短信(srcID测试)");
		info("3\t 接收短信");
		info("4\t 接收回执");
		info("5\t 查看帮助");
		info("6\t 退出");
		info("------------------------------");
		info("请输入你要进行操作的数字:");
	}
	public void quit()
	{
		release();
		System.exit(0);
	}
	public void run()
	{
		while(true)
		{
			menu();
			int menu = 0;
			menu = parseMenu(readLine());
			//try{menu = in.read();}catch(Exception e){error("",e);}
			if(menu < 1 || menu > 6)
			{
				continue;
			}
			switch(menu)
			{
				case 1 : sendSM();break;
				case 2 : testSend();break;
				case 3 : recvSM();break;
				case 4 : recvRPT();break;
				case 5 : usage();break;
				case 6 : quit();break;
				default:;break;
			}
		}
	}
	public int parseMenu(String menu)
	{
		int cmd = 0;
		try
		{
			cmd = Integer.parseInt(menu);
		}
		catch(Exception e)
		{
			cmd = -1;
		}
		return cmd;
	}
	public void parseCmd(String[] args)
	{
		String tmp = "";
		int index = 0;
		int len = args.length;
		if(args.length > 0)
		{
			info("parse argements....");
			while(index < len)
			{
				tmp = args[index++].trim();
				if(tmp.equalsIgnoreCase("-h"))
				{
					host = args[index++];
					info(" host  = "+host);
				}
				else if(tmp.equalsIgnoreCase("-n"))
				{
					name = args[index++];
					info(" name  = "+name);
				}
				else if(tmp.equalsIgnoreCase("-p"))
				{
					pwd = args[index++];
					info(" pwd   = "+pwd);
				}
				else if(tmp.equalsIgnoreCase("-i"))
				{
					apiId = args[index++];
					info(" apiId = "+apiId);
				}
				else
				{
					index += 2;
					continue;
				}
			}
		}
	}
	
	class SendTask extends Thread
	{
		int loop = 10;
		long interval = 2000L;
		public SendTask()
		{
		
		}
		public void run()
		{
			Random random = new Random();
			long tmpSmId = 0;
			long tmpSrcId = 0;
			while(loop > 0)
			{
				try
				{
					Thread.sleep(interval);
				}catch(InterruptedException e)
				{
				}
				
				tmpSmId = random.nextInt(1000);
				tmpSrcId = random.nextInt(100);
				System.out.println("TestSend:"+loop + "[smId:"+tmpSmId+";srcId:"+tmpSrcId+"]");
				handler.sendSM(mobileStr.split(","), content,  tmpSmId, tmpSrcId);
				
				loop--;
			}
			System.out.println("Test completed.");
		}
	}
	public static void main(String[] args)
	{
		ZhongShanSMSUtils demo = new ZhongShanSMSUtils(args);
		demo.run();
	}
	
	
}

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/article/KnowledgeCategoryDO.java

@ -20,7 +20,7 @@ public class KnowledgeCategoryDO extends UuidIdentityEntity {
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	private Date updateTime;  // 编辑时间
	private Integer del;    // 是否删除,1正常,0删除'
	private Long pid;   // 父id
	private String pid;   // 父id
	
	
	public String getName() {
@ -55,11 +55,11 @@ public class KnowledgeCategoryDO extends UuidIdentityEntity {
		this.del = del;
	}
	
	public Long getPid() {
	public String getPid() {
		return pid;
	}
	
	public void setPid(Long pid) {
	public void setPid(String pid) {
		this.pid = pid;
	}
}

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

@ -353,9 +353,10 @@ public class BaseHospitalRequestMapping {
        
        //更新会话成员(新增或删除)
        public static final String updateConsultParticipant = "updateConsultParticipant";
        
        // 居民导诊会话发送消息
        public static final String patientGuaidenceAppend = "patientGuaidenceAppend";
    }
    
    /**
@ -423,6 +424,15 @@ public class BaseHospitalRequestMapping {
    
        //测试发送外层SOCKET消息
        public static final String testSendWaiSocketMessage = "testSendWaiSocketMessage";
    
        //医生端:进行中的专家咨询数量
        public static final String doctorSpecialistConsultCount="doctorSpecialistConsultCount";
    
        //医生端:图文复诊、视频复诊咨询数量、协同门诊候诊数量
        public static final String doctorReviewConsultCount="doctorReviewConsultCount";
    
        //医生端:可抢单数量
        public static final String doctorPickCount="doctorPickCount";
    }
    /**

+ 4 - 0
svr/svr-internet-hospital-job/src/main/java/com/yihu/jw/job/InternetUpdateJob.java

@ -36,6 +36,10 @@ public class InternetUpdateJob implements Job {
            res = internetService.upAppointmentOnline(startDate,endDate);
            logger.info("END==========2.5 网上预约挂号上传结束========" + res);
            logger.info("START========2.6 网上医技预约上传开始========");
            res = internetService.upMedicalOnline(startDate,endDate);
            logger.info("END==========2.5 网上医技预约上传结束========" + res);
            logger.info("START========2.7 医生评价信息开始========");
            res = internetService.upNsDoctorScore(startDate,endDate);
            logger.info("END==========2.7 医生评价信息结束========" + res);

+ 6 - 0
svr/svr-internet-hospital/pom.xml

@ -219,6 +219,12 @@
            <artifactId>im-service</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>sms-service</artifactId>
            <version>2.0.0</version>
        </dependency>
    </dependencies>
    <build>

+ 2 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeArticleDao.java

@ -14,6 +14,6 @@ import java.util.List;
 * @date 2019/9/10 14:07
 */
public interface KnowledgeArticleDao extends PagingAndSortingRepository<KnowledgeArticleDO, String>, JpaSpecificationExecutor<KnowledgeArticleDO> {
	@Query("select a from KnowledgeArticleDO a where a.del=1 and category = :category")
	List<KnowledgeArticleDO> findByCategory(@Param("category") String category);
	@Query("select a from KnowledgeArticleDO a where a.del=1 and (categoryFirst = ?1 or categorySecond=?1)")
	List<KnowledgeArticleDO> findByCategory(String category);
}

+ 2 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/dao/consult/KnowledgeCategoryDao.java

@ -12,7 +12,7 @@ import org.springframework.data.repository.query.Param;
 * @author huangwenjie
 */
public interface KnowledgeCategoryDao extends PagingAndSortingRepository<KnowledgeCategoryDO, String>, JpaSpecificationExecutor<KnowledgeCategoryDO> {
	@Query("update KnowledgeCategoryDO c set c.del = 0 where c.id = :id")
	@Query("update KnowledgeCategoryDO c set c.del = 0 where c.id = ?1")
	@Modifying
	void updateDel(@Param("id") String id);
	void updateDel(String id);
}

+ 9 - 2
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/article/ArticleEndpoint.java

@ -16,6 +16,7 @@ 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;
/**
@ -123,7 +124,13 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
			@ApiParam(name = "pageSize", value = "每页分页大小", required = true, defaultValue = "10")
			@RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize)throws Exception{
		List<KnowledgeCategoryDO> result  = knowledgeCategoryService.search(fields,filters,sorts,page,pageSize);
		List<KnowledgeCategoryDO> list  = knowledgeCategoryService.search(fields,filters,sorts,page,pageSize);
		List<KnowledgeCategoryDO> result = new ArrayList<>();
		for(KnowledgeCategoryDO knowledgeCategoryDO:list){
			if(knowledgeCategoryDO.getDel() == 1){
				result.add(knowledgeCategoryDO);
			}
		}
		return success(result);
	}
	
@ -142,7 +149,7 @@ public class ArticleEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "id", value = "id", required = true)
			@RequestParam(value = "id", required = true)String id)throws Exception {
		Boolean flag = knowledgeCategoryService.updateDel(id);
		if (!flag) {
		if (flag) {
			return success("操作成功");
		}else{
			return failed("操作失败");

+ 101 - 43
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java

@ -15,6 +15,7 @@ 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.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.sms.service.ZhongShanSMSService;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -41,6 +42,9 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	@Autowired
	private ImService imService;
	
	@Autowired
	private ZhongShanSMSService smsService;
	
	@Autowired
	private PrescriptionService prescriptionService;
	
@ -49,6 +53,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	
	@Autowired
	private OutpatientDao outpatientDao;
	
	
	@GetMapping (value = BaseHospitalRequestMapping.DodtorIM.findWaitingRoomOutpatientByDoctor)
@ -269,48 +274,6 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		return success("请求成功");
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorIndexConsultCount)
	@ApiOperation(value = "复诊图文咨询人数,视频咨询人数、协同门诊人数,可抢单人数", notes = "复诊图文咨询人数,视频咨询人数、协同门诊人数,可抢单人数")
	public Envelop doctorIndexConsultCount(@ApiParam(name = "doctor", value = "医生CODE")
	                                           @RequestParam(value = "doctor",required = true) String doctor){
		
		//专家咨询
		Integer zjCount = imService.sessionCountByType(doctor,1,0);
		
		//复诊咨询
		Integer imgCount = imService.sessionCountByType(doctor,9,0);
		//正在进行中的视频复诊
		Long _videoOnlineCount = prescriptionService.doctorIndexConsultCount(doctor);
		Integer videoCount = _videoOnlineCount.intValue();
		
		//获取候诊居民数量(包含进行中的)
		Long _waitVideoCount = prescriptionService.getWaitVideoCount(doctor);
		Integer waitVideoCount = _waitVideoCount.intValue();
		
		JSONObject result = new JSONObject();
		result.put("zjCount",zjCount);
		
		imgCount = imgCount - videoCount;
		if(imgCount <=0){
			imgCount = 0;
		}
		
		result.put("zjCount",zjCount);//专家咨询数量
		result.put("imgCount",imgCount);//图文复诊数量
		result.put("videoCount",waitVideoCount+_videoOnlineCount);//视频复诊数量
		result.put("xtCount",0);//协同门诊候诊数量
		
		JSONObject resultPick = prescriptionService.findWaitingRoomOutpatientNumberByDoctor(doctor);
		result.put("imgPickCount",resultPick.getIntValue("twCount"));
		result.put("videoPickCount",resultPick.getIntValue("spCount"));
		result.put("xtPickCount",resultPick.getIntValue("xtCount"));
		
		
		return success("请求成功",result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.records)
	@ApiOperation(value = "医生咨询记录查询")
	public Envelop records(
@ -439,9 +402,104 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
	                                        @ApiParam(name = "reviver", value = "接受者")
	                                        @RequestParam(value = "reviver", required = false)String reviver
	                                        )throws Exception{
		imService.testSendWaiSocketMessage(sender,reviver);
//		imService.testSendWaiSocketMessage(sender,reviver);
		smsService.ZhongShangSendSMS("18205968966","测试发送短信");
		return success("请求成功");
	}
	
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorIndexConsultCount)
	@ApiOperation(value = "复诊图文咨询人数,视频咨询人数、协同门诊人数,可抢单人数", notes = "复诊图文咨询人数,视频咨询人数、协同门诊人数,可抢单人数")
	public Envelop doctorIndexConsultCount(@ApiParam(name = "doctor", value = "医生CODE")
	                                       @RequestParam(value = "doctor",required = true) String doctor){
		
		//专家咨询
		Integer zjCount = imService.sessionCountByType(doctor,1,0);
		
		//复诊咨询
		Integer imgCount = imService.sessionCountByType(doctor,9,0);
		
		//正在进行中的视频复诊
		Long _videoOnlineCount = prescriptionService.doctorIndexConsultCount(doctor);
		Integer videoCount = _videoOnlineCount.intValue();
		
		//获取候诊居民数量(包含进行中的)
		Long _waitVideoCount = prescriptionService.getWaitVideoCount(doctor);
		Integer waitVideoCount = _waitVideoCount.intValue();
		
		JSONObject result = new JSONObject();
		result.put("zjCount",zjCount);
		
		imgCount = imgCount - videoCount;
		if(imgCount <=0){
			imgCount = 0;
		}
		
		result.put("zjCount",zjCount);//专家咨询数量
		result.put("imgCount",imgCount);//图文复诊数量
		result.put("videoCount",waitVideoCount+_videoOnlineCount);//视频复诊数量
		result.put("xtCount",0);//协同门诊候诊数量
		
		JSONObject resultPick = prescriptionService.findWaitingRoomOutpatientNumberByDoctor(doctor);
		result.put("imgPickCount",resultPick.getIntValue("twCount"));
		result.put("videoPickCount",resultPick.getIntValue("spCount"));
		result.put("xtPickCount",resultPick.getIntValue("xtCount"));
		
		
		return success("请求成功",result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorSpecialistConsultCount)
	@ApiOperation(value = "医生端:进行中的专家咨询数量", notes = "医生端:进行中的专家咨询数量")
	public Envelop doctorSpecialistConsultCount(@ApiParam(name = "doctor", value = "医生CODE")
	                                       @RequestParam(value = "doctor",required = true) String doctor){
		//专家咨询
		Integer zjCount = imService.sessionCountByType(doctor,1,0);
		JSONObject result = new JSONObject();
		result.put("zjCount",zjCount);//专家咨询数量
		return success("请求成功",result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorReviewConsultCount)
	@ApiOperation(value = "医生端:图文复诊、视频复诊咨询数量", notes = "医生端:图文复诊、视频复诊咨询数量")
	public Envelop doctorReviewConsultCount(@ApiParam(name = "doctor", value = "医生CODE")
	                                            @RequestParam(value = "doctor",required = true) String doctor){
		
		//复诊咨询
		Integer imgCount = imService.sessionCountByType(doctor,9,0);
		
		//正在进行中的视频复诊
		Long _videoOnlineCount = prescriptionService.doctorIndexConsultCount(doctor);
		Integer videoCount = _videoOnlineCount.intValue();
		
		//获取候诊居民数量(包含进行中的)
		Long _waitVideoCount = prescriptionService.getWaitVideoCount(doctor);
		Integer waitVideoCount = _waitVideoCount.intValue();
		
		JSONObject result = new JSONObject();
		
		imgCount = imgCount - videoCount;
		if(imgCount <=0){
			imgCount = 0;
		}
		result.put("imgCount",imgCount);//图文复诊数量
		result.put("videoCount",waitVideoCount+_videoOnlineCount);//视频复诊数量
		result.put("xtCount",0);//协同门诊候诊数量
		return success("请求成功",result);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.DodtorIM.doctorPickCount)
	@ApiOperation(value = "医生端:可抢单数量", notes = "医生端:可抢单数量")
	public Envelop doctorPickCount(@ApiParam(name = "doctor", value = "医生CODE")
	                                        @RequestParam(value = "doctor",required = true) String doctor){
		
		JSONObject resultPick = prescriptionService.findWaitingRoomOutpatientNumberByDoctor(doctor);
		JSONObject result = new JSONObject();
		result.put("imgPickCount",resultPick.getIntValue("twCount"));
		result.put("videoPickCount",resultPick.getIntValue("spCount"));
		result.put("xtPickCount",resultPick.getIntValue("xtCount"));
		return success("请求成功",result);
	}
	
	
}

+ 18 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java

@ -440,6 +440,23 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
		return success("操作成功");
	}
	
	@PostMapping(value = BaseHospitalRequestMapping.PatientIM.patientGuaidenceAppend)
	@ApiOperation(value = "居民导诊会话发送消息", notes = "居民导诊会话发送消息")
	public Envelop patientGuaidenceAppend(
			@ApiParam(name = "sender_id", value = "发送者id", defaultValue = "")
			@RequestParam(value = "sender_id", required = true) String sender_id,
			@ApiParam(name = "sender_name", value = "发送者姓名", defaultValue = "")
			@RequestParam(value = "sender_name", required = true) String sender_name,
			@ApiParam(name = "session_id", value = "session_id", defaultValue = "")
			@RequestParam(value = "session_id", required = true) String session_id,
			@ApiParam(name = "content_type", value = "内容类型", defaultValue = "")
			@RequestParam(value = "content_type", required = true) String content_type,
			@ApiParam(name = "content", value = "消息内容", defaultValue = "")
			@RequestParam(value = "content", required = true) String content
	)throws Exception{
		String result = imService.patientGuaidenceAppend(sender_id,sender_name,session_id,content_type,content,"1");
		return success(result);
	}
	
}

+ 3 - 1
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeCategoryService.java

@ -9,6 +9,7 @@ import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Date;
@ -33,7 +34,7 @@ public class KnowledgeCategoryService extends BaseJpaService<KnowledgeCategoryDO
		jsonData = URLDecoder.decode(jsonData,"utf-8");
		KnowledgeCategoryDO knowledgeCategoryDO = objectMapper.readValue(jsonData, KnowledgeCategoryDO.class);
		if (null == knowledgeCategoryDO.getPid()) {
			knowledgeCategoryDO.setPid(0l);
			knowledgeCategoryDO.setPid("0");
		}
		if (null == knowledgeCategoryDO.getId()) {
			// 新增
@ -48,6 +49,7 @@ public class KnowledgeCategoryService extends BaseJpaService<KnowledgeCategoryDO
		return knowledgeCategoryDao.save(knowledgeCategoryDO);
	}
	
	@Transactional
	public Boolean updateDel(String code) {
		List<KnowledgeArticleDO> byCategory = articleDao.findByCategory(code);
		if (null != byCategory && byCategory.size() > 0) {