|
@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.prenatalInspector;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.yihu.device.entity.DevicePatientHealthIndex;
|
|
|
import com.yihu.wlyy.entity.doctor.profile.Doctor;
|
|
|
import com.yihu.wlyy.entity.patient.Patient;
|
|
@ -831,7 +832,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
|
|
|
|
|
|
/**
|
|
|
* 根据待产检ID查询最近一条待产检计划状态
|
|
|
*
|
|
|
* 及列表范围之外最近一条待产检计划状态
|
|
|
* @param prenatalId
|
|
|
*/
|
|
|
public JSONObject getPrenatalStatus(Long prenatalId) throws Exception {
|
|
@ -850,6 +851,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
|
|
|
if (StringUtils.isNotEmpty(pregnancyNo) && (pregnancyNo != null)){
|
|
|
Map<String,String> exams = getExamStatus(patient,pregnancyNo,begin,end);
|
|
|
String examStatus = exams.get("status");
|
|
|
Object beforePlan = exams.containsKey("plan")?exams.get("plan"):null;
|
|
|
if ("1".equals(examStatus)){
|
|
|
String examTime = exams.get("examTime");
|
|
|
json.put("renatalStatus", "4");
|
|
@ -858,10 +860,14 @@ public class PrenatalInspectorPreCardService extends BaseService {
|
|
|
if (days > 7) {
|
|
|
json.put("renatalStatus", "3");
|
|
|
json.put("sendStatus", flag == true ? "1" : "0");
|
|
|
json.put("plan", plan);
|
|
|
}else{
|
|
|
PrenatalInspectorRecord record = recordDao.findByRelationAndType(prenatalId.toString(), 0);
|
|
|
if (record == null) {
|
|
|
json.put("renatalStatus", "1");
|
|
|
if (beforePlan !=null){
|
|
|
json.put("plan", beforePlan);
|
|
|
}
|
|
|
if (days < -7) {
|
|
|
json.put("reason", "未到提醒时间(" + format.format(DateUtil.getPreDays(plan.getInspectionTime(), -7)) + " 08:00)");
|
|
|
}else {
|
|
@ -871,6 +877,9 @@ public class PrenatalInspectorPreCardService extends BaseService {
|
|
|
PrenatalInspectorRecord docRecord = recordDao.findByRelationAndType(prenatalId.toString(), 1);
|
|
|
json.put("renatalStatus", "2");
|
|
|
json.put("sendStatus", flag == true ? "1" : "0");
|
|
|
if (beforePlan !=null){
|
|
|
json.put("plan", beforePlan);
|
|
|
}
|
|
|
if (docRecord == null) {
|
|
|
json.put("sendTime", format.format(record.getSendTime()));
|
|
|
} else {
|
|
@ -1029,10 +1038,11 @@ public class PrenatalInspectorPreCardService extends BaseService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public Map getExamStatus(String patient,String pregnancyNo,Date begin,Date end) throws Exception {
|
|
|
Map<String,String> respose = new HashMap();
|
|
|
Map<String,Object> respose = new HashMap();
|
|
|
respose.put("status","0");
|
|
|
try {
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
PrenatalInspectorPlan plan = prenatalInspectorPlanDao.findByPatientBeforeList(patient);
|
|
|
JSONArray natals = reExamRecode(patient,pregnancyNo);
|
|
|
for (Object natal : natals) {
|
|
|
JSONObject examRecord = JSON.parseObject(natal.toString());
|
|
@ -1041,8 +1051,17 @@ public class PrenatalInspectorPreCardService extends BaseService {
|
|
|
if ((examTime.getTime()<= end.getTime()) && (examTime.getTime() >= begin.getTime())){
|
|
|
respose.put("status","1");
|
|
|
respose.put("examTime",exam_time);
|
|
|
return respose;
|
|
|
}
|
|
|
if ((plan != null) && (StringUtils.isNotEmpty(plan.getInspectionCode()))){
|
|
|
Date planTime = plan.getInspectionTime();
|
|
|
Date beginTime = DateUtil.getPreDays(planTime,-14);
|
|
|
Date endTime = DateUtil.getPreDays(planTime,14);
|
|
|
respose.put("plan",plan);
|
|
|
if ((examTime.getTime()<= beginTime.getTime()) && (examTime.getTime() >= endTime.getTime())){
|
|
|
respose.remove("plan");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|