Commit 1b0622917bcf6eda8e64ee6ef0f3c911509371ec
1 parent
4f0e2d1ce8
Exists in
dev
产妇建档
Showing 8 changed files with 173 additions and 3 deletions
- platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/AppointmentMapper.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/AppointmentService.java
- platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/AppointmentServiceImpl.java
- platform-biz-service/src/main/resources/mainOrm/master/AppointmentMapper.xml
- platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
- platform-dal/src/main/java/com/lyms/platform/pojo/PersonModel.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MedicalRecordController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MedicalRecordFacade.java
platform-biz-service/src/main/java/com/lyms/platform/permission/dao/master/AppointmentMapper.java
View file @
1b06229
platform-biz-service/src/main/java/com/lyms/platform/permission/service/AppointmentService.java
View file @
1b06229
platform-biz-service/src/main/java/com/lyms/platform/permission/service/impl/AppointmentServiceImpl.java
View file @
1b06229
platform-biz-service/src/main/resources/mainOrm/master/AppointmentMapper.xml
View file @
1b06229
| ... | ... | @@ -272,5 +272,79 @@ |
| 272 | 272 | <include refid="orderAndLimit"/> |
| 273 | 273 | |
| 274 | 274 | </select> |
| 275 | + | |
| 276 | + <update id="updateMedicalRecord" parameterType="com.lyms.platform.permission.model.MedicalRecordVo"> | |
| 277 | + UPDATE medical_record | |
| 278 | + <set> | |
| 279 | + <!-- 基本信息更新字段 --> | |
| 280 | + <if test="pid != null and pid != ''"> | |
| 281 | + PID = #{pid}, | |
| 282 | + </if> | |
| 283 | + <if test="name != null and name != ''"> | |
| 284 | + NAME = #{name}, | |
| 285 | + </if> | |
| 286 | + <if test="age != null"> | |
| 287 | + AGE = #{age}, | |
| 288 | + </if> | |
| 289 | + <if test="phone != null and phone != ''"> | |
| 290 | + PHONE = #{phone}, | |
| 291 | + </if> | |
| 292 | + <if test="gender != null and gender != ''"> | |
| 293 | + GENDER = #{gender}, | |
| 294 | + </if> | |
| 295 | + | |
| 296 | + <!-- 医疗信息更新字段 --> | |
| 297 | + <if test="zyType != null and zyType != ''"> | |
| 298 | + ZY_TYPE = #{zyType}, | |
| 299 | + </if> | |
| 300 | + <if test="medType != null and medType != ''"> | |
| 301 | + MED_TYPE = #{medType}, | |
| 302 | + </if> | |
| 303 | + <if test="department != null and department != ''"> | |
| 304 | + DEPARTMENT = #{department}, | |
| 305 | + </if> | |
| 306 | + <if test="diagnosis != null and diagnosis != ''"> | |
| 307 | + DIAGNOSIS = #{diagnosis}, | |
| 308 | + </if> | |
| 309 | + <if test="diagnosisCode != null and diagnosisCode != ''"> | |
| 310 | + DIAGNOSIS_CODE = #{diagnosisCode}, | |
| 311 | + </if> | |
| 312 | + <if test="operation != null and operation != ''"> | |
| 313 | + OPERATION = #{operation}, | |
| 314 | + </if> | |
| 315 | + <if test="operationCode != null and operationCode != ''"> | |
| 316 | + OPERATION_CODE = #{operationCode}, | |
| 317 | + </if> | |
| 318 | + <if test="medicine != null and medicine != ''"> | |
| 319 | + MEDICINE = #{medicine}, | |
| 320 | + </if> | |
| 321 | + | |
| 322 | + <!-- 分娩与产后信息更新字段 --> | |
| 323 | + <if test="deliveryType != null and deliveryType != ''"> | |
| 324 | + DELIVERY_TYPE = #{deliveryType}, | |
| 325 | + </if> | |
| 326 | + <if test="deliveryTime != null"> | |
| 327 | + DELIVERY_TIME = #{deliveryTime}, | |
| 328 | + </if> | |
| 329 | + <if test="babyWeight != null"> | |
| 330 | + BABY_WEIGHT = #{babyWeight}, | |
| 331 | + </if> | |
| 332 | + <if test="babyHeight != null"> | |
| 333 | + BABY_HEIGHT = #{babyHeight}, | |
| 334 | + </if> | |
| 335 | + <if test="babyGender != null and babyGender != ''"> | |
| 336 | + BABY_GENDER = #{babyGender}, | |
| 337 | + </if> | |
| 338 | + <if test="matnHistory != null and matnHistory != ''"> | |
| 339 | + MATN_HISTORY = #{matnHistory}, | |
| 340 | + </if> | |
| 341 | + | |
| 342 | + <!-- 时间戳更新 --> | |
| 343 | + <if test="modified != null"> | |
| 344 | + MODIFIED = #{modified} | |
| 345 | + </if> | |
| 346 | + </set> | |
| 347 | + WHERE CARD_NO = #{cardNo} | |
| 348 | + </update> | |
| 275 | 349 | </mapper> |
platform-dal/src/main/java/com/lyms/platform/pojo/Patients.java
View file @
1b06229
platform-dal/src/main/java/com/lyms/platform/pojo/PersonModel.java
View file @
1b06229
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/MedicalRecordController.java
View file @
1b06229
| 1 | 1 | package com.lyms.platform.operate.web.controller; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.lyms.platform.common.annotation.TokenRequired; | |
| 4 | 5 | import com.lyms.platform.common.base.BaseController; |
| 6 | +import com.lyms.platform.common.base.LoginContext; | |
| 5 | 7 | import com.lyms.platform.common.result.BaseResponse; |
| 6 | 8 | import com.lyms.platform.operate.web.facade.MedicalRecordFacade; |
| 7 | 9 | import com.lyms.platform.permission.model.MedicalRecordVo; |
| 8 | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 11 | import org.springframework.stereotype.Controller; |
| 12 | +import org.springframework.web.bind.annotation.RequestBody; | |
| 10 | 13 | import org.springframework.web.bind.annotation.RequestMapping; |
| 11 | 14 | import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 15 | import org.springframework.web.bind.annotation.ResponseBody; |
| 13 | 16 | |
| 17 | +import javax.servlet.http.HttpServletRequest; | |
| 14 | 18 | import javax.validation.Valid; |
| 15 | 19 | |
| 16 | 20 | |
| 17 | 21 | /* |
| 18 | 22 | * 产妇建党 |
| 19 | 23 | */ |
| 20 | -@Controller("/medicalRecord") | |
| 24 | +@Controller | |
| 25 | +@RequestMapping("/medicalRecord") | |
| 21 | 26 | public class MedicalRecordController extends BaseController { |
| 22 | 27 | |
| 23 | 28 | @Autowired |
| ... | ... | @@ -43,6 +48,20 @@ |
| 43 | 48 | @ResponseBody |
| 44 | 49 | public BaseResponse queryRecordOne(@Valid MedicalRecordVo medicalRecordVo) { |
| 45 | 50 | return medicalRecordFacade.queryRecordOne(medicalRecordVo); |
| 51 | + } | |
| 52 | + | |
| 53 | + | |
| 54 | + /** | |
| 55 | + * 病案单人信息查询 | |
| 56 | + * | |
| 57 | + * @return | |
| 58 | + */ | |
| 59 | + @RequestMapping(method = RequestMethod.POST, value = "/saveRecordOne") | |
| 60 | + @ResponseBody | |
| 61 | + @TokenRequired | |
| 62 | + public BaseResponse saveRecordOne(@Valid @RequestBody MedicalRecordVo medicalRecordVo , HttpServletRequest request) { | |
| 63 | + LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); | |
| 64 | + return medicalRecordFacade.saveRecordOne(medicalRecordVo,loginState.getId()); | |
| 46 | 65 | } |
| 47 | 66 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/MedicalRecordFacade.java
View file @
1b06229
| 1 | 1 | package com.lyms.platform.operate.web.facade; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.biz.service.PatientsService; | |
| 4 | +import com.lyms.platform.biz.service.PersonService; | |
| 3 | 5 | import com.lyms.platform.common.base.PageInfo; |
| 4 | 6 | import com.lyms.platform.common.constants.ErrorCodeConstants; |
| 5 | 7 | import com.lyms.platform.common.result.BaseListResponse; |
| 6 | 8 | import com.lyms.platform.common.result.BaseObjectResponse; |
| 7 | 9 | import com.lyms.platform.common.result.BaseResponse; |
| 10 | +import com.lyms.platform.common.utils.DateUtil; | |
| 8 | 11 | import com.lyms.platform.permission.model.MedicalRecordVo; |
| 9 | 12 | import com.lyms.platform.permission.service.AppointmentService; |
| 13 | +import com.lyms.platform.pojo.Patients; | |
| 14 | +import com.lyms.platform.pojo.PersonModel; | |
| 15 | +import com.lyms.platform.query.PatientsQuery; | |
| 10 | 16 | import org.apache.commons.collections.CollectionUtils; |
| 11 | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | 18 | import org.springframework.stereotype.Component; |
| 13 | 19 | |
| 20 | +import java.util.Date; | |
| 14 | 21 | import java.util.List; |
| 15 | 22 | |
| 16 | 23 | /** |
| ... | ... | @@ -21,6 +28,10 @@ |
| 21 | 28 | |
| 22 | 29 | @Autowired |
| 23 | 30 | private AppointmentService appointmentService; |
| 31 | + @Autowired | |
| 32 | + private PatientsService patientsService; | |
| 33 | + @Autowired | |
| 34 | + private PersonService personService; | |
| 24 | 35 | public BaseResponse queryRecord(MedicalRecordVo queryVo) { |
| 25 | 36 | MedicalRecordVo medicalRecordVo = new MedicalRecordVo(); |
| 26 | 37 | medicalRecordVo.setNeed("true"); |
| ... | ... | @@ -51,6 +62,62 @@ |
| 51 | 62 | return new BaseListResponse().setData(medicalRecordVoList).setErrorcode(ErrorCodeConstants.SUCCESS).setErrormsg("未查询到有效数据"); |
| 52 | 63 | } |
| 53 | 64 | return new BaseObjectResponse().setData(medicalRecordVoList.get(0)).setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); |
| 65 | + } | |
| 66 | + | |
| 67 | + | |
| 68 | + public BaseResponse saveRecordOne(MedicalRecordVo medicalRecordVo,Integer userId) { | |
| 69 | + // 查建档 | |
| 70 | + PatientsQuery patientsQuery = new PatientsQuery(); | |
| 71 | + patientsQuery.setCardNo(medicalRecordVo.getCardNo()); | |
| 72 | + patientsQuery.setPhone(medicalRecordVo.getPhone()); | |
| 73 | + patientsQuery.setYn(1); | |
| 74 | + patientsQuery.setType(3); | |
| 75 | + patientsQuery.setDesc("true"); | |
| 76 | + patientsQuery.setSort("created"); | |
| 77 | + List<Patients> patientsList = patientsService.queryPatient(patientsQuery); | |
| 78 | + if(CollectionUtils.isNotEmpty(patientsList)){ | |
| 79 | + return new BaseResponse().setErrormsg("该手机号已经存在产妇档案,请核实").setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 80 | + } | |
| 81 | + | |
| 82 | + // 写个人信息 | |
| 83 | + PersonModel pmodel = new PersonModel(); | |
| 84 | + pmodel.setName(medicalRecordVo.getName()); | |
| 85 | + pmodel.setPhone(medicalRecordVo.getPhone()); | |
| 86 | + pmodel.setCardNo(medicalRecordVo.getCardNo()); | |
| 87 | + pmodel.setType(3); | |
| 88 | + pmodel.setModified(new Date()); | |
| 89 | + pmodel.setYn(1); | |
| 90 | + pmodel.setCreated(new Date()); | |
| 91 | + PersonModel personModel = personService.addPerson(pmodel); | |
| 92 | + | |
| 93 | + // 写建档 | |
| 94 | + Patients patient=new Patients(); | |
| 95 | + patient.setHospitalId("2100002419"); | |
| 96 | + patient.setFmHospital("2100002419"); | |
| 97 | + patient.setFmDate(DateUtil.parseYMD(medicalRecordVo.getDeliveryTime())); | |
| 98 | + patient.setCardNo(medicalRecordVo.getCardNo()); | |
| 99 | + patient.setYn(1); | |
| 100 | + patient.setType(3); | |
| 101 | + patient.setBuildType(4); | |
| 102 | + patient.setBookbuildingDate(new Date()); | |
| 103 | + patient.setUsername(medicalRecordVo.getName()); | |
| 104 | + patient.setPhone(medicalRecordVo.getPhone()); | |
| 105 | + if (personModel != null) { | |
| 106 | + patient.setPid(personModel.getId()); | |
| 107 | + } | |
| 108 | + patient.setOperator(userId); | |
| 109 | + patient.setBirth(DateUtil.parseYMD(DateUtil.getBirthFromIdCard(medicalRecordVo.getCardNo()))); | |
| 110 | + patient.setCreated(new Date()); | |
| 111 | + patient.setModified(new Date()); | |
| 112 | + patientsService.addPatient(patient); | |
| 113 | + | |
| 114 | + // 更新诊断 | |
| 115 | + MedicalRecordVo insertVo = new MedicalRecordVo(); | |
| 116 | + insertVo.setModified(DateUtil.getYyyyMmDd(new Date())); | |
| 117 | + insertVo.setCardNo(medicalRecordVo.getCardNo()); | |
| 118 | + insertVo.setDiagnosis(medicalRecordVo.getDiagnosis()); | |
| 119 | + appointmentService.updateMedicalRecord(medicalRecordVo); | |
| 120 | + return new BaseResponse().setErrormsg("成功").setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 54 | 121 | } |
| 55 | 122 | } |