Forráskód Böngészése

Merge branch 'srdev' of chenweida/patient-co-management into srdev

chenweida 7 éve
szülő
commit
deeec96d13
15 módosított fájl, 84 hozzáadás és 135 törlés
  1. 3 3
      common/common-entity/src/main/java/com/yihu/wlyy/entity/followup/Followup.java
  2. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultDao.java
  3. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java
  4. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientHealthGuidanceDao.java
  5. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/concern/ConcernService.java
  6. 3 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  7. 13 19
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  8. 2 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthGuidanceService.java
  9. 40 76
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/ServiceStatisticsService.java
  10. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/concern/DoctorConcernController.java
  11. 1 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  12. 1 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java
  13. 1 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java
  14. 2 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/ServiceStatisticsController.java
  15. 3 3
      pom.xml

+ 3 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/followup/Followup.java

@ -64,7 +64,7 @@ public class Followup extends IdEntity {
	// 签约类型 1三师 2家庭
	private Integer signType;
	// 行政团队
	private Long adminTeamCode;
	private String adminTeamCode;
	//签约表Code
	private String signCode;
	//关联的续方CODE
@ -242,11 +242,11 @@ public class Followup extends IdEntity {
		this.signType = signType;
	}
	public Long getAdminTeamCode() {
	public String getAdminTeamCode() {
		return adminTeamCode;
	}
	public void setAdminTeamCode(Long adminTeamCode) {
	public void setAdminTeamCode(String adminTeamCode) {
		this.adminTeamCode = adminTeamCode;
	}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultDao.java

@ -31,8 +31,8 @@ public interface ConsultDao extends PagingAndSortingRepository<Consult, Long>, J
    @Query("select count(a) from Consult a,ConsultTeamDoctor b  where a.code = b.consult and a.patient=?1 and b.to=?2 and b.from is null")
    Integer findByPatient(String patientCode, String doctorCode);
    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.adminTeamId,b.team from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1 and b.adminTeamId = ?2 and a.del = '1' order by a.czrq desc")
    Page<Object> findByPatientAndTeam(String patient, Long team, Pageable pageRequest);
    @Query("select a.id,a.type,a.code,a.title,a.symptoms,a.czrq,b.status,b.adminTeamId,b.team from Consult a,ConsultTeam b where a.code = b.consult and a.patient = ?1  and a.del = '1' order by a.czrq desc")
    Page<Object> findByPatientAndTeam(String patient, Pageable pageRequest);
    //获取咨询的状态
    @Query("select a from Consult a,ConsultTeam b where a.code = b.consult and a.code = ?1 ")

+ 6 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -45,8 +45,8 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
     * @param pageable
     * @return
     */
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1 and a.adminTeamCode = ?2 and a.status > 0")
    Page<Object> findByPatientAndTeam(String patient, Long teamCode, Pageable pageable);
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1  and a.status > 0")
    Page<Object> findByPatientAndTeam(String patient,Pageable pageable);
    
    /**
     * 查找所有的随访计划(未开始的归类为计划)
@ -55,8 +55,8 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
     * @param pageable
     * @return
     */
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1 and a.adminTeamCode = ?2 and a.status = '2'")
    Page<Object> findPlanByPatientAndTeam(String patient, Long teamCode, Pageable pageable);
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1 and a.status = '2'")
    Page<Object> findPlanByPatientAndTeam(String patient, Pageable pageable);
    /**
@ -66,8 +66,8 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
     * @param pageable
     * @return
     */
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1 and a.adminTeamCode = ?2 and (a.status = '1' or a.status = '3')")
    Page<Object> findRecordByPatientAndTeam(String patient, Long teamCode, Pageable pageable);
    @Query("select d.code,d.name,d.photo,a.followupType,a.followupClass,a.status,a.createTime,a.updateTime,a.followupManagerStatus,c.code,c.name,c.photo" + ",a.followupDate,a.followupPlanDate,a.followupNextDate,a.id,a.followupNo,a.prescriptionCode from Followup a, Doctor d, Doctor c where a.doctorCode = d.code and a.creater = c.code and a.patientCode = ?1  and (a.status = '1' or a.status = '3')")
    Page<Object> findRecordByPatientAndTeam(String patient, Pageable pageable);
    
    /**
     * 根据续方CODE获取随访记录

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientHealthGuidanceDao.java

@ -55,6 +55,6 @@ public interface PatientHealthGuidanceDao extends PagingAndSortingRepository<Pat
    @Query("SELECT count(a) from PatientHealthGuidance a WHERE  a.patient=?2 and a.doctor=?1 ")
    Integer findbydoctorAndPatient(String doctor, String patientCode);
    @Query("select b.name, b.photo, a.id, substring(a.content, 1, 50) as content, a.createTime,b.level,b.code,a.adminTeamCode,a.readStatus from PatientHealthGuidance a, Doctor b where a.doctor = b.code and a.patient = ?1 and a.adminTeamCode = ?2 and a.del = '1'")
    Page<Object> findByPatientAndTeamCode(String patient, Long teamCode, Pageable pageable);
    @Query("select b.name, b.photo, a.id, substring(a.content, 1, 50) as content, a.createTime,b.level,b.code,a.adminTeamCode,a.readStatus from PatientHealthGuidance a, Doctor b where a.doctor = b.code and a.patient = ?1 and a.del = '1'")
    Page<Object> findByPatientAndTeamCode(String patient, Pageable pageable);
}

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/concern/ConcernService.java

@ -184,4 +184,8 @@ public class ConcernService extends BaseService {
        Integer patients = concernDao.countAllPatientsByDoctorCode(doctorCode);
        return patients;
    }
    public ConcernDO getByDoctorAndPatient(String doctorCode, String patientCode) {
        return concernDao.findByPatientAndDoctor(patientCode,doctorCode);
    }
}

+ 3 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -736,15 +736,14 @@ public class ConsultTeamService extends ConsultService {
     * 查询居民咨询记录
     *
     * @param patient
     * @param teamCode
     * @param page
     * @param pageSize
     * @return
     */
    public JSONArray findByPatientAndTeam(String patient, Long teamCode, int page, int pageSize) {
    public JSONArray findByPatientAndTeam(String patient, int page, int pageSize) {
        PageRequest pageRequest = new PageRequest(page, pageSize);
        Patient p = patientDao.findByCode(patient);
        Page<Object> result = consultDao.findByPatientAndTeam(patient, teamCode, pageRequest);
        Page<Object> result = consultDao.findByPatientAndTeam(patient, pageRequest);
        JSONArray array = new JSONArray();
        for (Object obj : result) {
@ -1183,7 +1182,7 @@ public class ConsultTeamService extends ConsultService {
            followup.setStatus("2");     //状态 0取消 1已完成 2未开始 3进行中
            followup.setCreateTime(new Date());
            followup.setCreater(doctorCode);
            followup.setAdminTeamCode(signFamily.getAdminTeamId());
            followup.setAdminTeamCode(signFamily.getAdminTeamId()+"");
            followup.setSignType(2);
            //保存质询code
            followup.setSignCode(patientService.getSignCodeByPatient(patient));

+ 13 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -5,6 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.es.entity.FollowupContentESDO;
import com.yihu.wlyy.config.es.ElasticFactory;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.concern.ConcernDO;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.Followup;
@ -24,6 +25,7 @@ import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.concern.ConcernService;
import com.yihu.wlyy.service.app.message.MessageService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.service.common.account.PatientService;
@ -125,6 +127,8 @@ public class FollowUpService extends BaseService {
    private ElastricSearchSave elastricSearchSave;
    @Autowired
    private MessageService messageService;
    @Autowired
    private ConcernService concernService;
    /**
     * 转译随访信息
@ -250,13 +254,13 @@ public class FollowUpService extends BaseService {
        Page<Object> result = null;
        if (StringUtils.isBlank(type)) {
            result = followupDao.findByPatientAndTeam(patient, teamCode, pageRequest);
            result = followupDao.findByPatientAndTeam(patient, pageRequest);
        } else if ("1".equals(type)) {
            //已经开始的就是记录
            result = followupDao.findPlanByPatientAndTeam(patient, teamCode, pageRequest);
            result = followupDao.findPlanByPatientAndTeam(patient, pageRequest);
        } else if ("2".equals(type)) {
            //未开始的就是计划
            result = followupDao.findRecordByPatientAndTeam(patient, teamCode, pageRequest);
            result = followupDao.findRecordByPatientAndTeam(patient, pageRequest);
        } else {
        }
@ -378,13 +382,7 @@ public class FollowUpService extends BaseService {
            if (patient == null) {
                throw new Exception("not exit patient:" + patientCode + ".\r\n");
            }
            SignFamily signFamily = signFamilyDao.findByjiatingPatient(patientCode);
            if (signFamily == null) {
                signFamily = signFamilyDao.findBySanshiPatient(patientCode);
                if (signFamily == null) {
                    throw new Exception("can not find patient's family sign info");
                }
            }
            ConcernDO concern =  concernService.getByDoctorAndPatient(doctorCode,patientCode);
            List<Followup> followupPlan = new ArrayList<>();
            for (Map<String, String> map : list) {
@ -395,7 +393,7 @@ public class FollowUpService extends BaseService {
                }
                Followup followup = new Followup();
                followup.setFollowupType(map.get("type"));
                followup.setFollowupType(map.get("type").toString());
                Date date = DateUtil.strToDate(map.get("date"));
                followup.setFollowupDate(date);
                followup.setFollowupPlanDate(date);
@ -410,7 +408,7 @@ public class FollowUpService extends BaseService {
                followup.setStatus("2");     //状态 0取消 1已完成 2未开始 3进行中
                followup.setCreateTime(new Date());
                followup.setCreater(doctorCode);
                followup.setAdminTeamCode(signFamily.getAdminTeamId());
                followup.setAdminTeamCode(concern.getTeamCode());
                followup.setSignType(2);
                //新增签约保存CODE
@ -509,12 +507,8 @@ public class FollowUpService extends BaseService {
        if (patient == null) {
            throw new Exception("not exit patient:" + patientCode + ".\r\n");
        }
        SignFamily signFamily = signFamilyDao.findByjiatingPatient(patientCode);
        if (signFamily == null) {
            signFamily = signFamilyDao.findBySanshiPatient(patientCode);
            if (signFamily == null)
                throw new Exception("can not find patient's family sign info");
        }
        ConcernDO concern =  concernService.getByDoctorAndPatient(doctorCode,patientCode);
        Followup followup = new Followup();
        Date followDate = DateUtil.strToDate(date);
@ -534,7 +528,7 @@ public class FollowUpService extends BaseService {
        followup.setStatus("2");     //状态 0取消 1已完成 2未开始 3进行中
        followup.setCreateTime(new Date());
        followup.setCreater(doctorCode);
        followup.setAdminTeamCode(signFamily.getAdminTeamId());
        followup.setAdminTeamCode(concern.getTeamCode());
        followup.setSignType(2);
        //保存质询code
        followup.setSignCode(patientService.getSignCodeByPatient(patientCode));

+ 2 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthGuidanceService.java

@ -245,15 +245,14 @@ public class PatientHealthGuidanceService extends BaseService {
	 * 健康指导查询
	 *
	 * @param patient
	 * @param teamCode
	 * @param page
	 * @param pageSize
	 * @return
	 */
	public JSONArray findByPatientAndGuidanceAndTeam(String patient,long teamCode,int page,int pageSize){
	public JSONArray findByPatientAndGuidanceAndTeam(String patient,int page,int pageSize){
		Sort sort = new Sort(Sort.Direction.DESC,"createTime");
		PageRequest pageRequest = new PageRequest(page, pageSize, sort);
		Page<Object> result = patientHealthGuidanceDao.findByPatientAndTeamCode(patient,teamCode,pageRequest);
		Page<Object> result = patientHealthGuidanceDao.findByPatientAndTeamCode(patient,pageRequest);
		JSONArray array = new JSONArray();
		if (result != null) {
			for (Object obj : result) {

+ 40 - 76
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/ServiceStatisticsService.java

@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -42,64 +43,28 @@ public class ServiceStatisticsService extends BaseService {
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    public JSONObject getServiceStatistics(String patient, long teamCode, String doctor) throws Exception {
    public JSONObject getServiceStatistics(String patient, String doctor) throws Exception {
        JSONObject result = new JSONObject();
        AdminTeam team = teamService.getTeam(teamCode);
        SignFamily signFamily = signFamilyDao.findByPatientAndAdminTeamId(patient, teamCode, 2);
        if (signFamily == null) {
            signFamily = signFamilyDao.findByPatientAndAdminTeamId(patient, teamCode, 1);
            if (signFamily == null) {
                throw new Exception("patient and doctor no sign relation");
            } else {
                if((!doctor.equals(team.getLeaderCode()) && !doctor.equals(signFamily.getDoctor())
                        && !doctor.equals(signFamily.getDoctorHealth()))) {
                    throw new Exception("patient and doctor no sign relation");
                }
            }
        } else {
            if((!doctor.equals(team.getLeaderCode()) && !doctor.equals(signFamily.getDoctor())
                    && !doctor.equals(signFamily.getDoctorHealth()))) {
                signFamily = signFamilyDao.findByPatientAndAdminTeamId(patient, teamCode, 1);
                if (signFamily == null) {
                    throw new Exception("patient and doctor no sign relation");
                } else {
                    if((!doctor.equals(team.getLeaderCode()) && !doctor.equals(signFamily.getDoctor())
                            && !doctor.equals(signFamily.getDoctorHealth()))) {
                        throw new Exception("patient and doctor no sign relation");
                    }
                }
            }
        }
        if (signFamily == null) {
            signFamily = signFamilyDao.findByPatientAndAdminTeamId(patient, teamCode, 1);
            if (signFamily == null) {
                throw new Exception("sign info can not find");
            }
        }
        Calendar today = Calendar.getInstance();
        today.set(Calendar.DATE, 1);
        String monthBegin = DateUtil.dateToStrShort(today.getTime()) + " 00:00:00";
        String yearBegin = DateUtil.dateToStrShort(signFamily.getBegin()) + " 00:00:00";
        String yearEnd = DateUtil.dateToStrShort(signFamily.getEnd()) + " 23:59:59";
        JSONObject consult = getConsultStatistics(patient, teamCode, yearBegin, yearEnd, monthBegin);
        String yearBegin = "2018-01-01 00:00:00";
        String yearEnd = DateUtil.dateToStrShort(new Date()) + " 23:59:59";
        JSONObject consult = getConsultStatistics(patient, doctor, yearBegin, yearEnd, monthBegin);
        result.put("consult", consult);
        JSONObject followup = getFollowupStatistics(patient, teamCode, yearBegin, yearEnd, monthBegin);
        JSONObject followup = getFollowupStatistics(patient, doctor, yearBegin, yearEnd, monthBegin);
        result.put("followup", followup);
        JSONObject reservation = getReservationStatistics(patient, teamCode, yearBegin, yearEnd, monthBegin);
        JSONObject reservation = getReservationStatistics(patient, doctor, yearBegin, yearEnd, monthBegin);
        result.put("reservation", reservation);
        JSONObject guidance = getGuidanceStatistics(patient, teamCode, yearBegin, yearEnd, monthBegin);
        JSONObject guidance = getGuidanceStatistics(patient, doctor, yearBegin, yearEnd, monthBegin);
        result.put("guidance", guidance);
        JSONObject article = getArticleStatistics(patient, teamCode, DateUtil.dateToStrShort(signFamily.getBegin()), DateUtil.dateToStrShort(signFamily.getEnd()), DateUtil.dateToStrShort(today.getTime()));
        JSONObject article = getArticleStatistics(patient, doctor, "2018-01-01", DateUtil.dateToStrShort(new Date()), DateUtil.dateToStrShort(today.getTime()));
        result.put("article", article);
        return result;
@ -115,21 +80,21 @@ public class ServiceStatisticsService extends BaseService {
     * @param monthBegin
     * @return
     */
    public JSONObject getConsultStatistics(String patient, long teamCode, String yearBegin, String yearEnd, String monthBegin) {
    public JSONObject getConsultStatistics(String patient, String doctor, String yearBegin, String yearEnd, String monthBegin) {
        JSONObject result = new JSONObject();
        result.put("history", 0);
        result.put("history", 0);
        result.put("history", 0);
        String sqlHistory = "select count(1) h from wlyy_consult_team where patient = ? and admin_team_code = ?";
        String sqlYear = "select count(1) y from wlyy_consult_team where patient = ? and admin_team_code = ? and czrq >= ? and czrq <= ?";
        String sqlMonth = "select count(1) m from wlyy_consult_team where patient = ? and admin_team_code = ? and czrq >= ?";
        String sqlHistory = "select count(1) h from wlyy_consult_team where patient = ? and doctor = ?";
        String sqlYear = "select count(1) y from wlyy_consult_team where patient = ? and doctor = ? and czrq >= ? and czrq <= ?";
        String sqlMonth = "select count(1) m from wlyy_consult_team where patient = ? and doctor = ? and czrq >= ?";
        String sql = "select * from " +
                "(" + sqlHistory + ") a" +
                ",(" + sqlYear + ") b" +
                ",(" + sqlMonth + ") c";
        List<Map<String, Object>> counts = jdbcTemplate.queryForList(sql, new Object[]{patient, teamCode,
                patient, teamCode, yearBegin, yearEnd, patient, teamCode, monthBegin
        List<Map<String, Object>> counts = jdbcTemplate.queryForList(sql, new Object[]{patient, doctor,
                patient, doctor, yearBegin, yearEnd, patient, doctor, monthBegin
        });
        if (counts != null && counts.size() > 0) {
@ -145,13 +110,13 @@ public class ServiceStatisticsService extends BaseService {
     * 健康教育统计
     *
     * @param patient
     * @param teamCode
     * @param doctor
     * @param yearBegin
     * @param yearEnd
     * @param monthBegin
     * @return
     */
    public JSONObject getArticleStatistics(String patient, long teamCode, String yearBegin, String yearEnd, String monthBegin) {
    public JSONObject getArticleStatistics(String patient, String doctor, String yearBegin, String yearEnd, String monthBegin) {
               JSONObject result = new JSONObject();
        result.put("history", 0);
        result.put("year", 0);
@ -175,9 +140,9 @@ public class ServiceStatisticsService extends BaseService {
        }*/
        //数据转移至Es
        String sqlHistory="select count(*) AS h from " + esType + " where patientCode='" + patient + "' and adminTeamCode = '"+teamCode+"'";
        String sqlYear = "select count(*) AS y from "+esType+" where patientCode='" + patient + "' and adminTeamCode = '"+teamCode+"' and createTime >= '"+changeDate(yearBegin)+"' and createTime <= '"+changeDate(yearEnd)+"'";
        String sqlMonth = "select count(*) AS m from "+esType+" where patientCode='" + patient + "' and adminTeamCode = '"+teamCode+"' and createTime >= '"+changeDate(monthBegin)+"'";
        String sqlHistory="select count(*) AS h from " + esType + " where patientCode='" + patient + "' and doctorCode = '"+doctor+"'";
        String sqlYear = "select count(*) AS y from "+esType+" where patientCode='" + patient + "' and doctorCode = '"+doctor+"' and createTime >= '"+changeDate(yearBegin)+"' and createTime <= '"+changeDate(yearEnd)+"'";
        String sqlMonth = "select count(*) AS m from "+esType+" where patientCode='" + patient + "' and doctorCode = '"+doctor+"' and createTime >= '"+changeDate(monthBegin)+"'";
        result.put("history", elasticsearchUtil.excuteForLong(sqlHistory,esType,esIndex));
        result.put("year", elasticsearchUtil.excuteForLong(sqlYear,esType,esIndex));
@ -195,27 +160,27 @@ public class ServiceStatisticsService extends BaseService {
     * 健康指导统计
     *
     * @param patient
     * @param teamCode
     * @param doctor
     * @param yearBegin
     * @param yearEnd
     * @param monthBegin
     * @return
     */
    public JSONObject getGuidanceStatistics(String patient, long teamCode, String yearBegin, String yearEnd, String monthBegin) {
    public JSONObject getGuidanceStatistics(String patient, String doctor, String yearBegin, String yearEnd, String monthBegin) {
        JSONObject result = new JSONObject();
        result.put("history", 0);
        result.put("year", 0);
        result.put("month", 0);
        String sqlHistory = "select count(1) h from wlyy_patient_health_guidance where patient = ? and admin_team_code = ?";
        String sqlYear = "select count(1) y from wlyy_patient_health_guidance where patient = ? and admin_team_code = ? and czrq >= ? and czrq <= ?";
        String sqlMonth = "select count(1) m from wlyy_patient_health_guidance where patient = ? and admin_team_code = ? and czrq >= ?";
        String sqlHistory = "select count(1) h from wlyy_patient_health_guidance where patient = ? and doctor = ?";
        String sqlYear = "select count(1) y from wlyy_patient_health_guidance where patient = ? and doctor = ? and czrq >= ? and czrq <= ?";
        String sqlMonth = "select count(1) m from wlyy_patient_health_guidance where patient = ? and doctor = ? and czrq >= ?";
        String sql = "select * from " +
                "(" + sqlHistory + ") a" +
                ",(" + sqlYear + ") b" +
                ",(" + sqlMonth + ") c";
        List<Map<String, Object>> counts = jdbcTemplate.queryForList(sql, new Object[]{patient, teamCode,
                patient, teamCode, yearBegin, yearEnd, patient, teamCode, monthBegin
        List<Map<String, Object>> counts = jdbcTemplate.queryForList(sql, new Object[]{patient, doctor,
                patient, doctor, yearBegin, yearEnd, patient, doctor, monthBegin
        });
        if (counts != null && counts.size() > 0) {
@ -231,20 +196,19 @@ public class ServiceStatisticsService extends BaseService {
     * 随访计划统计
     *
     * @param patient
     * @param teamCode
     * @param yearBegin
     * @param yearEnd
     * @param monthBegin
     * @return
     */
    public JSONObject getFollowupStatistics(String patient, long teamCode, String yearBegin, String yearEnd, String monthBegin) {
    public JSONObject getFollowupStatistics(String patient, String doctor, String yearBegin, String yearEnd, String monthBegin) {
        JSONObject result = new JSONObject();
        result.put("history", 0);
        result.put("year", 0);
        result.put("month", 0);
        String sqlHistory = "select count(1) h from wlyy_followup where patient_code = ? and admin_team_code = ?";
        String sqlYear = "select count(1) y from wlyy_followup where patient_code = ? and admin_team_code = ? and create_time >= ? and create_time <= ?";
        String sqlMonth = "select count(1) m from wlyy_followup where patient_code = ? and admin_team_code = ? and create_time >= ?";
        String sqlHistory = "select count(1) h from wlyy_followup where patient_code = ? and doctor_code = ?";
        String sqlYear = "select count(1) y from wlyy_followup where patient_code = ? and doctor_code = ? and create_time >= ? and create_time <= ?";
        String sqlMonth = "select count(1) m from wlyy_followup where patient_code = ? and doctor_code = ? and create_time >= ?";
        String sql = "select * from " +
                "(" + sqlHistory + " and status > 0" + ") a" +
                ",(" + sqlYear + " and status > 0" + ") b" +
@ -253,9 +217,9 @@ public class ServiceStatisticsService extends BaseService {
                ",(" + sqlYear.replace(" y ", " yy ") + " and status = 1" + ") e" +
                ",(" + sqlMonth.replace(" m ", " mm ") + " and status = 1" + ") f";
        List<Map<String, Object>> counts = jdbcTemplate.queryForList(sql, new Object[]{patient, teamCode,
                patient, teamCode, yearBegin, yearEnd, patient, teamCode, monthBegin, patient, teamCode,
                patient, teamCode, yearBegin, yearEnd, patient, teamCode, monthBegin
        List<Map<String, Object>> counts = jdbcTemplate.queryForList(sql, new Object[]{patient, doctor,
                patient, doctor, yearBegin, yearEnd, patient, doctor, monthBegin, patient, doctor,
                patient, doctor, yearBegin, yearEnd, patient, doctor, monthBegin
        });
        if (counts != null && counts.size() > 0) {
@ -278,21 +242,21 @@ public class ServiceStatisticsService extends BaseService {
     * @param monthBegin
     * @return
     */
    public JSONObject getReservationStatistics(String patient, long teamCode, String yearBegin, String yearEnd, String monthBegin) {
    public JSONObject getReservationStatistics(String patient, String doctor, String yearBegin, String yearEnd, String monthBegin) {
        JSONObject result = new JSONObject();
        result.put("history", 0);
        result.put("year", 0);
        result.put("month", 0);
        String sqlHistory = "select count(1) h from wlyy_patient_reservation where patient = ? and admin_team_code = ?";
        String sqlYear = "select count(1) y from wlyy_patient_reservation where patient = ? and admin_team_code = ? and czrq >= ? and czrq <= ?";
        String sqlMonth = "select count(1) m from wlyy_patient_reservation where patient = ? and admin_team_code = ? and czrq >= ?";
        String sqlHistory = "select count(1) h from wlyy_patient_reservation where patient = ? and doctor = ?";
        String sqlYear = "select count(1) y from wlyy_patient_reservation where patient = ? and doctor = ? and czrq >= ? and czrq <= ?";
        String sqlMonth = "select count(1) m from wlyy_patient_reservation where patient = ? and doctor = ? and czrq >= ?";
        String sql = "select * from " +
                "(" + sqlHistory + ") a" +
                ",(" + sqlYear + ") b" +
                ",(" + sqlMonth + ") c";
        List<Map<String, Object>> counts = jdbcTemplate.queryForList(sql, new Object[]{patient, teamCode,
                patient, teamCode, yearBegin, yearEnd, patient, teamCode, monthBegin
        List<Map<String, Object>> counts = jdbcTemplate.queryForList(sql, new Object[]{patient, doctor,
                patient, doctor, yearBegin, yearEnd, patient, doctor, monthBegin
        });
        if (counts != null && counts.size() > 0) {

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/concern/DoctorConcernController.java

@ -49,6 +49,7 @@ public class DoctorConcernController extends BaseController {
                jsonObject.put("name", patient.getName());
                jsonObject.put("photo", patient.getPhoto());
                jsonObject.put("sex", patient.getSex());
                jsonObject.put("phone", patient.getPhone());
                jsonObject.put("age", IdCardUtil.getAgeForIdcard(patient.getIdcard()));
                jsonObject.put("isWX", StringUtils.isEmpty(patient.getOpenid()) ? false : true);
                jsonObject.put("concernTime", DateUtil.dateToStr(patient.getConcernCreateTime(), "yyyy-MM-dd HH:mm:ss"));

+ 1 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -187,18 +187,14 @@ public class DoctorConsultController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation(value = "居民咨询列表查询")
    public String listByTeam(@RequestParam @ApiParam(value = "居民Code") String patient,
                             @RequestParam @ApiParam(value = "团队Code") Long teamCode,
                             @RequestParam @ApiParam(value = "第几页") int page,
                             @RequestParam @ApiParam(value = "页大小") int pagesize) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "请输入需查询的居民");
            }
            if (teamCode == null || teamCode < 1) {
                return error(-1, "请输入需查询的居民的团队");
            }
            page = page > 0 ? page - 1 : 0;
            JSONArray jsonArray = consultTeamService.findByPatientAndTeam(patient, teamCode, page, pagesize);
            JSONArray jsonArray = consultTeamService.findByPatientAndTeam(patient, page, pagesize);
            return write(200, "查询成功", "data", jsonArray);
        } catch (Exception e) {
            error(e);

+ 1 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -69,7 +69,7 @@ public class DoctorFollowUpController extends BaseController {
    @ResponseBody
    @ApiOperation(value = "查询居民随访列表")
    public String getListByPatientAndTeam(@RequestParam @ApiParam(value = "居民Code") String patient,
                                          @RequestParam @ApiParam(value = "团队code") Long teamCode,
                                          @RequestParam(required = false) @ApiParam(value = "团队code",required = false) Long teamCode,
                                          @RequestParam @ApiParam(value = "第几页") int page,
                                          @RequestParam @ApiParam(value = "页大小") int pagesize,
                                          @RequestParam(value = "type",required = false) @ApiParam(value = "类型:放空为全部,1计划,2记录",defaultValue = "0") String type) {
@ -77,9 +77,6 @@ public class DoctorFollowUpController extends BaseController {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "请输入需查询的居民");
            }
            if (teamCode == null || teamCode < 1) {
                return error(-1, "请输入需查询的居民的团队");
            }
            page = page > 0 ? page - 1 : 0;
            JSONArray result = followUpService.getListByPatientAndTeam(patient, teamCode, page, pagesize,type);

+ 1 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthGuidanceController.java

@ -306,18 +306,14 @@ public class DoctorHealthGuidanceController extends WeixinBaseController {
    @ResponseBody
    @ApiOperation(value = "查询居民健康指导记录")
    public String list(@RequestParam @ApiParam(value = "居民code") String patient,
                       @RequestParam @ApiParam(value = "团队Code") Long teamCode,
                       @RequestParam @ApiParam(value = "第几页") int page,
                       @RequestParam @ApiParam(value = "页大小") int pagesize) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "请输入需查询的居民");
            }
            if (teamCode == null || teamCode < 1) {
                return error(-1, "请输入需查询的居民的团队");
            }
            page = page > 0 ? page - 1 : 0;
            JSONArray result = patientHealthGuidanceService.findByPatientAndGuidanceAndTeam(patient, teamCode, page, pagesize);
            JSONArray result = patientHealthGuidanceService.findByPatientAndGuidanceAndTeam(patient, page, pagesize);
            return write(200, "查询成功!", "data", result);
        } catch (Exception e) {
            error(e);

+ 2 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/ServiceStatisticsController.java

@ -31,10 +31,9 @@ public class ServiceStatisticsController extends BaseController {
     */
    @RequestMapping(value = "/statistics", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "居民服务统计查询")
    public String statistics(@RequestParam @ApiParam(value = "居民code") String patient,
                             @RequestParam @ApiParam(value = "团队Code") Long teamCode) {
    public String statistics(@RequestParam @ApiParam(value = "居民code") String patient) {
        try {
            JSONObject result = serviceStatistics.getServiceStatistics(patient, teamCode, getUID());
            JSONObject result = serviceStatistics.getServiceStatistics(patient, getUID());
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();

+ 3 - 3
pom.xml

@ -18,9 +18,9 @@
    <!--deploy 的时候发布到这个服务器-->
    <distributionManagement>
        <repository>
            <id>test</id>
            <name>testRespository</name>
            <url>http://172.19.103.43:8081/nexus/content/repositories/test/</url>
            <id>jkzlRepositories</id>
            <name>jkzlRepositories</name>
            <url>http://172.19.103.43:8081/nexus/content/repositories/jkzlRepositories/</url>
        </repository>
    </distributionManagement>