Jelajahi Sumber

医生保存居民监测方案报错的问题

huangwenjie 7 tahun lalu
induk
melakukan
c78e88ee92

+ 3 - 6
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/scheme/DoctorSchemeBloodPressure.java

@ -32,7 +32,7 @@ public class DoctorSchemeBloodPressure extends IdEntity {
    private Timestamp createTime;      //创建时间
    private Short alertTag;            //是否提醒用户
    private String content;            //方案说明
    private Short del;          //0为正常,1为删除
    private Integer del;          //0为正常,1为删除
    @Basic
    @Column(name = "name")
@ -210,14 +210,11 @@ public class DoctorSchemeBloodPressure extends IdEntity {
        this.content = content;
    }
    @Basic
    @Column(name = "del")
    public Short getDel() {
    public Integer getDel() {
        return del;
    }
    public void setDel(Short del) {
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 3 - 5
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/scheme/DoctorSchemeBloodSugger.java

@ -36,7 +36,7 @@ public class DoctorSchemeBloodSugger extends IdEntity {
    private Timestamp createTime;
    private Short alertTag;                 //是否提醒用户
    private String content;                 //方案说明
    private Short del;          //0为正常,1为删除
    private Integer del;          //0为正常,1为删除
    @Basic
    @Column(name = "name")
@ -242,13 +242,11 @@ public class DoctorSchemeBloodSugger extends IdEntity {
        return alertTag;
    }
    @Basic
    @Column(name = "del")
    public Short getDel() {
    public Integer getDel() {
        return del;
    }
    public void setDel(Short del) {
    public void setDel(Integer del) {
        this.del = del;
    }

+ 3 - 5
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientSchemeList.java

@ -16,7 +16,7 @@ public class PatientSchemeList extends IdEntity {
    private String code;
    private String patientcode;
    private String schemecode;
    private Short type;//方案类型:1为血糖,2为血压
    private Integer type;//方案类型:1为血糖,2为血压
    private String doctorcode;
    private Timestamp createTime;
@ -51,13 +51,11 @@ public class PatientSchemeList extends IdEntity {
        this.schemecode = schemecode;
    }
    @Basic
    @Column(name = "type")
    public Short getType() {
    public Integer getType() {
        return type;
    }
    public void setType(Short type) {
    public void setType(Integer type) {
        this.type = type;
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctoreSchemeBloodPressureDao.java

@ -25,5 +25,5 @@ public interface DoctoreSchemeBloodPressureDao extends
    @Modifying
    @Query("update DoctorSchemeBloodPressure set del=?1 where doctorcode=?2 and code=?3")
    void updateDel(int i, String doctorcode, String schemecode);
    void updateDelStatus(int del, String doctorcode, String schemecode);
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctrorSchemeBloodSuggerDao.java

@ -30,5 +30,5 @@ public interface DoctrorSchemeBloodSuggerDao extends
    @Modifying
    @Query("update DoctorSchemeBloodSugger set del=?1 where doctorcode=?2 and code=?3")
    void updateDel(int i, String doctorcode, String schemecode);
    void updateDelStatus(int del, String doctorcode, String schemecode);
}

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/scheme/PatientSchemeListDao.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.repository.patient.scheme;
import com.yihu.wlyy.entity.patient.PatientSchemeList;
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;
@ -14,6 +15,7 @@ public interface PatientSchemeListDao extends
        PagingAndSortingRepository<PatientSchemeList, Long>,
        JpaSpecificationExecutor<PatientSchemeList> {
    @Query("delete from PatientSchemeList where patientcode=?1 and type=?2 and schemecode=?3")
    @Modifying
    @Query("delete PatientSchemeList where patientcode=?1 and type=?2 and schemecode=?3")
    void delByPatientCodeAndSchemeCode(String patientcode, int i, String code);
}

+ 40 - 35
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java

@ -25,6 +25,7 @@ import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.stereotype.Service;
import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.util.*;
@ -249,7 +250,7 @@ public class DoctorSchemeService {
            doctorSchemeBloodSugger.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
            doctorSchemeBloodSugger.setContent(content);
            doctorSchemeBloodSugger.setCreateTime(DateUtil.getNowTimestamp());
            doctorSchemeBloodSugger.setDel(new Short("0"));
            doctorSchemeBloodSugger.setDel(0);
            results.add(doctorSchemeBloodSugger);
        }
@ -308,7 +309,7 @@ public class DoctorSchemeService {
            doctorSchemeBloodPressure.setAlertTag(datalist.getJSONObject(i).getShort("alertTag"));
            doctorSchemeBloodPressure.setContent(content);
            doctorSchemeBloodPressure.setCreateTime(DateUtil.getNowTimestamp());
            doctorSchemeBloodPressure.setDel(new Short("0"));
            doctorSchemeBloodPressure.setDel(0);
            results.add(doctorSchemeBloodPressure);
        }
@ -326,20 +327,23 @@ public class DoctorSchemeService {
     * @param type
     * @throws Exception
     */
    @Transactional
    public void savePatientScheme(String doctorcode, String schemecode, String type,String patientcodes) throws Exception {
        List<String> patientcodeList = new ArrayList<>();
        JSONObject dataObj = JSON.parseObject(patientcodes);
        JSONArray codes = dataObj.getJSONArray("patientcodes");
        if (codes == null || codes.size() == 0) {
            throw new Exception("居民列表不能为空");
        }
        String[] codes = patientcodes.split(",");
        for (int i = 0; i < codes.size(); i++) {
            patientcodeList.add(codes.get(i).toString());
        if(patientcodes.contains(",")){
            for (String code : codes) {
                patientcodeList.add(code);
            }
        }else{
            patientcodeList.add(patientcodes);
        }
        if (!patientcodeList.isEmpty()) {
            //使用事务控制批量更新
@ -348,22 +352,21 @@ public class DoctorSchemeService {
            TransactionStatus status = transactionManager.getTransaction(def); // 获得事务状态
            try {
                for (String patientcode : patientcodeList) {
                    PatientSchemeList patientSchemeListObj = new PatientSchemeList();
                    patientSchemeListDao.delByPatientCodeAndSchemeCode(patientcode, Integer.parseInt(type), schemecode);
                    PatientSchemeList patientSchemeListObj = new PatientSchemeList();
                    patientSchemeListObj.setCode(UUID.randomUUID().toString());
                    patientSchemeListObj.setPatientcode(patientcode);
                    patientSchemeListObj.setSchemecode(schemecode);
                    patientSchemeListObj.setDoctorcode(doctorcode);
                    Short _type = new Short(type);
                    patientSchemeListObj.setType(_type);
                    patientSchemeListObj.setType(Integer.parseInt(type));
                    patientSchemeListObj.setCreateTime(DateUtil.getNowTimestamp());
                    patientSchemeListDao.save(patientSchemeListObj);
                }
                //事务提交
                transactionManager.commit(status);
            } catch (Exception ex) {
                System.out.println(ex.getMessage());
                //报错事务回滚
                transactionManager.rollback(status);
            }
@ -380,11 +383,11 @@ public class DoctorSchemeService {
     * @param enddate
     * @return
     */
    public JSONArray getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate) throws Exception{
    public JSONObject getSlowDiseaseTeaminfos(String teamCode, int getcolor, int getstands, int gethealthindex, String startdate, String enddate) throws Exception{
        List<Patient> patients = patientDao.findAllSignPatientTeamcode(teamCode);
        JSONArray result = new JSONArray();
        JSONObject result = new JSONObject();
        JSONObject green = new JSONObject();//绿标
        JSONObject yellow = new JSONObject();//黄标
        JSONObject red = new JSONObject();//红标
@ -453,19 +456,19 @@ public class DoctorSchemeService {
        if(1 == getcolor){
            green.put("greencount",green_patients.size());
            yellow.put("yellowcount",yellow_patients.size());
            red.put("redcount",red_patients.size());
            result.add(green);
            result.add(yellow);
            result.add(red);
            result.put("greencount",green_patients.size());
            result.put("yellowcount",yellow_patients.size());
            result.put("redcount",red_patients.size());
//            result.add(green);
//            result.add(yellow);
//            result.add(red);
        }
        if(1 == getstands){
            pressure_standard.put("pressure_standard",bloodpressure_patientcodes);
            sugar_standard.put("sugar_standard",bloodsugar_patientcodes);
            result.add(pressure_standard);
            result.add(sugar_standard);
            result.put("pressure_standard",bloodpressure_patientcodes);
            result.put("sugar_standard",bloodsugar_patientcodes);
//            result.add(pressure_standard);
//            result.add(sugar_standard);
        }
@ -501,15 +504,15 @@ public class DoctorSchemeService {
                }
            }
            pressure_count.put("pressure_count",pressure);
            pressure_unusual_ount.put("pressure_unusual_count",pressure_unusual);
            sugar_count.put("sugar_count",sugar);
            sugar_unusual_count.put("sugar_unusual_count",sugar_unusual);
            result.put("pressure_count",pressure);
            result.put("pressure_unusual_count",pressure_unusual);
            result.put("sugar_count",sugar);
            result.put("sugar_unusual_count",sugar_unusual);
            result.add(pressure_count);
            result.add(pressure_unusual_ount);
            result.add(sugar_count);
            result.add(sugar_unusual_count);
//            result.add(pressure_count);
//            result.add(pressure_unusual_ount);
//            result.add(sugar_count);
//            result.add(sugar_unusual_count);
        }
@ -522,14 +525,16 @@ public class DoctorSchemeService {
     * @param schemecode
     * @param type
     */
    @Transactional
    public void delDoctorScheme(String doctorcode, String schemecode, String type) throws Exception{
        if("1".equals(type)){
            doctroSchemeBloodSuggerDao.updateDel(1,doctorcode,schemecode);
            doctroSchemeBloodSuggerDao.updateDelStatus(1,doctorcode,schemecode);
        }
        if("2".equals(type)){
            doctoreSchemeBloodPressureDao.updateDel(1,doctorcode,schemecode);
            doctoreSchemeBloodPressureDao.updateDelStatus(1,doctorcode,schemecode);
        }
    }
}

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

@ -845,7 +845,7 @@ public class SignPatientLabelInfoController extends BaseController {
            @ApiParam(name="startdate", value="体征数据开始时间yyyy-mm-dd hh:mm:ss") @RequestParam(value = "startdate",required = false,defaultValue = "")  String startdate,
            @ApiParam(name="enddate", value="体征数据结束时间yyyy-mm-dd hh:mm:ss") @RequestParam(value = "enddate",required = false,defaultValue = "")  String enddate){
        try {
            com.alibaba.fastjson.JSONArray result = doctorSchemeService.getSlowDiseaseTeaminfos(teamCode,getcolor,getstands,gethealthindex,startdate,enddate);
            com.alibaba.fastjson.JSONObject result = doctorSchemeService.getSlowDiseaseTeaminfos(teamCode,getcolor,getstands,gethealthindex,startdate,enddate);
            return write(200, "查询成功", "data", result);
        }catch (Exception e){
            //日志文件中记录异常信息

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheme/DoctroSchemeController.java

@ -124,7 +124,7 @@ public class DoctroSchemeController extends BaseController {
            @ApiParam(name="doctorcode", value="医生CODE") @RequestParam(value = "doctorcode",required = true) String doctorcode,
            @ApiParam(name="schemecode", value="方案CODE") @RequestParam(value = "schemecode",required = true) String schemecode,
            @ApiParam(name="type", value="血糖1、血压2") @RequestParam(value = "type",required = true) String type,
            @ApiParam(name="patientcodes", value="JASON数据") @RequestParam(value = "patientcodes",required = true) String patientcodes){
            @ApiParam(name="patientcodes", value="用户CODE,多个用逗号拼接") @RequestParam(value = "patientcodes",required = true) String patientcodes){
        try {
            doctorSchemeService.savePatientScheme(doctorcode,schemecode,type,patientcodes);
            return write(200, "操作成功");