Browse Source

分诊页面添加性别年龄

lighter 1 year ago
parent
commit
029316bf33

+ 17 - 13
src/main/java/thyyxxk/webserver/dao/his/outpatient/triage/TriageDao.java

@@ -27,17 +27,19 @@ public interface TriageDao {
 
     // 获取未分诊的病人
     @Select("<script>" +
-            "select visit_date,rtrim(patient_id) as patientId, times,rtrim(name) as name, " +
-            "dept_code, dept_name=(select name from zd_unit_code where code=dept_code), " +
-            "room_code,room_name=(select room_name from mzfz_zd_dept_room where room_code=a.room_code), " +
-            "room_status=(select status_flag from mzfz_zd_dept_room where room_code=a.room_code), " +
-            "doctor_code,doctor_name=(select name from a_employee_mi where code=doctor_code), " +
-            "serial_no, gh_no, req_type,reqName=(select rtrim(name) from mzy_zd_charge_type where code=a.req_type), " +
-            "fz_no, slow_flag, status_flag, status_time,call_time, req_order, ampm, " +
-            "req_fee=(select req_fee from mzy_reqrec where patient_id=a.patient_id and times=a.times)," +
-            "clinic_fee=(select clinic_fee from mzy_reqrec where patient_id=a.patient_id and times=a.times) " +
-            "from mzfz_patient_order a where datediff(day, visit_date, getdate())=0 and isnull(status_flag,'') in ('','0') " +
-            "and dept_code in " +
+            "select visit_date,rtrim(patient_id) as patientId,times,rtrim(name) as name, " +
+            "fz_no,slow_flag,status_flag,status_time,call_time,req_order,ampm,dept_code, " +
+            "rtrim(room_code) as roomCode,doctor_code,serial_no, gh_no, req_type, " +
+            "deptName=(select d.name from zd_unit_code d where d.code=a.dept_code), " +
+            "roomName=(select d.room_name from mzfz_zd_dept_room d where d.room_code=a.room_code), " +
+            "roomStatus=(select d.status_flag from mzfz_zd_dept_room d where d.room_code=a.room_code), " +
+            "doctorName=(select rtrim(d.name) from a_employee_mi d where d.code=a.doctor_code), " +
+            "reqName=(select rtrim(d.name) from mzy_zd_charge_type d where d.code=a.req_type), " +
+            "reqFee=(select d.req_fee from mzy_reqrec d where d.patient_id=a.patient_id and d.times=a.times), " +
+            "clinicFee=(select d.clinic_fee from mzy_reqrec d where d.patient_id=a.patient_id and d.times=a.times), " +
+            "socialNo=(select rtrim(d.social_no) from mz_patient_mi d where d.patient_id=a.patient_id) " +
+            "from mzfz_patient_order a where datediff(day, visit_date, getdate())=0 " +
+            "and isnull(status_flag,'') in ('','0') and dept_code in " +
             "<foreach collection='deptCodes' item='deptCode' open='(' separator=',' close=')'>" +
             "#{deptCode}" +
             "</foreach>" +
@@ -53,7 +55,8 @@ public interface TriageDao {
             "room_status=(select status_flag from mzfz_zd_dept_room where room_code=a.room_code), " +
             "doctor_code,doctor_name=(select name from a_employee_mi where code=doctor_code), " +
             "serial_no, gh_no, req_type,reqName=(select rtrim(name) from mzy_zd_charge_type where code=a.req_type), " +
-            "fz_no, slow_flag, status_flag, status_time,call_time, req_order, ampm " +
+            "fz_no, slow_flag, status_flag, status_time,call_time, req_order, ampm, " +
+            "socialNo=(select rtrim(d.social_no) from mz_patient_mi d where d.patient_id=a.patient_id) " +
             "from mzfz_patient_order a where datediff(day, visit_date, getdate())=0 and status_flag='1' " +
             "and dept_code in " +
             "<foreach collection='deptCodes' item='deptCode' open='(' separator=',' close=')'>" +
@@ -70,7 +73,8 @@ public interface TriageDao {
             "room_status=(select status_flag from mzfz_zd_dept_room where room_code=a.room_code), " +
             "doctor_code,doctor_name=(select name from a_employee_mi where code=doctor_code), " +
             "serial_no, gh_no, req_type,reqName=(select rtrim(name) from mzy_zd_charge_type where code=a.req_type), " +
-            "fz_no, slow_flag, status_flag, status_time,call_time, req_order, ampm " +
+            "fz_no, slow_flag, status_flag, status_time,call_time, req_order, ampm, " +
+            "socialNo=(select rtrim(d.social_no) from mz_patient_mi d where d.patient_id=a.patient_id) " +
             "from mzfz_patient_order a where datediff(day, visit_date, getdate())=0 and status_flag='9' " +
             "and dept_code in " +
             "<foreach collection='deptCodes' item='deptCode' open='(' separator=',' close=')'>" +

+ 5 - 0
src/main/java/thyyxxk/webserver/entity/outpatient/triage/MzfzPatientOrder.java

@@ -14,6 +14,11 @@ public class MzfzPatientOrder  implements Serializable {
 	 */
 	private String patientId;
 
+	private String socialNo;
+
+	private String gender;
+	private String age;
+
 	/**
 	 * 就诊次数
 	 */

+ 29 - 7
src/main/java/thyyxxk/webserver/service/outpatient/triage/TriageService.java

@@ -18,10 +18,7 @@ import thyyxxk.webserver.entity.socketmessage.ApiMessageBody;
 import thyyxxk.webserver.entity.socketmessage.SendUserList;
 import thyyxxk.webserver.service.externalhttp.WebSocketService;
 import thyyxxk.webserver.service.outpatient.wxapi.SendWxInfoService;
-import thyyxxk.webserver.utils.DateUtil;
-import thyyxxk.webserver.utils.ResultVoUtil;
-import thyyxxk.webserver.utils.StringUtil;
-import thyyxxk.webserver.utils.TokenUtil;
+import thyyxxk.webserver.utils.*;
 
 import java.util.*;
 
@@ -51,11 +48,32 @@ public class TriageService {
         Map<String, Object> map = new HashMap<>(Capacity.TWO);
         IPage<MzfzPatientOrder> iPage = new Page<>(currentPage, pageSize);
         iPage = dao.getUnTriagedPatients(iPage, depts);
+
+        List<MzfzPatientOrder> list = iPage.getRecords();
+        fillGenderAndAge(list);
         map.put("totalSize", iPage.getTotal());
-        map.put("list", iPage.getRecords());
+        map.put("list", list);
         return ResultVoUtil.success(map);
     }
 
+    private void fillGenderAndAge(List<MzfzPatientOrder> list) {
+        for (MzfzPatientOrder item : list) {
+            if (IdCardUtil.isValidatedIdCard(item.getSocialNo())) {
+                String gender = IdCardUtil.getGenderByIdCard(item.getSocialNo());
+                item.setGender(gender.equals("MALE") ? "男" : "女");
+                Integer age = IdCardUtil.getAgeByIdCard(item.getSocialNo());
+                if (null == age) {
+                    item.setAge("未知");
+                } else {
+                    item.setAge(age + "岁");
+                }
+            } else {
+                item.setGender("未知");
+                item.setAge("未知");
+            }
+        }
+    }
+
     public ResultVo<List<String>> getPatientIdByIdNo(String idNo) {
         List<String> ids = dao.selectPatientIdByIdNo(idNo);
         if (ids.isEmpty()) {
@@ -69,7 +87,9 @@ public class TriageService {
         if (depts.length == 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请先前往【科室设置】分配分诊科室!");
         }
-        return ResultVoUtil.success(dao.getTriagedPatients(depts));
+        List<MzfzPatientOrder> list = dao.getTriagedPatients(depts);
+        fillGenderAndAge(list);
+        return ResultVoUtil.success(list);
     }
 
     public ResultVo<List<MzfzPatientOrder>> getTreatedPatients() {
@@ -77,7 +97,9 @@ public class TriageService {
         if (depts.length == 0) {
             return ResultVoUtil.fail(ExceptionEnum.LOGICAL_ERROR, "请先前往【科室设置】分配分诊科室!");
         }
-        return ResultVoUtil.success(dao.getTreatedPatients(depts));
+        List<MzfzPatientOrder> list = dao.getTreatedPatients(depts);
+        fillGenderAndAge(list);
+        return ResultVoUtil.success(list);
     }
 
     public ResultVo<List<FloorScreen>> getBigScreenData(Boolean fullName) {

+ 8 - 0
src/main/java/thyyxxk/webserver/utils/IdCardUtil.java

@@ -238,6 +238,14 @@ public class IdCardUtil {
         return a;
     }
 
+    public static String getGenderByIdCard(String idCard) {
+        if (idCard.length() < 18) {
+            return "UNKNOWN";
+        }
+        int identifyCode = idCard.charAt(16);
+        return identifyCode % 2 == 0 ? "FEMALE" : "MALE";
+    }
+
     public static Integer getAgeByIdCard(String idCard) {
         if (idCard.length() < 18) {
             return null;