Quellcode durchsuchen

Merge branch 'dev' of yeshijie/patient-co-management into dev

yeshijie vor 7 Jahren
Ursprung
Commit
c527ba19d6

+ 50 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java

@ -5,7 +5,6 @@ import com.yihu.wlyy.entity.device.Device;
import com.yihu.wlyy.entity.device.PatientBloodSugger;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.device.PatientHealthTime;
import com.yihu.wlyy.entity.dict.Icd10Dict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
@ -23,7 +22,9 @@ import com.yihu.wlyy.repository.doctor.SignPatientLabelInfoDao;
import com.yihu.wlyy.repository.patient.*;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.system.Icd10DictServcie;
import com.yihu.wlyy.service.third.iot.IotDeviceService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.util.DateUtil;
@ -59,7 +60,8 @@ public class PatientDeviceService extends BaseService {
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private Icd10DictServcie icd10DictServcie;
    @Autowired
    private PatientDeviceDao patientDeviceDao;
@ -87,7 +89,8 @@ public class PatientDeviceService extends BaseService {
    private PatientHealthStandardDao patientHealthStandardDao;
    @Autowired
    private HttpClientUtil HttpClientUtil;
    @Autowired
    private PrescriptionService prescriptionService;
    @Value("${yihu.yihu_OpenPlatform_url}")
    private String url;
    @Value("${yihu.yihu_OpenPlatform_appId}")
@ -107,7 +110,10 @@ public class PatientDeviceService extends BaseService {
    private IotDeviceService iotDeviceService;
    @Autowired
    private Icd10DictDao icd10DictDao;
    //健康问题 高血压
    private static final String gxy = "HP0093";
    //健康问题 糖尿病
    private static final String tnb = "HP0047";
    Map<Integer, String> relations = new HashMap<>();
    @PostConstruct
@ -932,6 +938,9 @@ public class PatientDeviceService extends BaseService {
        int eventSize = 0;//就诊次数
        int times = 0;//住院次数
        int num = 10;//查找10次后就不找了。
        int ni = 0;
        String drugs = "";
        if (!StringUtils.isEmpty(response)) {
            JSONArray array = new JSONArray(response);
            if (!"[{}]".equals(response)) {
@ -949,22 +958,45 @@ public class PatientDeviceService extends BaseService {
                    if(StringUtils.isNotBlank(type)){
                        //根据icd10过滤数据
                        String icdCode = item.optString("ICD_CODE");
                        Icd10Dict icd10Dict = icd10DictDao.findByCode(icdCode);
                        if(icd10Dict==null){
                            continue;
                        }
                        if("1".equals(type)){
                            //血糖
                            if(!"2".equals(icd10Dict.getType())){
                                continue;
                        String icdCode = item.optString("DIAGNOSIS");
                        String icd10 = icd10DictServcie.getHealthProblemsByIcd10Code(icdCode);
                        if(StringUtils.isNotBlank(icd10)){
                            com.alibaba.fastjson.JSONObject icd = com.alibaba.fastjson.JSONObject.parseObject(icd10);
                            String key = icd.getString("key");
                            if ("1".equals(type)) {
                                //主诊断为糖尿病
                                if(!tnb.equals(key)){
                                    continue;
                                }
                            } else  if("2".equals(type)){
                                //主诊断为高血压
                                if(!gxy.equals(key)){
                                    continue;
                                }
                            }
                        }else {
                            //血压
                            if(!"1".equals(icd10Dict.getType())){
                                continue;
                            }
                            continue;
                        }
//                        Icd10Dict icd10Dict = icd10DictDao.findByCode(icdCode);
//                        if(icd10Dict==null){
//                            continue;
//                        }
//                        if("1".equals(type)){
//                            //血糖
//                            if(!"2".equals(icd10Dict.getType())){
//                                continue;
//                            }
//                        }else {
//                            //血压
//                            if(!"1".equals(icd10Dict.getType())){
//                                continue;
//                            }
//                        }
                        ni++;
                        if(ni<num&&StringUtils.isEmpty(drugs)){
                            drugs = prescriptionService.findPatientMedicationRecords(patientCode,item.optString("END_TIME").toString(),type);
                        }
                    }
                    if("2".equals(item.optString("TYPE"))){
                        times++;
@ -1006,6 +1038,7 @@ public class PatientDeviceService extends BaseService {
        statistics.put("times",times);
        json.put("statistics",statistics);
        json.put("list",re);
        json.put("drugs",drugs);
        return json;
    }

+ 32 - 36
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -1210,7 +1210,7 @@ public class PatientHealthIndexService extends BaseService {
     * 按时间段查询患者健康指标
     *
     * @param type    健康指标类型(1血糖,2血压,3体重,4腰围)
     * @param gi_type 血糖就餐时间段(早餐前,早餐后等),(type=2时,1表示收缩压、2表示舒张压)
     * @param gi_type 血糖就餐时间段(早餐前,早餐后等)
     * @param begin   开始时间
     * @param end     结束时间
     * @return
@ -1336,40 +1336,36 @@ public class PatientHealthIndexService extends BaseService {
                Double minValueSSY = SystemConf.HEALTH_STANDARD_SSY_MIN;
                Double maxValueSZY = SystemConf.HEALTH_STANDARD_SZY_MAX;
                Double minValueSZY = SystemConf.HEALTH_STANDARD_SZY_MIN;
                if(gi_type==1){
                    //1表示收缩压
                    returnInt = checkHealth(maxValueSSY,minValueSSY,intVlue1);
                    switch (returnInt){
                        case 0:
                            normal++;
                            break;
                        case 1:
                            high++;
                            break;
                        default:
                            low++;
                            break;
                    }
                    if(intVlue1>=maxValueSSY){
                        flag = true;
                    }
                }else if(gi_type==2){
                    //2表示舒张压
                    returnInt = checkHealth(maxValueSZY,minValueSZY,intVlue2);
                    switch (returnInt){
                        case 0:
                            normal++;
                            break;
                        case 1:
                            high++;
                            break;
                        default:
                            low++;
                            break;
                    }
                    if(intVlue2>=maxValueSSY){
                        flag = true;
                    }
                returnInt = checkHealth(maxValueSSY,minValueSSY,intVlue1);
                switch (returnInt){
                    case 0:
                        normal++;
                        break;
                    case 1:
                        high++;
                        if(intVlue1>=maxValueSSY){
                            flag = true;
                        }
                        break;
                    default:
                        low++;
                        break;
                }
                returnInt = checkHealth(maxValueSZY,minValueSZY,intVlue2);
                switch (returnInt){
                    case 0:
                        normal++;
                        break;
                    case 1:
                        high++;
                        if(intVlue2>=maxValueSSY){
                            flag = true;
                        }
                        break;
                    default:
                        low++;
                        break;
                }
            }
@ -1413,7 +1409,7 @@ public class PatientHealthIndexService extends BaseService {
     * @return -1偏低,0正常,1偏高
     */
    private Integer checkHealth(Double max,Double min,Double value){
        if(max<=value){
        if(max<value){
            return 1;
        }else if(min>value){
            return -1;

+ 7 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.adapter.PresModeAdapter;
import com.yihu.wlyy.entity.dict.Icd10Dict;
import com.yihu.wlyy.entity.doctor.team.sign.DoctorTeam;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.message.Message;
@ -43,7 +42,6 @@ import org.springframework.transaction.TransactionDefinition;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.DefaultTransactionDefinition;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*;
@ -652,7 +650,7 @@ public class PrescriptionService extends BaseService {
     * @param type 1糖尿病,2高血压
     * @return
     */
    public String findPatientMedicationRecords(String patientCode, String timeline, Integer type) throws Exception{
    public String findPatientMedicationRecords(String patientCode, String timeline, String type) throws Exception{
        
        Integer totalCount = 0;
        
@ -707,8 +705,11 @@ public class PrescriptionService extends BaseService {
//                            break;
//                        }
//                    }
//
                    if (1 == type) {
                    if(type==null){
                        RECIPE_NO = r.getString("code");
                        break;
                    }
                    if ("1".equals(type)) {
                        //主诊断为糖尿病
                        if(tnb.equals(ds.getHealthProblem())){
                            RECIPE_NO = r.getString("code");
@ -716,7 +717,7 @@ public class PrescriptionService extends BaseService {
                        }else{
                            continue;
                        }
                    } else  if(2 == type){
                    } else  if("2".equals(type)){
                        //主诊断为高血压
                        if(gxy.equals(ds.getHealthProblem())){
                            RECIPE_NO = r.getString("code");

+ 1 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/iot/IotMonitoringHealthController.java

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.service.app.prescription.PrescriptionService;
import com.yihu.wlyy.service.third.iot.IotDeviceService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -220,7 +219,7 @@ public class IotMonitoringHealthController extends BaseController {
                                               @ApiParam(name="timeline",value = "时间轴(根据传入的时间搜索前25天后25天)YYYY-MM-DD")
                                               @RequestParam(name="timeline",required = true)String timeline,
                                               @ApiParam(name="type",value = "1糖尿病,2高血压")
                                               @RequestParam(name="type",required = true)Integer type){
                                               @RequestParam(name="type",required = true)String type){
        try {
            return write(200,"查询成功","data",prescriptionService.findPatientMedicationRecords(patientCode,timeline,type));
        }catch (Exception e){