|
@ -13,6 +13,7 @@ import com.yihu.jw.rm.specialist.SpecialistMapping;
|
|
|
import com.yihu.jw.service.rehabilitation.RehabilitationPlanService;
|
|
|
import com.yihu.jw.util.DataUtils;
|
|
|
import com.yihu.jw.util.ImUtill;
|
|
|
import com.yihu.jw.util.date.DateUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
@ -24,6 +25,7 @@ import org.springframework.cloud.sleuth.Tracer;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@ -364,4 +366,55 @@ public class RehabilitationPlanController extends EnvelopRestEndpoint {
|
|
|
return Envelop.getError(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@PostMapping(value = SpecialistMapping.rehabilitation.updateRehabilitationPlan)
|
|
|
@ApiOperation(value = "居民康复下转套餐编辑")
|
|
|
public MixEnvelop updateRehabilitationPlan(@ApiParam(name = "rehabilitationPlan", value = "实体JSON")
|
|
|
@RequestParam(value = "rehabilitationPlan", required = true)String rehabilitationPlan){
|
|
|
try {
|
|
|
JSONObject json = new JSONObject(rehabilitationPlan);
|
|
|
String planId = json.getString("planId");
|
|
|
String hospitalServiceItemId = json.getString("hospitalServiceItemId");
|
|
|
//删除该服务项目今日之后的计划
|
|
|
rehabilitationPlanService.deleteDetailByPlanIdAndHospitalServiceItemId(planId, hospitalServiceItemId, DateUtil.getDateShort(new Date()));
|
|
|
JSONArray array = new JSONArray();
|
|
|
for(Object planDetail : json.getJSONArray("detail")) {
|
|
|
JSONObject j = (JSONObject)planDetail;
|
|
|
if(j.has("executeTime")) {
|
|
|
String executeTime = j.get("executeTime").toString();
|
|
|
String[] result = null;
|
|
|
if (executeTime.contains(",")) {
|
|
|
result = executeTime.split(",");
|
|
|
} else {
|
|
|
result = new String[1];
|
|
|
result[0] = executeTime;
|
|
|
}
|
|
|
int len = result.length;
|
|
|
while (len > 0) {
|
|
|
len--;
|
|
|
JSONObject temp = new JSONObject(j.toString());
|
|
|
temp.put("executeTime", result[len]);
|
|
|
temp.put("createUser", json.get("createUser"));
|
|
|
temp.put("createUserName", json.get("createUserName"));
|
|
|
array.put(temp);
|
|
|
}
|
|
|
}else {
|
|
|
j.put("createUser", json.get("createUser"));
|
|
|
j.put("createUserName", json.get("createUserName"));
|
|
|
array.put(j);
|
|
|
}
|
|
|
}
|
|
|
String planDetails = array.toString();
|
|
|
ObjectMapper object = new ObjectMapper();
|
|
|
object.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm"));
|
|
|
List<RehabilitationDetailDO> details = object.readValue(planDetails, new TypeReference<List<RehabilitationDetailDO>>(){});
|
|
|
details = rehabilitationPlanService.createRehabilitationDetail(details, planId);
|
|
|
//调用服务包接口
|
|
|
return MixEnvelop.getSuccessList(SpecialistMapping.api_success, details);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
tracer.getCurrentSpan().logEvent(e.getMessage());
|
|
|
return MixEnvelop.getError(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
}
|