Commit 8865a1b0f1a99cec4f1b1c084d56791f11ebf8dc
1 parent
25ac226990
Exists in
master
产程完成
Showing 1 changed file with 53 additions and 2 deletions
parent/hospital.mac/src/main/java/com/lyms/hospital/service/woman/impl/WomanFetationRecordServiceImpl.java
View file @
8865a1b
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import org.springframework.transaction.annotation.Transactional; |
| 12 | 12 | import org.springframework.util.StringUtils; |
| 13 | 13 | |
| 14 | +import com.alibaba.fastjson.JSONObject; | |
| 14 | 15 | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| 15 | 16 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| 16 | 17 | import com.lyms.exception.SystemException; |
| 17 | 18 | |
| 18 | 19 | |
| 19 | 20 | |
| 20 | 21 | |
| 21 | 22 | |
| 22 | 23 | |
| ... | ... | @@ -191,24 +192,74 @@ |
| 191 | 192 | @Override |
| 192 | 193 | public List<List<FetationStages>> getFetationStages(Serializable personId) { |
| 193 | 194 | List<FetationStages> dataList = fetationMapper.getFetationStages(personId); |
| 194 | - //产程列表 | |
| 195 | + //产程列表 | |
| 195 | 196 | List<List<FetationStages>> ccList = InstanceUtils.newArrayList(); |
| 196 | 197 | List<FetationStages> oneStages = InstanceUtils.newArrayList();//初始化第一个产程列表 |
| 197 | 198 | Integer agoType = 0;//记录上一次阶段的type类型,用于是否新产程的判断 |
| 198 | 199 | for(FetationStages entity : dataList){ |
| 199 | 200 | if(agoType > 3){//代表是复诊以后的阶段 |
| 200 | 201 | if(entity.getType() == 1){//agoType > 3 && entity.getType() == 1 代表一个新的产程 |
| 202 | + oneStages.add(entity); | |
| 201 | 203 | ccList.add(oneStages); |
| 202 | 204 | oneStages = InstanceUtils.newArrayList();//新的一个产程 |
| 203 | 205 | agoType = 1; |
| 204 | 206 | continue; |
| 207 | + }else{ | |
| 208 | + agoType = entity.getType(); | |
| 209 | + oneStages.add(entity); | |
| 205 | 210 | } |
| 211 | + }else{ | |
| 206 | 212 | agoType = entity.getType(); |
| 207 | 213 | oneStages.add(entity); |
| 208 | 214 | } |
| 209 | - oneStages.add(entity); | |
| 210 | 215 | } |
| 216 | + ccList.add(oneStages); | |
| 211 | 217 | return ccList; |
| 218 | + } | |
| 219 | + | |
| 220 | + | |
| 221 | + public static void main(String[] args) { | |
| 222 | + List<FetationStages> dataList = getTestData(); | |
| 223 | + System.out.println(JSONObject.toJSONString(dataList)); | |
| 224 | + //产程列表 | |
| 225 | + List<List<FetationStages>> ccList = InstanceUtils.newArrayList(); | |
| 226 | + List<FetationStages> oneStages = InstanceUtils.newArrayList();//初始化第一个产程列表 | |
| 227 | + Integer agoType = 0;//记录上一次阶段的type类型,用于是否新产程的判断 | |
| 228 | + for(FetationStages entity : dataList){ | |
| 229 | + if(agoType > 3){//代表是复诊以后的阶段 | |
| 230 | + if(entity.getType() == 1){//agoType > 3 && entity.getType() == 1 代表一个新的产程 | |
| 231 | + oneStages.add(entity); | |
| 232 | + ccList.add(oneStages); | |
| 233 | + oneStages = InstanceUtils.newArrayList();//新的一个产程 | |
| 234 | + agoType = 1; | |
| 235 | + continue; | |
| 236 | + }else{ | |
| 237 | + agoType = entity.getType(); | |
| 238 | + oneStages.add(entity); | |
| 239 | + } | |
| 240 | + }else{ | |
| 241 | + agoType = entity.getType(); | |
| 242 | + oneStages.add(entity); | |
| 243 | + } | |
| 244 | + } | |
| 245 | + ccList.add(oneStages); | |
| 246 | + System.out.println(JSONObject.toJSONString(ccList)); | |
| 247 | + } | |
| 248 | + | |
| 249 | + public static List<FetationStages> getTestData(){ | |
| 250 | + List<FetationStages> dataList = InstanceUtils.newArrayList(); | |
| 251 | + | |
| 252 | + for(int i=1;i<8;i++){ | |
| 253 | + FetationStages entity = new FetationStages(); | |
| 254 | + entity.setType(i); | |
| 255 | + dataList.add(entity); | |
| 256 | + } | |
| 257 | + for(int i=1;i<6;i++){ | |
| 258 | + FetationStages entity = new FetationStages(); | |
| 259 | + entity.setType(i); | |
| 260 | + dataList.add(entity); | |
| 261 | + } | |
| 262 | + return dataList; | |
| 212 | 263 | } |
| 213 | 264 | } |