Kaynağa Gözat

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/jw2.0 into dev

liuwenbin 7 yıl önce
ebeveyn
işleme
1bed9cad2f
52 değiştirilmiş dosya ile 1986 ekleme ve 234 silme
  1. 20 1
      app/app-iot-server/pom.xml
  2. 4 7
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/FileUploadController.java
  3. 22 8
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/company/IotCompanyController.java
  4. 92 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/user/UserModel.java
  5. 2 4
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/config/EhrWebHttpSessionConfiguration.java
  6. 22 8
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/config/EhrWebSecurityConfiguration.java
  7. 40 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationFailureHandler.java
  8. 17 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationSuccessHandler.java
  9. 55 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebContextLogoutHandler.java
  10. 1 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebUserDetailsService.java
  11. 5 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/BaseService.java
  12. 37 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/SystemDictService.java
  13. 177 2
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/company/CompanyService.java
  14. 48 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/CurrentRequest.java
  15. 9 8
      app/app-iot-server/src/main/resources/application.yml
  16. 0 23
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/commonFoot.jsp
  17. 0 21
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/commonHead.jsp
  18. 0 17
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/commonInclude.jsp
  19. 0 21
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/layout.xml
  20. 0 25
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/mainLayout.jsp
  21. 0 13
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/simpleLayout.jsp
  22. 0 5
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/error.jsp
  23. 0 6
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/signin.jsp
  24. 0 49
      app/app-iot-server/src/main/webapp/WEB-INF/jsp/signinJs.jsp
  25. 2 2
      app/app-iot-server/src/main/webapp/front/js/common/apiServer.js
  26. 4 3
      app/app-iot-server/src/main/webapp/front/js/scripts/login.js
  27. 2 2
      app/app-iot-server/src/main/webapp/front/views/index.html
  28. 278 0
      common/common-entity/src/main/java/com/yihu/jw/entity/archives/PatientArchives.java
  29. 97 0
      common/common-entity/src/main/java/com/yihu/jw/entity/archives/PatientArchivesInfo.java
  30. 10 0
      common/common-entity/src/main/java/com/yihu/jw/iot/company/IotCompanyDO.java
  31. 14 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/archives/PatientArchivesMapping.java
  32. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  33. 34 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/archives/Test.java
  34. 20 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java
  35. 1 1
      server/svr-configuration/src/main/resources/application.yml
  36. 2 1
      svr/readme.MD
  37. 125 0
      svr/svr-wlyy-archives/pom.xml
  38. 1 0
      svr/svr-wlyy-archives/readme.MD
  39. 18 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/SvrWlyyArchivesApplication.java
  40. 51 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/config/SwaggerConfig.java
  41. 29 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/config/jpa/HibernateProperties.java
  42. 55 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/config/jpa/WlyyArchivesJpa.java
  43. 29 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/controller/PatientArchivesController.java
  44. 12 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/dao/PatientArchivesDao.java
  45. 12 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/dao/PatientArchivesInfoDao.java
  46. 13 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/service/PatientArchivesSevice.java
  47. 220 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/util/AddressUtils.java
  48. 47 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/util/CusAccessObjectUtil.java
  49. 218 0
      svr/svr-wlyy-archives/src/main/java/com/yihu/jw/util/IDCard.java
  50. 88 0
      svr/svr-wlyy-archives/src/main/resources/application.yml
  51. 6 0
      svr/svr-wlyy-archives/src/main/resources/banner.txt
  52. 46 0
      svr/svr-wlyy-archives/src/main/resources/bootstrap.yml

+ 20 - 1
app/app-iot-server/pom.xml

@ -234,7 +234,7 @@
    </dependencies>
    <build>
        <finalName>app-emergency-server</finalName>
        <finalName>app-iot-server</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
@ -248,5 +248,24 @@
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <!--打包的时候把resources下的资源移到classpath下-->
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${project.build.directory}/classes</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
            <resource>
                <!--打包的时候把resources下的资源移到classpath下-->
                <directory>${basedir}/src/main/resources</directory>
                <targetPath>${project.build.directory}/classes</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>

+ 4 - 7
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/FileUploadController.java

@ -2,8 +2,6 @@ package com.yihu.ehr.iot.controller.common;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.base.fastdfs.FastDFSHelper;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -139,9 +137,7 @@ public class FileUploadController extends BaseController {
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    public Envelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流") @RequestBody String jsonData) throws Exception {
        try {
            if(jsonData == null){
                return Envelop.getError(IotRequestMapping.FileUpload.message_fail_jsonData_is_null, ExceptionCode.common_error_params_code);
            }
            String date = URLDecoder.decode(jsonData,"UTF-8");
            String[] fileStreams = date.split(",");
            String is = URLDecoder.decode(fileStreams[1],"UTF-8").replace(" ","+");
@ -168,8 +164,9 @@ public class FileUploadController extends BaseController {
            uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fid").toString().replaceAll("\"", ""));
            //返回文件路径
            return Envelop.getSuccess(IotRequestMapping.FileUpload.message_success_upload, uploadVO);
        }catch (ApiException e){
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }
    }

+ 22 - 8
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/company/IotCompanyController.java

@ -45,7 +45,7 @@ public class IotCompanyController extends BaseController {
    @PostMapping(value = IotRequestMapping.Company.addCompany)
    @ApiOperation(value = "创建企业", notes = "创建企业")
    public Envelop<IotCompanyVO> addCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
    public Envelop<IotCompanyVO> addCompany(@ApiParam(name = "jsonData", value = "json串", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            return companyService.addCompany(jsonData);
@ -57,7 +57,7 @@ public class IotCompanyController extends BaseController {
    @GetMapping(value = IotRequestMapping.Company.findCompanyById)
    @ApiOperation(value = "根据id查找企业", notes = "根据id查找企业")
    public Envelop<IotCompanyVO> findByCode(@ApiParam(name = "id", value = "id")
    public Envelop<IotCompanyVO> findByCode(@ApiParam(name = "id", value = "企业id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return companyService.findByCode(id);
@ -69,7 +69,7 @@ public class IotCompanyController extends BaseController {
    @GetMapping(value = IotRequestMapping.Company.findByBusinessLicense)
    @ApiOperation(value = "根据营业执照号查找企业", notes = "根据营业执照号查找企业")
    public Envelop<IotCompanyVO> findByBusinessLicense(@ApiParam(name = "businessLicense", value = "businessLicense")
    public Envelop<IotCompanyVO> findByBusinessLicense(@ApiParam(name = "businessLicense", value = "营业执照号")
                                                       @RequestParam(value = "businessLicense", required = true) String businessLicense) {
        try {
            return companyService.findByBusinessLicense(businessLicense);
@ -81,7 +81,7 @@ public class IotCompanyController extends BaseController {
    @PostMapping(value = IotRequestMapping.Company.delCompany)
    @ApiOperation(value = "删除企业", notes = "删除企业")
    public Envelop<IotCompanyVO> delCompany(@ApiParam(name = "id", value = "id")
    public Envelop<IotCompanyVO> delCompany(@ApiParam(name = "id", value = "企业id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return companyService.delCompany(id);
@ -93,7 +93,7 @@ public class IotCompanyController extends BaseController {
    @PostMapping(value = IotRequestMapping.Company.updCompany)
    @ApiOperation(value = "修改企业信息", notes = "修改企业信息")
    public Envelop<IotCompanyVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
    public Envelop<IotCompanyVO> updCompany(@ApiParam(name = "jsonData", value = "json串", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            return companyService.updCompany(jsonData);
@ -128,7 +128,7 @@ public class IotCompanyController extends BaseController {
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertById)
    @ApiOperation(value = "根据id查找企业证书", notes = "根据id查找企业证书")
    public Envelop<IotCompanyCertificateVO> findCompanyCertById(@ApiParam(name = "id", value = "id")
    public Envelop<IotCompanyCertificateVO> findCompanyCertById(@ApiParam(name = "id", value = "企业证书id")
                                                                @RequestParam(value = "id", required = true) String id) {
        try {
            return companyService.findCompanyCertById(id);
@ -140,7 +140,7 @@ public class IotCompanyController extends BaseController {
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertByCompanyId)
    @ApiOperation(value = "根据企业id查找企业证书", notes = "根据企业id查找企业证书")
    public Envelop<IotCompanyCertificateVO> findCompanyCertByCompanyId(@ApiParam(name = "companyId", value = "companyId")
    public Envelop<IotCompanyCertificateVO> findCompanyCertByCompanyId(@ApiParam(name = "companyId", value = "企业id")
                                                                       @RequestParam(value = "companyId", required = true) String companyId) {
        try {
            return companyService.findCompanyCertByCompanyId(companyId);
@ -152,7 +152,7 @@ public class IotCompanyController extends BaseController {
    @PostMapping(value = IotRequestMapping.Company.addCompanyCert)
    @ApiOperation(value = "创建企业证书", notes = "创建企业证书")
    public Envelop<IotCompanyCertificateVO> addCompanyCert(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
    public Envelop<IotCompanyCertificateVO> addCompanyCert(@ApiParam(name = "jsonData", value = "json串", defaultValue = "")
                                                           @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            return companyService.addCompanyCert(jsonData);
@ -162,4 +162,18 @@ public class IotCompanyController extends BaseController {
        }
    }
    @PostMapping(value = IotRequestMapping.Company.changePassWord)
    @ApiOperation(value = "修改用户密码", notes = "修改用户密码")
    public Envelop changePassWord(@ApiParam(name = "userId", value = "用户id", defaultValue = "")
                                  @RequestParam(value = "userId", required = true)String userId,
                                  @ApiParam(name = "passWord", value = "密码", defaultValue = "")
                                  @RequestParam(value = "passWord", required = true)String passWord){
        try {
            return companyService.changePassWord(userId,passWord);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 92 - 0
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/user/UserModel.java

@ -0,0 +1,92 @@
package com.yihu.ehr.iot.model.user;
import java.io.Serializable;
/**
 * ehr用户model
 * @author yeshijie on 2018/2/2.
 */
public class UserModel implements Serializable{
    private String id;
    private String email;
    private String loginCode;
    private String realName;
    private String password;
    private String newPassWord;
    private String telephone;
    private String idCardNo;
    private String role;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getLoginCode() {
        return loginCode;
    }
    public void setLoginCode(String loginCode) {
        this.loginCode = loginCode;
    }
    public String getRealName() {
        return realName;
    }
    public void setRealName(String realName) {
        this.realName = realName;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getNewPassWord() {
        return newPassWord;
    }
    public void setNewPassWord(String newPassWord) {
        this.newPassWord = newPassWord;
    }
    public String getTelephone() {
        return telephone;
    }
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
    public String getIdCardNo() {
        return idCardNo;
    }
    public void setIdCardNo(String idCardNo) {
        this.idCardNo = idCardNo;
    }
    public String getRole() {
        return role;
    }
    public void setRole(String role) {
        this.role = role;
    }
}

+ 2 - 4
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/config/EhrWebHttpSessionConfiguration.java

@ -8,13 +8,11 @@ import org.springframework.security.core.session.SessionRegistryImpl;
/**
 * Created by progr1mmer on 2018/1/27.
 */
//@Configuration
//@EnableRedisHttpSession
@Configuration
public class EhrWebHttpSessionConfiguration {
    /*
    @Bean
    SessionRegistry sessionRegistry(){
        return new SessionRegistryImpl();
    }*/
    }
}

+ 22 - 8
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/config/EhrWebSecurityConfiguration.java

@ -1,9 +1,6 @@
package com.yihu.ehr.iot.security.config;
import com.yihu.ehr.iot.security.core.EhrWebAuthenticationProvider;
import com.yihu.ehr.iot.security.core.EhrWebAuthenticationSuccessHandler;
import com.yihu.ehr.iot.security.core.EhrWebUserDetailsService;
import com.yihu.ehr.iot.security.core.EhrWebUsernamePasswordAuthenticationFilter;
import com.yihu.ehr.iot.security.core.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@ -14,8 +11,10 @@ import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy;
/**
 * Created by progr1mmer on 2018/1/26.
@ -33,10 +32,15 @@ public class EhrWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
    private EhrWebAuthenticationProvider ehrWebAuthenticationProvider;
    @Autowired
    private EhrWebAuthenticationSuccessHandler ehrWebAuthenticationSuccessHandler;
    @Autowired
    private EhrWebAuthenticationFailureHandler ehrWebAuthenticationFailureHandler;
    //@Autowired
    //private EhrWebAccessDecisionManager ehrWebAccessDecisionManager;
    //@Autowired
    //private SessionRegistry sessionRegistry;
    @Autowired
    private SessionRegistry sessionRegistry;
    @Autowired
    private EhrWebContextLogoutHandler ehrWebContextLogoutHandler;
    @Override
    public void configure(WebSecurity web) throws Exception {
@ -48,8 +52,9 @@ public class EhrWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
        // ---------- 自定义Filter Start ----------
        EhrWebUsernamePasswordAuthenticationFilter ehrWebUsernamePasswordAuthenticationFilter = new EhrWebUsernamePasswordAuthenticationFilter(oauth2InnerUrl, profileInnerUrl);
        ehrWebUsernamePasswordAuthenticationFilter.setAuthenticationSuccessHandler(ehrWebAuthenticationSuccessHandler);
        ehrWebUsernamePasswordAuthenticationFilter.setAuthenticationFailureHandler(ehrWebAuthenticationFailureHandler);
        ehrWebUsernamePasswordAuthenticationFilter.setAuthenticationManager(authenticationManagerBean());
        //ehrWebUsernamePasswordAuthenticationFilter.setSessionAuthenticationStrategy(new ConcurrentSessionControlAuthenticationStrategy(sessionRegistry));
        ehrWebUsernamePasswordAuthenticationFilter.setSessionAuthenticationStrategy(new ConcurrentSessionControlAuthenticationStrategy(sessionRegistry));
        http.addFilterBefore(ehrWebUsernamePasswordAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
        // ---------- 自定义Filter End ----------
        //http.sessionManagement().maximumSessions(3).expiredUrl("/login?expired").sessionRegistry(sessionRegistry);
@ -69,7 +74,7 @@ public class EhrWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
                .antMatchers("/front/views/**").hasRole("USER")
                .antMatchers("/**").hasRole("USER")
                .and().formLogin().loginPage("/login")
                .and().logout().logoutUrl("/logout").logoutSuccessUrl("/login")
                .and().logout().addLogoutHandler(ehrWebContextLogoutHandler).logoutUrl("/logout").logoutSuccessUrl("/login")
                .and().headers().frameOptions().disable()
                .and().csrf().disable();
    }
@ -96,6 +101,15 @@ public class EhrWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
        return new EhrWebAuthenticationSuccessHandler();
    }
    @Bean
    EhrWebAuthenticationFailureHandler ehrWebAuthenticationFailureHandler(){
        return new EhrWebAuthenticationFailureHandler();
    }
    @Bean
    EhrWebContextLogoutHandler ehrWebContextLogoutHandler(){
        return new EhrWebContextLogoutHandler();
    }
    /**
    @Bean
    EhrWebAccessDecisionManager ehrWebAccessDecisionManager() {

+ 40 - 0
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationFailureHandler.java

@ -0,0 +1,40 @@
package com.yihu.ehr.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.util.rest.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebAuthenticationFailureHandler implements AuthenticationFailureHandler {
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * Step 4
     * @param httpServletRequest
     * @param httpServletResponse
     * @param authException
     * @throws IOException
     * @throws ServletException
     */
    @Override
    public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException authException) throws IOException, ServletException {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(false);
        envelop.setErrorMsg("invalid account or password !");
        envelop.setErrorCode(-1);
        httpServletResponse.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
        httpServletResponse.getWriter().print(objectMapper.writeValueAsString(envelop));
    }
}

+ 17 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationSuccessHandler.java

@ -1,17 +1,23 @@
package com.yihu.ehr.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.iot.util.CurrentRequest;
import com.yihu.ehr.util.rest.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -21,8 +27,9 @@ public class EhrWebAuthenticationSuccessHandler implements AuthenticationSuccess
    @Autowired
    private ObjectMapper objectMapper;
    //@Autowired
    //private FindByIndexNameSessionRepository findByIndexNameSessionRepository;
    @Autowired
    SessionRegistry sessionRegistry;
    /**
     * Step 4
@ -44,8 +51,15 @@ public class EhrWebAuthenticationSuccessHandler implements AuthenticationSuccess
        userMap.put("username", username);
        userMap.put("realName", realName);
        envelop.setObj(userMap);
        //Map<String, Object> sessionMap = findByIndexNameSessionRepository.findByIndexNameAndIndexValue(FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, "admin");
        List modelList = new ArrayList<>();
        UserDetailModel userDetailModel = (UserDetailModel)httpServletRequest.getAttribute("user");
        modelList.add(userDetailModel);
        envelop.setDetailModelList(modelList);
        httpServletResponse.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
        httpServletResponse.getWriter().print(objectMapper.writeValueAsString(envelop));
        sessionRegistry.registerNewSession(httpServletRequest.getSession().getId(),userDetailModel);
    }
}

+ 55 - 0
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebContextLogoutHandler.java

@ -0,0 +1,55 @@
package com.yihu.ehr.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.iot.util.CurrentRequest;
import com.yihu.ehr.util.rest.Envelop;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import org.springframework.security.web.authentication.logout.LogoutHandler;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.util.Assert;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebContextLogoutHandler extends SecurityContextLogoutHandler {
    protected final Log logger = LogFactory.getLog(this.getClass());
    @Autowired
    SessionRegistry sessionRegistry;
    /**
     * Step 5
     * @param httpServletRequest
     * @param httpServletResponse
     * @param authentication
     */
    @Override
    public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) {
        Assert.notNull(httpServletRequest, "HttpServletRequest required");
            HttpSession session = httpServletRequest.getSession(false);
            if (session != null) {
                this.logger.debug("removeSessionInformation, session: " + session.getId());
                sessionRegistry.removeSessionInformation(session.getId());
            }
    }
}

+ 1 - 0
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebUserDetailsService.java

@ -66,6 +66,7 @@ public class EhrWebUserDetailsService implements UserDetailsService {
                    request.setAttribute("id", userDetailModel.getId());
                    request.setAttribute("username", username);
                    request.setAttribute("realName", userDetailModel.getRealName());
                    request.setAttribute("user",userDetailModel);
                    return new User(username, password, getGrantedAuthorities(username));
                }
                logger.error(httpResponse.getBody());

+ 5 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/BaseService.java

@ -2,6 +2,7 @@ package com.yihu.ehr.iot.service.common;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.iot.util.CurrentRequest;
import com.yihu.ehr.iot.util.encode.AES;
import com.yihu.ehr.iot.util.encode.Base64;
import com.yihu.ehr.iot.util.http.HttpHelper;
@ -33,8 +34,8 @@ public class BaseService {
    protected String permissionsInfo;
    @Value("${app.clientId}")
    protected String clientId;
    @Value("${app.baseClientId}")
    protected String baseClientId;
//    @Value("${app.baseClientId}")
//    protected String baseClientId;
    @Value("${service-gateway.profileInnerUrl}")
    protected String profileInnerUrl;
    @Value("${service-gateway.profileOuterUrl}")
@ -49,7 +50,8 @@ public class BaseService {
    protected String oauth2InnerUrl;
    @Value("${app.oauth2OuterUrl}")
    protected String oauth2OuterUrl;
    @Autowired
    private CurrentRequest currentRequest;
    public String readFile(String filePath, String charSet) {

+ 37 - 0
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/SystemDictService.java

@ -1,6 +1,8 @@
package com.yihu.ehr.iot.service.common;
import com.yihu.ehr.constants.ErrorCode;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.model.ObjectResult;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
@ -24,6 +26,9 @@ public class SystemDictService extends BaseService{
     * @throws Exception
     */
    public Envelop<IotSystemDictVO> getList(String dictName) throws Exception {
        if("HOSPITAL".equals(dictName)){
            return organizations();
        }
        Map<String, Object> params = new HashMap<>();
        params.put("dictName", dictName);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.System.FindDictByCode, params);
@ -31,4 +36,36 @@ public class SystemDictService extends BaseService{
        return envelop;
    }
    /**
     * 获取组织机构信息
     * @return
     */
    private Envelop<IotSystemDictVO> organizations(){
        String url = "/organizations";
        Envelop<IotSystemDictVO> envelop = new Envelop<IotSystemDictVO>();
        Map<String, Object> params = new HashMap<>();
        params.put("fields","");
        params.put("sorts","");
        params.put("filters", "orgCode?3502");
        params.put("page", 1);
        params.put("size", 100);
        try {
            HttpResponse response = HttpHelper.get(profileInnerUrl + url, params);
            ObjectResult result =  objectMapper.readValue(response.getBody(),ObjectResult.class);
            if(result.isSuccessFlg()){
                envelop = objectMapper.readValue(response.getBody(),Envelop.class);
                envelop.setStatus(200);
            }else {
                envelop.setStatus(-1);
                envelop.setErrorMsg(result.getErrorMsg());
            }
            return envelop;
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
}

+ 177 - 2
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/company/CompanyService.java

@ -1,6 +1,10 @@
package com.yihu.ehr.iot.service.company;
import com.yihu.ehr.constants.ErrorCode;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.model.ObjectResult;
import com.yihu.ehr.iot.model.Result;
import com.yihu.ehr.iot.model.user.UserModel;
import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
@ -8,6 +12,7 @@ import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyCertificateVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.HashMap;
@ -19,6 +24,8 @@ import java.util.Map;
@Service
public class CompanyService extends BaseService {
    private String roleId = "10268";//物联网默认用户角色
    /**
     * 分页查找企业
     * @param name
@ -49,13 +56,181 @@ public class CompanyService extends BaseService {
     * @throws IOException
     */
    public Envelop<IotCompanyVO> addCompany(String jsonData) throws IOException {
        Envelop<IotCompanyVO> envelop = new Envelop<IotCompanyVO>();
        //新增ehr用户
        IotCompanyVO iotCompany = toModel(jsonData, IotCompanyVO.class);
        envelop = userVerification(iotCompany,envelop);
        if(envelop.getStatus()==-1){
            return envelop;
        }
        //验证账户
        Result login_code = existence("login_code",iotCompany.getAccount());
        if(login_code.isSuccessFlg()){
            envelop.setStatus(-1);
            envelop.setErrorMsg("该账号已存在");
            return envelop;
        }
        //验证身份证
        Result id_card_no = existence("id_card_no",iotCompany.getContactsIdcard());
        if(id_card_no.isSuccessFlg()){
            envelop.setStatus(-1);
            envelop.setErrorMsg("该身份证号已被注册,请确认。");
            return envelop;
        }
        //验证邮件
        Result email = existence("email",iotCompany.getContactsEmail());
        if(email.isSuccessFlg()){
            envelop.setStatus(-1);
            envelop.setErrorMsg("该邮箱已存在");
            return envelop;
        }
        //验证手机号
        Result telephone = existence("telephone",iotCompany.getContactsMobile());
        if(telephone.isSuccessFlg()){
            envelop.setStatus(-1);
            envelop.setErrorMsg("该手机号码已存在");
            return envelop;
        }
        Envelop<UserModel> userModelEnvelop = updateUser(iotCompany);
        if(userModelEnvelop.getStatus()!=200){
            envelop.setStatus(-1);
            envelop.setErrorMsg(userModelEnvelop.getErrorMsg());
            return envelop;
        }
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        params.put("jsonData", toJson(iotCompany));
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Company.AddCompany, params);
        Envelop<IotCompanyVO> envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }
    /**
     * 校验用户信息
     * @param iotCompany
     * @param envelop
     * @return
     */
    private Envelop<IotCompanyVO> userVerification(IotCompanyVO iotCompany,Envelop<IotCompanyVO> envelop){
        if(StringUtils.isEmpty(iotCompany.getAccount())){
            envelop.setStatus(-1);
            envelop.setErrorMsg("账号不能为空");
            return envelop;
        }
        if(StringUtils.isEmpty(iotCompany.getContactsIdcard())){
            envelop.setStatus(-1);
            envelop.setErrorMsg("身份证号不能为空");
            return envelop;
        }
        if(StringUtils.isEmpty(iotCompany.getContactsEmail())){
            envelop.setStatus(-1);
            envelop.setErrorMsg("邮箱不能为空");
            return envelop;
        }
        if(StringUtils.isEmpty(iotCompany.getContactsMobile())){
            envelop.setStatus(-1);
            envelop.setErrorMsg("手机号码账号不能为空");
            return envelop;
        }
        return envelop;
    }
    /**
     * 验证用户信息
     */
    private Result existence(String existenceType, String existenceNm){
        String getUserUrl = "/users/existence";
        Result result = null;
        Map<String, Object> params = new HashMap<>();
        params.put("existenceType",existenceType);
        params.put("existenceNm",existenceNm);
//        params.put("username",null);
//        params.put("password",null);
        try {
            HttpResponse response = HttpHelper.get(profileInnerUrl + getUserUrl, params);
            result = objectMapper.readValue(response.getBody(),Result.class);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            result = new Result();
            result.setSuccessFlg(false);
            result.setMessage(ErrorCode.SystemError.toString());
            return result;
        }
    }
    /**
     * 新增用户
     * @param iotCompany
     * @return
     */
    private Envelop<UserModel> updateUser(IotCompanyVO iotCompany){
        String url = "/user/";
        UserModel userModel = new UserModel();
        userModel.setEmail(iotCompany.getContactsEmail());
        userModel.setIdCardNo(iotCompany.getContactsIdcard());
        userModel.setLoginCode(iotCompany.getAccount());
        userModel.setTelephone(iotCompany.getContactsMobile());
        userModel.setRole(roleId);
        Envelop envelop  = new Envelop();
        Map<String, Object> params = new HashMap<>();
        params.put("user_json_data",toJson(userModel));
        try {
            Map<String, Object> head = new HashMap<>();
            head.put("Content-Type","application/json; charset=UTF-8");
            HttpResponse response = HttpHelper.post(profileInnerUrl + url, params,head);
            ObjectResult result = toModel(response.getBody(),ObjectResult.class);
            if(result.isSuccessFlg()){
                UserModel addUserModel = toModel(toJson(result.getObj()),UserModel.class);
                iotCompany.setEhrUserId(addUserModel.getId());
                envelop.setStatus(200);
            }else {
                envelop.setStatus(-1);
                envelop.setErrorMsg(result.getErrorMsg());
            }
            return envelop;
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    /**
     * 修改密码
     * @param userId
     * @param passWord
     * @return
     */
    public Envelop changePassWord(String userId,String passWord){
        Envelop envelop = new Envelop();
        String url = "/users/changePassWord";
        Map<String, Object> params = new HashMap<>();
        params.put("user_id",userId);
        params.put("password",passWord);
        try {
            HttpResponse response = HttpHelper.put(profileInnerUrl + url, params);
            ObjectResult result = toModel(response.getBody(),ObjectResult.class);
            if(result.isSuccessFlg()){
                envelop.setStatus(200);
                envelop.setSuccessMsg("修改成功");
            }else {
                envelop.setStatus(-1);
                envelop.setErrorMsg(result.getErrorMsg());
            }
            return envelop;
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    /**
     * 根据id查找企业
     * @param id

+ 48 - 0
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/CurrentRequest.java

@ -0,0 +1,48 @@
package com.yihu.ehr.iot.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.ehr.iot.util.spring.SpringContextHolder;
import com.yihu.ehr.util.rest.Envelop;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.session.SessionInformation;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 * @author lith
 * @created 2018/02/06
 */
@Component
public class CurrentRequest {
    @Autowired
    SessionRegistry sessionRegistry;
    /**
     * 获取当前登录用户,当前已登录的用户都缓存在session中
     * @param request
     * @return
     */
    public  UserDetailModel getCurrentUser(HttpServletRequest request){
        String sessionId = request.getSession().getId();
        UserDetailModel user = null;
        SessionInformation sessionInformation = sessionRegistry.getSessionInformation(sessionId);
        if(null != sessionInformation.getPrincipal()){
            user = (UserDetailModel)sessionInformation.getPrincipal();
        }
        return user;
    }
}

+ 9 - 8
app/app-iot-server/src/main/resources/application.yml

@ -18,11 +18,11 @@ spring:
      max-wait: -1 # Maximum amount of time (in milliseconds) a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
      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.
  application:
    name: app-emergency-server
    message: EHR Emergency Server
    name: app-iot-server
    message: App IOT Server
  resources:
    static-locations: classpath:/
    cache-period: 0
#    cache-period: 0
@ -59,10 +59,11 @@ app:
  oauth2InnerUrl: http://172.19.103.73:10260/   # 认证中心,获取token ehr环境
  oauth2OuterUrl: http://27.154.233.186:10260/  # 上饶-授权外网映射
service-gateway:
  iotUrl: http://192.168.131.24:8088/svr-io
#  profileInnerUrl: http://172.19.103.48:10000/api/v1.0/admin/ # 物联网环境
  profileInnerUrl: http://172.19.103.73:10000/api/v1.0/admin   # 网关接口 ehr环境
  iotUrl: http://192.168.131.24:8088/svr-iot/
  profileInnerUrl: http://172.19.103.73:10000/api/v1.0/admin
  profileOuterUrl: http://27.154.233.186:10000/api/v1.0/admin
  portalInnerUrl: http://172.19.103.73:10280/api/v1.0/portal
  portalOuterUrl: http://27.154.233.186:10280/api/v1.0/portal
fast-dfs:
@ -70,7 +71,7 @@ fast-dfs:
  public-server: http://172.19.103.54:80/
logging:
  path: /data/logger
  file: app-emergency-server
  file: app-iot-server
---
spring:
@ -116,7 +117,7 @@ fast-dfs:
  accessUrl: http://11.1.2.9
logging:
  path: /data/logger
  file: app-emergency-server
  file: app-iot-server
#单点登录
#GET http://172.19.103.73:10260/oauth/sso?response_type=token&client_id=uzs5G0HgTp&state=sxy&scope=read&redirect_uri=http://192.168.1.221:8010/ehr/browser/common/login/signin?idCardNo=362321200108017313&user=admin

+ 0 - 23
app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/commonFoot.jsp

@ -1,23 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@include file="/WEB-INF/jsp/common/commonInclude.jsp" %>
<script src="${staticRoot}/js/lib/jquery.min.js"></script>
<script>
    $.extend({
        Context: {
            PATH: '${contextRoot}',
            STATIC_PATH: '${staticRoot}'
        }
    })
</script>
<script>
    (function ($, win) {
        $(function () {
            var $title = $('title'),
                    $headTitleTarget = $('[data-head-title="true"]');
            document.title = $headTitleTarget.text();
        });
    })(jQuery, window);
</script>

+ 0 - 21
app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/commonHead.jsp

@ -1,21 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@include file="/WEB-INF/jsp/common/commonInclude.jsp" %>
<%--定义页面文档类型以及使用的字符集,浏览器会根据此来调用相应的字符集显示页面内容--%>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<%--IE=edge告诉IE使用最新的引擎渲染网页,chrome=1则可以激活Chrome Frame.--%>
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="${staticRoot}/css/reset.css">
<link rel="stylesheet" href="${staticRoot}/css/bootstrap.min.css">
<head>
    <link rel="icon" href="${staticRoot}/images/logo.png" type="image/x-icon" />
    <link rel="shortcut icon" href="${staticRoot}/images/logo.png" type="image/x-icon" />
</head>

+ 0 - 17
app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/commonInclude.jsp

@ -1,17 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles-extras" prefix="tilesx" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<c:set var="contextRoot" value="<%=request.getContextPath()%>" scope="page" />
<c:set var="devgMode" value="true" scope="page" />
<c:choose>
  <c:when test="${devgMode == 'true'}">
    <c:set var="staticRoot" value="${contextRoot}/front" scope="page" />
  </c:when>
  <c:otherwise>
    <c:set var="staticRoot" value="${contextRoot}/webapp/front/static" scope="page" />
  </c:otherwise>
</c:choose>

+ 0 - 21
app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/layout.xml

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
        "-//Apache Software Foundation//DTD Tiles Configuration 3.0//EN"
        "http://tiles.apache.org/dtds/tiles-config_3_0.dtd">
<tiles-definitions>
    <!--出错页面提示-->
    <definition name="errorPage"  template="/WEB-INF/jsp/error.jsp"></definition>
    <!-- 主布局 -->
    <definition name="layout" template="/WEB-INF/jsp/common/mainLayout.jsp">
    </definition>
    <!-- 主布局 -->
    <definition name="generalView" extends="layout">
        <put-attribute name="header" value="/WEB-INF/jsp/common/commonHead.jsp" />
        <!--<put-attribute name="pageCss" expression="/WEB-INF/jsp/${contentPage}Css.jsp" />-->
        <put-attribute name="contentPage" expression="/WEB-INF/jsp/${contentPage}.jsp" />
        <put-attribute name="footer" value="/WEB-INF/jsp/common/commonFoot.jsp" />
        <put-attribute name="pageJs" expression="/WEB-INF/jsp/${contentPage}Js.jsp" />
    </definition>
</tiles-definitions>

+ 0 - 25
app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/mainLayout.jsp

@ -1,25 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@include file="/WEB-INF/jsp/common/commonInclude.jsp" %>
<!DOCTYPE html>
<html>
<head>
    <%--定义页面文档类型以及使用的字符集,浏览器会根据此来调用相应的字符集显示页面内容--%>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <%--IE=edge告诉IE使用最新的引擎渲染网页,chrome=1则可以激活Chrome Frame.--%>
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>${title}</title>
    <tiles:insertAttribute name="header" />
    <tiles:insertAttribute name="pageCss" ignore="true"/>
</head>
<body>
    <div data-content-page>
        <tiles:insertAttribute name="contentPage" ignore="true"/>
    </div>
    <tiles:insertAttribute name="footer"/>
    <tiles:insertAttribute name="pageJs" ignore="true"/>
    <input type="hidden" id="flag_top_window" />
</body>
</html>

+ 0 - 13
app/app-iot-server/src/main/webapp/WEB-INF/jsp/common/simpleLayout.jsp

@ -1,13 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@include file="/WEB-INF/jsp/common/commonInclude.jsp" %>
<script>
    $.extend({
        Context: {
            PATH: '${contextRoot}',
            STATIC_PATH: '${staticRoot}'
        }
    })
</script>
<tiles:insertAttribute name="pageCss" ignore="true"/>
<tiles:insertAttribute name="contentPage" ignore="true"/>
<tiles:insertAttribute name="pageJs" ignore="true"/>

+ 0 - 5
app/app-iot-server/src/main/webapp/WEB-INF/jsp/error.jsp

@ -1,5 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@include file="/WEB-INF/jsp/common/commonInclude.jsp" %>
<div id="divErrorContent" style="width:550px;height:400px;margin:0 auto;background: url('${contextRoot}/src/images/404.png') no-repeat;">
</div>

+ 0 - 6
app/app-iot-server/src/main/webapp/WEB-INF/jsp/signin.jsp

@ -1,6 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="utf-8"%>
<%@include file="/WEB-INF/jsp/common/commonInclude.jsp" %>
<div style="margin:20px;">
加载中,请稍候...
</div>

+ 0 - 49
app/app-iot-server/src/main/webapp/WEB-INF/jsp/signinJs.jsp

@ -1,49 +0,0 @@
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/jsp/common/commonInclude.jsp" %>
<script>
    var clientId = '${clientId}';
    var signin = {
        init:function () {
            //判断是否自动登录
            var hash = window.location.hash;
            if(hash.indexOf("#access_token")>=0)
            {
                //获取accrss_token
                var tokenString =hash.substring(1,hash.indexOf("&"));
                var token = tokenString.substr(hash.indexOf("="));
                debugger;
                //自动登录
                $.ajax({
                    url: "${contextRoot}/login/autoLogin",
                    type: 'POST',
                    dataType: 'json',
                    data:{
                        "token":token,
                        "clientId": clientId
                    },
                    success: function (data) {
                        debugger;
                        if(data.successFlg){
                            sessionStorage.setItem("ZF_UID",data.obj.id);
                            sessionStorage.setItem("ZF_UN",data.obj.realName);
                            sessionStorage.setItem("ZF_U",data.obj);
                            location.href = '${contextRoot}/index';
                        }else{
                            location.href = '${contextRoot}/login';
                        }
                    },
                    error: function (data) {
                        location.href = '${contextRoot}/login';
                    }
                });
                return;
            }
        }
    }
    $(function() {
        signin.init();
    });
</script>

+ 2 - 2
app/app-iot-server/src/main/webapp/front/js/common/apiServer.js

@ -62,13 +62,13 @@ define(['jquery', 'promise', 'layer', 'jsHelper'], function ($, Promise, layer,
    var APIService = {
        indexPage: function () {//首页
            return baseUrl + 'attendance/index'
            return baseUrl + '/index'
        },
        autoLogin: function (opt) {//单点登录
            return httpPost(baseUrl + 'login', opt)
        },
        login: function(opt) {//登录
            return httpPost(baseUrl + 'login11', opt)
            return httpPost(baseUrl + 'login', opt)
        },
        out: function (opt) {//退出
            sessionStorage.clear();

+ 4 - 3
app/app-iot-server/src/main/webapp/front/js/scripts/login.js

@ -35,9 +35,10 @@ require(loginRelyOn, function ($, layer, vue, jsHelper, apiServer, Promise) {
                }).then(function (res) {
                    layer.close(load);
                    if (res.successFlg) {
                        sessionStorage.setItem("ZF_UID",res.data.user.id);
                        sessionStorage.setItem("ZF_UN",res.data.user.realName);
                        sessionStorage.setItem("ZF_U",res.data.user);
                        debugger
                        sessionStorage.setItem("ZF_UID",res.obj.id);
                        sessionStorage.setItem("ZF_UN",res.obj.realName);
                        sessionStorage.setItem("ZF_U",res.obj);
                        location.href = apiServer.indexPage();
                    } else {
                        layer.msg(res.message);

+ 2 - 2
app/app-iot-server/src/main/webapp/front/views/index.html

@ -10,8 +10,8 @@
    <meta http-equiv="refresh" content="0;ie.html" />
    <![endif]-->
    <title>卫生应急指挥平台</title>
    <link href="../css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="../css/index.css" rel="stylesheet">
    <link href="/iot/front/css/bootstrap.min14ed.css?v=3.3.6" rel="stylesheet">
    <link href="/iot/front/css/index.css" rel="stylesheet">
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=mHjQLONxGpRtrZHZkxr9t3cD3n0HupQ0"></script>
</head>
<body>

+ 278 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/archives/PatientArchives.java

@ -0,0 +1,278 @@
package com.yihu.jw.entity.archives;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by Trick on 2018/2/7.
 */
@Entity
@Table(name = "wlyy_patient_archives")
public class PatientArchives extends IdEntityWithOperation implements Serializable {
    private String code;//档案编号
    private String saasId; //saasid
    private String patientCode;//关联居民登录code
    private String patientName;//姓名
    private String idcard;//身份证号
    private Date birthday;//生日
    private String sex;//int(11) DEFAULT NULL COMMENT '性别,1男,2女
    private String mobile;//手机号
    private String ssc;//社保卡号
    private String status;//int(11) DEFAULT NULL COMMENT '档案状态:1正常,0注销
    private String cancelReseanType;//注销原因:1死亡,2.重复
    private String sickVillage;//居委会代码(字典)
    private String sickVillageName;//居委会
    private String residentType;//常住类型 :1户籍,2非户籍
    private String blood;//血型:A,AB,O,B,N(不详)
    private String RH;//1,阴性;2阳性;0 不详
    private String nationCode;//民族code(字典)
    private String nation;//民族名称
    private String workPlace;//工作地点
    private String contactPeople;//联系人
    private String contactMobile;//联系人电话
    private String educationCode;//文化程度(字典)
    private String education;//文化程度
    private String professionCode;//职业(字典)
    private String profession;//职业·
    private String marriageCode;//婚姻状况(字典)
    private String marriage;//婚姻状况
    private String paymentCode;//支付方式(字典)
    private String payment;// 支付方式
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public Date getBirthday() {
        return birthday;
    }
    public void setBirthday(Date birthday) {
        this.birthday = birthday;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getMobile() {
        return mobile;
    }
    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getCancelReseanType() {
        return cancelReseanType;
    }
    public void setCancelReseanType(String cancelReseanType) {
        this.cancelReseanType = cancelReseanType;
    }
    public String getSickVillage() {
        return sickVillage;
    }
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
    public String getSickVillageName() {
        return sickVillageName;
    }
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
    public String getResidentType() {
        return residentType;
    }
    public void setResidentType(String residentType) {
        this.residentType = residentType;
    }
    public String getBlood() {
        return blood;
    }
    public void setBlood(String blood) {
        this.blood = blood;
    }
    public String getRH() {
        return RH;
    }
    public void setRH(String RH) {
        this.RH = RH;
    }
    public String getNationCode() {
        return nationCode;
    }
    public void setNationCode(String nationCode) {
        this.nationCode = nationCode;
    }
    public String getNation() {
        return nation;
    }
    public void setNation(String nation) {
        this.nation = nation;
    }
    public String getWorkPlace() {
        return workPlace;
    }
    public void setWorkPlace(String workPlace) {
        this.workPlace = workPlace;
    }
    public String getContactPeople() {
        return contactPeople;
    }
    public void setContactPeople(String contactPeople) {
        this.contactPeople = contactPeople;
    }
    public String getContactMobile() {
        return contactMobile;
    }
    public void setContactMobile(String contactMobile) {
        this.contactMobile = contactMobile;
    }
    public String getEducationCode() {
        return educationCode;
    }
    public void setEducationCode(String educationCode) {
        this.educationCode = educationCode;
    }
    public String getEducation() {
        return education;
    }
    public void setEducation(String education) {
        this.education = education;
    }
    public String getProfessionCode() {
        return professionCode;
    }
    public void setProfessionCode(String professionCode) {
        this.professionCode = professionCode;
    }
    public String getProfession() {
        return profession;
    }
    public void setProfession(String profession) {
        this.profession = profession;
    }
    public String getMarriageCode() {
        return marriageCode;
    }
    public void setMarriageCode(String marriageCode) {
        this.marriageCode = marriageCode;
    }
    public String getMarriage() {
        return marriage;
    }
    public void setMarriage(String marriage) {
        this.marriage = marriage;
    }
    public String getPaymentCode() {
        return paymentCode;
    }
    public void setPaymentCode(String paymentCode) {
        this.paymentCode = paymentCode;
    }
    public String getPayment() {
        return payment;
    }
    public void setPayment(String payment) {
        this.payment = payment;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
}

+ 97 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/archives/PatientArchivesInfo.java

@ -0,0 +1,97 @@
package com.yihu.jw.entity.archives;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by Trick on 2018/2/7.
 */
@Entity
@Table(name = "wlyy_patient_archives_info")
public class PatientArchivesInfo extends IdEntityWithOperation implements Serializable {
    private String code; //业务主键
    private String saasId; //saasid
    private String archivesCode; //档案code
    private String level1;//1.历史情况,2.既往史,3.家族史,4.生活环境
    private String level2; //子类别
    private String key; //字典值,或判断值(有,无)
    private String value; //字典名称
    private Date date;//关联时间
    private String remark; //备注/其他/描述/详情
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getArchivesCode() {
        return archivesCode;
    }
    public void setArchivesCode(String archivesCode) {
        this.archivesCode = archivesCode;
    }
    public String getLevel1() {
        return level1;
    }
    public void setLevel1(String level1) {
        this.level1 = level1;
    }
    public String getLevel2() {
        return level2;
    }
    public void setLevel2(String level2) {
        this.level2 = level2;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public Date getDate() {
        return date;
    }
    public void setDate(Date date) {
        this.date = date;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/iot/company/IotCompanyDO.java

@ -54,6 +54,8 @@ public class IotCompanyDO extends IdEntityWithOperation implements Serializable
    private String contactsIdcardImg;//联系人身份证照片
    @Column(name = "account")
    private String account;//账号
    @Column(name = "ehr_user_id")
    private String ehrUserId;//    ehr用户id,修改密码时使用
    @Column(name = "del")
    private Integer del;//删除标志(1有效,0删除)
@ -204,6 +206,14 @@ public class IotCompanyDO extends IdEntityWithOperation implements Serializable
        this.account = account;
    }
    public String getEhrUserId() {
        return ehrUserId;
    }
    public void setEhrUserId(String ehrUserId) {
        this.ehrUserId = ehrUserId;
    }
    public Integer getDel() {
        return del;
    }

+ 14 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/archives/PatientArchivesMapping.java

@ -0,0 +1,14 @@
package com.yihu.jw.rm.archives;
/**
 * Created by Trick on 2018/2/7.
 */
public class PatientArchivesMapping {
    public static final String api_archives_common = "svr-archives";
    public static final Integer api_archives_fail = -1;
    public static class Archives{
    }
}

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

@ -70,6 +70,7 @@ public class IotRequestMapping {
        public static final String findCompanyCertById = "findCompanyCertById";
        public static final String findCompanyCertByCompanyId = "findCompanyCertByCompanyId";
        public static final String addCompanyCert = "addCompanyCert";
        public static final String changePassWord = "changePassWord";
        public static final String api_create = "company";
        public static final String api_delete = "company";

+ 34 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/archives/Test.java

@ -0,0 +1,34 @@
package com.yihu.jw.restmodel.archives;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2018/2/7.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "测试")
public class Test {
    @ApiModelProperty("文件名字")
    private String fileName; //文件名字
    @ApiModelProperty("文件类型")
    private String fileType; //文件类型
    public String getFileType() {
        return fileType;
    }
    public void setFileType(String fileType) {
        this.fileType = fileType;
    }
    public String getFileName() {
        return fileName;
    }
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }
}

+ 20 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java

@ -54,7 +54,10 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    private String contactsIdcardImg;
    @ApiModelProperty("账号")
    private String account;
    @ApiModelProperty("密码")
    private String password;
    @ApiModelProperty("ehr用户id,修改密码时使用")
    private String ehrUserId;
    @ApiModelProperty("类型")
    private List<IotCompanyTypeVO> typeList;
@ -201,4 +204,20 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    public void setTypeList(List<IotCompanyTypeVO> typeList) {
        this.typeList = typeList;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getEhrUserId() {
        return ehrUserId;
    }
    public void setEhrUserId(String ehrUserId) {
        this.ehrUserId = ehrUserId;
    }
}

+ 1 - 1
server/svr-configuration/src/main/resources/application.yml

@ -23,7 +23,7 @@ eureka:
---
spring:
  profiles: jwdev
  profiles:
#
#  cloud:
#    stream:

+ 2 - 1
svr/readme.MD

@ -4,4 +4,5 @@ svr 相关的db设计
    svr-quota 统计相关服务
    svr-wlyy i健康公共业务后台
    svr-iot 医疗物联网服务
    svr-manage 基卫后台管理系统   (独立的系统不注册到发现服务)
    svr-manage 基卫后台管理系统   (独立的系统不注册到发现服务)
    svr-wlyy-archives 居民档案建立服务

+ 125 - 0
svr/svr-wlyy-archives/pom.xml

@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.archives</groupId>
    <artifactId>svr-wlyy-archives</artifactId>
    <version>1.0.0</version>
    <dependencies>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-swagger</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-data-mysql</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-log</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-aop</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-eureka</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <!--zipkin支持分布式追踪系统-->
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-sleuth</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-sleuth-zipkin</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
        </dependency>
    </dependencies>
</project>

+ 1 - 0
svr/svr-wlyy-archives/readme.MD

@ -0,0 +1 @@
svr-wlyy-archives i健康公共业务后台-建档服务

+ 18 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/SvrWlyyArchivesApplication.java

@ -0,0 +1,18 @@
package com.yihu.jw;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.oauth2.OAuth2AutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@SpringBootApplication(exclude = OAuth2AutoConfiguration.class)
@ComponentScan(basePackages = {"com"})
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
public class SvrWlyyArchivesApplication {
    public static void main(String[] args) {
        SpringApplication.run(SvrWlyyArchivesApplication.class, args);
    }
}

+ 51 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/config/SwaggerConfig.java

@ -0,0 +1,51 @@
package com.yihu.jw.config;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import com.yihu.jw.rm.wlyy.WlyyRequestMapping;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import static com.google.common.base.Predicates.or;
import static springfox.documentation.builders.PathSelectors.regex;
@Configuration
@EnableSwagger2
@ComponentScan("com.yihu.jw.**")
public class SwaggerConfig {
    public static final String archives_API = "archives";
    @Bean
    public Docket wlyyAPI() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName(archives_API)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(false)
                .pathMapping("/")
                .select()
                .paths(or(
                        regex("/" + PatientArchivesMapping.api_archives_common + "/.*")
                ))
                .build()
                .apiInfo(wlyyApiInfo());
    }
    private ApiInfo wlyyApiInfo() {
        ApiInfo wlyyInfo = new ApiInfo("基卫2.0API",
                "基卫2.0API,提供基础卫生相关服务。",
                "1.0",
                "No terms of service",
                "wenfujian@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return wlyyInfo;
    }
}

+ 29 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/config/jpa/HibernateProperties.java

@ -0,0 +1,29 @@
package com.yihu.jw.config.jpa;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.Properties;
/**
 * Created by chenweida on 2017/4/6.
 */
@Component
@RefreshScope
public class HibernateProperties {
    @Value("${hibernate.dialect}")
    private String dialect;
    @Value("${hibernate.show_sql}")
    private String show_sql;
    @Value("${hibernate.ejb.naming_strategy}")
    private String naming_strategy;
    public  Properties hibProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect",dialect);
        properties.put("hibernate.show_sql", show_sql);
        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
        return properties;
    }
}

+ 55 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/config/jpa/WlyyArchivesJpa.java

@ -0,0 +1,55 @@
package com.yihu.jw.config.jpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
/**
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "wlyyArchivesEntityManagerFactory",
        transactionManagerRef = "wlyyArchivesTransactionManager",
        basePackages = {"com.yihu.jw.dao"})   //设置Repository所在位置
public class WlyyArchivesJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
    @Bean(name = "wlyyArchivesEntityManagerFactory")
    @Primary
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.yihu.jw.entity");
        emfb.setPersistenceUnitName("archives");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        return emfb;
    }
    @Bean(name = "wlyyArchivesTransactionManager")
    @Primary
    JpaTransactionManager transactionManagerSecondary(
            @Qualifier("wlyyArchivesEntityManagerFactory") EntityManagerFactory builder) {
        return new JpaTransactionManager(builder);
    }
}

+ 29 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/controller/PatientArchivesController.java

@ -0,0 +1,29 @@
package com.yihu.jw.controller;
import com.yihu.jw.entity.archives.PatientArchives;
import com.yihu.jw.restmodel.archives.Test;
import com.yihu.jw.rm.archives.PatientArchivesMapping;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Trick on 2018/2/7.
 */
@RestController
@RequestMapping(PatientArchivesMapping.api_archives_common)
@Api(tags = "居民建档相关操作", description = "居民建档相关操作")
public class PatientArchivesController {
    @GetMapping(value = "test")
    @ApiOperation(value = "测试")
    public Test test(){
        Test t = new Test();
        t.setFileName("11");
        t.setFileType("1");
        return t;
    }
}

+ 12 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/dao/PatientArchivesDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.archives.PatientArchives;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2018/2/7.
 */
public interface PatientArchivesDao extends PagingAndSortingRepository<PatientArchives, String>,
        JpaSpecificationExecutor<PatientArchives> {
}

+ 12 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/dao/PatientArchivesInfoDao.java

@ -0,0 +1,12 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.archives.PatientArchivesInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2018/2/7.
 */
public interface PatientArchivesInfoDao extends PagingAndSortingRepository<PatientArchivesInfo, String>,
        JpaSpecificationExecutor<PatientArchivesInfo> {
}

+ 13 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/service/PatientArchivesSevice.java

@ -0,0 +1,13 @@
package com.yihu.jw.service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * Created by Trick on 2018/2/7.
 */
@Service
@Transactional
public class PatientArchivesSevice {
}

+ 220 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/util/AddressUtils.java

@ -0,0 +1,220 @@
package com.yihu.jw.util;
import org.apache.commons.lang.StringUtils;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
/**
 * Created by Administrator on 2017/6/6 0006.
 */
public class AddressUtils {
    public String getAddresses(String ip)
            throws UnsupportedEncodingException {
        return getAddresses(ip,"utf-8");
    }
    /**
     * 返回"0" 为无效ip,局域网测试
     * "中国-西南-四川省-成都市- -电信"  (没有值,中间用空格隔开  country-area-region-city-county-isp)
     * @param content
     * @param encodingString
     * @return
     * @throws UnsupportedEncodingException
     */
    public String getAddresses(String content, String encodingString)
            throws UnsupportedEncodingException {
        // 这里调用pconline的接口
        String urlStr = "http://ip.taobao.com/service/getIpInfo.php";
        // 从http://whois.pconline.com.cn取得IP所在的省市区信息
        content = "ip="+content;
        String returnStr = this.getResult(urlStr, content, encodingString);
        if (returnStr != null) {
            // 处理返回的省市区信息
            String[] temp = returnStr.split(",");
            if (temp.length < 3) {
                return "0";//无效IP,局域网测试
            }
            String region = (temp[5].split(":"))[1].replaceAll("\"", "");
            region = decodeUnicode(region);// 省份
            String country = "";
            String area = "";
            // String region = "";
            String city = "";
            String county = "";
            String isp = "";
            for (int i = 0; i < temp.length; i++) {
                switch (i) {
                    case 1:
                        country = (temp[i].split(":"))[2].replaceAll("\"", "");
                        country = decodeUnicode(country);// 国家
                        break;
                    case 3:
                        area = (temp[i].split(":"))[1].replaceAll("\"", "");
                        area = decodeUnicode(area);// 地区
                        break;
                    case 5:
                        region = (temp[i].split(":"))[1].replaceAll("\"", "");
                        region = decodeUnicode(region);// 省份
                        break;
                    case 7:
                        city = (temp[i].split(":"))[1].replaceAll("\"", "");
                        city = decodeUnicode(city);// 市区
                        break;
                    case 9:
                        county = (temp[i].split(":"))[1].replaceAll("\"", "");
                        county = decodeUnicode(county);// 地区
                        break;
                    case 11:
                        isp = (temp[i].split(":"))[1].replaceAll("\"", "");
                        isp = decodeUnicode(isp); // ISP公司
                        break;
                }
            }
            String district = country + "-" + area + "-" + region + "-" + city + "-" + county + "-" + isp;
            return district;
        }
        return null;
    }
    /**
     * @param urlStr   请求的地址
     * @param content  请求的参数 格式为:name=xxx&pwd=xxx
     * @param encoding 服务器端请求编码。如GBK,UTF-8等
     * @return
     */
    private String getResult(String urlStr, String content, String encoding) {
        URL url = null;
        HttpURLConnection connection = null;
        try {
            url = new URL(urlStr);
            connection = (HttpURLConnection) url.openConnection();// 新建连接实例
            connection.setConnectTimeout(2000);// 设置连接超时时间,单位毫秒
            connection.setReadTimeout(2000);// 设置读取数据超时时间,单位毫秒
            connection.setDoOutput(true);// 是否打开输出流 true|false
            connection.setDoInput(true);// 是否打开输入流true|false
            connection.setRequestMethod("POST");// 提交方法POST|GET
            connection.setUseCaches(false);// 是否缓存true|false
            connection.connect();// 打开连接端口
            DataOutputStream out = new DataOutputStream(connection
                    .getOutputStream());// 打开输出流往对端服务器写数据
            out.writeBytes(content);// 写数据,也就是提交你的表单 name=xxx&pwd=xxx
            out.flush();// 刷新
            out.close();// 关闭输出流
            BufferedReader reader = new BufferedReader(new InputStreamReader(
                    connection.getInputStream(), encoding));// 往对端写完数据对端服务器返回数据
            // ,以BufferedReader流来读取
            StringBuffer buffer = new StringBuffer();
            String line = "";
            while ((line = reader.readLine()) != null) {
                buffer.append(line);
            }
            reader.close();
            return buffer.toString();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (connection != null) {
                connection.disconnect();// 关闭连接
            }
        }
        return null;
    }
    /**
     * unicode 转换成 中文
     *
     * @param theString
     * @return
     * @author fanhui 2007-3-15
     */
    public static String decodeUnicode(String theString) {
        char aChar;
        int len = theString.length();
        StringBuffer outBuffer = new StringBuffer(len);
        for (int x = 0; x < len; ) {
            aChar = theString.charAt(x++);
            if (aChar == '\\') {
                aChar = theString.charAt(x++);
                if (aChar == 'u') {
                    int value = 0;
                    for (int i = 0; i < 4; i++) {
                        aChar = theString.charAt(x++);
                        switch (aChar) {
                            case '0':
                            case '1':
                            case '2':
                            case '3':
                            case '4':
                            case '5':
                            case '6':
                            case '7':
                            case '8':
                            case '9':
                                value = (value << 4) + aChar - '0';
                                break;
                            case 'a':
                            case 'b':
                            case 'c':
                            case 'd':
                            case 'e':
                            case 'f':
                                value = (value << 4) + 10 + aChar - 'a';
                                break;
                            case 'A':
                            case 'B':
                            case 'C':
                            case 'D':
                            case 'E':
                            case 'F':
                                value = (value << 4) + 10 + aChar - 'A';
                                break;
                            default:
                                throw new IllegalArgumentException(
                                        "Malformed      encoding.");
                        }
                    }
                    outBuffer.append((char) value);
                } else {
                    if (aChar == 't') {
                        aChar = '\t';
                    } else if (aChar == 'r') {
                        aChar = '\r';
                    } else if (aChar == 'n') {
                        aChar = '\n';
                    } else if (aChar == 'f') {
                        aChar = '\f';
                    }
                    outBuffer.append(aChar);
                }
            } else {
                outBuffer.append(aChar);
            }
        }
        String string = outBuffer.toString();
        if(StringUtils.isBlank(string)){
            string=" ";
        }
        return string;
    }
    // 测试
    //public static void main(String[] args) {
    //    AddressUtils addressUtils = new AddressUtils();
    //    // 测试ip 219.136.134.157 中国-华南-广东省-广州市-越秀区-电信
    //    String ip = "219.136.134.157";
    //    String address = "";
    //    try {
    //        address = addressUtils.getAddresses(ip);
    //    } catch (UnsupportedEncodingException e) {
    //        // TODO Auto-generated catch block
    //        e.printStackTrace();
    //    }
    //    System.out.println(address);
    //    // 输出结果为:广东省,广州市,越秀区
    //}
}

+ 47 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/util/CusAccessObjectUtil.java

@ -0,0 +1,47 @@
package com.yihu.jw.util;
import javax.servlet.http.HttpServletRequest;
/**
 * 自定义访问对象工具类
 *
 * 获取对象的IP地址等信息
 * @author X-rapido
 *
 */
public class CusAccessObjectUtil {
    /**
     * 获取用户真实IP地址,不使用request.getRemoteAddr();的原因是有可能用户使用了代理软件方式避免真实IP地址,
     *
     * 可是,如果通过了多级反向代理的话,X-Forwarded-For的值并不止一个,而是一串IP值,究竟哪个才是真正的用户端的真实IP呢?
     * 答案是取X-Forwarded-For中第一个非unknown的有效IP字符串。
     *
     * 如:X-Forwarded-For:192.168.1.110, 192.168.1.120, 192.168.1.130,
     * 192.168.1.100
     *
     * 用户真实IP为: 192.168.1.110
     *
     * @param request
     * @return
     */
    public static String getIpAddress(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }
}

Dosya farkı çok büyük olduğundan ihmal edildi
+ 218 - 0
svr/svr-wlyy-archives/src/main/java/com/yihu/jw/util/IDCard.java


+ 88 - 0
svr/svr-wlyy-archives/src/main/resources/application.yml

@ -0,0 +1,88 @@
##如果有配置服务的话,远程服务器和本地服务器配置不一致的情况下,优先远程的为主  git上 svr-base ->  git application ->本地 appliction ->本地 bootstarp
server:
  port: 10051
spring:
  application:
    name:  svr-wlyy-archives  #注册到发现服务的id 如果id一样 eurika会自动做负载
  datasource:
    driver-class-name: com.mysql.jdbc.Driver
    max-active: 50
    max-idle: 50 #最大空闲连接
    min-idle: 10 #最小空闲连接
    validation-query-timeout: 20
    log-validation-errors: true
    validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
    validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
    test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
    test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
    idle-timeout: 30000
    connection-test-query: SELECT 1
    num-tests-per-eviction-run: 50 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
    test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
  data:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true
  # JEST (Elasticsearch HTTP client) (JestProperties)
  elasticsearch:
    jest:
      uris: http://172.19.103.68:9200
#      uris: http://172.19.103.68:9200
      connection-timeout: 60000 # Connection timeout in milliseconds.
      multi-threaded: true # Enable connection requests from multiple execution threads.
#      username: # Login user.
#      password: # Login password.
#      proxy.port:  # Proxy port the HTTP client should use.
#      proxy.host:  # Proxy host the HTTP client should use.
#hibernate 配置
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  show_sql: true
  ejb:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
fast-dfs:
  tracker-server: 172.19.103.54:22122 #服务器地址
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
  http:
    tracker-http-port: 80
    anti-steal-token: no
    secret-key: FastDFS1234567890
  pool: #连接池大小
    init-size: 5
    max-size: 20
    wait-time: 500
---
spring:
  profiles: jwdev
  datasource:
    url: jdbc:mysql://172.19.103.77:3306/wlyy_archives?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: root
    password: 123456
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: jwtest
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: jwprod
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/

+ 6 - 0
svr/svr-wlyy-archives/src/main/resources/banner.txt

@ -0,0 +1,6 @@
                                        .__                                              .__    .__
  _________  _________          __  _  _|  | ___.__.___.__.         _____ _______   ____ |  |__ |__|__  __ ____   ______
 /  ___/\  \/ /\_  __ \  ______ \ \/ \/ /  |<   |  <   |  |  ______ \__  \\_  __ \_/ ___\|  |  \|  \  \/ // __ \ /  ___/
 \___ \  \   /  |  | \/ /_____/  \     /|  |_\___  |\___  | /_____/  / __ \|  | \/\  \___|   Y  \  |\   /\  ___/ \___ \
/____  >  \_/   |__|              \/\_/ |____/ ____|/ ____|         (____  /__|    \___  >___|  /__| \_/  \___  >____  >
     \/                                      \/     \/                   \/            \/     \/              \/     \/

+ 46 - 0
svr/svr-wlyy-archives/src/main/resources/bootstrap.yml

@ -0,0 +1,46 @@
##优先读取 boostarap配置 然后在读取application。yml的配置
spring:
  #从发现服务里面取配置服务的信息
  cloud:
    config:
      failFast: true #启动快速失败 即链接不到配置服务就启动失败
      username: jw
      password: jkzl
      discovery:
        enabled: true #使用发现服务
        service-id: svr-configurations #配置服务的名字
---
spring:
  profiles: jwdev
##发现服务的地址
eureka:
  client:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@172.19.103.33:8761/eureka/
---
spring:
  profiles: jwtest
eureka:
  client:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@172.19.103.33:8761/eureka/
---
spring:
  profiles: jwprod
eureka:
  client:
    serviceUrl:
      #http://账号:密码@127.0.0.1:8761/eureka/
      defaultZone: http://jw:jkzl@127.0.0.1:8761/eureka/