Browse Source

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

yeshijie 4 years ago
parent
commit
1806ef3e0a

+ 70 - 6
svr/svr-cloud-care/pom.xml

@ -266,19 +266,83 @@
        <finalName>svr-cloud-care</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <mainClass>com.yihu.SvrCloudCareApplication</mainClass>
                    <archive>
                        <!-- 生成的jar中,不要包含pom.xml和pom.properties这两个文件 -->
                        <addMavenDescriptor>false</addMavenDescriptor>
                        <manifest>
                            <!-- 是否要把第三方jar加入到类构建路径 -->
                            <addClasspath>true</addClasspath>
                            <!-- 外部依赖jar包的最终位置 -->
                            <classpathPrefix>lib/</classpathPrefix>
                            <mainClass>com.yihu.SvrCloudCareApplication</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <!--拷贝依赖到jar外面的lib目录-->
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-lib</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-dependencies</goal>
                        </goals>
                        <configuration>
                            <!-- 依赖包输出目录,将来不打进jar包里 -->
                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
                            <excludeTransitive>false</excludeTransitive>
                            <stripVersion>false</stripVersion>
                            <includeScope>runtime</includeScope>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--指定配置文件,将resources打成外部resource-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
                    <archive>
                        <!-- 指定配置文件目录,这样jar运行时会去找到同目录下的resources文件夹下查找 -->
                        <manifestEntries>
                            <Class-Path>resources/</Class-Path>
                        </manifestEntries>
                    </archive>
                    <!-- 打包时忽略的文件(也就是不打进jar包里的文件) -->
                    <excludes>
                        <exclude>**/*.yml</exclude>
                        <exclude>**/*.xml</exclude>
                    </excludes>
                </configuration>
            </plugin>
            <!-- 拷贝资源文件 外面的resource目录-->
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-dependencies</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <!-- 资源文件输出目录 -->
                            <outputDirectory>${project.build.directory}/resources</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/main/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

File diff suppressed because it is too large
+ 3 - 2
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/sign/SignEndpoint.java


+ 125 - 93
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/sign/CapacityAssessmentRecordService.java

@ -144,121 +144,153 @@ public class CapacityAssessmentRecordService extends BaseJpaService<CapacityAsse
    /**
     *
     * @param patient
     * @param item 1基本信息 2日常生活能力 3认知能力 4精神状态与社会交流能力
     * @param item 0全部 1基本信息 2日常生活能力 3认知能力 4精神状态与社会交流能力
     * @param year
     * @return
     */
    public JSONObject getAssessmentItemDetail(String patient,Integer item,String year) throws Exception {
        JSONObject result = new JSONObject();
        String tableName = "";
        String objName="";
        String keyName="";
        Integer tmpItem=item;
        boolean allSearch=false;
        if(StringUtils.isBlank(year)){
            year = DateUtil.getNowYear()+"";
        }
        if (item==1){
            tableName="base_capacity_assessment_baseinfo";
            objName="com.yihu.jw.entity.care.sign.CapacityAssessmentBaseInfoDo";
        }else if (item==2){
            tableName="base_capacity_assessment_living_ability";
            objName="com.yihu.jw.entity.care.sign.CapacityAssessmentLivingAbilityDo";
        }else if (item==3){
            tableName="base_capacity_assessment_cognitive_ability";
            objName="com.yihu.jw.entity.care.sign.CapacityAssessmentCognitiveAbilityDo";
        if (item==0){
            tmpItem++;
            allSearch=true;
        }
        else if (item==4){
            tableName="base_capacity_assessment_social_ability";
            objName="com.yihu.jw.entity.care.sign.CapacityAssessmentSocialAbilityDo";
        }
        else return new JSONObject();
        Class c1 = Class.forName(objName);
        String sql = "select * from "+tableName+" where patient='"+patient+"' and assessment_year='"+year+"' and status=1";
        Object O1 =null;
        Boolean searchFlag=true;
        try {
            O1 =  jdbcTemplate.queryForObject(sql.toString(),new BeanPropertyRowMapper(c1));
        }catch (Exception e){
            searchFlag=false;
            O1 = c1.newInstance();
        }
        JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(O1, SerializerFeature.WriteMapNullValue));
        if (!searchFlag&&item==1){//基本信息带入
            CapacityAssessmentBaseInfoDo obj = new CapacityAssessmentBaseInfoDo();
            BasePatientDO patientDo = patientDao.findById(patient);
            if (patientDo!=null){
                obj.setPatient(patientDo.getId());
                obj.setName(patientDo.getName());
                obj.setSex(patientDo.getSex());
                obj.setIdcard(patientDo.getIdcard());
                obj.setAge(IdCardUtil.getAgeForIdcard(patientDo.getIdcard())+"");
                obj.setNation(patientDo.getNational()==null?null:patientDo.getNational()+"");//名族
                obj.setNationName(patientDo.getNationalName());
                obj.setPatientPhone(patientDo.getMobile());//手机
                obj.setResidencePhone(patientDo.getPhone());//住宅电话
                obj.setDomicileCounty(patientDo.getTownCode());//户籍 区
                obj.setDomicileCountyName(patientDo.getTownName());
                obj.setDomicileStreet(patientDo.getStreetCode());//户籍 街道
                obj.setDomicileStreetName(patientDo.getStreetName());
                obj.setLiveCounty(patientDo.getLiveTownCode());
                obj.setLiveCountyName(patientDo.getLiveTownName());
                obj.setLiveStreet(patientDo.getLiveStreetCode());
                obj.setLiveStreetName(patientDo.getLiveStreetName());
                jsonObject = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
        for(;tmpItem<=4;) {
            if (tmpItem == 1) {
                tableName = "base_capacity_assessment_baseinfo";
                objName = "com.yihu.jw.entity.care.sign.CapacityAssessmentBaseInfoDo";
                keyName = "baseinfo";
            } else if (tmpItem == 2) {
                tableName = "base_capacity_assessment_living_ability";
                objName = "com.yihu.jw.entity.care.sign.CapacityAssessmentLivingAbilityDo";
                keyName = "living_ability";
            } else if (tmpItem == 3) {
                tableName = "base_capacity_assessment_cognitive_ability";
                objName = "com.yihu.jw.entity.care.sign.CapacityAssessmentCognitiveAbilityDo";
                keyName = "cognitive_ability";
            } else if (tmpItem == 4) {
                tableName = "base_capacity_assessment_social_ability";
                objName = "com.yihu.jw.entity.care.sign.CapacityAssessmentSocialAbilityDo";
                keyName = "social_ability";
            }
            Class c1 = Class.forName(objName);
            String sql = "select * from " + tableName + " where patient='" + patient + "' and assessment_year='" + year + "' and status=1";
            Object O1 = null;
            Boolean searchFlag = true;
            try {
                O1 = jdbcTemplate.queryForObject(sql.toString(), new BeanPropertyRowMapper(c1));
            } catch (Exception e) {
                searchFlag = false;
                O1 = c1.newInstance();
            }
            JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(O1, SerializerFeature.WriteMapNullValue));
            if (!searchFlag && item == 1) {//基本信息带入
                CapacityAssessmentBaseInfoDo obj = new CapacityAssessmentBaseInfoDo();
                BasePatientDO patientDo = patientDao.findById(patient);
                if (patientDo != null) {
                    obj.setPatient(patientDo.getId());
                    obj.setName(patientDo.getName());
                    obj.setSex(patientDo.getSex());
                    obj.setIdcard(patientDo.getIdcard());
                    obj.setAge(IdCardUtil.getAgeForIdcard(patientDo.getIdcard()) + "");
                    obj.setNation(patientDo.getNational() == null ? null : patientDo.getNational() + "");//名族
                    obj.setNationName(patientDo.getNationalName());
                    obj.setPatientPhone(patientDo.getMobile());//手机
                    obj.setResidencePhone(patientDo.getPhone());//住宅电话
                    obj.setDomicileCounty(patientDo.getTownCode());//户籍 区
                    obj.setDomicileCountyName(patientDo.getTownName());
                    obj.setDomicileStreet(patientDo.getStreetCode());//户籍 街道
                    obj.setDomicileStreetName(patientDo.getStreetName());
                    obj.setLiveCounty(patientDo.getLiveTownCode());
                    obj.setLiveCountyName(patientDo.getLiveTownName());
                    obj.setLiveStreet(patientDo.getLiveStreetCode());
                    obj.setLiveStreetName(patientDo.getLiveStreetName());
                    jsonObject = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
                }
            }
            result.put(keyName, jsonObject);
            if (allSearch){
                tmpItem++;
            }
            else break;
        }
        return jsonObject;
        return result;
    }
    /**
     *
     * @param json
     * @param item 1基本信息 2日常生活能力 3认知能力 4精神状态与社会交流能力
     * @param item 0全部 1基本信息 2日常生活能力 3认知能力 4精神状态与社会交流能力
     * @return
     */
    public JSONObject saveAssessmentItemDetail(String json,Integer item){
       String year = DateUtil.getNowYear()+"";
       JSONObject result  = new JSONObject();
        if (item==1){
            CapacityAssessmentBaseInfoDo obj = JSON.parseObject(json,CapacityAssessmentBaseInfoDo.class);
            List<CapacityAssessmentBaseInfoDo> tmp = CAbaseInfoDao.findByPatientAndYear(obj.getPatient(),year);
            if (tmp.size()>0){
                obj.setId(tmp.get(0).getId());
            }
            obj.setStatus(1);
            obj.setAssessmentYear(year);
            CAbaseInfoDao.save(obj);
            result = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
        }else if (item==2){
            CapacityAssessmentLivingAbilityDo obj = JSON.parseObject(json,CapacityAssessmentLivingAbilityDo.class);
            List<CapacityAssessmentLivingAbilityDo> tmp = CALivingAbilityDao.findByPatientAndYear(obj.getPatient(),year);
            if (tmp.size()>0){
                obj.setId(tmp.get(0).getId());
            }
            obj.setStatus(1);
            obj.setAssessmentYear(year);
            CALivingAbilityDao.save(obj);
            result = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
        }else if (item==3){
            CapacityAssessmentCognitiveAbilityDo obj = JSON.parseObject(json,CapacityAssessmentCognitiveAbilityDo.class);
            List<CapacityAssessmentCognitiveAbilityDo> tmp = CACognitiveAbilityDao.findByPatientAndYear(obj.getPatient(),year);
            if (tmp.size()>0){
                obj.setId(tmp.get(0).getId());
            }
            obj.setStatus(1);
            obj.setAssessmentYear(year);
            CACognitiveAbilityDao.save(obj);
            result = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
        }else if (item==4){
            CapacityAssessmentSocialAbilityDo obj = JSON.parseObject(json,CapacityAssessmentSocialAbilityDo.class);
            List<CapacityAssessmentSocialAbilityDo> tmp = CASocialAbilityDao.findByPatientAndYear(obj.getPatient(),year);
            if (tmp.size()>0){
                obj.setId(tmp.get(0).getId());
            }
            obj.setStatus(1);
            obj.setAssessmentYear(year);
            CASocialAbilityDao.save(obj);
            result = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
        }
        return result;
       JSONObject jsonObj = JSONObject.parseObject(json);
       boolean saveAll = false;
       if (item==0){
           saveAll=true;
       }
       if (item==1||saveAll){
           String tmpStr = jsonObj.getString("baseinfo");
           CapacityAssessmentBaseInfoDo obj = JSON.parseObject(tmpStr,CapacityAssessmentBaseInfoDo.class);
           List<CapacityAssessmentBaseInfoDo> tmp = CAbaseInfoDao.findByPatientAndYear(obj.getPatient(),year);
           if (tmp.size()>0){
               obj.setId(tmp.get(0).getId());
           }
           obj.setStatus(1);
           obj.setAssessmentYear(year);
           CAbaseInfoDao.save(obj);
           JSONObject resultTmp = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
           result.put("baseinfo",resultTmp);
       }
       if (item==2||saveAll){
           String tmpStr = jsonObj.getString("living_ability");
           CapacityAssessmentLivingAbilityDo obj = JSON.parseObject(tmpStr,CapacityAssessmentLivingAbilityDo.class);
           List<CapacityAssessmentLivingAbilityDo> tmp = CALivingAbilityDao.findByPatientAndYear(obj.getPatient(),year);
           if (tmp.size()>0){
               obj.setId(tmp.get(0).getId());
           }
           obj.setStatus(1);
           obj.setAssessmentYear(year);
           CALivingAbilityDao.save(obj);
           JSONObject resultTmp = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
           result.put("living_ability",resultTmp);
       }
       if (item==3||saveAll){
           String tmpStr = jsonObj.getString("cognitive_ability");
           CapacityAssessmentCognitiveAbilityDo obj = JSON.parseObject(tmpStr,CapacityAssessmentCognitiveAbilityDo.class);
           List<CapacityAssessmentCognitiveAbilityDo> tmp = CACognitiveAbilityDao.findByPatientAndYear(obj.getPatient(),year);
           if (tmp.size()>0){
               obj.setId(tmp.get(0).getId());
           }
           obj.setStatus(1);
           obj.setAssessmentYear(year);
           CACognitiveAbilityDao.save(obj);
           JSONObject resultTmp = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
           result.put("cognitive_ability",resultTmp);
       }
       if (item==4||saveAll){
           String tmpStr = jsonObj.getString("social_ability");
           CapacityAssessmentSocialAbilityDo obj = JSON.parseObject(tmpStr,CapacityAssessmentSocialAbilityDo.class);
           List<CapacityAssessmentSocialAbilityDo> tmp = CASocialAbilityDao.findByPatientAndYear(obj.getPatient(),year);
           if (tmp.size()>0){
               obj.setId(tmp.get(0).getId());
           }
           obj.setStatus(1);
           obj.setAssessmentYear(year);
           CASocialAbilityDao.save(obj);
            JSONObject resultTmp = JSON.parseObject(JSON.toJSONString(obj, SerializerFeature.WriteMapNullValue));
           result.put("social_ability",resultTmp);
       }
       return result;
    }
}