Преглед изворни кода

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

hzp пре 8 година
родитељ
комит
bc8040be37
27 измењених фајлова са 539 додато и 253 уклоњено
  1. 1 1
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/extract/DBPageExtract.java
  2. 6 1
      patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  3. 7 0
      patient-co-statistics/src/main/resources/application.yml
  4. 0 5
      patient-co-wlyy/pom.xml
  5. 15 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java
  6. 8 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java
  7. 5 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamMemberDao.java
  8. 3 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/SignFamilyDao.java
  9. 25 10
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  10. 199 41
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  11. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/InspectionService.java
  12. 35 11
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/ExpensesRemindService.java
  13. 78 14
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  14. 9 5
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java
  15. 4 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/team/AdminTeamService.java
  16. 2 113
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/XMLUtil.java
  17. 2 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java
  18. 2 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  19. 0 7
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java
  20. 6 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  21. 7 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  22. 13 3
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthRecordController.java
  23. 23 0
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  24. 30 10
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java
  25. 24 8
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java
  26. 16 2
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java
  27. 17 7
      patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

+ 1 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/extract/DBPageExtract.java

@ -91,7 +91,7 @@ public class DBPageExtract<T> {
     * @param pageSize
     * @return
     */
    private List<T> MultiThreadExtract(Class<T> clazz, String sql,String countSql, int pageSize)  {
    private   List<T> MultiThreadExtract(Class<T> clazz, String sql,String countSql, int pageSize)  {
        try{
            //得到数据的总数
            Integer dataCount=getCount(countSql);

+ 6 - 1
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -95,6 +95,10 @@ public class CurrentDayAllQuotaJob implements Job {
    String fv_jdbc_username;
    @Value("${fv.jdbc.password}")
    String fv_jdbc_password;
    @Value("${redis.quota.current.expire}")
    String currentExpire="2";
    @Override
    public void execute(JobExecutionContext context)
            throws JobExecutionException {
@ -166,8 +170,9 @@ public class CurrentDayAllQuotaJob implements Job {
        quartzJobLog.setJobType("1");
        quartzJobLog.setJobEndTime(new Date());
        quartzJobLogDao.save(quartzJobLog);
        for (String key :RedisStorage.keys){
            redisTemplate.expire(key, 1, TimeUnit.HOURS);//1小时过期
            redisTemplate.expire(key, Integer.valueOf(currentExpire), TimeUnit.HOURS);//2小时过期
        }
        RedisStorage.keys.clear();//清空Key

+ 7 - 0
patient-co-statistics/src/main/resources/application.yml

@ -54,6 +54,7 @@ spring:
      min-idle: 1 # Target for the minimum number of idle connections to maintain in the pool. This setting only has an effect if it is positive.
multipart:
  max-file-size: 100MB
  max-request-size: 100MB
@ -69,6 +70,12 @@ security:
logging:
  level:
    root: INFO
redis:
  quota:
    current:
      expire: 2 #实时统计redis 的过期时间 默认是2小时
---
spring:
  profiles: cwd

+ 0 - 5
patient-co-wlyy/pom.xml

@ -260,11 +260,6 @@
        </dependency>
        <!-- JSON end -->
        <dependency>
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>xom</groupId>
            <artifactId>xom</artifactId>

+ 15 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java

@ -253,4 +253,19 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
	@Query("FROM ConsultTeam a where a.type=?1 and a.adminTeamId is null")
	List<ConsultTeam> findByTypeAndAdminTeamIdIsNull(Integer s);
	//名医咨询 -我咨询的全部 带symptoms
	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.from = ?1 and a.id < ?2 and a.symptoms like ?3 and a.del = '1' and b.del = '1'")
	Page<ConsultTeam> findMyFamousDoctorAllList(String uid, long id, String title, Pageable pageRequest);
	//名医咨询 -我咨询的全部 带symptoms
	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.from = ?1 and a.symptoms like ?2 and a.del = '1' and b.del = '1'")
	Page<ConsultTeam> findMyFamousDoctorAllList(String uid, String title, Pageable pageRequest);
	//名医咨询 -我咨询的全部 带symptoms
	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.from = ?1 and a.id < ?2 and  a.del = '1' and b.del = '1'")
	Page<ConsultTeam> findMyFamousDoctorAllList(String uid, Long id, Pageable pageRequest);
	//名医咨询 -我咨询的全部 带symptoms
	@Query("select a from ConsultTeam a, ConsultTeamDoctor b where a.consult = b.consult and a.type=6 and b.from = ?1  and a.del = '1' and b.del = '1'")
	Page<ConsultTeam> findMyFamousDoctorAllList(String uid, Pageable pageRequest);
}

+ 8 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamDao.java

@ -31,6 +31,10 @@ public interface DoctorAdminTeamDao extends
    Integer getDoctorSignCount(@Param(value = "doctorCode") String doctorCode,
                               @Param(value = "teamId") long teamId);
    @Modifying
    @Query("UPDATE AdminTeam t SET t.available = false where t.id = :teamId")
    void delete(@Param("teamId") long teamId);
    /**
     * 团队内,健康管理师的签约数。
     *
@ -62,16 +66,17 @@ public interface DoctorAdminTeamDao extends
     * @return
     */
    @Query("SELECT t.id, t.name, t.leaderCode, f.doctor, f.doctorName, f.doctorHealth, f.doctorHealthName " +
            "FROM SignFamily f, AdminTeam t WHERE f.patient = :patientCode AND f.status in (-3, 1) AND t.id=f.adminTeamId ORDER BY f.czrq DESC")
            "FROM SignFamily f, AdminTeam t WHERE f.patient = :patientCode AND f.status in (-3, 1) AND " +
            "t.id=f.adminTeamId AND t.available = true ORDER BY f.czrq DESC")
    List<Object> findAdminTeamByPatientSignTeam(@Param("patientCode") String patientCode, Pageable pageable);
    @Query("SELECT t.id from AdminTeam t WHERE t.leaderCode = :leaderCode")
    @Query("SELECT t.id from AdminTeam t WHERE t.leaderCode = :leaderCode AND t.available = true")
    Long findIdByLeaderCode(@Param("leaderCode") String leaderCode);
    @Query(" from AdminTeam t")
    List<AdminTeam> findAllTeam();
    @Query("SELECT t from AdminTeam t WHERE t.leaderCode = :leaderCode")
    @Query("SELECT t from AdminTeam t WHERE t.leaderCode = :leaderCode AND t.available = true")
    AdminTeam findByLeaderCode(@Param("leaderCode") String leaderCode);
    List<AdminTeam> findByOrgCode(String orgCode);

+ 5 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorAdminTeamMemberDao.java

@ -23,10 +23,11 @@ public interface DoctorAdminTeamMemberDao extends
    AdminTeamMember findByTeamIdAndDoctorCodeOrderByDoctorCodeAsc(long teamId, String doctorCode);
    @Query("SELECT t FROM AdminTeamMember m, AdminTeam t WHERE m.doctorCode = :doctorCode AND t.id = m.teamId")
    @Query("SELECT t FROM AdminTeamMember m, AdminTeam t WHERE m.doctorCode = :doctorCode AND t.id = m.teamId AND t.available = true")
    List<AdminTeam> findDoctorTeams(@Param(value = "doctorCode") String doctorCode);
    @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m.teamId AND m.doctorCode = d.code ORDER BY d.level")
    @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = :teamId AND t.id = m.teamId " +
            "AND m.doctorCode = d.code AND t.available = true ORDER BY d.level")
    List<Doctor> findAllMembers(@Param(value = "teamId") long teamId);
    @Query("SELECT case when count(A) > 0 then true else false END FROM AdminTeamMember A WHERE A.teamId = :teamId " +
@ -41,6 +42,7 @@ public interface DoctorAdminTeamMemberDao extends
                                         @Param(value = "teamId") long teamId,
                                         Pageable pageable);
    @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = ?1 AND t.id = m.teamId AND m.doctorCode = d.code and  d.code != ?2 and d.level != 1 ")
    @Query("SELECT d FROM AdminTeamMember m, AdminTeam t, Doctor d WHERE t.id = ?1 AND t.id = m.teamId AND " +
            "m.doctorCode = d.code and  d.code != ?2 AND t.available = true and d.level != 1 ")
    List<Doctor> findAllHeathExcludeThis(long teamId, String doctorCode);
}

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

@ -44,6 +44,9 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
	@Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
	SignFamily findByDoctorPatient(String doctor, String patient);
	@Query("select a from SignFamily a where a.doctorHealth = ?1 and a.patient = ?2 and a.type = 2 and a.status >= 0")
	SignFamily findByDoctorHealthPatient(String doctor, String patient);
	@Query("select a from SignFamily a where a.doctor = ?1 and a.patient = ?2 and a.type = 1 and a.status > 0")
	SignFamily findSsSignByDoctorPatient(String doctor, String patient);

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

@ -124,7 +124,7 @@ public class ConsultTeamService extends ConsultService {
                return findByDoctorType5(uid, id, pagesize, title);
            case 6:
                //6 名医咨询 进行中
                return findByDoctorTypeSix(uid, id, pagesize, title);
                 return findByDoctorTypeSix(uid, id, pagesize, title);
            case 7:
                //7 名医咨询 已结束
                return findByDoctorType6(uid, 1, id, pagesize, title);
@ -132,10 +132,33 @@ public class ConsultTeamService extends ConsultService {
                return findByDoctorType8(uid, id, pagesize, title);
            case 9:
                return findByDoctorType9(uid, id, pagesize);
            case 10:
                //我咨询的
                return findByDoctorType10(uid, id, pagesize, title);
        }
        return null;
    }
    private Page<ConsultTeam> findByDoctorType10(String uid, long id, int pagesize,String title) {
        Sort sort = new Sort(Direction.DESC, "id");
        // 分页信息
        PageRequest pageRequest = new PageRequest(0, pagesize, sort);
        if (StringUtils.isNoneEmpty(title)) {
            title = "%" + title + "%";
            if (id > 0) {
                return consultTeamDao.findMyFamousDoctorAllList(uid, id, title, pageRequest);
            } else {
                return consultTeamDao.findMyFamousDoctorAllList(uid, title, pageRequest);
            }
        } else {
            if (id > 0) {
                return consultTeamDao.findMyFamousDoctorAllList(uid, id, pageRequest);
            } else {
                return consultTeamDao.findMyFamousDoctorAllList(uid, pageRequest);
            }
        }
    }
    private Page<ConsultTeam> findByDoctorTypeSix(String uid, long id, int pagesize, String title) {
        Sort sort = new Sort(Direction.DESC, "id");
        // 分页信息
@ -335,15 +358,7 @@ public class ConsultTeamService extends ConsultService {
     * @return
     */
    public Page<ConsultTeam> findByDoctorType9(String uid, long id, int pagesize) {
        // 排序
        Sort sort = new Sort(Direction.DESC, "id");
        // 分页信息
        PageRequest pageRequest = new PageRequest(0, pagesize, sort);
        if (id > 0) {
            return consultTeamDao.findDoctorAllList(uid, id, pageRequest);
        } else {
            return consultTeamDao.findDoctorAllList(uid, pageRequest);
        }
        return null;
    }
    /**

+ 199 - 41
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -18,6 +18,7 @@ import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import org.apache.commons.beanutils.converters.CalendarConverter;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.type.descriptor.sql.JdbcTypeFamilyInformation;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -56,6 +57,101 @@ public class SignPatientLabelInfoService extends BaseService {
    SignFamilyDao signFamilyDao;
    @Autowired
    StringRedisTemplate redisTemplate;
    /**
     * 查询单个居民信息
     *
     * @param patient
     * @return
     * @throws Exception
     */
    public JSONObject getPatient(String patient) throws Exception {
        JSONObject json = new JSONObject();
        Patient p = patientDao.findByCode(patient);
        if(p == null){
            throw new Exception("patient info can not find");
        }
        List<SignFamily> signs = signFamilyDao.findAllSignByPatient(patient);
        // 设置患者标识
        json.put("code", p.getCode());
        // 设置患者姓名
        json.put("name", p.getName());
        // 设置患者手机号
        json.put("mobile", p.getMobile());
        // 设置患者联系电话
        json.put("phone", p.getPhone());
        // 设置患者头像
        json.put("photo", p.getPhoto());
        // 设置患者年龄
        json.put("age", DateUtil.getAgeByBirthday(p.getBirthday()));
        // 设置患者性别
        json.put("sex", p.getSex());
        // 身份证号
        json.put("idcard", p.getIdcard());
        // 社保号
        json.put("ssc", p.getSsc());
        if(signs != null && signs.size() > 0){
            SignFamily ssSign = null;
            SignFamily familySign = null;
            for(SignFamily sign : signs){
                if(sign.getType() == 1){
                    ssSign = sign;
                } else if(sign.getType() == 2){
                    familySign = sign;
                }
            }
            if(ssSign != null) {
                // 设置患者紧急联系人
                json.put("emerMobile", StringUtils.isEmpty(ssSign.getEmerMobile()) ? "" : String.valueOf(ssSign.getEmerMobile()));
                // 设置签约日期
                json.put("qyrq", ssSign.getApplyDate() != null ? DateUtil.dateToStr((Date) ssSign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
                // 设置签约类型
                json.put("signType", 1);
                // 设置签约状态
                json.put("ssStatus", ssSign.getStatus());
            }
            if(familySign != null){
                // 设置患者紧急联系人
                json.put("emerMobile", StringUtils.isEmpty(familySign.getEmerMobile()) ? "" : String.valueOf(familySign.getEmerMobile()));
                // 设置签约日期
                json.put("qyrq", familySign.getApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getApplyDate(), DateUtil.YYYY_MM_DD) : "");
                // 设置签约日期
                json.put("patientApplyDate", familySign.getPatientApplyDate() != null ? DateUtil.dateToStr((Date) familySign.getPatientApplyDate(), DateUtil.YYYY_MM_DD) : "");
                // 设置签约类型
                json.put("signType", json.has("signType") ? 3 : 2);
                // 缴费情况
                json.put("expensesStatus", StringUtils.isNotEmpty(familySign.getExpensesStatus()) ? String.valueOf(familySign.getExpensesStatus()) : "0");
                // 缴费时间
                json.put("expensesTime", familySign.getExpensesTime() != null ? DateUtil.dateToStr((Date) familySign.getExpensesTime(), DateUtil.YYYY_MM_DD_HH_MM) : "");
                // 缴费类型
                json.put("expensesType", StringUtils.isNotEmpty(familySign.getExpensesType()) ? String.valueOf(familySign.getExpensesType()) : "");
                // 设置签约状态
                json.put("familyStatus", familySign.getStatus());
                if("1".equals(familySign.getExpensesStatus())){
                    json.put("qyrq", familySign.getExpensesTime() != null ? DateUtil.dateToStr((Date) familySign.getExpensesTime(), DateUtil.YYYY_MM_DD) : "");
                }
            }
            if (json.has("expensesStatus") && (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0"))) {
                String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                if (StringUtils.isEmpty(epTime)) {
                    json.put("expensesRemindStatus", 0);
                } else {
                    json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                }
            }
        }
        return json;
    }
    /**
     * 根据标签查询患者信息
     *
@ -165,6 +261,21 @@ public class SignPatientLabelInfoService extends BaseService {
                    }
                    if (String.valueOf(sign.get("type")).equals("2")) {
                        jsonP.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
                        // 缴费情况
                        jsonP.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")): "0");
                        // 缴费时间
                        jsonP.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                        // 缴费类型
                        jsonP.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                        if (StringUtils.isEmpty(String.valueOf(jsonP.get("expensesStatus"))) || String.valueOf(jsonP.get("expensesStatus")).equals("0")) {
                            String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                            if (StringUtils.isEmpty(epTime)) {
                                jsonP.put("expensesRemindStatus", 0);
                            } else {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                    }
                    continue;
@ -197,20 +308,25 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("idcard", p.getIdcard());
                // 社保号
                json.put("ssc", p.getSsc());
                // 缴费情况
                json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")): "0");
                // 缴费时间
                json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                // 缴费类型
                json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                    String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                    if (StringUtils.isEmpty(epTime)) {
                        json.put("expensesRemindStatus", 0);
                    } else {
                        json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                if(String.valueOf(sign.get("type")).equals("2")) {
                    // 缴费情况
                    json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
                    // 缴费时间
                    json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                    // 缴费类型
                    json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
//                if("2".equals(String.valueOf(sign.get("type"))) && "1".equals(String.valueOf(sign.get("expenses_status")))){
//                    json.put("qyrq", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD) : "");
//                }
                    if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                        String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                        if (StringUtils.isEmpty(epTime)) {
                            json.put("expensesRemindStatus", 0);
                        } else {
                            json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                }
                // 患者标签
@ -269,7 +385,24 @@ public class SignPatientLabelInfoService extends BaseService {
                    if (!String.valueOf(jsonP.get("signType")).equals(String.valueOf(sign.get("type")))) {
                        jsonP.put("signType", 3);
                    }
                    if (String.valueOf(sign.get("type")).equals("2")) {
                        jsonP.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
                        // 缴费情况
                        jsonP.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")): "0");
                        // 缴费时间
                        jsonP.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                        // 缴费类型
                        jsonP.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                        if (StringUtils.isEmpty(String.valueOf(jsonP.get("expensesStatus"))) || String.valueOf(jsonP.get("expensesStatus")).equals("0")) {
                            String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                            if (StringUtils.isEmpty(epTime)) {
                                jsonP.put("expensesRemindStatus", 0);
                            } else {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                    }
                    continue;
                }
@ -314,19 +447,24 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("idcard", p.getIdcard());
                // 社保号
                json.put("ssc", p.getSsc());
                // 缴费情况
                json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")): "0");
                // 缴费时间
                json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                // 缴费类型
                json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                    String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                    if (StringUtils.isEmpty(epTime)) {
                        json.put("expensesRemindStatus", 0);
                    } else {
                        json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                if(String.valueOf(sign.get("type")).equals("2")) {
                    // 缴费情况
                    json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
                    // 缴费时间
                    json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                    // 缴费类型
                    json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
//                if("2".equals(String.valueOf(sign.get("type"))) && "1".equals(String.valueOf(sign.get("expenses_status")))){
//                    json.put("qyrq", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD) : "");
//                }
                    if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                        String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                        if (StringUtils.isEmpty(epTime)) {
                            json.put("expensesRemindStatus", 0);
                        } else {
                            json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                }
                // 患者标签
@ -724,6 +862,21 @@ public class SignPatientLabelInfoService extends BaseService {
                    }
                    if (String.valueOf(sign.get("type")).equals("2")) {
                        jsonP.put("qyrq", sign.get("apply_date") != null ? DateUtil.dateToStr((Date) sign.get("apply_date"), DateUtil.YYYY_MM_DD) : "");
                        // 缴费情况
                        jsonP.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")): "0");
                        // 缴费时间
                        jsonP.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                        // 缴费类型
                        jsonP.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                        if (StringUtils.isEmpty(String.valueOf(jsonP.get("expensesStatus"))) || String.valueOf(jsonP.get("expensesStatus")).equals("0")) {
                            String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                            if (StringUtils.isEmpty(epTime)) {
                                jsonP.put("expensesRemindStatus", 0);
                            } else {
                                jsonP.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                            }
                        }
                    }
                    continue;
@ -776,19 +929,24 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("idcard", p.getIdcard());
                // 社保号
                json.put("ssc", p.getSsc());
                // 缴费情况
                json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")): "0");
                // 缴费时间
                json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                // 缴费类型
                json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")): "");
                if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                    String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                    if (StringUtils.isEmpty(epTime)) {
                        json.put("expensesRemindStatus", 0);
                    } else {
                        json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                if (String.valueOf(sign.get("type")).equals("2")) {
                    // 缴费情况
                    json.put("expensesStatus", sign.get("expenses_status") != null ? String.valueOf(sign.get("expenses_status")) : "0");
                    // 缴费时间
                    json.put("expensesTime", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD_HH_MM) : "");
                    // 缴费类型
                    json.put("expensesType", sign.get("expenses_type") != null ? String.valueOf(sign.get("expenses_type")) : "");
//                if("2".equals(String.valueOf(sign.get("type"))) && "1".equals(String.valueOf(sign.get("expenses_status")))){
//                    json.put("qyrq", sign.get("expenses_time") != null ? DateUtil.dateToStr((Date) sign.get("expenses_time"), DateUtil.YYYY_MM_DD) : "");
//                }
                    if (StringUtils.isEmpty(String.valueOf(json.get("expensesStatus"))) || String.valueOf(json.get("expensesStatus")).equals("0")) {
                        String epTime = redisTemplate.opsForValue().get("expenses:remind:" + p.getCode());
                        if (StringUtils.isEmpty(epTime)) {
                            json.put("expensesRemindStatus", 0);
                        } else {
                            json.put("expensesRemindStatus", new SimpleDateFormat("yyyy-MM-dd").format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                }
                // 患者标签

+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/record/InspectionService.java

@ -60,14 +60,14 @@ public class InspectionService extends BaseService {
        JSONArray check = getChecking(strSSID, startNum, endNum);
        if (!check.isNull(0)) {
            JSONObject jsonObject = check.getJSONObject(0);
            if (!StringUtils.isEmpty(jsonObject.get("error"))) {
            if (jsonObject.has("error")) {
                return jsonObject.get("error").toString();
            }
        }
        JSONArray inspect = getInspection(strSSID, startNum, endNum);
        if (!inspect.isNull(0)) {
            JSONObject jsonObject = inspect.getJSONObject(0);
            if (!StringUtils.isEmpty(jsonObject.get("error"))) {
            if (jsonObject.has("error")) {
                return jsonObject.get("error").toString();
            }
        }

+ 35 - 11
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/ExpensesRemindService.java

@ -82,7 +82,7 @@ public class ExpensesRemindService extends BaseService {
     * @param doc
     * @param hos
     */
    public void RemindAll( Doctor doc, Hospital hos) {
    public void RemindAll(Doctor doc, Hospital hos) {
        try {
            String sql = "select distinct a.patient from " +
                    " (select patient,expenses_status,LENGTH(trim(ifnull(expenses_status,''))) len " +
@ -136,9 +136,7 @@ public class ExpensesRemindService extends BaseService {
                throw new Exception("patient info can not find");
            }
            remindPatientExpenses(p, doc, hos);
            return 1;
            return remindPatientExpenses(p, doc, hos);
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
@ -153,16 +151,24 @@ public class ExpensesRemindService extends BaseService {
     * @param hos 医院
     * @return
     */
    public void remindPatientExpenses(Patient p, Doctor doc, Hospital hos) throws Exception {
    public int remindPatientExpenses(Patient p, Doctor doc, Hospital hos) throws Exception {
        try {
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            if (StringUtils.isNotEmpty(p.getMobile()) ) {
                smsService.sendMsg(p.getMobile(), "厦门市民健康系统】" + doc.getName() + "医生提醒您:为完成家庭医生签约," +
            boolean mFlag = false;
            boolean wFlag = false;
            boolean isMobileExist = false;
            boolean isOpenIdExist = false;
            if (StringUtils.isNotEmpty(p.getMobile())) {
                isMobileExist = true;
                int result = smsService.sendMsg(p.getMobile(), "厦门市民健康系统】" + doc.getName() + "医生提醒您:为完成家庭医生签约," +
                        "尽早为您提供家庭医生服务,请尽快到" + hos.getName() + "(地址:" + hos.getAddress() + ")缴费");
                if (result == 1) {
                    mFlag = true;
                }
            }
            if(StringUtils.isNotEmpty(p.getOpenid())){
            if (StringUtils.isNotEmpty(p.getOpenid())) {
                isOpenIdExist = true;
                // 微信提醒
                JSONObject json = new JSONObject();
                json.put("first", "缴费提醒");
@ -174,10 +180,28 @@ public class ExpensesRemindService extends BaseService {
                json.put("remark", "");
                // 添加到发送队列
                PushMsgTask.getInstance().putWxMsg(tokenUtils.getAccessToken(), 8, p.getOpenid(), p.getName(), json);
                wFlag = true;
            }
            if (wFlag || mFlag) {
                redisTemplate.opsForValue().set("expenses:remind:" + p.getCode(), df.format(new Date()));
                if (!isMobileExist) {
                    return 2;
                }
                if (!isOpenIdExist) {
                    return 3;
                }
                return 1;
            } else {
                if (!isMobileExist && !isOpenIdExist) {
                    return -1;
                }
                return 0;
            }
            redisTemplate.opsForValue().set("expenses:remind:" + p.getCode(), df.format(new Date()));
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
    }
}

+ 78 - 14
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -39,6 +39,7 @@ import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
@ -232,7 +233,13 @@ public class FamilyContractService extends BaseService {
        json.put("expertise", d.getExpertise());
        json.put("level", d.getLevel());
        // 查询与当前医生的签约状态
        SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        SignFamily sf = null;
        if (d.getLevel() == 2) {
            sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        }else if(d.getLevel() == 3){
            sf = signFamilyDao.findByDoctorHealthPatient(doctor, patient);
        }
        if (sf == null) {
            // 没有签约信息
            json.put("sign", -1);
@ -564,9 +571,20 @@ public class FamilyContractService extends BaseService {
     * @param doctor  医生标识
     * @return
     */
    public int unsign(String patient, String doctor) {
    public int unsign(String patient, String doctor) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        if(doc == null){
            throw new Exception("doctor info can not find");
        }
        //修改签约标识为无效
        SignFamily sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        SignFamily sf = null;
        if(doc.getLevel() == 2){
            sf = signFamilyDao.findByDoctorPatient(doctor, patient);
        } else if(doc.getLevel() == 3){
            sf = signFamilyDao.findByDoctorHealthPatient(doctor, patient);
        }
        Message message = messageDao.findByPatient(patient, doctor);
        if (sf.getStatus() != 0 && sf.getStatus() != 2) {
            return -2;
@ -991,8 +1009,8 @@ public class FamilyContractService extends BaseService {
            //添加健康管理师
            DoctorTeamMember wlyyDoctorTeamDoctor = new DoctorTeamMember();
            wlyyDoctorTeamDoctor.setTeam(doctorTeamCode);
            wlyyDoctorTeamDoctor.setMemberCode(healthDoctor);
            wlyyDoctorTeamDoctor.setName(healthDoctorName);
            wlyyDoctorTeamDoctor.setMemberCode(sf.getDoctorHealth());
            wlyyDoctorTeamDoctor.setName(sf.getDoctorHealthName());
            wlyyDoctorTeamDoctor.setDel("1");
            wlyyDoctorTeamDoctor.setSignType("2");
@ -1441,6 +1459,7 @@ public class FamilyContractService extends BaseService {
        if (jtSignFamily != null) {
            //家庭签约只找全科医生
            Doctor doctor = doctorDao.findByCode(jtSignFamily.getDoctor());
            Doctor doctorHealth = doctorDao.findByCode(jtSignFamily.getDoctorHealth());
            if (doctor != null) {
                JSONObject jo = new JSONObject();
                jo.put("code", doctor.getCode());
@ -1461,6 +1480,26 @@ public class FamilyContractService extends BaseService {
                }
                jsonArray.put(jo);
            }
            if (doctorHealth != null) {
                JSONObject jo = new JSONObject();
                jo.put("code", doctorHealth.getCode());
                jo.put("sex", doctorHealth.getSex());
                jo.put("name", doctorHealth.getName());
                jo.put("photo", doctorHealth.getPhoto());
                jo.put("hosptialName", doctorHealth.getHosptialName());
                jo.put("level", doctorHealth.getLevel());
                jo.put("signType", "2");//三师签约
                jo.put("signStatus", jtSignFamily.getStatus());
                jo.put("jobName", doctorHealth.getJobName());
                jo.put("disease", patient.getDisease());//0健康,1高血压,2糖尿病,3高血压+糖尿病
                if (jtSignFamily.getStatus() == 0) {
                    jo.put("sqDate", DateUtil.dateToStrShort(jtSignFamily.getPatientApplyDate()));//申请时间
                } else {
                    jo.put("qyDate", DateUtil.dateToStrShort(jtSignFamily.getApplyDate()));//签约时间
                    jo.put("endDate", DateUtil.dateToStrShort(jtSignFamily.getEnd()));//结束时间
                }
                jsonArray.put(jo);
            }
        }
        return jsonArray;
    }
@ -1528,7 +1567,7 @@ public class FamilyContractService extends BaseService {
     * @param healthDoctor 健康管理师code
     * @return
     */
    public JSONObject updateSignInfo(String patient, String healthDoctor,String doctor, String expensesType) {
    public JSONObject updateSignInfo(String patient, String healthDoctor, String doctor, String expensesType) {
        JSONObject result = new JSONObject();
        SignFamily signFamily = signFamilyDao.findByjiatingPatientYes(patient);
@ -1629,17 +1668,42 @@ public class FamilyContractService extends BaseService {
        return signFamilyDao.findNoHealthSignFamilyNum(doctor);
    }
    public Page<SignFamily> findNoHealthSignFamilyHealth(String doctor, Integer page, Integer pagesize) {
    public Map<String,Object> findNoHealthSignFamilyHealth(String doctor, Integer page, Integer pagesize,String patientName,String patientAddr) {
        Map<String,Object> returnMap=new HashMap();
        if (pagesize == null || pagesize <= 0) {
            pagesize = 10;
        }
        if (page == null || page < 0) {
            page = 0;
        }
        // 分页信息
        PageRequest pageRequest = new PageRequest(page, pagesize);
        return signFamilyDao.findNoHealthSignFamilyHealth(doctor, pageRequest);
        if (page == null || page <=0) {
            page =1;
        }
        int start =(page-1)*pagesize;
        //先找出该医生下面没有健康管理师的患者 然后在去患者表找出该患者
        StringBuffer sql=new StringBuffer("" +
                " select p.* from wlyy_patient p where p.code in " +
                " (select a.patient code from wlyy_sign_family a where a.type = 2 and a.status >= 1 and a.doctor_health is null and a.doctor='"+doctor+"' order by a.czrq desc ) ");
        StringBuffer countSql=new StringBuffer("" +
                " select count(*) from wlyy_patient p where p.code in " +
                " (select a.patient code from wlyy_sign_family a where a.type = 2 and a.status >= 1 and a.doctor_health is null and a.doctor='"+doctor+"' order by a.czrq desc ) ");
        if(!org.springframework.util.StringUtils.isEmpty(patientName)){
            sql.append(" and name like '"+patientName+"%'");
            countSql.append(" and name like '"+patientName+"%'");
        }
        if(!org.springframework.util.StringUtils.isEmpty(patientAddr)){
            sql.append(" and address like '"+patientAddr+"%'");
            countSql.append(" and address like '"+patientAddr+"%'");
        }
        sql.append(" limit "+start+","+pagesize+"");
        List<Patient> returnList= jdbcTemplate.query(sql.toString(),new BeanPropertyRowMapper(Patient.class));
        Integer allCount= jdbcTemplate.queryForObject(countSql.toString(),Integer.class);
        if(allCount%pagesize==0){
            returnMap.put("count",allCount/pagesize);
        }else{
            returnMap.put("count",(allCount/pagesize)+1);
        }
        returnMap.put("returnList",returnList);
        return returnMap;
    }
    /**

+ 9 - 5
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -48,6 +48,7 @@ public class SignWebService extends BaseService {
                "    a.code " +
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.idcard " +
                "    ,b.name " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
@ -56,12 +57,13 @@ public class SignWebService extends BaseService {
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                "    ,a.apply_date as applyDate" +
                (status == 1? "    ,a.patient_apply_date as applyDate ":"    ,a.expenses_time as applyDate ") +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and status = ? and type = 2 order by begin desc ) a " +
                " ( select code,patient,doctor,status,id,apply_date,patient_apply_date,expenses_time,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and status = ? and type = 2" +
                (status == 3 ? " and expenses_status = '1'" : "") + " order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by a.begin desc ";
@ -71,6 +73,7 @@ public class SignWebService extends BaseService {
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.name " +
                "    ,b.idcard " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
@ -78,7 +81,7 @@ public class SignWebService extends BaseService {
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                "    ,a.apply_date as applyDate" +
                "    ,a.apply_date as applyDate " +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
@ -93,6 +96,7 @@ public class SignWebService extends BaseService {
                "    ,a.doctor " +
                "    ,b.code  as  patient" +
                "    ,b.name " +
                "    ,b.idcard " +
                "    ,b.province_name  as provinceName" +
                "    ,b.city_name  as cityName" +
                "    ,b.town_name  as townName" +
@ -100,12 +104,12 @@ public class SignWebService extends BaseService {
                "    ,b.photo " +
                "    ,a.status " +
                "    ,a.id " +
                "    ,a.apply_date as applyDate" +
                "    ,a.apply_unsign_date as applyDate" +
                "    ,a.reason " +
                "    ,b.street_name as streetName" +
                "    ,b.sex" +
                " from " +
                " ( select code,patient,doctor,status,id,apply_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
                " ( select code,patient,doctor,status,id,apply_date,apply_unsign_date,reason,begin from wlyy_sign_family where " + (doctorType == 2 ? "doctor" : "doctor_health") + " = ? and ( status = ? or status = ? ) and type = 2 order by begin desc ) a " +
                " ,wlyy_patient b " +
                " where a.patient = b.code  order by a.begin desc ";

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

@ -72,6 +72,10 @@ public class AdminTeamService extends BaseService {
        return team;
    }
    public void deleteTeam(long teamId){
        teamDao.delete(teamId);
    }
    /**
     * 获取团队信息。
     *

Разлика између датотеке није приказан због своје велике величине
+ 2 - 113
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/XMLUtil.java


+ 2 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java

@ -160,8 +160,8 @@ public class LoginController extends BaseController {
                password = RSAUtils.getInstance(doctorService).decryptString(password);
                password=StringUtils.reverse(password);
                Doctor doctor=doctorService.findDoctorByMobile(mobile);
                loginLog.setUserCode(doctor.getCode());
                loginLog.setLoginType("2");
                loginLog.setUserCode(doctor.getCode());
                if(doctor==null){
                    errorMessage="该身份证未注册!";
                    loginLog.setErrorMessage(errorMessage);
@ -222,7 +222,6 @@ public class LoginController extends BaseController {
                        return error(-1, errorMessage);}
                }
                Doctor doctor = doctorService.findDoctorByMobile(mobile);
                loginLog.setUserCode(doctor.getCode());
                loginLog.setLoginType("1");
                if (doctor == null) {
                     errorMessage="该手机号未注册,请确认!";
@ -230,6 +229,7 @@ public class LoginController extends BaseController {
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else {
                    loginLog.setUserCode(doctor.getCode());
                    // 用户校验通过,生成token
                    Token token = tokenService.newToken(doctor.getCode(), getIMEI(), 2);
                    loginLog.setTokenId(token.getId());

+ 2 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -347,7 +347,6 @@ public class WechatController extends WeixinBaseController {
                if(patient==null){
                    patient= patientService.findByIdcard(mobile);
                }
                loginLog.setUserCode(patient.getCode());
                loginLog.setLoginType("2");
                if (patient == null) {
                    errorMessage="该手机号暂未注册帐号,请确认后重新输入!";
@ -370,6 +369,7 @@ public class WechatController extends WeixinBaseController {
                    loginLogService.saveLog(loginLog);
                    return error(-1,errorMessage);
                }
                loginLog.setUserCode(patient.getCode());
                //解密
                password = RSAUtils.getInstance(patientService).decryptString(password);
                password=StringUtils.reverse(password);
@ -428,7 +428,6 @@ public class WechatController extends WeixinBaseController {
                        return error(-1, errorMessage);}
                }
                Patient patient = patientService.findByMobile(mobile);
                loginLog.setUserCode(patient.getCode());
                loginLog.setLoginType("1");
                if (patient == null) {
                    errorMessage="该手机号暂未注册帐号,请确认后重新输入!";
@ -451,7 +450,7 @@ public class WechatController extends WeixinBaseController {
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                }
                loginLog.setUserCode(patient.getCode());
                // 绑定用户手机号和openid
                if (!StringUtils.equals(patient.getOpenid(), openid)) {
                    patient.setOpenid(openid);

+ 0 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java

@ -1,22 +1,15 @@
package com.yihu.wlyy.web.common.util;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.SOAPUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jdk.nashorn.internal.parser.JSONParser;
import net.sf.json.JSON;
import net.sf.json.util.JSONUtils;
import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

+ 6 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -378,6 +378,12 @@ public class DoctorController extends BaseController {
                    json.put("dept", doctor.getDept());
                    json.put("deptName", doctor.getDeptName());
                    json.put("expertise", doctor.getExpertise());
                    JSONObject iswork = workTimeService.isDoctorWorking(doctor.getCode());
                    if (iswork.getString("status").equals("1")) {
                        json.put("isworking", 1);
                    } else {
                        json.put("isworking", 0);
                    }
                    array.put(json);
                }
            }

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

@ -57,14 +57,19 @@ public class DoctorConsultController extends WeixinBaseController {
    /**
     * 三师咨询列表查询
     *
     * @param type     咨询类型:0、全部,1、咨询我的,2、公共的, 3、参与过的,4、已结束的  5 名医咨询 全部  6 名医咨询 进行中 7 名医咨询 已结束 8名医咨询 待处理 9咨询我的三师 + 家庭 + 名医
     * @param type     咨询类型:0、全部,1、咨询我的,2、公共的, 3、参与过的,4、已结束的  5 名医咨询 全部
     *                 6 名医咨询 进行中 7 名医咨询 已结束 8名医咨询 待处理 9咨询我的三师 + 家庭 + 名医   10查询我咨询的
     * @param id
     * @param pagesize 每页显示数,默认为10
     * @return
     */
    @RequestMapping(value = "list")
    @ResponseBody
    public String list(int type, int id, int pagesize, @RequestParam(required = false) String patient, @RequestParam(required = false) String title) {
    public String list(int type,
                       int id,
                       int pagesize,
                       @RequestParam(required = false) String patient,
                       @RequestParam(required = false) String title) {
        try {
            Page<ConsultTeam> list = consultTeamService.findByDoctor(getUID(), type, id, pagesize, title);
            JSONArray jsonArray = new JSONArray();

+ 13 - 3
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthRecordController.java

@ -1,6 +1,7 @@
package com.yihu.wlyy.web.doctor.health;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -9,6 +10,7 @@ import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yihu.wlyy.entity.patient.PatientHealthRecordDiet;
@ -103,10 +105,18 @@ public class DoctorHealthRecordController extends BaseController {
	 */
	@RequestMapping(value = "list_medication")
	@ResponseBody
	public String medication(String patient, String start,String end,int page, int pagesize) {
	public String medication(String patient, @RequestParam(required = false) String start,
							 @RequestParam(required = false) String end,
							 @RequestParam(required = false) int page,
							 @RequestParam(required = false) String sortDate, int pagesize) {
		try {
			//Page<PatientHealthRecordMedication> data = patientHealthRecordService.findMedicationByPatient(patient, DateUtil.strToDateLong(sortDate), pagesize);
			Page<PatientHealthRecordMedication> data = patientHealthRecordService.findMedicalByPatientPage(patient, start,end, page, pagesize);
			Page<PatientHealthRecordMedication> data = null;
			if(!StringUtils.isEmpty(sortDate)) {
				data = patientHealthRecordService.findMedicationByPatient(patient, DateUtil.strToDateLong(sortDate), pagesize);
			} else {
				data = patientHealthRecordService.findMedicalByPatientPage(patient, start, end, page, pagesize);
			}
			if (data != null) {
				JSONArray array = new JSONArray();
				for (PatientHealthRecordMedication record : data) {

+ 23 - 0
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java

@ -5,9 +5,11 @@ import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.web.BaseController;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@ -24,6 +26,27 @@ public class SignPatientLabelInfoController extends BaseController {
    @Autowired
    SignPatientLabelInfoService labelInfoService;
    /**
     * 查询居民信息
     *
     * @param patient 患者
     * @return
     */
    @RequestMapping(value = "/patient")
    @ResponseBody
    public String getPatient(String patient){
        try{
            if(StringUtils.isEmpty(patient)){
                return error(-1,"居民不能为空");
            }
            JSONObject p = labelInfoService.getPatient(patient);
            return write(200,"查询成功","data",p);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    /**
     * 查询某个团队的某个标签下的患者信息
     *

+ 30 - 10
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorFamilyContractController.java

@ -312,10 +312,12 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                }
            }
            if (StringUtils.isEmpty(doctor) && StringUtils.isEmpty(healthDoctor)) {
            if (StringUtils.isEmpty(doctor) && StringUtils.isEmpty(healthDoctor) && type != 2) {
                return error(-1, "全科医生或健管师不能为空!");
            }
            if (adminTeamCode <= 0 && type != 2) {
                return error(-1, "团队不能为空!");
            }
            if (StringUtils.isEmpty(healthLabel) && type != 2) {
                return error(-1, "健康情况标签不能为空!");
            }
@ -787,22 +789,32 @@ public class DoctorFamilyContractController extends WeixinBaseController {
     * @param doctor   医生code
     * @param page     当前页
     * @param pageSize 每页显示条数
     * @param patientName 患者名称
     * @param patientAddr 患者居住地址
     * @return
     */
    @RequestMapping(value = "/findNoHealthSignFamilyHealth")
    @ResponseBody
    public String findNoHealthSignFamilyHealth(String doctor, Integer page, Integer pageSize) {
    public String findNoHealthSignFamilyHealth(
            String doctor,
            Integer page,
            Integer pageSize,
            @RequestParam(required = false) String patientName,
            @RequestParam(required = false) String patientAddr) {
        try {
            JSONObject returnJo=new JSONObject();
            JSONArray array = new JSONArray();
            Page<SignFamily> list = familyContractService.findNoHealthSignFamilyHealth(doctor, page, pageSize);
            Map<String,Object> returnMap=familyContractService.findNoHealthSignFamilyHealth(doctor, page, pageSize,patientName,patientAddr);
            List<Patient> list = (List<Patient>) returnMap.get("returnList");
            Integer count= (Integer) returnMap.get("count");
            if (list != null) {
                for (SignFamily sf : list) {
                for (Patient sf : list) {
                    if (sf == null) {
                        continue;
                    }
                    JSONObject json = new JSONObject();
                    json.put("signCode", sf.getCode());//签约code
                    json.put("code", sf.getPatient());//患者code
                    //json.put("signCode", sf.getCode());//签约code
                    json.put("code", sf.getCode());//患者code
                    json.put("name", sf.getName());//患者name
                    String idcard = sf.getIdcard();
                    if (StringUtils.isNotBlank(idcard) && (idcard.length() == 15 || idcard.length() == 18)) {
@ -822,7 +834,9 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                    array.put(json);
                }
            }
            return write(200, "签约数据加载成功!", "list", array);
            returnJo.put("list",array);
            returnJo.put("count",count);
            return write(200, "签约数据加载成功!", "data", returnJo);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
@ -848,12 +862,18 @@ public class DoctorFamilyContractController extends WeixinBaseController {
                int result = expensesRemindService.remindPatientExpenses(patient, getUID());
                if (result == 1) {
                    return error(200, "提醒成功");
                } if (result == 2) {
                    return error(200, "居民未绑定手机号,无法短信提醒,已发送微信提醒");
                }if (result == 3) {
                    return error(200, "居民未绑定微信,无法微信提醒,已发送短信提醒");
                } if (result == -1) {
                    return error(-1, "居民未绑定手机号和微信,无法提醒");
                } else {
                    return error(-1, "提醒失败");
                }
            } else if (StringUtils.isNotEmpty(isAll) && isAll.equals("1")) {
                expensesRemindService.remindPatientExpensesAll(getUID()); //int result =
                return error(200, "提醒成功");
                expensesRemindService.remindPatientExpensesAll(getUID());
                return error(200, "提醒操作成功");
            } else {
                return write(-1, "参数错误");
            }

+ 24 - 8
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/sign/DoctorSignController.java

@ -1,11 +1,9 @@
package com.yihu.wlyy.web.doctor.sign;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import com.yihu.wlyy.util.IdCardUtil;
import io.swagger.annotations.Api;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@ -222,7 +220,7 @@ public class DoctorSignController extends BaseController {
                }
            }
            JSONObject data = new JSONObject();
            JSONArray jsonArray = new JSONArray();
            List<JSONObject> jsonArray = new ArrayList<>();
            SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
            if (listSub != null) {
                for (Map<String, Object> temp : listSub) {
@ -234,6 +232,7 @@ public class DoctorSignController extends BaseController {
                    json.put("doctorCode", temp.get("doctor"));
                    json.put("patientCode", temp.get("patient"));
                    json.put("patientName", temp.get("name"));
                    json.put("age", IdCardUtil.getAgeForIdcard(String.valueOf(temp.get("idcard"))));
                    json.put("provinceName", temp.get("provinceName"));
                    json.put("cityName", temp.get("cityName"));
                    json.put("townName", temp.get("townName"));
@ -255,11 +254,10 @@ public class DoctorSignController extends BaseController {
                        case -4:
                            statusName = "已解约";
                            break;
                    }
                    json.put("statusName", statusName);
                    json.put("id", temp.get("id"));
                    json.put("applyDate", DateUtil.dateToStrShort((Date) temp.get("applyDate")));
                    json.put("applyDate", DateUtil.dateToStrLong((Date) temp.get("applyDate")));
                    json.put("releaseSpeak", temp.get("reason"));
                    json.put("streetName", temp.get("streetName"));
                    json.put("sex", temp.get("sex"));
@ -272,9 +270,27 @@ public class DoctorSignController extends BaseController {
                            json.put("expensesRemindStatus", df.format(new Date()).equals(epTime) ? 1 : 0);
                        }
                    }
                    jsonArray.put(json);
                    jsonArray.add(json);
                }
            }
            if (status == 5) {
                jsonArray.sort(new Comparator<JSONObject>() {
                    @Override
                    public int compare(JSONObject o1, JSONObject o2) {
                        if (o1.getInt("expensesRemindStatus") > o2.getInt("expensesRemindStatus")) {
                            return 1;
                        } else if (o1.getInt("expensesRemindStatus") < o2.getInt("expensesRemindStatus")) {
                            return -1;
                        } else if (o1.getInt("expensesRemindStatus") == o2.getInt("expensesRemindStatus")) {
                            return 0;
                        } else {
                            return 0;
                        }
                    }
                });
            }
            data.put("list", jsonArray);
            data.put("totalPage", totalPage);
            data.put("page", page);

+ 16 - 2
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/team/AdminTeamController.java

@ -69,6 +69,19 @@ public class AdminTeamController extends BaseController {
        }
    }
    @RequestMapping(value = "/deletion", method = RequestMethod.POST)
    @ApiOperation(value = "删除团队信息")
    public String deleteTeam(@RequestParam("teamId") long teamId){
        try {
            teamService.deleteTeam(teamId);
            return write(200, "OK");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/{team_id}/name", method = RequestMethod.POST)
    @ApiOperation(value = "更新团队名称")
    public String updateTeamName(@PathVariable("team_id") long teamId,
@ -140,9 +153,10 @@ public class AdminTeamController extends BaseController {
            return error(-1, e.getMessage());
        }
    }
    //目前没用到,之后可能会用到
//    @RequestMapping(value = "/{team_id}/members/excludedThisAndLevel3", method = RequestMethod.GET)
//    @ApiOperation(value = "获取团队成员,排除自己和专科医生")
//  @RequestMapping(value = "/{team_id}/members/excludedThisAndLevel3", method = RequestMethod.GET)
//  @ApiOperation(value = "获取团队成员,排除自己和专科医生")
    public String getTeamMembersExcludedThisAndLevel3(@PathVariable("team_id") long teamId) {
        try {
            List<Doctor> members = memberService.getMembers(teamId,super.getUID());

+ 17 - 7
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/account/PatientController.java

@ -143,16 +143,26 @@ public class PatientController extends WeixinBaseController {
     */
    @RequestMapping(value = "save")
    @ResponseBody
    public String save(@RequestParam(required = false) String photo, @RequestParam(required = false) String name, @RequestParam(required = false) Integer sex, @RequestParam(required = false) String birthday, @RequestParam(required = false) String ssc, @RequestParam(required = false) String province, @RequestParam(required = false) String city, @RequestParam(required = false) String town, @RequestParam(required = false) String address, @RequestParam(required = false) String street) {
    public String save(@RequestParam(required = false) String photo,
                       @RequestParam(required = false) String name,
                       @RequestParam(required = false) Integer sex,
                       @RequestParam(required = false) String birthday,
                       @RequestParam(required = false) String ssc,
                       @RequestParam(required = false) String province,
                       @RequestParam(required = false) String city,
                       @RequestParam(required = false) String town,
                       @RequestParam(required = false) String address,
                       @RequestParam(required = false) String street) {
        try {
            Patient patient = patientInfoService.findByCode(getUID());
            if (StringUtils.isEmpty(photo)) {
                photo = fetchWxImages();
            }
            if (StringUtils.isNotEmpty(photo)) {
                photo = CommonUtil.copyTempImage(photo);
            }
//            if (StringUtils.isEmpty(photo)) {
//                photo = fetchWxImages();
//            }
//            if (StringUtils.isNotEmpty(photo)) {
//                photo = CommonUtil.copyTempImage(photo);
//            }
            if (StringUtils.isNotEmpty(photo)) {
                photo=SystemConf.getInstance().getImageServer()+photo;
                patient.setPhoto(photo);
            }
            if (StringUtils.isNotEmpty(name))