Quellcode durchsuchen

统计代码重构

esb vor 8 Jahren
Ursprung
Commit
2970a10d7b

+ 9 - 9
patient-co-statistics/pom.xml

@ -8,8 +8,8 @@
    <modelVersion>4.0.0</modelVersion>
    <!--打成war包需要的配置-->
    <packaging>war</packaging>
    <!--<packaging>jar</packaging>-->
    <!--<packaging>war</packaging>-->
    <packaging>jar</packaging>
    <name>patient-co-statistics</name>
    <properties>
@ -371,7 +371,7 @@
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-tomcat</artifactId>
                <version>${version.spring-boot}</version>
                <scope>provided</scope>
                <!--<scope>provided</scope>-->
            </dependency>
        <dependency>
            <groupId>org.json</groupId>
@ -394,12 +394,12 @@
    <build>
        <plugins>
            <!--打成war包需要的配置-->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <!--<plugin>-->
                <!--<artifactId>maven-war-plugin</artifactId>-->
                <!--<configuration>-->
                    <!--<failOnMissingWebXml>false</failOnMissingWebXml>-->
                <!--</configuration>-->
            <!--</plugin>-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>

+ 6 - 6
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/ServletInitializer.java

@ -7,9 +7,9 @@ import org.springframework.boot.context.web.SpringBootServletInitializer;
/**
 * Created by Administrator on 2016.10.14.
 */
public class ServletInitializer extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(Application.class);
    }
}
//public class ServletInitializer extends SpringBootServletInitializer {
//    @Override
//    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
//        return application.sources(Application.class);
//    }
//}

+ 6 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/ConsultDataFilter.java

@ -87,6 +87,12 @@ public class ConsultDataFilter {
                isAll=false;
                continue;
            }
            if(orgCode.length()!=10) {
                errorContent.append("咨询Id:"+consultTeam.getId()+",团队Id:"+adminTeam.getId()+",咨询的团队(wlyy_consult_team)中的机构是测试机构");
                isAll=false;
                errorCount++;
                continue;
            }
            String orgCodeTemp="";
            //统计机构
            if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){

+ 6 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/FollowUpDataFilter.java

@ -103,6 +103,12 @@ public class FollowUpDataFilter {
                isAll=false;
                continue;
            }
            if(orgCode.length()!=10) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的hospital数据是测试数据");
                isAll=false;
                errorCount++;
                continue;
            }
            //统计机构
            if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
                //统计站

+ 6 - 0
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/HealthGuideDataFilter.java

@ -95,6 +95,12 @@ public class HealthGuideDataFilter {
                isAll=false;
                continue;
            }
            if(orgCode.length()!=10) {
                errorContent.append("健康咨询id:"+patientHealthGuidance.getId()+",签约code:"+signFamily.getCode()+",咨询的家庭签约的机构Hospital是测试机构");
                isAll=false;
                errorCount++;
                continue;
            }
            String orgCodeTemp="";
            //统计机构 -----------------start---------------------
            if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){

+ 8 - 3
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java

@ -38,7 +38,7 @@ public class SignDataFilter {
    public static String level2Health="5";//健康服务分布
    public static String level3Disease="1";//疾病分组
   public static int size=0;
    private StringBuffer errorContent =new StringBuffer();//错误信息
    @Autowired
@ -126,6 +126,12 @@ public class SignDataFilter {
                errorCount++;
                continue;
            }
            if(orgCode.length()!=10) {
                errorContent.append("签约code:"+signFamily.getCode()+",签约表中(wlyy_sign_family)中的hospital数据是测试数据");
                isAll=false;
                errorCount++;
                continue;
            }
            String orgCodeTemp="";
            if(!"00".equals(orgCode.substring(orgCode.length()-2,orgCode.length()))){
                //站
@ -300,8 +306,7 @@ public class SignDataFilter {
    }
    private String getExpenses(SignFamily signFamily) {
        String returnLevel2Key;
        returnLevel2Key= StringUtils.isEmpty(signFamily.getExpensesStatus())?"0":signFamily.getExpensesStatus();
        String returnLevel2Key= StringUtils.isEmpty(signFamily.getExpensesStatus())?"0":signFamily.getExpensesStatus();
        return returnLevel2Key;
    }

+ 3 - 4
patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/AllSignExpenseStatusJob.java

@ -16,10 +16,7 @@ import com.yihu.wlyy.statistics.model.system.Town;
import com.yihu.wlyy.statistics.model.team.AdminTeam;
import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import com.yihu.wlyy.statistics.vo.WlyyQuotaVO;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
@ -40,6 +37,7 @@ import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Calendar;
/**
 * Created by Administrator on 2016.10.11.
@ -47,6 +45,7 @@ import java.util.*;
 */
@Component
@Scope("prototype")
@DisallowConcurrentExecution//防止到了执行时间点前一任务还在执行中,但是这时有空闲的线程,那么马上又会执行,这样一来就会存在同一job被并行执行
public class AllSignExpenseStatusJob implements Job{
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象

+ 59 - 59
patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/PatientInterceptor.java

@ -25,65 +25,65 @@ public class PatientInterceptor extends BaseInterceptor {
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
		boolean flag = true;
		try {
//			if(request.getRequestURI().contains("/patient/hosptail/getHositalByTownCode")){
//				return true;
//			}
//			response.setCharacterEncoding("UTF-8");
//			JSONObject json = getAgent(request);
//			if (json == null) {
//				// 未登录
//				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//				return false;
//			}
//			String tokenStr = json.has("token") ? json.getString("token") : "";
//			String user = json.has("uid") ? json.getString("uid") : "";
//			String imei = json.has("imei") ? json.getString("imei") : "";
//			String openid = json.has("openid") ? json.getString("openid") : "";
//			int platform = json.has("platform") ? json.getInt("platform") : 1;
//			if (StringUtils.isEmpty(imei)) {
//				imei = openid;
//			}
//
//			Token token = null;
//			if (platform == 1) {
//				token = SystemData.patientTokens.get(user);
//			} else if (platform == 3) {
//				token = SystemData.wxPatientTokens.get(user);
//			}
//			if (token == null) {
//				token = tokenDao.findByPatient(user, platform);
//				// 加入缓存
//				if (platform == 1) {
//					SystemData.patientTokens.put(user, token);
//				} else if (platform == 3) {
//					SystemData.wxPatientTokens.put(user, token);
//				}
//			}
//			if (token == null || StringUtils.isEmpty(tokenStr) || (token.getPlatform() != 1 && token.getPlatform() != 3)) {
//				// 未登录
//				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
//				flag = false;
//			} else {
//				if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(user, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
//					// 别处登录
//					response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
//					flag = false;
//				} else {
//					// 一天只更新一次
//					if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
//						// 今天未更新,则更新缓存
//						token.setCzrq(new Date());
//						// 更新内存
//						if (platform == 1) {
//							SystemData.patientTokens.put(user, token);
//						} else if (platform == 3) {
//							SystemData.wxPatientTokens.put(user, token);
//						}
//						// 更新数据库
//						tokenDao.save(token);
//					}
//				}
//			}
			if(request.getRequestURI().contains("/patient/hosptail/getHositalByTownCode")){
				return true;
			}
			response.setCharacterEncoding("UTF-8");
			JSONObject json = getAgent(request);
			if (json == null) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				return false;
			}
			String tokenStr = json.has("token") ? json.getString("token") : "";
			String user = json.has("uid") ? json.getString("uid") : "";
			String imei = json.has("imei") ? json.getString("imei") : "";
			String openid = json.has("openid") ? json.getString("openid") : "";
			int platform = json.has("platform") ? json.getInt("platform") : 1;
			if (StringUtils.isEmpty(imei)) {
				imei = openid;
			}
			Token token = null;
			if (platform == 1) {
				token = SystemData.patientTokens.get(user);
			} else if (platform == 3) {
				token = SystemData.wxPatientTokens.get(user);
			}
			if (token == null) {
				token = tokenDao.findByPatient(user, platform);
				// 加入缓存
				if (platform == 1) {
					SystemData.patientTokens.put(user, token);
				} else if (platform == 3) {
					SystemData.wxPatientTokens.put(user, token);
				}
			}
			if (token == null || StringUtils.isEmpty(tokenStr) || (token.getPlatform() != 1 && token.getPlatform() != 3)) {
				// 未登录
				response.getOutputStream().write(error(SystemConf.NOT_LOGIN, "请登录后再操作!").getBytes());
				flag = false;
			} else {
				if (!StringUtils.equals(tokenStr, token.getToken()) || !StringUtils.equals(user, token.getUser()) || !StringUtils.equals(imei, token.getImei())) {
					// 别处登录
					response.getOutputStream().write(error(SystemConf.LOGIN_OTHER, "帐号在别处登录,请重新登录").getBytes());
					flag = false;
				} else {
					// 一天只更新一次
					if (DateUtil.getDays(token.getCzrq(), DateUtil.getNowDateShort()) != 0) {
						// 今天未更新,则更新缓存
						token.setCzrq(new Date());
						// 更新内存
						if (platform == 1) {
							SystemData.patientTokens.put(user, token);
						} else if (platform == 3) {
							SystemData.wxPatientTokens.put(user, token);
						}
						// 更新数据库
						tokenDao.save(token);
					}
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -742,7 +742,7 @@ public class DoctorInfoService extends BaseService {
        if(!newPassword1.equals(newPassword2)){
           throw new Exception("新密码不一致");
        }
        if(newPassword1.equals(oldPassword)){
        if(!newPassword1.equals(oldPassword)){
            throw new Exception("新旧密码一致");
        }
        Doctor doctor=doctorDao.findByCode(doctorCode);

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

@ -493,7 +493,7 @@ public class DoctorController extends BaseController {
                //是否名医
                json.put("isFamous", temp.getIsFamous());
                //是否医生提示 提示过是1 其他都是0
                json.put("isPasswordPrompt", StringUtils.isEmpty(temp.getIsPasswordPrompt())?"0":temp.getIsPasswordPrompt());
                json.put("isPasswordPrompt", StringUtils.isEmpty(temp.getIsPasswordPrompt()) ? "0" : temp.getIsPasswordPrompt());
                return write(200, "医生信息查询成功!", "data", json);
            } else {
@ -1524,4 +1524,26 @@ public class DoctorController extends BaseController {
        }
    }
    /**
     * 当前医生是否与居民签约
     *
     * @param patient
     * @return
     */
    @RequestMapping(value = "/is_patient_signed")
    @ResponseBody
    public String isPatientSign(String patient) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "居民不能为空");
            }
            boolean isSigned = doctorInfoService.isPatientSigned(patient, getUID());
            return write(200, "查询成功", "data", isSigned ? "1" : "0");
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}

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

@ -60,9 +60,10 @@ public class DoctorHealthRecordController extends BaseController {
	 */
	@RequestMapping(value = "list_sports")
	@ResponseBody
	public String sports(String patient, String sortDate, int pagesize) {
	public String sports(String patient, String start,String end,int page, int pagesize) {
		try {
			Page<PatientHealthRecordSports> data = patientHealthRecordService.findSportsByPatient(patient, DateUtil.strToDateLong(sortDate), pagesize);
			//Page<PatientHealthRecordSports> data = patientHealthRecordService.findSportsByPatient(patient, DateUtil.strToDateLong(sortDate), pagesize);
			Page<PatientHealthRecordSports> data = patientHealthRecordService.findSportsByPatientPage(patient, start,end,page, pagesize);
			if (data != null) {
				JSONArray array = new JSONArray();
				for (PatientHealthRecordSports record : data) {
@ -102,9 +103,10 @@ public class DoctorHealthRecordController extends BaseController {
	 */
	@RequestMapping(value = "list_medication")
	@ResponseBody
	public String medication(String patient, String sortDate, int pagesize) {
	public String medication(String patient, String start,String end,int page, int pagesize) {
		try {
			Page<PatientHealthRecordMedication> data = patientHealthRecordService.findMedicationByPatient(patient, DateUtil.strToDateLong(sortDate), pagesize);
			//Page<PatientHealthRecordMedication> data = patientHealthRecordService.findMedicationByPatient(patient, DateUtil.strToDateLong(sortDate), pagesize);
			Page<PatientHealthRecordMedication> data = patientHealthRecordService.findMedicalByPatientPage(patient, start,end, page, pagesize);
			if (data != null) {
				JSONArray array = new JSONArray();
				for (PatientHealthRecordMedication record : data) {
@ -141,9 +143,9 @@ public class DoctorHealthRecordController extends BaseController {
	 */
	@RequestMapping(value = "list_diet")
	@ResponseBody
	public String diet(String patient, String sortDate, int pagesize) {
	public String diet(String patient, String start,String end,int page, int pagesize) {
		try {
			Page<PatientHealthRecordDiet> data = patientHealthRecordService.findDietByPatient(patient, DateUtil.strToDateLong(sortDate), pagesize);
			Page<PatientHealthRecordDiet> data = patientHealthRecordService.findDietByPatientPage(patient, start,end, page, pagesize);
			if (data != null) {
				JSONArray array = new JSONArray();
				for (PatientHealthRecordDiet record : data) {

+ 10 - 8
patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -35,10 +35,12 @@ public class FamilyMemberController extends BaseController {
     * @param relation 关系
     * @return
     */
    @RequestMapping(value = "/member_add")
    @RequestMapping(value = "/member_add",method = RequestMethod.POST)
    @ApiOperation(value = "添加成员")
    public String addFamilyMember(String member, @RequestParam(required = false) String captcha,
                                  @RequestParam(required = false) String password, int relation) {
    public String addFamilyMember(@RequestParam("member")String member,
                                  @RequestParam(value = "captcha",required = false) String captcha,
                                  @RequestParam(value = "password",required = false) String password,
                                  @RequestParam("relation")int relation) {
        try {
            if (StringUtils.isEmpty(member)) {
                return error(-1, "添加成员不能为空");
@ -76,9 +78,9 @@ public class FamilyMemberController extends BaseController {
     * @param relation 家庭关系
     * @return
     */
    @RequestMapping(value = "/relation_update")
    @RequestMapping(value = "/relation_update",method = RequestMethod.POST)
    @ApiOperation(value = "家庭成员关系修改")
    public String modifyFamilyRelation(String member, int relation) {
    public String modifyFamilyRelation(@RequestParam("member")String member, @RequestParam("relation")int relation) {
        try {
            if (StringUtils.isEmpty(member)) {
                return error(-1, "添加成员不能为空");
@ -110,9 +112,9 @@ public class FamilyMemberController extends BaseController {
     * @param member
     * @return
     */
    @RequestMapping(value = "/member_delete")
    @RequestMapping(value = "/member_delete",method = RequestMethod.POST)
    @ApiOperation(value = "家庭成员删除")
    public String deleteMember(String member) {
    public String deleteMember(@RequestParam("member")String member) {
        try {
            if (StringUtils.isEmpty(member)) {
                return error(-1, "成员不能为空");
@ -157,7 +159,7 @@ public class FamilyMemberController extends BaseController {
     */
    @RequestMapping(value = "/is_register", method = RequestMethod.GET)
    @ApiOperation(value = "家庭成员查询")
    public String isRegister(String idcard) {
    public String isRegister(@RequestParam("idcard")String idcard) {
        try {
            if (StringUtils.isEmpty(idcard)) {
                return error(-1, "身份证号不能为空");

+ 36 - 36
patient-co-wlyy/src/main/resources/application.properties

@ -43,50 +43,50 @@
#------------------------------------开发环境数据库配置------------------------------------#
##### mysql database setting
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
jdbc.username=root
jdbc.password=123456
#### health index
health.jdbc.driver=com.mysql.jdbc.Driver
health.jdbc.url=jdbc:mysql://172.19.103.77/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
health.jdbc.username=root
health.jdbc.password=123456
#### suifang
fv.jdbc.driver=com.mysql.jdbc.Driver
fv.jdbc.url=jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
fv.jdbc.username=root
fv.jdbc.password=123456
#### redis
redis.host=172.19.103.47
redis.port=6379
#---------------------------------测试环境数据库配置---------------------------------------#
###### mysql database setting
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.url=jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#jdbc.username=ssgg
#jdbc.password=ssgg
#jdbc.url=jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#jdbc.username=root
#jdbc.password=123456
#
###### health index
##### health index
#health.jdbc.driver=com.mysql.jdbc.Driver
#health.jdbc.url=jdbc:mysql://172.19.103.85/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#health.jdbc.username=ssgg
#health.jdbc.password=ssgg
#health.jdbc.url=jdbc:mysql://172.19.103.77/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#health.jdbc.username=root
#health.jdbc.password=123456
#
###### suifang
##### suifang
#fv.jdbc.driver=com.mysql.jdbc.Driver
#fv.jdbc.url=jdbc:mysql://172.19.103.85/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#fv.jdbc.username=ssgg
#fv.jdbc.password=ssgg
#fv.jdbc.url=jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#fv.jdbc.username=root
#fv.jdbc.password=123456
#
###### redis
#redis.host=172.19.103.88
##### redis
#redis.host=172.19.103.47
#redis.port=6379
#---------------------------------测试环境数据库配置---------------------------------------#
##### mysql database setting
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
jdbc.username=luofaqiang
jdbc.password=luofaqiang
##### health index
health.jdbc.driver=com.mysql.jdbc.Driver
health.jdbc.url=jdbc:mysql://172.19.103.85/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
health.jdbc.username=luofaqiang
health.jdbc.password=luofaqiang
##### suifang
fv.jdbc.driver=com.mysql.jdbc.Driver
fv.jdbc.url=jdbc:mysql://172.19.103.85/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
fv.jdbc.username=luofaqiang
fv.jdbc.password=luofaqiang
##### redis
redis.host=172.19.103.88
redis.port=6379
#-----------------------------------通用配置--------------------------------------------#
##### redis
redis.maxIdle=300