|
@@ -162,6 +162,12 @@ func PatientApiRegistRouters() {
|
162
|
162
|
|
163
|
163
|
beego.Router("/api/patient/getpatientlapeso", &DialysisApiController{}, "Get:GetPatientLapseList")
|
164
|
164
|
|
|
165
|
+ beego.Router("/api/patient/adddeathsummary", &DialysisApiController{}, "Post:AddDeathSummary")
|
|
166
|
+
|
|
167
|
+ beego.Router("/api/patient/getpatientdeathsummary", &DialysisApiController{}, "Get:GetPatientDeathSummary")
|
|
168
|
+
|
|
169
|
+ beego.Router("/api/patient/deletepatientdeathsummary", &DialysisApiController{}, "Get:DeletePatientDeathSummary")
|
|
170
|
+
|
165
|
171
|
}
|
166
|
172
|
func (c *PatientApiController) GetExportList() {
|
167
|
173
|
startTime := c.GetString("start_time")
|
|
@@ -7626,6 +7632,8 @@ func (c *PatientApiController) SavePatientLapse() {
|
7626
|
7632
|
|
7627
|
7633
|
end_time_one := dataBody["end_time_one"].(string)
|
7628
|
7634
|
|
|
7635
|
+ is_check := int64(dataBody["is_check"].(float64))
|
|
7636
|
+
|
7629
|
7637
|
timeLayout := "2006-01-02"
|
7630
|
7638
|
loc, _ := time.LoadLocation("Local")
|
7631
|
7639
|
var recordDate int64
|
|
@@ -7711,9 +7719,11 @@ func (c *PatientApiController) SavePatientLapse() {
|
7711
|
7719
|
|
7712
|
7720
|
service.UpdatePatientLapsetoByPatientId(patient_id, recordDate, lapse_reason)
|
7713
|
7721
|
|
7714
|
|
- service.UpdateScheduleByDeathTime(patient_id, recordDate)
|
|
7722
|
+ if is_check == 2 {
|
|
7723
|
+ service.UpdateScheduleByDeathTime(patient_id, recordDate)
|
|
7724
|
+ service.UpdateScheduleItemByPatientId(patient_id)
|
|
7725
|
+ }
|
7715
|
7726
|
|
7716
|
|
- service.UpdateScheduleItemByPatientId(patient_id)
|
7717
|
7727
|
}
|
7718
|
7728
|
|
7719
|
7729
|
//病人转出
|
|
@@ -7721,9 +7731,11 @@ func (c *PatientApiController) SavePatientLapse() {
|
7721
|
7731
|
|
7722
|
7732
|
service.UpdatePatientLapsetoByPatientIdOne(patient_id, recordDate, lapse_reason)
|
7723
|
7733
|
|
7724
|
|
- service.UpdateScheduleByDeathTime(patient_id, recordDate)
|
|
7734
|
+ if is_check == 2 {
|
|
7735
|
+ service.UpdateScheduleByDeathTime(patient_id, recordDate)
|
|
7736
|
+ service.UpdateScheduleItemByPatientId(patient_id)
|
|
7737
|
+ }
|
7725
|
7738
|
|
7726
|
|
- service.UpdateScheduleItemByPatientId(patient_id)
|
7727
|
7739
|
}
|
7728
|
7740
|
|
7729
|
7741
|
if lapse_type == 11 {
|
|
@@ -8024,3 +8036,114 @@ func (c *DialysisApiController) GetPatientLapseList() {
|
8024
|
8036
|
//
|
8025
|
8037
|
//}
|
8026
|
8038
|
}
|
|
8039
|
+
|
|
8040
|
+func (c *DialysisApiController) AddDeathSummary() {
|
|
8041
|
+
|
|
8042
|
+ dataBody := make(map[string]interface{}, 0)
|
|
8043
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &dataBody)
|
|
8044
|
+ fmt.Println(err)
|
|
8045
|
+
|
|
8046
|
+ id := int64(dataBody["id"].(float64))
|
|
8047
|
+
|
|
8048
|
+ patient_id := int64(dataBody["patient_id"].(float64))
|
|
8049
|
+
|
|
8050
|
+ record_date := dataBody["record_date"].(string)
|
|
8051
|
+
|
|
8052
|
+ last_record_date := dataBody["last_record_date"].(string)
|
|
8053
|
+
|
|
8054
|
+ reason_one := dataBody["reason_one"].(string)
|
|
8055
|
+
|
|
8056
|
+ reason_two := dataBody["reason_two"].(string)
|
|
8057
|
+
|
|
8058
|
+ reason_three := dataBody["reason_three"].(string)
|
|
8059
|
+
|
|
8060
|
+ reason_four := dataBody["reason_four"].(string)
|
|
8061
|
+
|
|
8062
|
+ death_way := dataBody["death_way"].(string)
|
|
8063
|
+
|
|
8064
|
+ replace_way := dataBody["replace_way"].(string)
|
|
8065
|
+
|
|
8066
|
+ replace_reason := dataBody["replace_reason"].(string)
|
|
8067
|
+
|
|
8068
|
+ transplant := dataBody["transplant"].(string)
|
|
8069
|
+
|
|
8070
|
+ remark := dataBody["remark"].(string)
|
|
8071
|
+
|
|
8072
|
+ timeLayout := "2006-01-02"
|
|
8073
|
+ loc, _ := time.LoadLocation("Local")
|
|
8074
|
+ var recordDate int64
|
|
8075
|
+ if len(record_date) > 0 {
|
|
8076
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
8077
|
+ if err != nil {
|
|
8078
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
8079
|
+ return
|
|
8080
|
+ }
|
|
8081
|
+ recordDate = theTime.Unix()
|
|
8082
|
+ }
|
|
8083
|
+
|
|
8084
|
+ var lastRecordDate int64
|
|
8085
|
+ if len(record_date) > 0 {
|
|
8086
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", last_record_date+" 00:00:00", loc)
|
|
8087
|
+ if err != nil {
|
|
8088
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
8089
|
+ return
|
|
8090
|
+ }
|
|
8091
|
+ lastRecordDate = theTime.Unix()
|
|
8092
|
+ }
|
|
8093
|
+
|
|
8094
|
+ orgId := c.GetAdminUserInfo().CurrentOrgId
|
|
8095
|
+
|
|
8096
|
+ admin_user_id := c.GetAdminUserInfo().AdminUser.Id
|
|
8097
|
+
|
|
8098
|
+ deathSummary := models.XtDeathSummary{
|
|
8099
|
+ ID: id,
|
|
8100
|
+ PatientId: patient_id,
|
|
8101
|
+ UserOrgId: orgId,
|
|
8102
|
+ RecordDate: recordDate,
|
|
8103
|
+ ReasonOne: reason_one,
|
|
8104
|
+ ReasonTwo: reason_two,
|
|
8105
|
+ ReasonThree: reason_three,
|
|
8106
|
+ ReasonFour: reason_four,
|
|
8107
|
+ DeathWay: death_way,
|
|
8108
|
+ ReplaceWay: replace_way,
|
|
8109
|
+ ReplaceReason: replace_reason,
|
|
8110
|
+ Transplant: transplant,
|
|
8111
|
+ Ctime: time.Now().Unix(),
|
|
8112
|
+ Remark: remark,
|
|
8113
|
+ Mtime: time.Now().Unix(),
|
|
8114
|
+ Status: 1,
|
|
8115
|
+ AdminUserId: admin_user_id,
|
|
8116
|
+ UpdateCreater: admin_user_id,
|
|
8117
|
+ LastRecordDate: lastRecordDate,
|
|
8118
|
+ }
|
|
8119
|
+
|
|
8120
|
+ service.CreateDeathSummary(deathSummary)
|
|
8121
|
+
|
|
8122
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
8123
|
+ "deathSummary": deathSummary,
|
|
8124
|
+ })
|
|
8125
|
+}
|
|
8126
|
+
|
|
8127
|
+func (c *DialysisApiController) GetPatientDeathSummary() {
|
|
8128
|
+
|
|
8129
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
8130
|
+
|
|
8131
|
+ orgId := c.GetAdminUserInfo().CurrentOrgId
|
|
8132
|
+
|
|
8133
|
+ deathSummary, _ := service.GetPatientDeathSummary(patient_id, orgId)
|
|
8134
|
+
|
|
8135
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
8136
|
+ "deathSummary": deathSummary,
|
|
8137
|
+ })
|
|
8138
|
+}
|
|
8139
|
+
|
|
8140
|
+func (c *DialysisApiController) DeletePatientDeathSummary() {
|
|
8141
|
+
|
|
8142
|
+ id, _ := c.GetInt64("id")
|
|
8143
|
+
|
|
8144
|
+ service.DeletePatientDeathSummary(id)
|
|
8145
|
+
|
|
8146
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
8147
|
+ "msg": "删除成功",
|
|
8148
|
+ })
|
|
8149
|
+}
|