Sfoglia il codice sorgente

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

wangzhinan 4 anni fa
parent
commit
979abc8af8
16 ha cambiato i file con 355 aggiunte e 44 eliminazioni
  1. 9 0
      business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java
  2. 15 5
      business/base-service/src/main/java/com/yihu/jw/hospital/prescription/service/PrescriptionService.java
  3. 6 0
      business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateDao.java
  4. 13 1
      common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java
  5. 9 0
      common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateDO.java
  6. 3 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/hospital/BaseHospitalRequestMapping.java
  7. 30 0
      common/common-rest-model-es/src/main/java/iot/device/LocationDataVO.java
  8. 19 18
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/consult/PatientConsultEndpoint.java
  9. 18 17
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java
  10. 12 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/prescription/PrescriptionEndpoint.java
  11. 33 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/survey/SurveyEndpoint.java
  12. 129 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java
  13. 19 0
      svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java
  14. 2 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java
  15. 33 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  16. 5 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

+ 9 - 0
business/base-service/src/main/java/com/yihu/jw/doctor/service/BaseDoctorInfoService.java

@ -6,6 +6,7 @@ import com.yihu.jw.doctor.dao.DoctorSpecialDiseaseDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.base.doctor.DoctorSpecialDiseaseDo;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.message.BaseBannerDoctorDO;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
@ -372,4 +373,12 @@ public class BaseDoctorInfoService extends BaseJpaService<BaseDoctorDO, BaseDoct
        List<BaseDoctorDO> doctors = baseDoctorDao.findByIdcard(idcard);
        return doctors;
    }
    public BaseDoctorDO popularityIncrease(String doctor){
        BaseDoctorDO baseDoctorDO=baseDoctorDao.findById(doctor);
        if (null!=baseDoctorDO){
            baseDoctorDO.setPopularity(baseDoctorDO.getPopularity()+1);
        }
        baseDoctorDO = baseDoctorDao.save(baseDoctorDO);
        return baseDoctorDO;
    }
}

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

@ -3096,6 +3096,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
            rs.put("visitDept",doctorDO.getVisitDept());
            rs.put("learning",doctorDO.getLearning());
            rs.put("sex",doctorDO.getSex());
            rs.put("popularity",doctorDO.getPopularity());
            //机构科室信息
            List<BaseDoctorHospitalDO> hospitalDOs = baseDoctorHospitalDao.findByDoctorCode(doctorDO.getId());
@ -4436,7 +4437,7 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
     * @param consutlSort
     * @return
     */
    public List<Map<String, Object>> findDoctorByHospitalAndDiseaseAndDept(String iswork, String patientid, String orgCode, String dept,
    public MixEnvelop findDoctorByHospitalAndDiseaseAndDept(String iswork, String patientid, String orgCode, String dept,
                                                                           String diseaseKey, String doctorNameKey,
                                                                           String jobTitleNameKey, String outpatientType,
                                                                           String keyName, String workingTime, String consultStatus, String chargType, String consutlSort, String isAttention, Integer page, Integer pagesize) {
@ -4583,13 +4584,22 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
        }
        sql += " and d.del='1' order by a.total " + consutlSort;
        String sqlCount = "select count(1) as \"total\" from ( "+sql+" ) t";
        List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql, params, page, pagesize);
        List<Map<String, Object>> listCount = hibenateUtils.createSQLQuery(sqlCount, params);
        Long count = 0L;
        if(listCount!=null){
            //mysql 与 Oracle 聚合函数返回类型不一致,需要判断装换
            count = hibenateUtils.objTransformLong(listCount.get(0).get("total"));
        }
        logger.info("findDoctorByHospitalAndDiseaseAndDept end:" + DateUtil.dateToStr(new Date(), "yyyy-MM-dd HH:mm:ss:SSS"));
        logger.info("sql:" + sql);
        return list;
        MixEnvelop envelop =new MixEnvelop();
        envelop.setDetailModelList(list);
        envelop.setTotalCount(count.intValue());
        envelop.setPageSize(pagesize);
        envelop.setCurrPage(page);
        return envelop;
    }
    /**

+ 6 - 0
business/base-service/src/main/java/com/yihu/jw/hospital/survey/dao/SurveyTemplateDao.java

@ -2,10 +2,16 @@ package com.yihu.jw.hospital.survey.dao;
import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateDO;
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 Trick on 2019/9/6.
 */
public interface SurveyTemplateDao extends PagingAndSortingRepository<WlyySurveyTemplateDO, String>, JpaSpecificationExecutor<WlyySurveyTemplateDO> {
    @Query(value = "select * from wlyy_survey_template t where t.creater = ?1" ,nativeQuery = true)
    List<WlyySurveyTemplateDO> getMyTemplate(String doctor);
}

+ 13 - 1
common/common-entity/src/main/java/com/yihu/jw/entity/base/doctor/BaseDoctorDO.java

@ -235,8 +235,20 @@ public class BaseDoctorDO extends UuidIdentityEntityWithOperator {
     * 学术背景
     */
    private String learning;
    /**
     * 人气值
     */
    private Integer popularity;
    @Column(name = "popularity")
    public Integer getPopularity() {
        return popularity;
    }
    public void setPopularity(Integer popularity) {
        this.popularity = popularity;
    }
	@Column(name = "password")
    @Column(name = "password")
    public String getPassword() {
        return password;
    }

+ 9 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/hospital/survey/WlyySurveyTemplateDO.java

@ -22,6 +22,7 @@ public class WlyySurveyTemplateDO {
    private String creater;//创建人',
    private String organization;//发布机构',
    private String del;//删除标志(1正常,0删除)',
    private Integer used;//常用量',
    private Date createTime;//创建时间',
    private Date updateTime;//修改时间',
@ -92,4 +93,12 @@ public class WlyySurveyTemplateDO {
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getUsed() {
        return used;
    }
    public void setUsed(Integer used) {
        this.used = used;
    }
}

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

@ -476,6 +476,7 @@ public class BaseHospitalRequestMapping {
        public static final String findProvince="/findProvince";
        public static final String findCity="/findCity";
        public static final String findPatientOpenId="/findPatientOpenId";
        public static final String popularityIncrease="/popularityIncrease";
        public static final String selectByUrl="/selectByUrl";
@ -1128,6 +1129,8 @@ public class BaseHospitalRequestMapping {
        public static final String findSurveyTemplateResult  = "/findSurveyTemplateResult";
        public static final String findQuestionInfoList  = "/findQuestionInfoList";
        public static final String findAnswerList  = "/findAnswerList";
        public static final String getSurveyList  = "/getSurveyList";
        public static final String setUsed  = "/setUsed";

+ 30 - 0
common/common-rest-model-es/src/main/java/iot/device/LocationDataVO.java

@ -40,6 +40,36 @@ public class LocationDataVO {
    @ApiModelProperty("创建时间")
    private String createTime;
    @ApiModelProperty("居民姓名")
    private String name;
    @ApiModelProperty("居民编码")
    private String code;
    @ApiModelProperty("设备名称")
    private String equimentName;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getEquimentName() {
        return equimentName;
    }
    public void setEquimentName(String equimentName) {
        this.equimentName = equimentName;
    }
    public String getId() {
        return id;

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

@ -23,6 +23,7 @@ import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.patient.service.BasePatientService;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
import com.yihu.jw.rm.patient.PatientRequestMapping;
@ -327,48 +328,48 @@ public class PatientConsultEndpoint extends EnvelopRestEndpoint {
	
	@GetMapping(value = BaseHospitalRequestMapping.Prescription.findDoctorByHospitalAndDiseaseAndDept)
	@ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
	public ListEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "iswork", value = "机构code")
	public MixEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "iswork", value = "机构code")
																 @RequestParam(value = "iswork", required = false)String iswork,
	                                                         @ApiParam(name = "patientid", value = "居民ID")
															@ApiParam(name = "patientid", value = "居民ID")
	                                                         @RequestParam(value = "patientid", required = false)String patientid,
			                                       @ApiParam(name = "orgCode", value = "机构code")
															@ApiParam(name = "orgCode", value = "机构code")
	                                               @RequestParam(value = "orgCode", required = false)String orgCode,
	                                               @ApiParam(name = "dept", value = "部门code")
															@ApiParam(name = "dept", value = "部门code")
	                                               @RequestParam(value = "dept", required = false)String dept,
	                                               @ApiParam(name = "diseaseKey", value = "疾病名称关键字")
															@ApiParam(name = "diseaseKey", value = "疾病名称关键字")
	                                               @RequestParam(value = "diseaseKey", required = false)String diseaseKey,
                                                   @ApiParam(name = "doctorNameKey", value = "医生名称关键字")
															@ApiParam(name = "doctorNameKey", value = "医生名称关键字")
	                                               @RequestParam(value = "doctorNameKey", required = false)String doctorNameKey,
                                                   @ApiParam(name = "jobTitleNameKey", value = "医生职称关键字")
															@ApiParam(name = "jobTitleNameKey", value = "医生职称关键字")
                                                   @RequestParam(value = "jobTitleNameKey", required = false)String jobTitleNameKey,
                                                   @ApiParam(name = "outpatientType", value = "咨询类型1图文,2视频")
															@ApiParam(name = "outpatientType", value = "咨询类型1图文,2视频")
                                                   @RequestParam(value = "outpatientType", required = false)String outpatientType,
                                                   @ApiParam(name = "keyName", value = "姓名/科室/疾病模糊搜索关键字")
															@ApiParam(name = "keyName", value = "姓名/科室/疾病模糊搜索关键字")
                                                   @RequestParam(value = "keyName", required = false)String keyName,
                                                   @ApiParam(name = "workingTime", value = "排班时间YYYY-MM-DD")
															@ApiParam(name = "workingTime", value = "排班时间YYYY-MM-DD")
	                                               @RequestParam(value = "workingTime", required = false)String workingTime,
	                                               @ApiParam(name = "consultStatus", value = "在线状态")
															@ApiParam(name = "consultStatus", value = "在线状态")
	                                               @RequestParam(value = "consultStatus", required = false,defaultValue = "")String consultStatus,
                                                   @ApiParam(name = "chargType", value = "医生号别")
															@ApiParam(name = "chargType", value = "医生号别")
	                                                @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
                                                   @ApiParam(name = "consutlSort", value = "咨询量排序")
															@ApiParam(name = "consutlSort", value = "咨询量排序")
                                                   @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
													@ApiParam(name = "isAttention", value = "是否关注")
															@ApiParam(name = "isAttention", value = "是否关注")
													@RequestParam(value = "isAttention", required = false)String isAttention,
	                                                 @ApiParam(name = "page", value = "第几页")
															@ApiParam(name = "page", value = "第几页")
	                                                     @RequestParam(value = "page",required = false) Integer page,
	                                                 @ApiParam(name = "pagesize", value = "分页大小")
															@ApiParam(name = "pagesize", value = "分页大小")
	                                                     @RequestParam(value = "pagesize",required = false) Integer pagesize
	) throws Exception{
		logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
		return success(prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,patientid,
		return prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,patientid,
				orgCode,dept,
				diseaseKey,doctorNameKey,
				jobTitleNameKey,outpatientType,
				keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize));
				keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
	}
	
	@GetMapping(value = BaseHospitalRequestMapping.Prescription.findHotDeptAndDiseaseDict)

+ 18 - 17
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/patient/PatientNoLoginEndPoint.java

@ -36,6 +36,7 @@ import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionInfoVO;
import com.yihu.jw.restmodel.hospital.prescription.WlyyPrescriptionVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import com.yihu.jw.rm.hospital.BaseHospitalRequestMapping;
@ -142,44 +143,44 @@ public class PatientNoLoginEndPoint extends EnvelopRestEndpoint {
    @GetMapping(value = BaseHospitalRequestMapping.PatientNoLogin.findDoctorByHospitalAndDiseaseAndDept)
    @ApiOperation(value = "根据疾病名称,热门部门查询医生", notes = "根据疾病名称,热门部门查询医生")
    public ListEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "iswork", value = "是否过滤排班,1是")
    public MixEnvelop findDoctorByHospitalAndDiseaseAndDept(@ApiParam(name = "iswork", value = "是否过滤排班,1是")
                                                             @RequestParam(value = "iswork", required = true)String iswork,
                                                             @ApiParam(name = "orgCode", value = "机构code")
                                                            @ApiParam(name = "orgCode", value = "机构code")
                                                             @RequestParam(value = "orgCode", required = true,defaultValue = "350211A1002")String orgCode,
                                                             @ApiParam(name = "dept", value = "部门code")
                                                            @ApiParam(name = "dept", value = "部门code")
                                                             @RequestParam(value = "dept", required = false)String dept,
                                                             @ApiParam(name = "diseaseKey", value = "疾病名称关键字")
                                                            @ApiParam(name = "diseaseKey", value = "疾病名称关键字")
                                                             @RequestParam(value = "diseaseKey", required = false)String diseaseKey,
                                                             @ApiParam(name = "doctorNameKey", value = "医生名称关键字")
                                                            @ApiParam(name = "doctorNameKey", value = "医生名称关键字")
                                                             @RequestParam(value = "doctorNameKey", required = false)String doctorNameKey,
                                                             @ApiParam(name = "jobTitleNameKey", value = "医生职称关键字")
                                                            @ApiParam(name = "jobTitleNameKey", value = "医生职称关键字")
                                                             @RequestParam(value = "jobTitleNameKey", required = false)String jobTitleNameKey,
                                                             @ApiParam(name = "outpatientType", value = "咨询类型1图文,2视频")
                                                            @ApiParam(name = "outpatientType", value = "咨询类型1图文,2视频")
                                                             @RequestParam(value = "outpatientType", required = false)String outpatientType,
                                                             @ApiParam(name = "keyName", value = "姓名/科室/疾病模糊搜索关键字")
                                                            @ApiParam(name = "keyName", value = "姓名/科室/疾病模糊搜索关键字")
                                                             @RequestParam(value = "keyName", required = false)String keyName,
                                                             @ApiParam(name = "workingTime", value = "排班时间YYYY-MM-DD")
                                                            @ApiParam(name = "workingTime", value = "排班时间YYYY-MM-DD")
                                                             @RequestParam(value = "workingTime", required = false)String workingTime,
                                                             @ApiParam(name = "consultStatus", value = "在线状态")
                                                            @ApiParam(name = "consultStatus", value = "在线状态")
                                                             @RequestParam(value = "consultStatus", required = false,defaultValue = "")String consultStatus,
                                                             @ApiParam(name = "chargType", value = "医生号别")
                                                            @ApiParam(name = "chargType", value = "医生号别")
                                                             @RequestParam(value = "chargType", required = false,defaultValue = "")String chargType,
                                                             @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                            @ApiParam(name = "consutlSort", value = "咨询量排序")
                                                             @RequestParam(value = "consutlSort", required = true,defaultValue = "DESC")String consutlSort,
                                                             @ApiParam(name = "isAttention", value = "是否关注 1:关注 0:不关注 不传:查所有")
                                                            @ApiParam(name = "isAttention", value = "是否关注 1:关注 0:不关注 不传:查所有")
                                                                 @RequestParam(value = "isAttention", required = false)String isAttention,
                                                             @ApiParam(name = "page", value = "第几页")
                                                            @ApiParam(name = "page", value = "第几页")
                                                             @RequestParam(value = "page",required = false) Integer page,
                                                             @ApiParam(name = "pagesize", value = "分页大小")
                                                            @ApiParam(name = "pagesize", value = "分页大小")
                                                             @RequestParam(value = "pagesize",required = false) Integer pagesize
    ) throws Exception{
        logger.info("findDoctorByHospitalAndDiseaseAndDept start:"+ DateUtil.dateToStr(new Date(),"yyyy-MM-dd HH:mm:ss:SSS"));
        return success(prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,null,
        return prescriptionService.findDoctorByHospitalAndDiseaseAndDept(iswork,null,
                orgCode,dept,
                diseaseKey,doctorNameKey,
                jobTitleNameKey,outpatientType,
                keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize));
                keyName,workingTime,consultStatus,chargType,consutlSort,isAttention,page,pagesize);
    }

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

@ -5,12 +5,14 @@ import com.yihu.jw.area.service.BaseCityService;
import com.yihu.jw.area.service.BaseCommitteeService;
import com.yihu.jw.area.service.BaseProvinceService;
import com.yihu.jw.area.service.BaseTownService;
import com.yihu.jw.doctor.service.BaseDoctorInfoService;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeExcelReader;
import com.yihu.jw.doctor.service.excel.DoctorWorkTimeMainExcelDO;
import com.yihu.jw.entity.base.area.BaseCityDO;
import com.yihu.jw.entity.base.area.BaseCommitteeDO;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
import com.yihu.jw.entity.base.area.BaseTownDO;
import com.yihu.jw.entity.base.doctor.BaseDoctorDO;
import com.yihu.jw.entity.hospital.message.SystemMessageDO;
import com.yihu.jw.entity.hospital.prescription.*;
import com.yihu.jw.hospital.mapping.service.PatientMappingService;
@ -109,6 +111,8 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
    private BaseCityService baseCityService;
    @Autowired
    private PatientMappingService patientMappingService;
    @Autowired
    private BaseDoctorInfoService baseDoctorInfoService;
    @Value("${demo.flag}")
    private boolean demoFlag;
@ -1949,4 +1953,12 @@ public class PrescriptionEndpoint extends EnvelopRestEndpoint {
            return ObjEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = BaseHospitalRequestMapping.Prescription.popularityIncrease)
    @ApiOperation(value = "医生人气值增长")
    public Envelop popularityIncrease (
            @ApiParam(name = "doctor", value = "医生id")
            @RequestParam(value = "doctor", required = false) String doctor) throws Exception {
        BaseDoctorDO baseDoctorDO=baseDoctorInfoService.popularityIncrease(doctor);
        return  success("操作成功",baseDoctorDO);
    }
}

+ 33 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/endpoint/survey/SurveyEndpoint.java

@ -1,7 +1,9 @@
package com.yihu.jw.hospital.endpoint.survey;
import com.yihu.jw.hospital.service.consult.BasePatientBusinessService;
import com.yihu.jw.hospital.survey.service.SurveyService;
import com.yihu.jw.restmodel.hospital.consult.WlyyHospitalSysDictVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
@ -26,6 +28,9 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
    @Autowired
    private SurveyService surveyService;
    @Autowired
    private BasePatientBusinessService businessService;
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.findSurveyLabel)
    @ApiOperation(value = "问题-查询字典")
    public ListEnvelop findSurveyLabel(@ApiParam(name = "name", value = "1.surveyLabel 标签;2.surveyScreenLabel 问卷类型")
@ -223,4 +228,32 @@ public class SurveyEndpoint extends EnvelopRestEndpoint {
        return surveyService.findAnswerList(tempId,patient,title,page,size);
    }
    //=================
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.getSurveyList)
    @ApiOperation(value = "查询问卷模板")
    public Envelop getUsedList(@ApiParam(name = "title", value = "模板名称")
                                     @RequestParam(value = "title",required = false) String title,
                               @ApiParam(name = "doctor", value = "医生id")
                                     @RequestParam(value = "doctor",required = false) String doctor,
                               @ApiParam(name = "used", value = "是否常用")
                                     @RequestParam(value = "used",required = false) Integer used,
                               @ApiParam(name = "page", value = "第几页,1开始",defaultValue = "1")
                                     @RequestParam(value = "page",required = true,defaultValue = "1")Integer page,
                               @ApiParam(name = "pageSize", value = "每页大小",defaultValue = "10")
                                     @RequestParam(value = "pageSize",required = true,defaultValue = "10")Integer pageSize)throws Exception {
        return success(businessService.getUsedList(title,doctor,used,page,pageSize));
    }
    @GetMapping(value = BaseHospitalRequestMapping.WlyySurvey.setUsed)
    @ApiOperation(value = "设置模板为常用")
    public Envelop setUsed(@ApiParam(name = "tempId", value = "模板id")
                                     @RequestParam(value = "tempId",required = false) String tempId,
                                     @ApiParam(name = "used", value = "是否常用")
                                     @RequestParam(value = "used",required = false) Integer used,
                                     @ApiParam(name = "doctor", value = "医生id")
                                     @RequestParam(value = "doctor",required = false) String doctor)throws Exception {
        businessService.setUsed(tempId,used,doctor);
        return success("操作成功");
    }
}

+ 129 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/BasePatientBusinessService.java

@ -6,16 +6,23 @@ import com.yihu.jw.entity.base.patient.BasePatientBusinessDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyTemplateDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.survey.dao.SurveyTemplateDao;
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.util.date.DateUtil;
import com.yihu.jw.utils.hibernate.HibenateUtils;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.provider.HibernateUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 患者文章业务层代码
@ -33,6 +40,10 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
	private BasePatientDao patientDao;
	@Autowired
	private BaseDoctorDao doctorDao;
	@Autowired
	private SurveyTemplateDao surveyTemplateDao;
	@Autowired
	private HibenateUtils hibenateUtils;
	/**
	 *
	 * @param id
@ -152,5 +163,123 @@ public class BasePatientBusinessService extends BaseJpaService<BasePatientBusine
		}
		return knowledgeArticleUserDO;
	}
	public void setUsed(String id,Integer used,String doctor){
		WlyySurveyTemplateDO wlyySurveyTemplateDO = surveyTemplateDao.findOne(id);
		BaseDoctorDO doctorDO = doctorDao.findById(doctor);
		KnowledgeArticleUserDO knowledgeArticleUserDO =knowledgeArticleUserDao.findByrelationCodeAndUserAndDel(id,doctor);
		if (null==knowledgeArticleUserDO){
			knowledgeArticleUserDO = new KnowledgeArticleUserDO();
			knowledgeArticleUserDO.setUsed(used);
			knowledgeArticleUserDO.setRelationCode(id);
			knowledgeArticleUserDO.setRelationName(wlyySurveyTemplateDO.getTitle());
			knowledgeArticleUserDO.setRelationType(1);
			knowledgeArticleUserDO.setDel(1);
			knowledgeArticleUserDO.setUser(doctor);
			if (doctorDO!=null){
				knowledgeArticleUserDO.setUserName(doctorDO.getName());
				knowledgeArticleUserDO.setCreateUserName(doctorDO.getName());
			}
			knowledgeArticleUserDO.setCreateTime(new Date());
			knowledgeArticleUserDO.setUpdateTime(new Date());
			knowledgeArticleUserDO.setCreateUser(doctor);
			knowledgeArticleUserDO.setUpdateUser(doctor);
			knowledgeArticleUserDO = knowledgeArticleUserDao.save(knowledgeArticleUserDO);
		}
		if (wlyySurveyTemplateDO!=null){
			if (wlyySurveyTemplateDO.getUsed()!=null){
				if (used==1){
					knowledgeArticleUserDO.setUsed(1);
					wlyySurveyTemplateDO.setUsed(wlyySurveyTemplateDO.getUsed()+1);
				}else if (used==0){
					knowledgeArticleUserDO.setUsed(0);
					wlyySurveyTemplateDO.setUsed(wlyySurveyTemplateDO.getUsed()==0?0:wlyySurveyTemplateDO.getUsed()-1);
				}
			}else {
				if (used==1){
					wlyySurveyTemplateDO.setUsed(1);
				}else if (used==0){
					wlyySurveyTemplateDO.setUsed(0);
				}
			}
		}
		knowledgeArticleUserDao.save(knowledgeArticleUserDO);
		surveyTemplateDao.save(wlyySurveyTemplateDO);
	}
	public List<Map<String,Object>> getUsedList(String title,String doctor,Integer used,Integer page,Integer pageSize) {
		StringBuffer sql = new StringBuffer();
		sql.append("select a.id AS \"id\" ,a.title AS \"title\",a.template_comment AS \"template_comment\" ," +
				" a.organization AS \"organization\",a.create_time AS \"create_time\" ," +
				"a.creater AS \"creater\"FROM wlyy_survey_template a ");
		//1为查询常用
		if (null != used) {
			if (1 == used) {
				sql.append("JOIN wlyy_knowledge_article_user b on a.id = b.relation_code " +
						"where 1=1");
				sql.append(" and b.used = 1");
				if (StringUtils.isNotEmpty(doctor)) {
					sql.append(" and a.title like '%" + title + "%'");
				}
				if (StringUtils.isNotEmpty(doctor)) {
					sql.append(" and a.creater = '" + doctor + "'");
				}
				List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
				if (list.size() > 0) {
					for (Map<String, Object> map : list) {
						String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
						String creater = null == map.get("creater") ? "" : map.get("creater").toString();
						map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
						BaseDoctorDO doctorDO = doctorDao.findById(creater);
						if (null!=doctor){
							map.put("doctrName", doctorDO.getName());
						}
					}
				}
				return list;
				//0为查询模板
			} else {
				sql.append("where a.del = 1");
				if (StringUtils.isNotEmpty(doctor)) {
					sql.append(" and a.title like '%" + title + "%'");
				}
				List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
				if (list.size() > 0) {
					for (Map<String, Object> map : list) {
						String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
						String creater = null == map.get("creater") ? "" : map.get("creater").toString();
						map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
						BaseDoctorDO doctorDO = doctorDao.findById(creater);
						if (null!=doctor){
							map.put("doctrName", doctorDO.getName());
						}
					}
				}
				return list;
			}
			//空位查我的问卷
		} else {
			sql.append("where a.del = 1");
			if (StringUtils.isNotEmpty(doctor)) {
				sql.append(" and a.creater = '" + doctor + "'");
			}
			if (StringUtils.isNotEmpty(doctor)) {
				sql.append(" and a.title like '%" + title + "%'");
			}
			List<Map<String, Object>> list = hibenateUtils.createSQLQuery(sql.toString(), page, pageSize);
			if (list.size() > 0) {
				for (Map<String, Object> map : list) {
					String createTime = null == map.get("create_time") ? "" : map.get("create_time").toString();
					String creater = null == map.get("creater") ? "" : map.get("creater").toString();
					map.put("create_time", DateUtil.dateToStrLong(DateUtil.strToDateLong(createTime)));
					BaseDoctorDO doctorDO = doctorDao.findById(creater);
					if (null!=doctor){
						map.put("doctrName", doctorDO.getName());
					}
				}
			}
			return list;
		}
	}
}

+ 19 - 0
svr/svr-internet-hospital/src/main/java/com/yihu/jw/hospital/service/consult/KnowledgeArticleService.java

@ -9,10 +9,12 @@ import com.yihu.jw.entity.hospital.article.KnowledgeArticleDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleDeptDO;
import com.yihu.jw.entity.hospital.article.KnowledgeArticleUserDO;
import com.yihu.jw.entity.hospital.consult.WlyyHospitalSysDictDO;
import com.yihu.jw.entity.hospital.survey.WlyySurveyUserDO;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleDeptDao;
import com.yihu.jw.hospital.dao.consult.KnowledgeArticleUserDao;
import com.yihu.jw.hospital.dict.WlyyHospitalSysDictDao;
import com.yihu.jw.hospital.survey.dao.SurveyUserDao;
import com.yihu.jw.im.util.ImUtil;
import com.yihu.jw.patient.dao.BasePatientBusinessDao;
import com.yihu.jw.utils.EntityUtils;
@ -49,6 +51,8 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
	private BaseDoctorDao doctorDao;
	@Autowired
	private ImUtil imUtil;
	@Autowired
	private SurveyUserDao surveyUserDao;
	
	/**
	 * 删除,支持批量
@ -233,6 +237,21 @@ public class KnowledgeArticleService extends BaseJpaService<KnowledgeArticleDO,
					object.put("content",knowledgeArticleDO.getIntro());
					object.put("img",knowledgeArticleDO.getImage());
					imUtil.sendImMsg(patientBusinessDO.getDoctor(), patientBusinessDO.getDoctorName(), patientBusinessDO.getSessionId(), "4", object.toJSONString(),"1");
				}else {
					WlyySurveyUserDO wlyySurveyUserDO = new WlyySurveyUserDO();
					String doctor = patientBusinessDO.getDoctor();
					BaseDoctorDO doctorDO = doctorDao.findById(doctor);
					wlyySurveyUserDO.setDept(doctorDO.getVisitDept());
					wlyySurveyUserDO.setDeptName(doctorDO.getVisitDeptName());
					wlyySurveyUserDO.setDoctor(doctor);
					wlyySurveyUserDO.setDoctorName(doctorDO.getName());
					wlyySurveyUserDO.setStatus(0);
					wlyySurveyUserDO.setPatient(patientBusinessDO.getPatient());
					wlyySurveyUserDO.setPatientName(patientBusinessDO.getPatientName());
					wlyySurveyUserDO.setSurveyTempCode(patientBusinessDO.getRelationCode());
					wlyySurveyUserDO.setSurveyTempTitle(patientBusinessDO.getRelationName());
					wlyySurveyUserDO.setCreateTime(new Date());
					surveyUserDao.save(wlyySurveyUserDO);
				}
			}

+ 2 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java

@ -205,6 +205,7 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
        try {
            List<LocationDataVO> list = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonData);
            figureLabelSerachService.getFigureLabelByList(list);
            List<LocationDataVO> list2 = iotPatientDeviceService.addNameAndCodeToList(list);
//            list.forEach(one->{
//                JSONArray jsonArray = new JSONArray();
//                JSONObject json = new JSONObject();
@ -235,7 +236,7 @@ public class IotPatientDeviceController extends EnvelopRestEndpoint {
//                }
//
//            });
            return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_create,list,iotPatientDeviceService.getESCount(jsonData));
            return MixEnvelop.getSuccessList(IotRequestMapping.Device.message_success_create,list2,iotPatientDeviceService.getESCount(jsonData));
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());

+ 33 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -11,6 +11,7 @@ import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.iot.service.useragent.UserAgent;
import com.yihu.iot.util.excel.HibenateUtils;
import com.yihu.jw.device.LocationDataDO;
import com.yihu.jw.entity.iot.device.IotDeviceDO;
import com.yihu.jw.entity.iot.device.IotDeviceOverhaulDO;
@ -30,6 +31,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.provider.HibernateUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -65,6 +67,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
    private UserAgent userAgent;
    @Autowired
    private IotCompanyDao iotCompanyDao;
    @Autowired
    private HibenateUtils hibernateUtils;
    /**
     * 新增
@ -257,6 +261,35 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,
        JestResult esResult = elasticSearchHelper.search(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,queryStr.toString());
        return getESResultBeanList(esResult);
    }
    public List<LocationDataVO> addNameAndCodeToList(List<LocationDataVO> list){
        if(null!=list){
            for (LocationDataVO locationDataVO:list){
                String sql = "select t.code as \"code\",t.name as \"name\" from wlyy.wlyy_patient t where 1=1 ";
                String sqlEqt="select t.device_name as\"device_name\" from device.wlyy_devices t where 1=1";
                String idCard = locationDataVO.getIdCard();
                String snCoed = locationDataVO.getDeviceSn();
                if (StringUtils.isNotEmpty(idCard)){
                    sql = sql +" and t.idcard = '"+idCard+"'";
                }if (StringUtils.isNotEmpty(snCoed)){
                    sqlEqt = sqlEqt +" and t.device_code = '"+snCoed+"'";
                }
                List<Map<String,Object>> nameList = hibernateUtils.createSQLQuery(sql);
                List<Map<String,Object>> deviceList = hibernateUtils.createSQLQuery(sqlEqt);
                if(nameList.size()>0){
                    String code = null==nameList.get(0).get("code")?"":nameList.get(0).get("code").toString();
                    String name = null==nameList.get(0).get("name")?"":nameList.get(0).get("name").toString();
                    locationDataVO.setCode(code);
                    locationDataVO.setName(name);
                }
                if (deviceList.size()>0){
                    String equipmentName = null==deviceList.get(0).get("device_name")?"":deviceList.get(0).get("device_name").toString();
                    locationDataVO.setEquimentName(equipmentName);
                }
            }
        }
        return list;
    }
    /**
     * 根据设备SN码查询设备地址

+ 5 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/monitorPlatform/MonitorPlatformService.java

@ -95,7 +95,8 @@ public class MonitorPlatformService  {
                    jsonObject.put("size",size);
                    List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString());
                    //figureLabelSerachService.getFigureLabelByList(locationDataVOList);
                    envelop.getDetailModelList().addAll(locationDataVOList);
                    List<LocationDataVO> list2 = iotPatientDeviceService.addNameAndCodeToList(locationDataVOList);
                    envelop.getDetailModelList().addAll(list2);
                }
            }
            envelop.setTotalCount(total);
@ -115,8 +116,9 @@ public class MonitorPlatformService  {
            jsonObject.put("page",page);
            jsonObject.put("size",size);
            List<LocationDataVO> locationDataVOList = iotPatientDeviceService.findDeviceLocationsByIdCard(jsonObject.toString());
            List<LocationDataVO> list2 = iotPatientDeviceService.addNameAndCodeToList(locationDataVOList);
            //figureLabelSerachService.getFigureLabelByList(locationDataVOList);
            envelop.getDetailModelList().addAll(locationDataVOList);
            envelop.getDetailModelList().addAll(list2);
            envelop.setTotalCount(iotPatientDeviceService.getESCount(jsonObject.toString()));
            return envelop;
        }
@ -884,6 +886,7 @@ public class MonitorPlatformService  {
                    list = iotPatientDeviceService.findDeviceLocationsBySn(jsonObject.toString());
                    if(list.size()>0){
                        data.put("locationData",list.get(0).getLocation());
                        data.put("diseaseCondition",list.get(0).getDiseaseCondition());
                    }else{
                        data.put("locationData","{}");
                    }