Browse Source

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

liubing 3 years ago
parent
commit
8d0ea15153

+ 25 - 1
common/common-entity/sql记录

@ -1502,4 +1502,28 @@ ALTER table wlyy_devices add column iccid VARCHAR(20) default null COMMENT '物
ALTER table wlyy_devices add column imsi VARCHAR(20) default null COMMENT '物联网卡IMSI';
ALTER table wlyy_devices add column  category_code varchar(50) DEFAULT NULL COMMENT '设备类型 dm_device表定义';
ALTER table dm_device add column device_type tinyint(2) DEFAULT NULL COMMENT '设备种类 0健康设备 1安防设备';
ALTER table dm_device add column device_type tinyint(2) DEFAULT NULL COMMENT '设备种类 0健康设备 1安防设备';
-- 2021-09-26
CREATE TABLE `base_capacity_label` (
  `id` varchar(50) NOT NULL,
  `patient` varchar(255) DEFAULT NULL,
  `family` varchar(1) DEFAULT NULL COMMENT '是否有家属 1是0否',
  `hypertension` varchar(1) DEFAULT NULL COMMENT '高血压 1是 0否',
  `hyperglycemia` varchar(1) DEFAULT NULL COMMENT '高血糖 1是 0否',
  `heart_disease` varchar(1) DEFAULT NULL COMMENT '心脏疾病 1是 0否',
  `work_status` varchar(1) DEFAULT NULL COMMENT '行走状态 1迟缓 2一般 3健步如飞',
  `disability` varchar(1) DEFAULT NULL COMMENT '残疾 1是 0否',
  `disabled_part` varchar(100) DEFAULT NULL COMMENT '残疾部位',
  `visual_condition` varchar(1) DEFAULT NULL COMMENT '视觉状况 1看不见 2近距离 3正常',
  `auditory_condition` varchar(1) DEFAULT NULL COMMENT '听觉状况 1听不见 2大声量 3正常',
  `communication` varchar(1) DEFAULT NULL COMMENT '交流情况 1不善于 2一般 3善于',
  `mental_illness` varchar(1) DEFAULT NULL COMMENT '精神类疾病 1是 0否',
  `often_go_out` varchar(1) DEFAULT NULL COMMENT '经常外出 1是 0否',
  `use_phone` varchar(1) DEFAULT NULL COMMENT '会使用智能手机 1是 0否',
  `take_exercise` varchar(1) DEFAULT NULL COMMENT '参加锻炼 1是 0否',
  `create_time` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='能力状况记录表';

+ 166 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/care/label/BaseCapacityLabelDO.java

@ -0,0 +1,166 @@
package com.yihu.jw.entity.care.label;
import com.yihu.jw.entity.UuidIdentityEntityWithCreateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 能力状况记录表
 */
@Entity
@Table(name = "base_capacity_label")
public class BaseCapacityLabelDO extends UuidIdentityEntityWithCreateTime {
    private String patient;
    private String family;//是否有家属 1是0否
    private String hypertension;//高血压 1是 0否
    private String hyperglycemia;//高血糖 1是 0否
    private String heartDisease;//心脏疾病 1是 0否
    private String workStatus;//行走状态 1迟缓 2一般 3健步如飞
    private String disability;//残疾 1是 0否
    private String disabledPart;//残疾部位
    private String visualCondition;//视觉状况 1看不见 2近距离 3正常
    private String auditoryCondition;//听觉状况 1听不见 2大声量 3正常
    private String communication;//交流情况 1不善于 2一般 3善于
    private String mentalIllness;//精神类疾病 1是 0否
    private String oftenGoOut;//经常外出 1是 0否
    private String usePhone;//会使用智能手机 1是 0否
    private String takeExercise;//参加锻炼 1是 0否
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "family")
    public String getFamily() {
        return family;
    }
    public void setFamily(String family) {
        this.family = family;
    }
    @Column(name = "hypertension")
    public String getHypertension() {
        return hypertension;
    }
    public void setHypertension(String hypertension) {
        this.hypertension = hypertension;
    }
    @Column(name = "hyperglycemia")
    public String getHyperglycemia() {
        return hyperglycemia;
    }
    public void setHyperglycemia(String hyperglycemia) {
        this.hyperglycemia = hyperglycemia;
    }
    @Column(name = "heart_disease")
    public String getHeartDisease() {
        return heartDisease;
    }
    public void setHeartDisease(String heartDisease) {
        this.heartDisease = heartDisease;
    }
    @Column(name = "work_status")
    public String getWorkStatus() {
        return workStatus;
    }
    public void setWorkStatus(String workStatus) {
        this.workStatus = workStatus;
    }
    @Column(name = "disability")
    public String getDisability() {
        return disability;
    }
    public void setDisability(String disability) {
        this.disability = disability;
    }
    @Column(name = "disabled_part")
    public String getDisabledPart() {
        return disabledPart;
    }
    public void setDisabledPart(String disabledPart) {
        this.disabledPart = disabledPart;
    }
    @Column(name = "visual_condition")
    public String getVisualCondition() {
        return visualCondition;
    }
    public void setVisualCondition(String visualCondition) {
        this.visualCondition = visualCondition;
    }
    @Column(name = "auditory_condition")
    public String getAuditoryCondition() {
        return auditoryCondition;
    }
    public void setAuditoryCondition(String auditoryCondition) {
        this.auditoryCondition = auditoryCondition;
    }
    @Column(name = "communication")
    public String getCommunication() {
        return communication;
    }
    public void setCommunication(String communication) {
        this.communication = communication;
    }
    @Column(name = "mental_illness")
    public String getMentalIllness() {
        return mentalIllness;
    }
    public void setMentalIllness(String mentalIllness) {
        this.mentalIllness = mentalIllness;
    }
    @Column(name = "often_go_out")
    public String getOftenGoOut() {
        return oftenGoOut;
    }
    public void setOftenGoOut(String oftenGoOut) {
        this.oftenGoOut = oftenGoOut;
    }
    @Column(name = "use_phone")
    public String getUsePhone() {
        return usePhone;
    }
    public void setUsePhone(String usePhone) {
        this.usePhone = usePhone;
    }
    @Column(name = "take_exercise")
    public String getTakeExercise() {
        return takeExercise;
    }
    public void setTakeExercise(String takeExercise) {
        this.takeExercise = takeExercise;
    }
}

+ 24 - 38
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/patient/BasePatientEndpoint.java

@ -33,6 +33,7 @@ import jxl.Sheet;
import jxl.Workbook;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
@ -72,6 +73,8 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
    private ArchiveDao archiveDao;
    @Autowired
    private WlyyPatientLabelDao patientLabelDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @PostMapping(value = BaseRequestMapping.BasePatient.CREATE)
    @ApiOperation(value = "创建")
@ -226,33 +229,21 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
     *   姓名	性别	年龄	身份证号	      联系方式	   小区	            地址	                 签约团队	        能力类型
     * 沈xxx	女	    88	330103xxxxxxxx0720	1525xxxx711	朝晖九区	朝晖九区10幢4单元103	    虹园/稻香园服务团队	    能力完好
     * 沈xxx	女	    86	330103xxxxxxxx0720	1525xxxx711	朝晖九区	朝晖九区天盛居4幢1202室	  大木桥服务团队	    能力完好
     * @param request
     * @param file
     * @return
     */
    @RequestMapping(value = "/importPatientFromExcel", produces = "application/json;charset=UTF-8",method = RequestMethod.POST)
    @RequestMapping(value = "/open/importPatientFromTmp" ,method = RequestMethod.POST)
    @ResponseBody
    public ObjEnvelop importPatientFromExcel(HttpServletRequest request, @ApiParam(value = "文件", required = true)
    @RequestParam(value = "file", required = true) MultipartFile file) {
        Calendar c1 = Calendar.getInstance();
        /**
         * c1  签约结束时间
         */
        c1.set(2023, 12 - 1, 31,23,59,59);
        List errorLs = new ArrayList<>();
    public ObjEnvelop importPatientFromTmp() {
        Calendar cal = Calendar.getInstance();
        int year= 100;
        List correctLs = new ArrayList<>();
        List idcardList = new ArrayList<>();
        Map<String, String> errorMsgMap = new HashMap<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        List<String> deviceCodes = new ArrayList<>();
        try {
            request.setCharacterEncoding("UTF-8");
            InputStream inputStream = file.getInputStream();
            Workbook rwb = Workbook.getWorkbook(inputStream);
            Sheet[] sheets = rwb.getSheets();
            int rows;
            int row;
            String name=null;//用户姓名
            String sql = "select * from patient_tmp";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            String name;//用户姓名
            String sex; //性别
            String age; //年龄
            String idcard;  //身份证号
@ -261,24 +252,18 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
            String address; //居住地址
            String signTeam; //签约团队
            String label; //能力类型
            Sheet sheet = sheets[0];    //第一张表
            rows = sheet.getRows();
            for (int j = 1; j < rows; j++) {
                if (sheet.getRow(j).length == 0) {
                    continue;
                }
            for (Map<String,Object> map:list) {
                BasePatientDO basePatientVO = new BasePatientDO();
                JSONObject infoMap = new JSONObject();
                row = j;
                name = sheet.getCell(0, row).getContents().trim();    //0 用户姓名
                sex = sheet.getCell(1, row).getContents().trim();  //1 性别
                age = sheet.getCell(2, row).getContents().trim();   //2 年龄
                idcard = sheet.getCell(3, row).getContents().trim(); //3 身份证号
                mobile = sheet.getCell(4, row).getContents().trim();  //4 联系方式
                residentialArea = sheet.getCell(5, row).getContents().trim(); //5 居住小区
                address = sheet.getCell(6, row).getContents().trim(); //6 居住地址
                signTeam = sheet.getCell(7, row).getContents().trim();; //签约团队
                label = sheet.getCell(8, row).getContents().trim();; //能力类型
                name = map.get("name")+"";    //0 用户姓名
                sex = map.get("sex")+"";  //1 性别
                age = map.get("age")+"";   //2 年龄
                idcard = map.get("idcard")+""; //3 身份证号
                mobile = map.get("mobile")+"";  //4 联系方式
                residentialArea = map.get("area")+""; //5 居住小区
                address = map.get("address")+""; //6 居住地址
                signTeam = map.get("sign")+""; //签约团队
                label = map.get("label")+""; //能力类型
                if (StringUtils.isBlank(idcard)){
                    continue;
                }
@ -352,7 +337,8 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
                        signRecordDO.setName(name);
                        signRecordDO.setStatus(1);
                        signRecordDO.setStartTime(new Date());
                        signRecordDO.setEndTime(c1.getTime());
                        cal.add(Calendar.YEAR,year);
                        signRecordDO.setEndTime(cal.getTime());
                        BaseTeamDO teamDO = baseTeamDao.findByName(signTeam);
                        if (teamDO == null) {
                            errorMsgMap.put(idcard,"团队信息获取失败");
@ -403,7 +389,7 @@ public class BasePatientEndpoint extends EnvelopRestEndpoint {
            //包装导入结果(导入成功数量、错误对象集合)
            Map<String, Object> map = new HashMap<>();
            map.put("successNum", correctLs.size());
            map.put("failedNum", rows-1 - correctLs.size() );
            map.put("failedNum", list.size() - correctLs.size() );
            map.put("errorData", JSON.toJSONString(errorMsgMap, SerializerFeature.WriteMapNullValue));
            System.out.println(map);
            return ObjEnvelop.getSuccess("获取成功",map);

+ 19 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/label/BaseCapacityLabelDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.care.dao.label;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2021/9/26.
 */
public interface BaseCapacityLabelDao  extends PagingAndSortingRepository<BaseCapacityLabelDO, String>,
        JpaSpecificationExecutor<BaseCapacityLabelDO> {
    @Query("select a from BaseCapacityLabelDO a where a.patient=?1")
    BaseCapacityLabelDO findByPatient(String patient);
}

+ 26 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/patient/PatientEndpoint.java

@ -144,6 +144,32 @@ public class PatientEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "findCapLabel")
    @ApiOperation(value = "获取居民能力状况信息")
    public Envelop findCapLabel(
            @ApiParam(name = "patientId", value = "居民id")
            @RequestParam(value = "patientId", required = true) String patientId) {
        try{
            return success("获取成功", patientService.findCapLabel(patientId));
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @PostMapping(value = "updCapLabel")
    @ApiOperation(value = "修改居民能力状况信息")
    @ObserverRequired
    public Envelop updCapLabel(
            @ApiParam(name = "jsonData", value = "能力状况")
            @RequestParam(value = "jsonData", required = true) String jsonData) {
        try{
            return success("获取成功", patientService.updCapLabel(jsonData));
        }catch (Exception e){
            return failedException2(e);
        }
    }
    @PostMapping(value = "updLatLon")
    @ApiOperation(value = "修改居民经纬度信息")
    public Envelop updLatLon(@ApiParam(name = "latLon", value = "经纬度24.48923061,118.10388605")

+ 32 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/patient/CarePatientService.java

@ -3,6 +3,8 @@ package com.yihu.jw.care.service.patient;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.care.dao.label.BaseCapacityLabelDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.service.common.DictService;
import com.yihu.jw.care.service.device.DeviceService;
@ -14,6 +16,7 @@ import com.yihu.jw.doctor.dao.BaseDoctorHospitalDao;
import com.yihu.jw.entity.base.doctor.BaseDoctorHospitalDO;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.base.servicePackage.ServicePackageSignRecordDO;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import com.yihu.jw.im.util.ImUtil;
@ -75,6 +78,31 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
    private DeviceService deviceService;
    @Autowired
    private HospitalSysDictDao hospitalSysDictDao;
    @Autowired
    private BaseCapacityLabelDao capacityLabelDao;
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * 获取能力状况
     * @param patient
     * @return
     */
    public BaseCapacityLabelDO findCapLabel(String patient){
        return capacityLabelDao.findByPatient(patient);
    }
    /**
     * 更新能力状况
     * @param jsonData
     * @return
     * @throws Exception
     */
    public BaseCapacityLabelDO updCapLabel(String jsonData) throws Exception{
        BaseCapacityLabelDO capacityLabelDO = objectMapper.readValue(jsonData, BaseCapacityLabelDO.class);
        capacityLabelDao.save(capacityLabelDO);
        return capacityLabelDO;
    }
    /**
     * 签约记录
@ -209,6 +237,10 @@ public class CarePatientService extends BaseJpaService<BasePatientDO, BasePatien
                res.put("capAssRecordDO",recordDO);
            }
        }
        //能力状况
        BaseCapacityLabelDO capacityLabelDO = capacityLabelDao.findByPatient(patientId);
        res.put("capacityLabelDO",capacityLabelDO);
        JSONObject tmp = res.getJSONObject("patient");
        tmp.put("deviceType",deviceService.getPatientDeviceCategoryCode(patientId));
        res.put("patient",tmp);

+ 7 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/third/PatientInfoPlatFormService.java

@ -1,6 +1,7 @@
package com.yihu.jw.care.service.third;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.label.BaseCapacityLabelDao;
import com.yihu.jw.care.dao.label.WlyyPatientLabelDao;
import com.yihu.jw.care.service.course.CourseService;
import com.yihu.jw.care.service.device.PatientDeviceService;
@ -11,6 +12,7 @@ import com.yihu.jw.care.service.security.SecurityMonitoringOrderService;
import com.yihu.jw.care.service.sign.CapacityAssessmentRecordService;
import com.yihu.jw.care.service.sign.ServicePackageService;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
import com.yihu.jw.entity.care.label.WlyyPatientLabelDO;
import com.yihu.jw.entity.care.sign.CapacityAssessmentRecordDO;
import com.yihu.jw.patient.dao.BasePatientDao;
@ -55,6 +57,8 @@ public class PatientInfoPlatFormService {
    private PatientHealthIndexService healthIndexService;
    @Autowired
    private CapacityAssessmentRecordService capacityAssessmentRecordService;
    @Autowired
    private BaseCapacityLabelDao capacityLabelDao;
    /**
@ -107,6 +111,9 @@ public class PatientInfoPlatFormService {
            }catch (Exception e){
                e.printStackTrace();
            }
            //能力状况
            BaseCapacityLabelDO capacityLabelDO = capacityLabelDao.findByPatient(patient);
            result.put("capacityLabelDO",capacityLabelDO);
            return result;
        }
        return null;