Sfoglia il codice sorgente

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

wangzhinan 5 anni fa
parent
commit
4fee4648a2
25 ha cambiato i file con 1057 aggiunte e 668 eliminazioni
  1. 62 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  2. 105 122
      business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java
  3. 4 0
      business/sms-service/pom.xml
  4. 60 0
      business/sms-service/src/main/java/com/yihu/jw/sms/service/IotSMSService.java
  5. 1 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java
  6. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyPatientRegisterTimeDO.java
  7. 3 1
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPatientRegisterDO.java
  8. 22 0
      common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotSystemDictDO.java
  9. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  10. 4 0
      server/svr-authentication/pom.xml
  11. 1 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/core/userdetails/jdbc/WlyyUserDetailsService.java
  12. 15 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/dao/iot/UserDao.java
  13. 117 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyIotLoginEndpoint.java
  14. 1 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthWlyyConfigService.java
  15. 94 0
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/UserService.java
  16. 1 1
      server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java
  17. 362 362
      server/svr-authentication/src/main/java/com/yihu/jw/security/utils/HttpClientUtil.java
  18. 2 0
      server/svr-authentication/src/main/resources/application.yml
  19. 16 98
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/DoctorConsultEndpoint.java
  20. 96 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/expressage/DoctorExpressageEndpoint.java
  21. 20 59
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  22. 18 13
      svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java
  23. 6 2
      svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotSystemDictDao.java
  24. 42 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  25. 1 1
      svr/svr-iot/src/main/resources/application.yml

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

@ -692,13 +692,13 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        //pay_status`:处方结算状态,0为未结算,1为结算成功,默认为0',
        String outPatientSql="";
        if ("1".equals(status)) {
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            sql = "UPDATE base.wlyy_prescription p SET p.status='13' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            WlyyPrescriptionDO wlyyPrescriptionDO = prescriptionDao.findByRealOrder(realOrder);
            jdbcTemplate.execute(sql);
        } else if ("2".equals(status)) {
            //开方成功时候,先用处方号获取本地处方状态是否为开方失败,如果是则需要更新本地的处方
            sql = "UPDATE base.wlyy_prescription p SET p.`status`='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            sql = "UPDATE base.wlyy_prescription p SET p.status='20' WHERE p.adm_no='" + admNo + "' AND p.real_order='" + realOrder + "' ";
            //变更门诊状态
            outPatientSql="UPDATE base.wlyy_outpatient p SET p.`status`='2' WHERE p.adm_no='" + admNo + "'";
            jdbcTemplate.execute(outPatientSql);
@ -2747,7 +2747,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                    " t. NAME AS \"roleName\"" +
                    " FROM " +
                    " base_doctor_role r " +
                    " JOIN base_doctor_role_dict t ON t.`code` = r.role_code " +
                    " JOIN base_doctor_role_dict t ON t.code = r.role_code " +
                    " WHERE " +
                    " r.doctor_code = '"+doctor+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -3217,7 +3217,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
                "room.doctor AS doctor, " +
                "room.doctor_name AS doctorName " +
                "FROM wlyy_outpatient op,wlyy_hospital_waiting_room room " +
                "WHERE op.`status`=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "WHERE op.status=0 AND room.outpatient_id=op.id AND room.consult_type=2 " +
                "AND room.doctor IS NOT NULL ";
        if(StringUtils.isNoneBlank(dept)){
            waitingSql = waitingSql + " and op.dept = '"+dept+"' ";
@ -4829,6 +4829,63 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
       return entranceService.BS10008(idcard,patientId,admitNum,ybcard,demoFlag);
    }
    /**
     * 查找未配送处方订单
     */
    public List<WlyyPrescriptionVO> findUndeliveredList(){
        String sql ="SELECT " +
                " p.id AS \"id\", " +
                " p.real_order AS \"realOrder\"," +
                " p.origin_real_order AS \"originRealOrder\"," +
                " p.adm_no AS \"admNo\"," +
                " p.origin_adm_no AS \"originAdmNo\"," +
                " p.serial_no AS \"serialNo\"," +
                " p.type AS \"type\", " +
                " p.patient_code AS \"patientCode\", " +
                " p.patient_name AS \"patientName\", " +
                " p.ssc AS \"ssc\", " +
                " p.doctor AS \"doctor\", " +
                " p.doctor_name AS \"doctorName\", " +
                " p.status AS \"status\", " +
                " p.mk_fail_reason AS \"mkFailReason\", " +
                " p.mk_time AS \"mk_time\", " +
                " p.prescribe_reason AS \"prescribeReason\", " +
                " p.prescribe_time AS \"prescribeTime\", " +
                " p.pay_time AS \"payTime\", " +
                " p.dosage_time AS \"dosageTime\", " +
                " p.finish_time AS \"finishTime\", " +
                " p.create_time AS \"createTime\", " +
                " p.dept AS \"dept\", " +
                " p.dept_name AS \"deptName\", " +
                " p.hospital AS \"hospital\", " +
                " p.hospital_name AS \"hospitalName\", " +
                " p.consult AS \"consult\", " +
                " p.dispensary_type AS \"dispensaryType\", " +
                " p.reason AS \"reason\", " +
                " p.remark AS \"remark\", " +
                " p.cancel_reason AS \"cancelReason\", " +
                " p.ca_cert_data AS \"caCertData\", " +
                " p.ca_message AS \"caMessage\", " +
                " p.digital_sign_no AS \"digitalSignNo\", " +
                " p.original_data_abstract AS \"originalDataAbstract\", " +
                " p.str_original_data AS \"strOriginalData\", " +
                " p.his_dept_code AS \"hisDeptCode\", " +
                " p.his_doctor_code AS \"hisDoctorCode\", " +
                " p.his_gister_type_code AS \"hisGisterTypeCode\", " +
                " p.his_rate_type_code AS \"hisRateTypeCode\", " +
                " p.his_hospital AS \"hisHospital\", " +
                " p.his_register_fee AS \"hisRegisterFee\", " +
                " p.pay_status AS \"payStatus\" " +
                " FROM " +
                " wlyy_prescription p " +
                " WHERE status = 60 or status = 50 ";
        List<WlyyPrescriptionVO> list = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyPrescriptionVO.class));
        if(list!=null){
            return list;
        }
        return new ArrayList<>();
    }
    /**
     * 获取医生信息
     * @param hospital
@ -4838,7 +4895,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
    public List<Map<String,Object>> findDoctorByName(String hospital, String name,String chargeType){
        String sql ="SELECT " +
                " d.id AS \"id\", " +
                " d.`name` AS \"name\"" +
                " d.name AS \"name\"" +
                " FROM " +
                " base_doctor d ";
        if(StringUtils.isNotBlank(hospital)){

+ 105 - 122
business/im-service/src/main/java/com/yihu/jw/im/service/ImService.java

@ -245,7 +245,7 @@ public class ImService {
	public Long countConsultRecordByPatient(String patient, String id,String type, String title) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor d " +
@ -279,16 +279,16 @@ public class ImService {
	 */
	public String  getUnfinishedConsult(String patient, String doctor) {
		
		String totalSql = "SELECT a.consult as consultCode " +
		String totalSql = "SELECT a.consult as \"consultCode\" " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"WHERE a.consult=b.consult " +
				"AND a.patient= '" +patient+"' "+
				"AND b.to_doctor='" +doctor+"' "+
				"AND a.del='1' " +
				"AND (a.type<> 9 or a.type<> 16)" +
				"AND a.`status`=0";
				"AND a.status=0";
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		
		String consultCode = "";
		if (rstotal != null && rstotal.size() > 0) {
@ -317,16 +317,16 @@ public class ImService {
	public JSONObject  getUnfinishedConsultByActualSender(String patient, String general_doctor) {
		JSONObject result = new JSONObject();
		
		String totalSql = "SELECT a.consult as consultCode,a.doctor as specialDoctor " +
		String totalSql = "SELECT a.consult as \"consultCode\",a.doctor as \"specialDoctor\"  " +
				"FROM wlyy_consult_team a,wlyy_consult_team_doctor b " +
				"WHERE a.consult=b.consult " +
				"AND a.patient= '" +patient+"' "+
				"AND a.actual_sender='" +general_doctor+"' "+
				"AND a.del='1' " +
				"AND a.type<> 12 " +
				"AND a.`status`=0";
				"AND a.status=0";
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		
		String consultCode = "";
		String specialDoctor = "";
@ -1481,7 +1481,7 @@ public class ImService {
	 */
	public String getConsultCodeByOutpatientId(String outpatientid) {
		String totalSql = "SELECT id FROM wlyy_consult WHERE relation_code='"+outpatientid+"' ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		String id = "";
		if (rstotal != null && rstotal.size() > 0) {
			id = rstotal.get(0).get("id").toString();
@ -1495,8 +1495,8 @@ public class ImService {
	 * @return
	 */
	public String getOutpatientidByConsoultCode(String consult) {
		String totalSql = "SELECT relation_code FROM wlyy_consult WHERE id='"+consult+"' ";
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(totalSql);
		String totalSql = "SELECT relation_code as \"relation_code\" FROM wlyy_consult WHERE id='"+consult+"' ";
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(totalSql);
		String id = "";
		if (rstotal != null && rstotal.size() > 0) {
			id = rstotal.get(0).get("relation_code").toString();
@ -1592,22 +1592,22 @@ public class ImService {
	public List<Map<String,Object>> getEvaluationByConsultCode(String consult) {
		//查询评价明细
		String sqlScoreList = "SELECT " +
				"a.score as score," +
				"a.score_type as score_type," +
				"a.content as content," +
				"b.create_time as create_time," +
				"c.type as type," +
				"c.name as patientname," +
				"b.id as id," +
				"c.photo as patientphoto," +
				"b.type as niming " +
				"a.score as \"score\"," +
				"a.score_type as \"score_type\"," +
				"a.content as \"content\"," +
				"b.create_time as \"create_time\"," +
				"c.type as \"type\"," +
				"c.name as \"patientname\"," +
				"b.id as \"id\"," +
				"c.photo as \"patientphoto\"," +
				"b.type as \"niming\" " +
				"FROM " +
				"base_evaluate a " +
				"LEFT JOIN base_evaluate_score b ON b.id=a.relation_code " +
				"LEFT JOIN wlyy_consult_team c ON c.consult=b.relation_code " +
				"WHERE a.relation_code=b.id "+
				"AND c.consult='"+consult+"'";
		List<Map<String,Object>> scoreList = jdbcTemplate.queryForList(sqlScoreList);
		List<Map<String,Object>> scoreList = hibenateUtils.createSQLQuery(sqlScoreList);
		if(scoreList.isEmpty()){
			return null;
		}else{
@ -1693,35 +1693,27 @@ public class ImService {
	 * @param end_time 结束时间
	 * @return
	 */
	public List<ConsultVO>  findConsultRecordByDoctor(String doctor, String id,
	public List<Map<String,Object>>  findConsultRecordByDoctor(String doctor, String id,
	                                                  String type, Integer status,
	                                                  int page,int pagesize,
	                                                  String title,String start_time,String end_time) {
		
		if(page >=1){
			page --;
		}
		
		if (pagesize <= 0) {
			pagesize = 10;
		}
		
		String  sql = "";
		//专家咨询
		if("1".equals(type) || "15".equals(type) || type.contains(",")){
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d " +
@ -1730,22 +1722,22 @@ public class ImService {
		}else{
			
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"op.id as outpatientid," +
					"op.type as consultType," +
					"op.general_doctor as generalDoctor," +
					"op.icd10_name as icd10Name," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"op.id as \"outpatientid\"," +
					"op.type as \"consultType\"," +
					"op.general_doctor as \"generalDoctor\"," +
					"op.icd10_name as \"icd10Name\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d, " +
@ -1755,10 +1747,6 @@ public class ImService {
		}
		
		
		
		List<ConsultVO> result = new ArrayList<>();
		
		if(!StringUtils.isEmpty(title)){
			title="%"+title+"%";
			sql +=" and a.title like '"+title+"'";
@ -1794,8 +1782,7 @@ public class ImService {
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		return result;
		return hibenateUtils.createSQLQuery(sql);
	}
	
	/**
@ -1812,7 +1799,7 @@ public class ImService {
	public Long countConsultRecordByDoctor(String doctor, String id,String type, Integer status,String title,String start_time,String end_time) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_patient d," +
@ -1855,7 +1842,7 @@ public class ImService {
			sql += " and a.id = '" + id + "'";
		}
		
		List<Map<String, Object>> rstotal = jdbcTemplate.queryForList(sql);
		List<Map<String, Object>> rstotal = hibenateUtils.createSQLQuery(sql);
		Long count = 0L;
		if (rstotal != null && rstotal.size() > 0) {
			count = (Long) rstotal.get(0).get("total");
@ -2087,7 +2074,7 @@ public class ImService {
	 * @param end_time 结束时间
	 * @return
	 */
	public List<ConsultVO>  findexpertConsultRecordByDoctor(String doctor, String id,
	public List<Map<String,Object>>   findexpertConsultRecordByDoctor(String doctor, String id,
	                                                  Integer type, Integer status,
	                                                  int page,int pagesize,
	                                                  String title,String start_time,String end_time,String patinet) {
@ -2101,20 +2088,20 @@ public class ImService {
		}
		
		String  sql = "SELECT " +
				"a.id AS id," +
				"a.type AS type," +
				"a.title AS title," +
				"a.symptoms AS symptoms," +
				"a.czrq AS czrq," +
				"b.status AS status," +
				"b.evaluate AS evaluate," +
				"d.name AS patientName," +
				"d.id as patientId," +
				"d.idcard as patientIdcard," +
				"d.sex as patientsex," +
				"d.photo AS patientphoto, " +
				"doctor.name AS doctorName, " +
				"doctor.job_title_name AS jobTitleName " +
				"a.id AS \"id\"," +
				"a.type AS \"type\"," +
				"a.title AS \"title\"," +
				"a.symptoms AS \"symptoms\"," +
				"a.czrq AS \"czrq\"," +
				"b.status AS \"status\"," +
				"b.evaluate AS \"evaluate\"," +
				"d.name AS \"patientName\"," +
				"d.id as \"patientId\"," +
				"d.idcard as \"patientIdcard\"," +
				"d.sex as \"patientsex\"," +
				"d.photo AS \"patientphoto\", " +
				"doctor.name AS \"doctorName\", " +
				"doctor.job_title_name AS \"jobTitleName\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_doctor doctor," +
@ -2159,9 +2146,9 @@ public class ImService {
		}
		sql += " ORDER BY a.czrq desc limit "+page * pagesize+","+pagesize+"";
		
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
//		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		
		return result;
		return hibenateUtils.createSQLQuery(sql);
	}
	
	
@ -2180,7 +2167,7 @@ public class ImService {
	public Long findexpertConsultRecordByDoctor(String doctor, String id,Integer type, Integer status,String title,String start_time,String end_time,String patient) {
		
		String  sql = "SELECT " +
				" COUNT(1) AS total " +
				" COUNT(1) AS \"total\" " +
				"FROM wlyy_consult a," +
				"wlyy_consult_team b," +
				"base_patient d " +
@ -2260,9 +2247,9 @@ public class ImService {
				break;
		}
		
		String sql = "select id, session_id, sender_id, sender_name, content_type, content, timestamp from " + data_base_name + "." +
		String sql = "id AS \"id\",session_id AS \"session_id\",sender_id AS \"sender_id\",sender_name AS \"sender_name\",content_type AS \"content_type\",content AS \"content\",timestamp AS \"timestamp\"  from " + data_base_name + "." +
				tableName + " where id in(" + content + ") order by timestamp desc ";
		List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
		List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql);
		com.alibaba.fastjson.JSONArray ja = new com.alibaba.fastjson.JSONArray();
		for (int i = 0; i < list.size(); i++) {
			Map<String, Object> map = list.get(i);
@ -2398,28 +2385,26 @@ public class ImService {
	 * 医生待办事项列表
	 * @param doctorCode
	 * @param type
	 * @param page
	 * @param pagesize
	 * @return
	 */
	public List<ConsultVO> doctorUpcomingList(String doctorCode, String type) {
	public List<Map<String,Object>> doctorUpcomingList(String doctorCode, String type) {
		String sql = "";
		if("1,15".equals(type)) {
			sql = "SELECT " +
					"a.id AS id," +
					"a.type AS type," +
					"a.title AS title," +
					"a.symptoms AS symptoms," +
					"a.czrq AS czrq," +
					"b.status AS status," +
					"b.evaluate AS evaluate," +
					"b.doctor AS doctorCode," +
					"b.actual_sender AS generalDoctor," +
					"d.name AS patientName," +
					"d.id as patientId," +
					"d.idcard as patientIdcard," +
					"d.sex as patientsex," +
					"d.photo AS patientphoto " +
					"a.id AS \"id\"," +
					"a.type AS \"type\"," +
					"a.title AS \"title\"," +
					"a.symptoms AS \"symptoms\"," +
					"a.czrq AS \"czrq\"," +
					"b.status AS \"status\"," +
					"b.evaluate AS \"evaluate\"," +
					"b.doctor AS \"doctorCode\"," +
					"b.actual_sender AS \"generalDoctor\"," +
					"d.name AS \"patientName\"," +
					"d.id as \"patientId\"," +
					"d.idcard as \"patientIdcard\"," +
					"d.sex as \"patientsex\"," +
					"d.photo AS \"patientphoto\" " +
					"FROM wlyy_consult a," +
					"wlyy_consult_team b," +
					"base_patient d  " +
@ -2429,20 +2414,20 @@ public class ImService {
		}
		if("9".equals(type) || "16".equals(type)|| "12".equals(type)){
			sql = "SELECT " +
					"op.description AS title," +
					"op.description AS symptoms," +
					"op.create_time AS czrq," +
					"op.status AS status," +
					"op.evaluate_status AS evaluate," +
					"op.doctor AS doctorCode," +
					"op.general_doctor AS generalDoctor," +
					"patient.NAME AS patientName," +
					"patient.id AS patientId," +
					"patient.idcard AS patientIdcard," +
					"patient.sex AS patientsex," +
					"patient.photo AS patientphoto," +
					"op.id AS outpatientid," +
					"op.register_date AS registerDate," +
					"op.description AS \"title\"," +
					"op.description AS \"symptoms\"," +
					"op.create_time AS \"czrq\"," +
					"op.status AS \"status\"," +
					"op.evaluate_status AS \"evaluate\"," +
					"op.doctor AS \"doctorCode\"," +
					"op.general_doctor AS \"generalDoctor\"," +
					"patient.NAME AS \"patientName\"," +
					"patient.id AS \"patientId\"," +
					"patient.idcard AS \"patientIdcard\"," +
					"patient.sex AS \"patientsex\"," +
					"patient.photo AS \"patientphoto\"," +
					"op.id AS \"outpatientid\"," +
					"op.register_date AS \"registerDate\"," +
					"op.status AS outpatientstatus " +
					"FROM wlyy_outpatient op," +
					"base_patient patient " +
@ -2465,9 +2450,7 @@ public class ImService {
			sql =sql +" ORDER BY op.create_time DESC";
		}
		
		List<ConsultVO> result = new ArrayList<>();
		result = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ConsultVO.class));
		return result;
		return hibenateUtils.createSQLQuery(sql);
	}
	
	/**
@ -2493,11 +2476,11 @@ public class ImService {
	public List<Map<String,Object>>  getDoctorConsultCount(String doctorids) throws Exception{
		//医生角色
		String sql = "SELECT " +
				"count(id) AS total," +
				"doctor " +
				"count(id) AS \"total\"," +
				"doctor as \"doctor\"" +
				"FROM wlyy_consult_team " +
				"WHERE doctor IN ("+doctorids+") AND (type=1 OR type=15) and status = 0 GROUP BY doctor";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		List<Map<String,Object>> list = hibenateUtils.createSQLQuery(sql);
		return list;
	}
}

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

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

+ 60 - 0
business/sms-service/src/main/java/com/yihu/jw/sms/service/IotSMSService.java

@ -0,0 +1,60 @@
package com.yihu.jw.sms.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.util.http.HttpClientUtil;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.*;
/**
 * 物联网短信网关
 *
 * @author hmf
 */
@Service
public class IotSMSService {
    @Value("${wlyy.url}")
    private String wlyyUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    public String IotSendSMS(String mobileStr, String content) throws Exception {
        //请求i健康发送短信接口
        String url = wlyyUrl+"wlyygc/doctor/message/sendMobileMessage";
        List<NameValuePair> par = new ArrayList<NameValuePair>();
        par.add(new BasicNameValuePair("mobiles", mobileStr));
        par.add(new BasicNameValuePair("content", content));
        String result = httpClientUtil.post(url,par,"UTF-8");
        JSONObject re = JSONObject.parseObject(result);
        if (re.getInteger("status") != 10000) {
            // 发送失败
            throw new Exception("短信发送失败!");
        } else {
            return "success";
        }
    }
    public static JSONObject toJson(String result) {
        JSONObject json = new JSONObject();
        try {
            String[] temps = result.split("&");
            for (String temp : temps) {
                if (temp.split("=").length != 2) {
                    continue;
                }
                String key = temp.split("=")[0];
                String value = temp.split("=")[1];
                json.put(key, value);
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return json;
    }
}

+ 1 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/im/ConsultTeamDo.java

@ -203,6 +203,7 @@ public class ConsultTeamDo extends UuidIdentityEntity {
		this.voice = voice;
	}
	
	@Column(name = "consult_comment")
	public String getComment() {
		return comment;
	}

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/doctor/WlyyPatientRegisterTimeDO.java

@ -3,6 +3,7 @@ package com.yihu.jw.entity.hospital.doctor;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -99,7 +100,8 @@ public class WlyyPatientRegisterTimeDO extends UuidIdentityEntity {
    public void setTimeType(String timeType) {
        this.timeType = timeType;
    }
    
    @Column(name = "register_date")
    public String getDate() {
        return date;
    }

+ 3 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/prescription/WlyyPatientRegisterDO.java

@ -2,6 +2,7 @@ package com.yihu.jw.entity.hospital.prescription;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
@ -55,7 +56,8 @@ public class WlyyPatientRegisterDO extends UuidIdentityEntity {
    public void setRegisterNo(String registerNo) {
        this.registerNo = registerNo;
    }
    
    @Column(name = "register_date")
    public String getDate() {
        return date;
    }

+ 22 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/iot/dict/IotSystemDictDO.java

@ -5,6 +5,7 @@ import com.yihu.jw.entity.UuidIdentityEntityWithOperator;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
/**
@ -29,6 +30,10 @@ public class IotSystemDictDO extends UuidIdentityEntityWithOperator implements S
    private Long sort;//排序
    @Column(name = "del")
    private Integer del;//删除标志
    @Column(name = "parent_code")
    private String parentCode;
    @Transient
    private String parentName;//父类字典名称
    public String getSaasId() {
        return saasId;
@ -85,4 +90,21 @@ public class IotSystemDictDO extends UuidIdentityEntityWithOperator implements S
    public void setDel(Integer del) {
        this.del = del;
    }
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    @Transient
    public String getParentName() {
        return parentName;
    }
    public void setParentName(String parentName) {
        this.parentName = parentName;
    }
}

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -41,6 +41,7 @@ public class IotRequestMapping {
    public static class System{
        public static final String findDictByCode = "findDictByCode";
        public static final String createDict = "createDict";
    }
    /**

+ 4 - 0
server/svr-authentication/pom.xml

@ -111,6 +111,10 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>mysql-starter</artifactId>

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

@ -7,8 +7,8 @@ import com.yihu.jw.security.dao.patient.BasePatientWechatDao;
import com.yihu.jw.security.model.WlyyUserDetails;
import com.yihu.jw.security.model.WlyyUserSimple;
import com.yihu.jw.security.utils.HttpClientUtil;
import com.yihu.jw.security.utils.IdCardUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.utils.security.MD5;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.time.DateUtils;

+ 15 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/dao/iot/UserDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.security.dao.iot;
import com.yihu.jw.entity.base.user.UserDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Dao - 后台管理员
 * Created by progr1mmer on 2018/8/20.
 */
public interface UserDao extends PagingAndSortingRepository<UserDO, String>, JpaSpecificationExecutor<UserDO> {
}

+ 117 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyIotLoginEndpoint.java

@ -0,0 +1,117 @@
package com.yihu.jw.security.oauth2.provider.endpoint;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.restmodel.ResultStatus;
import com.yihu.jw.security.model.Captcha;
import com.yihu.jw.security.model.Oauth2Envelop;
import com.yihu.jw.security.oauth2.core.redis.WlyyRedisVerifyCodeService;
import com.yihu.jw.security.service.UserService;
import com.yihu.jw.sms.service.IotSMSService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.oauth2.common.exceptions.InvalidRequestException;
import org.springframework.security.oauth2.provider.OAuth2RequestFactory;
import org.springframework.security.oauth2.provider.OAuth2RequestValidator;
import org.springframework.security.oauth2.provider.request.DefaultOAuth2RequestValidator;
import org.springframework.util.StringUtils;
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 java.util.Map;
/**
 * @Auther hmf
 * @Date 2020.4.24
 */
@Api(description = "物联网认证服务")
@RestController
public class WlyyIotLoginEndpoint {
    private final Logger LOG = LoggerFactory.getLogger(getClass());
    private OAuth2RequestFactory oAuth2RequestFactory;
    private OAuth2RequestValidator oAuth2RequestValidator = new DefaultOAuth2RequestValidator();
    @Autowired
    private WlyyRedisVerifyCodeService wlyyRedisVerifyCodeService;
    @Autowired
    private IotSMSService iotSMSService;
    @Autowired
    private UserService userService;
    @RequestMapping(value = "/oauth/sendIotCaptcha", method = RequestMethod.GET)
    @ApiOperation("发送短信验证码")
    public ResponseEntity<Oauth2Envelop<Captcha>> sendZSCaptcha(@RequestParam Map<String, String> parameters) throws Exception {
        String client_id = parameters.get("client_id");
        String mobile = parameters.get("username");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(mobile)) {
            throw new InvalidRequestException("username");
        }
        //验证请求间隔超时,防止频繁获取验证码
        if (!wlyyRedisVerifyCodeService.isIntervalTimeout(client_id, mobile)) {
            throw new IllegalAccessException("SMS request frequency is too fast");
        }
        //发送短信获取验证码
        String captcha = wlyyRedisVerifyCodeService.getCodeNumber();
        String result = iotSMSService.IotSendSMS(mobile, "您好,你的手机注册短信验证码是:" + captcha + ",5分钟内有效。");
        if (result.equals("success")) {
            Captcha _captcha = new Captcha();
            _captcha.setCode(captcha);
            _captcha.setExpiresIn(300);
            wlyyRedisVerifyCodeService.store(client_id, mobile, captcha, 300);
            Oauth2Envelop<Captcha> oauth2Envelop = new Oauth2Envelop<>("captcha", 200, _captcha);
            HttpHeaders headers = new HttpHeaders();
            headers.set("Cache-Control", "no-store");
            headers.set("Pragma", "no-cache");
            return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
        }
        throw new IllegalStateException("验证码发送失败!");
    }
    @RequestMapping(value = "/oauth/captchaAndRegister", method = RequestMethod.POST)
    @ApiOperation("验证短信验证码并注册")
    public ResponseEntity<Oauth2Envelop> captchaCheck(@RequestParam Map<String, String> parameters) throws Exception {
        String client_id = parameters.get("client_id");
        String mobile = parameters.get("username");
        String captcha = parameters.get("captcha");
        String jsonData = parameters.get("jsonData");
        if (StringUtils.isEmpty(client_id)) {
            throw new InvalidRequestException("client_id");
        }
        if (StringUtils.isEmpty(mobile)) {
            throw new InvalidRequestException("username");
        }
        if (StringUtils.isEmpty(captcha)) {
            throw new InvalidRequestException("captcha");
        }
        Oauth2Envelop<Boolean> oauth2Envelop;
        if (wlyyRedisVerifyCodeService.verification(client_id, mobile, captcha)) {
            oauth2Envelop = new Oauth2Envelop<>("注册成功", 200, true);
            //注册账号
            JSONObject jsonObject =  userService.createUser(jsonData);
            if (jsonObject.getString("response").equalsIgnoreCase(ConstantUtils.FAIL)) {
                oauth2Envelop = new Oauth2Envelop<>(jsonObject.getString("msg"), ResultStatus.INVALID_GRANT, false);
            }
        } else {
            oauth2Envelop = new Oauth2Envelop<>("验证码错误", ResultStatus.INVALID_GRANT, false);
        }
        HttpHeaders headers = new HttpHeaders();
        headers.set("Cache-Control", "no-store");
        headers.set("Pragma", "no-cache");
        return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
    }
}

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/OauthWlyyConfigService.java

@ -11,7 +11,7 @@ import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorHospitalDao;
import com.yihu.jw.security.dao.doctor.BaseDoctorRoleDao;
import com.yihu.jw.security.dao.doctor.DoctorMappingDao;
import com.yihu.jw.security.utils.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import com.yihu.utils.security.MD5;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;

+ 94 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/service/UserService.java

@ -0,0 +1,94 @@
package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.entity.base.org.BaseOrgUserDO;
import com.yihu.jw.entity.base.user.UserDO;
import com.yihu.jw.patient.util.ConstantUtils;
import com.yihu.jw.security.dao.iot.UserDao;
import com.yihu.utils.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Random;
/**
 * 物联网用户注册
 *
 * @author hmf
 */
@Service
public class UserService {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private UserDao userDao;
    //用手机号注册账号
    public UserDO registerWithMobile(UserDO userDO) {
        userDO.setUsername(userDO.getMobile());
        userDO.setName(userDO.getMobile());
        userDO.setSalt(randomString(5));
        userDO.setEnabled(true);
        userDO.setLocked(false);
        userDO.setLoginFailureCount(0);
        String password = userDO.getPassword();
        if (StringUtils.isEmpty(password)) {
            password = userDO.getMobile().substring(userDO.getMobile().length()-6, userDO.getMobile().length());
        }
        userDO.setPassword(MD5.md5Hex(password + "{" + userDO.getSalt() + "}"));
        userDO.setCreateTime(new Date());
        userDO.setUpdateTime(new Date());
        return userDao.save(userDO);
    }
    public JSONObject createUser(String jsonData) {
        JSONObject result = new JSONObject();
        if (StringUtils.isEmpty(jsonData)) {
            result.put("msg", "parameter jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        JSONObject user = JSONObject.parseObject(jsonData);
        //归属租户为默认租户,表示用户为超级管理员,不需要机构
        if (null == user || !user.getString("saasId").equalsIgnoreCase("2c9a80ed719a6dcb0171a5dd1d700014")) {
            result.put("msg", "parameter user or org of jsonData is null");
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        //组装用户信息
        UserDO userDO = null;
        try {
            userDO = objectMapper.readValue(user.toJSONString(), UserDO.class);
        } catch (IOException e) {
            result.put("msg", "convert user jsonObject to UserDO failed," + e.getCause());
            result.put("response", ConstantUtils.FAIL);
            return result;
        }
        registerWithMobile(userDO);
        result.put("response", ConstantUtils.SUCCESS);
        return result;
    }
    public String randomString(int length) {
        String str = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
        StringBuffer buffer = new StringBuffer();
        Random random = new Random();
        for(int i = 0; i < length; ++i) {
            int pos = random.nextInt(str.length());
            buffer.append(str.charAt(pos));
        }
        return buffer.toString();
    }
}

+ 1 - 1
server/svr-authentication/src/main/java/com/yihu/jw/security/service/YkyyService.java

@ -3,7 +3,7 @@ package com.yihu.jw.security.service;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.security.dao.doctor.BaseDoctorDao;
import com.yihu.jw.security.utils.HttpClientUtil;
import com.yihu.jw.util.http.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

+ 362 - 362
server/svr-authentication/src/main/java/com/yihu/jw/security/utils/HttpClientUtil.java

@ -1,362 +1,362 @@
package com.yihu.jw.security.utils;
import com.alibaba.fastjson.JSONObject;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;
import org.apache.http.ParseException;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@Component
public class HttpClientUtil {
    /**
     * 发送post请求
     *
     * @param url     请求地址
     * @param params  请求参数
     * @param chatSet 编码格式
     * @return
     */
    public  String post(String url, List<NameValuePair> params, String chatSet) {
        // 创建默认的httpClient实例.
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 创建httppost
        HttpPost httppost = new HttpPost(url);
        UrlEncodedFormEntity uefEntity;
        try {
            uefEntity = new UrlEncodedFormEntity(params, chatSet);
            httppost.setEntity(uefEntity);
            CloseableHttpResponse response = httpclient.execute(httppost);
            try {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * 发送get请求
     *
     * @param url     请求地址
     * @param chatSet 编码格式
     * @return
     */
    public  String get(String url, String chatSet) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            HttpGet httpget = new HttpGet(url);
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * http调用方法,(健康之路开放平台)
     *
     * @param url
     * @param params
     * @return
     * @throws Exception
     */
    public  String httpPost(String url, Map<String, String> params) throws Exception {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();//设置请求和传输超时时间
        try {
            HttpPost httpPost = new HttpPost(url);
            httpPost.setConfig(requestConfig);
            if (params != null && params.size() > 0) {
                List<NameValuePair> valuePairs = new ArrayList<NameValuePair>(params.size());
                for (Map.Entry<String, String> entry : params.entrySet()) {
                    NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()));
                    valuePairs.add(nameValuePair);
                }
                UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(valuePairs, "UTF-8");
                httpPost.setEntity(formEntity);
            }
            CloseableHttpResponse resp = httpclient.execute(httpPost);
            try {
                HttpEntity entity = resp.getEntity();
                String respContent = EntityUtils.toString(entity, "UTF-8").trim();
                return respContent;
            } finally {
                resp.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        } finally {
            httpclient.close();
        }
    }
    /**
     * 获取加密后参数集合(健康之路开放平台)
     *
     * @param params
     * @return
     */
    public  Map<String, String> getSecretParams(Map<String, String> params, String appId, String secret) {
        String timestamp = Long.toString(System.currentTimeMillis());
        params.put("timestamp", timestamp);
        StringBuilder stringBuilder = new StringBuilder();
        // 对参数名进行字典排序  
        String[] keyArray = params.keySet().toArray(new String[0]);
        Arrays.sort(keyArray);
        // 拼接有序的参数名-值串  
        stringBuilder.append(appId);
        for (String key : keyArray) {
            stringBuilder.append(key).append(params.get(key));
        }
        String codes = stringBuilder.append(secret).toString();
        String sign = org.apache.commons.codec.digest.DigestUtils.shaHex(codes).toUpperCase();
        // 添加签名,并发送请求  
        params.put("appId", appId);
        params.put("sign", sign);
        return params;
    }
    public  String postBody(String url, JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
    public  void putBody(String url, JSONObject params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
        restTemplate.put(url, formEntity, String.class);
    }
    /**
     * 发送post请求
     *
     * @param url     请求地址
     * @param params  请求参数
     * @return
     */
    public String iotPostBody(String url, String params) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params, headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
    /**
     * 发送post请求
     *
     * @param url     请求地址
     * @param params  请求参数
     * @param chatSet 编码格式
     * @param headerMap 请求头
     * @return
     */
    public  String headerPost(String url, List<NameValuePair> params, String chatSet, Map<String,Object> headerMap) {
        // 创建默认的httpClient实例.
        CloseableHttpClient httpclient = HttpClients.createDefault();
        // 创建httppost
        HttpPost httppost = new HttpPost(url);
        UrlEncodedFormEntity uefEntity;
        try {
            uefEntity = new UrlEncodedFormEntity(params, chatSet);
            httppost.setEntity(uefEntity);
            for(String str:headerMap.keySet()){
                httppost.addHeader(str,headerMap.get(str).toString());
            }
            CloseableHttpResponse response = httpclient.execute(httppost);
            try {
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (UnsupportedEncodingException e1) {
            e1.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    public  String get(String url, String chatSet,Map<String,Object> headerMap) {
        CloseableHttpClient httpclient = HttpClients.createDefault();
        try {
            // 创建httpget.
            url= url.replaceAll(" ", "%20");
            HttpGet httpget = new HttpGet(url);
            for(String str:headerMap.keySet()){
                httpget.addHeader(str,headerMap.get(str).toString());
            }
            // 执行get请求.
            CloseableHttpResponse response = httpclient.execute(httpget);
            try {
                // 获取响应实体
                HttpEntity entity = response.getEntity();
                if (entity != null) {
                    return EntityUtils.toString(entity, chatSet);
                }
            } finally {
                response.close();
            }
        } catch (ClientProtocolException e) {
            e.printStackTrace();
        } catch (ParseException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            // 关闭连接,释放资源
            try {
                httpclient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return null;
    }
    /**
     * 向指定 URL 发送POST方法的请求
     *
     * @param url
     *            发送请求的 URL带上参数
     * @param param
     *            POST参数。
     * @return 所代表远程资源的响应结果
     */
    public  String sendPost(String url, String param) {
        StringBuffer buffer = new StringBuffer();
        PrintWriter out = null;
        BufferedReader in = null;
        HttpURLConnection conn = null;
        try {
            URL realUrl = new URL(url);
            // 打开和URL之间的连接
            conn = (HttpURLConnection) realUrl.openConnection();
            conn.setRequestMethod("POST");
            conn.setDoOutput(true);
            conn.setDoInput(true);
            conn.setUseCaches(false);
            conn.setRequestProperty("Content-Type", "application/json");
            conn.setRequestProperty("accept", "*/*");
            conn.setRequestProperty("connection", "Keep-Alive");
            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
            OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
            osw.write(param.toString());
            osw.flush();
            // 读取返回内容
            BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
            String temp;
            while ((temp = br.readLine()) != null) {
                buffer.append(temp);
                buffer.append("\n");
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (out != null) {
                    out.close();
                }
                if (in != null) {
                    in.close();
                }
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
        return buffer.toString();
    }
}
//package com.yihu.jw.security.utils;
//
//import com.alibaba.fastjson.JSONObject;
//import org.apache.http.HttpEntity;
//import org.apache.http.NameValuePair;
//import org.apache.http.ParseException;
//import org.apache.http.client.ClientProtocolException;
//import org.apache.http.client.config.RequestConfig;
//import org.apache.http.client.entity.UrlEncodedFormEntity;
//import org.apache.http.client.methods.CloseableHttpResponse;
//import org.apache.http.client.methods.HttpGet;
//import org.apache.http.client.methods.HttpPost;
//import org.apache.http.impl.client.CloseableHttpClient;
//import org.apache.http.impl.client.HttpClients;
//import org.apache.http.message.BasicNameValuePair;
//import org.apache.http.util.EntityUtils;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.MediaType;
//import org.springframework.stereotype.Component;
//import org.springframework.web.client.RestTemplate;
//
//import java.io.*;
//import java.net.HttpURLConnection;
//import java.net.URL;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//import java.util.Map;
//
//@Component
//public class HttpClientUtil {
//    /**
//     * 发送post请求
//     *
//     * @param url     请求地址
//     * @param params  请求参数
//     * @param chatSet 编码格式
//     * @return
//     */
//    public  String post(String url, List<NameValuePair> params, String chatSet) {
//        // 创建默认的httpClient实例.
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        // 创建httppost
//        HttpPost httppost = new HttpPost(url);
//        UrlEncodedFormEntity uefEntity;
//        try {
//            uefEntity = new UrlEncodedFormEntity(params, chatSet);
//            httppost.setEntity(uefEntity);
//            CloseableHttpResponse response = httpclient.execute(httppost);
//            try {
//                HttpEntity entity = response.getEntity();
//                if (entity != null) {
//                    return EntityUtils.toString(entity, chatSet);
//                }
//            } finally {
//                response.close();
//            }
//        } catch (ClientProtocolException e) {
//            e.printStackTrace();
//        } catch (UnsupportedEncodingException e1) {
//            e1.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            // 关闭连接,释放资源
//            try {
//                httpclient.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return null;
//    }
//
//
//    /**
//     * 发送get请求
//     *
//     * @param url     请求地址
//     * @param chatSet 编码格式
//     * @return
//     */
//    public  String get(String url, String chatSet) {
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        try {
//            // 创建httpget.
//            HttpGet httpget = new HttpGet(url);
//            // 执行get请求.
//            CloseableHttpResponse response = httpclient.execute(httpget);
//            try {
//                // 获取响应实体
//                HttpEntity entity = response.getEntity();
//                if (entity != null) {
//                    return EntityUtils.toString(entity, chatSet);
//                }
//            } finally {
//                response.close();
//            }
//        } catch (ClientProtocolException e) {
//            e.printStackTrace();
//        } catch (ParseException e) {
//            e.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            // 关闭连接,释放资源
//            try {
//                httpclient.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return null;
//    }
//
//    /**
//     * http调用方法,(健康之路开放平台)
//     *
//     * @param url
//     * @param params
//     * @return
//     * @throws Exception
//     */
//    public  String httpPost(String url, Map<String, String> params) throws Exception {
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(60000).setConnectTimeout(60000).build();//设置请求和传输超时时间
//
//        try {
//            HttpPost httpPost = new HttpPost(url);
//            httpPost.setConfig(requestConfig);
//            if (params != null && params.size() > 0) {
//                List<NameValuePair> valuePairs = new ArrayList<NameValuePair>(params.size());
//                for (Map.Entry<String, String> entry : params.entrySet()) {
//                    NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()));
//                    valuePairs.add(nameValuePair);
//                }
//                UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(valuePairs, "UTF-8");
//                httpPost.setEntity(formEntity);
//            }
//            CloseableHttpResponse resp = httpclient.execute(httpPost);
//            try {
//                HttpEntity entity = resp.getEntity();
//                String respContent = EntityUtils.toString(entity, "UTF-8").trim();
//                return respContent;
//            } finally {
//                resp.close();
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//            return e.getMessage();
//        } finally {
//            httpclient.close();
//        }
//    }
//
//    /**
//     * 获取加密后参数集合(健康之路开放平台)
//     *
//     * @param params
//     * @return
//     */
//    public  Map<String, String> getSecretParams(Map<String, String> params, String appId, String secret) {
//        String timestamp = Long.toString(System.currentTimeMillis());
//        params.put("timestamp", timestamp);
//        StringBuilder stringBuilder = new StringBuilder();
//
//        // 对参数名进行字典排序  
//        String[] keyArray = params.keySet().toArray(new String[0]);
//        Arrays.sort(keyArray);
//        // 拼接有序的参数名-值串  
//        stringBuilder.append(appId);
//        for (String key : keyArray) {
//            stringBuilder.append(key).append(params.get(key));
//        }
//        String codes = stringBuilder.append(secret).toString();
//        String sign = org.apache.commons.codec.digest.DigestUtils.shaHex(codes).toUpperCase();
//        // 添加签名,并发送请求  
//        params.put("appId", appId);
//        params.put("sign", sign);
//
//        return params;
//    }
//
//
//    public  String postBody(String url, JSONObject params) {
//        RestTemplate restTemplate = new RestTemplate();
//        HttpHeaders headers = new HttpHeaders();
//        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
//        headers.setContentType(type);
//        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
//        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
//        String ret = restTemplate.postForObject(url, formEntity, String.class);
//        return ret;
//    }
//
//    public  void putBody(String url, JSONObject params) {
//        RestTemplate restTemplate = new RestTemplate();
//        HttpHeaders headers = new HttpHeaders();
//        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
//        headers.setContentType(type);
//        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
//        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params.toString(), headers);
//        restTemplate.put(url, formEntity, String.class);
//    }
//
//
//    /**
//     * 发送post请求
//     *
//     * @param url     请求地址
//     * @param params  请求参数
//     * @return
//     */
//    public String iotPostBody(String url, String params) {
//        RestTemplate restTemplate = new RestTemplate();
//        HttpHeaders headers = new HttpHeaders();
//        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
//        headers.setContentType(type);
//        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
//        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params, headers);
//        String ret = restTemplate.postForObject(url, formEntity, String.class);
//        return ret;
//    }
//    /**
//     * 发送post请求
//     *
//     * @param url     请求地址
//     * @param params  请求参数
//     * @param chatSet 编码格式
//     * @param headerMap 请求头
//     * @return
//     */
//    public  String headerPost(String url, List<NameValuePair> params, String chatSet, Map<String,Object> headerMap) {
//        // 创建默认的httpClient实例.
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        // 创建httppost
//        HttpPost httppost = new HttpPost(url);
//        UrlEncodedFormEntity uefEntity;
//        try {
//            uefEntity = new UrlEncodedFormEntity(params, chatSet);
//            httppost.setEntity(uefEntity);
//            for(String str:headerMap.keySet()){
//                httppost.addHeader(str,headerMap.get(str).toString());
//            }
//            CloseableHttpResponse response = httpclient.execute(httppost);
//            try {
//                HttpEntity entity = response.getEntity();
//                if (entity != null) {
//                    return EntityUtils.toString(entity, chatSet);
//                }
//            } finally {
//                response.close();
//            }
//        } catch (ClientProtocolException e) {
//            e.printStackTrace();
//        } catch (UnsupportedEncodingException e1) {
//            e1.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            // 关闭连接,释放资源
//            try {
//                httpclient.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return null;
//    }
//
//    public  String get(String url, String chatSet,Map<String,Object> headerMap) {
//        CloseableHttpClient httpclient = HttpClients.createDefault();
//        try {
//            // 创建httpget.
//            url= url.replaceAll(" ", "%20");
//            HttpGet httpget = new HttpGet(url);
//            for(String str:headerMap.keySet()){
//                httpget.addHeader(str,headerMap.get(str).toString());
//            }
//            // 执行get请求.
//            CloseableHttpResponse response = httpclient.execute(httpget);
//            try {
//                // 获取响应实体
//                HttpEntity entity = response.getEntity();
//                if (entity != null) {
//                    return EntityUtils.toString(entity, chatSet);
//                }
//            } finally {
//                response.close();
//            }
//        } catch (ClientProtocolException e) {
//            e.printStackTrace();
//        } catch (ParseException e) {
//            e.printStackTrace();
//        } catch (IOException e) {
//            e.printStackTrace();
//        } finally {
//            // 关闭连接,释放资源
//            try {
//                httpclient.close();
//            } catch (IOException e) {
//                e.printStackTrace();
//            }
//        }
//        return null;
//    }
//
//
//    /**
//     * 向指定 URL 发送POST方法的请求
//     *
//     * @param url
//     *            发送请求的 URL带上参数
//     * @param param
//     *            POST参数。
//     * @return 所代表远程资源的响应结果
//     */
//    public  String sendPost(String url, String param) {
//        StringBuffer buffer = new StringBuffer();
//        PrintWriter out = null;
//        BufferedReader in = null;
//        HttpURLConnection conn = null;
//        try {
//            URL realUrl = new URL(url);
//            // 打开和URL之间的连接
//            conn = (HttpURLConnection) realUrl.openConnection();
//            conn.setRequestMethod("POST");
//            conn.setDoOutput(true);
//            conn.setDoInput(true);
//            conn.setUseCaches(false);
//            conn.setRequestProperty("Content-Type", "application/json");
//            conn.setRequestProperty("accept", "*/*");
//            conn.setRequestProperty("connection", "Keep-Alive");
//            conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
//            OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
//            osw.write(param.toString());
//            osw.flush();
//
//            // 读取返回内容
//            BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
//            String temp;
//            while ((temp = br.readLine()) != null) {
//                buffer.append(temp);
//                buffer.append("\n");
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        } finally {
//            try {
//                if (out != null) {
//                    out.close();
//                }
//                if (in != null) {
//                    in.close();
//                }
//            } catch (IOException ex) {
//                ex.printStackTrace();
//            }
//        }
//        return buffer.toString();
//    }
//}

+ 2 - 0
server/svr-authentication/src/main/resources/application.yml

@ -146,6 +146,8 @@ zhongshanHospital:
  user-info-uri: http://laptop-u738dn2p:10023/mqsdk/getUserInfoByOpenid
fastDFS:
  fastdfs_file_url: http://172.26.0.110:8888/
wlyy:
  url: http://www.xmtyw.cn/wlyy/
#文件服务器上传配置 0本地,1.I健康,2.内网调用
testPattern:
  sign: 0

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

@ -39,6 +39,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@ -364,52 +365,16 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO> data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		List<Map<String,Object>>  data = imService.findConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time);
		
		if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
					continue;
				}
				JSONObject json = new JSONObject();
				json.put("id", consult.getId());
				// 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
				json.put("type", consult.getType());
				
			for(Map<String,Object> consult :data){
				//如果是协同门诊,多返回全科医生的详细信息
				if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
					json.put("generalDoctorName", baseDoctorDO.getName());
				if(13 == Integer.parseInt((String)consult.get("type")) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					consult.put("generalDoctorName", baseDoctorDO.getName());
				}
				
				// 设置显示标题
				json.put("title", consult.getTitle());
				// 设置主诉
				json.put("symptoms", consult.getSymptoms());
				// 咨询状态
				json.put("status", consult.getStatus());
				// 设置咨询日期
				json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
				//是否评价
				json.put("evaluate", consult.getEvaluate());
				//患者ID
				json.put("patientId", consult.getPatientId());
				//患者性别
				json.put("patientsex", consult.getPatientsex());
				//患者姓名
				json.put("patientName", consult.getPatientName());
				//患者年龄
				json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
				//就诊记录ID
				json.put("outpatientId", consult.getOutpatientid());
				//图文或者视频类型
				json.put("consultType", consult.getConsultType());
				//诊断
				json.put("icd10Name", consult.getIcd10Name());
				
				array.add(json);
			}
		}
		
@ -417,7 +382,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		result.put("list",data);
		return success(result);
	}
	
@ -614,71 +579,24 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
			@ApiParam(name = "pagesize", value = "分页大小")
			@RequestParam(value = "pagesize",required = false) int pagesize
	)throws Exception{
		JSONArray array = new JSONArray();
		List<ConsultVO> data = imService.findexpertConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time,patient);
		List<Map<String,Object>>  data = imService.findexpertConsultRecordByDoctor(doctor, id,type,status, page,pagesize, title,start_time,end_time,patient);
		
		if (data != null) {
			for (ConsultVO consult : data) {
				if (consult == null) {
					continue;
				}
				JSONObject json = new JSONObject();
				json.put("id", consult.getId());
				// 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
				json.put("type", consult.getType());
			for (Map<String,Object> consult : data) {
				
				//如果是协同门诊,多返回全科医生的详细信息
				if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
					json.put("generalDoctorName", baseDoctorDO.getName());
				if(13 == Integer.parseInt((String)consult.get("type")) && StringUtils.isNoneBlank((String)consult.get("generalDoctor"))){
					BaseDoctorDO baseDoctorDO = baseDoctorDao.findById((String)consult.get("generalDoctor"));
					consult.put("generalDoctorName", baseDoctorDO.getName());
				}
				
				List<BaseDoctorHospitalDO> hospitalDOs =  baseDoctorHospitalDao.findByDoctorCode(doctor);
				if(hospitalDOs!=null&&hospitalDOs.size()>0){
					json.put("hospital",hospitalDOs.get(0));
//					BaseOrgDO org = baseOrgDao.findByCode(hospitalDOs.get(0).getOrgCode());
//					rs.put("winNo",org.getWinNo());
//					json.put("deptName",hospitalDOs.get(0).getDeptName());
//					json.put("dept",hospitalDOs.get(0).getDeptCode());
					consult.put("hospital",hospitalDOs.get(0));
				}else{
					json.put("hospital",null);
//					json.put("winNo",null);
//					json.put("deptName",null);
//					json.put("dept",null);
					consult.put("hospital",null);
				}
				
				//医生职称
				json.put("jobTitleName", consult.getJobTitleName());
				//医生名称
				json.put("doctorName", consult.getDoctorName());
				
				// 设置显示标题
				json.put("title", consult.getTitle());
				// 设置主诉
				json.put("symptoms", consult.getSymptoms());
				// 咨询状态
				json.put("status", consult.getStatus());
				// 设置咨询日期
				json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
				//是否评价
				json.put("evaluate", consult.getEvaluate());
				
				//患者ID
				json.put("patientId", consult.getPatientId());
				//患者性别
				json.put("patientsex", consult.getPatientsex());
				//患者姓名
				json.put("patientName", consult.getPatientName());
				//患者年龄
				json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
				//就诊记录ID
				json.put("outpatientId", consult.getOutpatientid());
				//图文或者视频类型
				json.put("consultType", consult.getConsultType());
				//诊断
				json.put("icd10Name", consult.getIcd10Name());
				
				array.add(json);
			}
		}
		
@ -686,7 +604,7 @@ public class DoctorConsultEndpoint extends EnvelopRestEndpoint {
		
		JSONObject result = new JSONObject();
		result.put("total",total);
		result.put("list",array);
		result.put("list",data);
		return success(result);
	}
	

File diff suppressed because it is too large
+ 96 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/expressage/DoctorExpressageEndpoint.java


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

@ -2,6 +2,7 @@ package com.yihu.jw.hospital.endpoint.prescription;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.WlyyOutpatientDO;
import com.yihu.jw.entity.hospital.prescription.WlyyPrescriptionDiagnosisDO;
@ -953,72 +954,32 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
                                      @RequestParam(value = "type",required = true) String type)throws Exception{
    
        com.alibaba.fastjson.JSONArray array = new com.alibaba.fastjson.JSONArray();
        List<ConsultVO> data = imService.doctorUpcomingList(doctorCode, type);
        List<Map<String,Object>>  data = imService.doctorUpcomingList(doctorCode, type);
    
        if (data != null) {
            for (ConsultVO consult : data) {
                if (consult == null) {
                    continue;
                }
                com.alibaba.fastjson.JSONObject json = new com.alibaba.fastjson.JSONObject();
                json.put("id", consult.getId());
                // 设置咨询类型:1专家咨询,9在线复诊,待扩展,13协同门诊
                json.put("type", consult.getType());
//
//                //如果是协同门诊,多返回全科医生的详细信息
//                if(13 == consult.getType() && StringUtils.isNoneBlank(consult.getGeneralDoctor())){
//                    BaseDoctorDO baseDoctorDO = baseDoctorDao.findById(consult.getGeneralDoctor());
//                    json.put("generalDoctorName", baseDoctorDO.getName());
//                }
            
                // 设置显示标题
                json.put("title", consult.getTitle());
                // 设置主诉
                json.put("symptoms", consult.getSymptoms());
                // 咨询状态
                json.put("status", consult.getStatus());
                // 设置咨询日期
                json.put("czrq", DateUtil.dateToStrLong(consult.getCzrq()));
                //是否评价
                json.put("evaluate", consult.getEvaluate());
            
                //患者ID
                json.put("patientId", consult.getPatientId());
                //患者性别
                json.put("patientsex", consult.getPatientsex());
                //患者姓名
                json.put("patientName", consult.getPatientName());
                //患者年龄
                json.put("patientAge", DateUtil.getAgeForIdcard(consult.getPatientIdcard()));
                //就诊记录ID
                json.put("outpatientId", consult.getOutpatientid());
                //就诊记录状态
                json.put("outpatientstatus", consult.getOutpatientstatus());
                // 设置咨询日期
                json.put("registerDate", DateUtil.dateToStrLong(consult.getRegisterDate()));
                //图文或者视频类型
                json.put("consultType", consult.getConsultType());
                //诊断
                json.put("icd10Name", consult.getIcd10Name());
            for (Map<String,Object> consult : data) {
                
                Integer consultType =  Integer.parseInt((String)consult.get("type"));
                
                if("1,15".equals(type)){//专家咨询
                    if(1 == consult.getType()){//专家咨询
                        json.put("session_id", consult.getPatientId()+"_"+ consult.getDoctorCode()+"_1");
                    }else if(15 == consult.getType()){//家医求助
                        json.put("session_id", consult.getPatientId()+"_"+ consult.getGeneralDoctor()+"_"+ consult.getDoctorCode()+"_15");
                if("1,15".equals(consultType)){//专家咨询
                    if(1 == consultType){//专家咨询
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("doctorCode").toString()+"_1");
                    }else if(15 == consultType){//家医求助
                        consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("generalDoctor").toString()+"_"+ consult.get("doctorCode").toString()+"_15");
                    }else{}
                }else if("9".equals(type)){//图文复诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_9");
                    json.put("type",type);
                }else if("16".equals(type)){//视频复诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_16");
                    json.put("type",type);
                }else if("9".equals(consultType)){//图文复诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientid").toString()+"_9");
                    consult.put("type",consultType);
                }else if("16".equals(consultType)){//视频复诊
                    consult.put("session_id", consult.get("patientId").toString()+"_"+ consult.get("outpatientid").toString()+"_16");
                    consult.put("type",consultType);
                }else if("12".equals(type)){//协同门诊
                    json.put("session_id", consult.getPatientId()+"_"+ consult.getOutpatientid()+"_12");
                    json.put("type",type);
                    consult.put("session_id", consult.get("patientId").toString()+"_"+consult.get("outpatientid").toString()+"_12");
                    consult.put("type",consultType);
                }else{}
            
                array.add(json);
                array.add(consult);
            }
        }
        return success(array);

+ 18 - 13
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java

@ -1,22 +1,16 @@
package com.yihu.iot.controller.common;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -29,22 +23,33 @@ public class IotSystemDictController extends EnvelopRestEndpoint {
    @Autowired
    private IotSystemDictService iotSystemDictService;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    @GetMapping(value = IotRequestMapping.System.findDictByCode)
    @ApiOperation(value = "获取字典列表(不分页)")
    public MixEnvelop<IotSystemDictVO, IotSystemDictVO> getList(
    public MixEnvelop<IotSystemDictDO, IotSystemDictDO> getList(
            @ApiParam(name = "dictName", value = "字典名称", defaultValue = "COMPANY_TYPE")
            @RequestParam(value = "dictName", required = true) String dictName) throws Exception {
        try {
            List<IotSystemDictDO> doList = iotSystemDictDao.findByDictName(dictName);
            List<IotSystemDictVO> voList = convertToModels(doList,new ArrayList<IotSystemDictVO>(doList.size()),IotSystemDictVO.class);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,voList);
            List<IotSystemDictDO> doList = iotSystemDictService.getListByDictName(dictName);
//            List<IotSystemDictVO> voList = convertToModels(doList,new ArrayList<IotSystemDictVO>(doList.size()),IotSystemDictVO.class);
            return MixEnvelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,doList);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError("查询失败");
        }
    }
    @PostMapping(value = IotRequestMapping.System.createDict)
    @ApiOperation(value = "创建字典", notes = "创建字典")
    public MixEnvelop<IotSystemDictDO, IotSystemDictDO> create(@ApiParam(name = "jsonData", value = "字典json", defaultValue = "{\"value\":\"血糖仪\", \"dictName\":\"DEVICE_TYPE\"}")
                                                       @RequestParam String jsonData) {
        try {
//            List<IotSystemDictDO> dictDOList = new ObjectMapper().readValue(jsonData, new TypeReference<List<IotSystemDictDO>>(){});
            IotSystemDictDO dictDO = toEntity(jsonData, IotSystemDictDO.class);
            return MixEnvelop.getSuccess(IotRequestMapping.Company.message_success_create, iotSystemDictService.create(dictDO));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 6 - 2
svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotSystemDictDao.java

@ -13,7 +13,11 @@ import java.util.List;
public interface IotSystemDictDao extends PagingAndSortingRepository<IotSystemDictDO,String>,
        JpaSpecificationExecutor<IotSystemDictDO> {
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY sort")
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY w.parentCode,sort")
    List<IotSystemDictDO> findByDictName(String dictName);
    
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY w.code desc ")
    List<IotSystemDictDO> getAllByDictNameAndOrderByCodeDesc(String dictName);
    IotSystemDictDO findByDictNameAndCodeAndDel(String dictName, String code, Integer del);
}

+ 42 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -5,9 +5,11 @@ import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.common.MyJdbcTemplate;
import com.yihu.jw.entity.iot.dict.IotSystemDictDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -39,6 +41,45 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
    }
    public IotSystemDictDO create(IotSystemDictDO dictDO) {
        String value = dictDO.getValue();
        String parentCode = dictDO.getParentCode();
        //判断新增或者编辑
        if(StringUtils.isNotBlank(dictDO.getCode())){
            dictDO = iotSystemDictDao.findByDictNameAndCodeAndDel(dictDO.getDictName(), dictDO.getCode(), 1);
            dictDO.setValue(value);
            dictDO.setParentCode(parentCode);
            dictDO.setUpdateTime(new Date());
        }else {
            //获取最近一条添加记录的code
            List<IotSystemDictDO> dictDOList = iotSystemDictDao.getAllByDictNameAndOrderByCodeDesc(dictDO.getDictName());
            if(dictDOList.size() > 0){
                dictDO.setCode((Long.parseLong(dictDOList.get(0).getCode()) + 1) + "");
            }else {
                dictDO.setCode("1");
            }
            dictDO.setSaasId(getCode());
            dictDO.setDel(1);
            dictDO.setCreateTime(new Date());
        }
        iotSystemDictDao.save(dictDO);
        return dictDO;
    }
    /**
     * 根据字典类名获取相关字典数据
     * @param dictName
     * @return
     */
    public List<IotSystemDictDO> getListByDictName(String dictName){
        List<IotSystemDictDO> systemDictDOList = iotSystemDictDao.findByDictName(dictName);
        for(IotSystemDictDO dictDO : systemDictDOList){
            if(StringUtils.isNotBlank(dictDO.getParentCode())){
                //获取父类字典名称
                IotSystemDictDO parentDict = iotSystemDictDao.findOne(dictDO.getParentCode());
                dictDO.setParentName(parentDict.getValue());
            }
        }
        return systemDictDOList;
    }
}

+ 1 - 1
svr/svr-iot/src/main/resources/application.yml

@ -81,7 +81,7 @@ fastDFS:
spring:
  profiles: dev
  datasource:
    url: jdbc:mysql://172.26.0.204:3306/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    url: jdbc:mysql://172.26.0.104:3306/xmiot?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: ssgg
    password: ssgg@jkzl2019
  elasticsearch: