|
@@ -106,69 +106,79 @@ func HisManagerApiRegistRouters() {
|
106
|
106
|
|
107
|
107
|
beego.Router("/api/getfapiaonumber", &HisApiController{}, "get:GetFaPiaoNumber")
|
108
|
108
|
|
109
|
|
- //beego.Router("/api/associationprescription", &HisApiController{}, "get:AssociationHisPrescription")
|
110
|
|
- //beego.Router("/api/checkhispatient", &HisApiController{}, "get:CheckHisPatient")
|
|
109
|
+ beego.Router("/api/associationprescription", &HisApiController{}, "get:AssociationHisPrescription")
|
|
110
|
+ beego.Router("/api/checkhispatient", &HisApiController{}, "get:CheckHisPatient")
|
111
|
111
|
|
112
|
112
|
}
|
113
|
113
|
|
114
|
|
-//func (c *HisApiController) CheckHisPatient() {
|
115
|
|
-// record_date := c.GetString("record_date")
|
116
|
|
-// patient_id, _ := c.GetInt64("patient_id")
|
117
|
|
-//
|
118
|
|
-// timeLayout := "2006-01-02"
|
119
|
|
-// loc, _ := time.LoadLocation("Local")
|
120
|
|
-// theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
121
|
|
-// if err != nil {
|
122
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
123
|
|
-// return
|
124
|
|
-// }
|
125
|
|
-// recordDateTime := theTime.Unix()
|
126
|
|
-// adminInfo := c.GetAdminUserInfo()
|
127
|
|
-// patients, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient_id, recordDateTime)
|
128
|
|
-// if len(patients) > 1 {
|
129
|
|
-// ps, _ := service.GetHisPrescriptionByHisPatientID(recordDateTime, adminInfo.CurrentOrgId, patient_id)
|
130
|
|
-// if len(ps) > 0 {
|
131
|
|
-// c.ServeSuccessJSON(map[string]interface{}{
|
132
|
|
-// "status": 1,
|
133
|
|
-// "msg": "关联",
|
134
|
|
-// "ps": ps,
|
135
|
|
-// })
|
136
|
|
-// } else {
|
137
|
|
-// c.ServeSuccessJSON(map[string]interface{}{
|
138
|
|
-// "status": 0,
|
139
|
|
-// "msg": "无需关联",
|
140
|
|
-// })
|
141
|
|
-// }
|
142
|
|
-// } else {
|
143
|
|
-// c.ServeSuccessJSON(map[string]interface{}{
|
144
|
|
-// "status": 0,
|
145
|
|
-// "msg": "无需关联",
|
146
|
|
-// })
|
147
|
|
-// return
|
148
|
|
-// }
|
149
|
|
-//}
|
150
|
|
-//func (c *HisApiController) AssociationHisPrescription() {
|
151
|
|
-// record_date, _ := c.GetInt64("record_date")
|
152
|
|
-// his_patient_id, _ := c.GetInt64("his_patient_id")
|
153
|
|
-// patient_id, _ := c.GetInt64("patient_id")
|
154
|
|
-// p_ids := c.GetString("p_ids")
|
155
|
|
-// p_ids_arr := strings.Split(p_ids, ",")
|
156
|
|
-// his_patient, _ := service.GetHisPatientByIdThree(his_patient_id)
|
157
|
|
-// if his_patient_id == 0 || his_patient.ID == 0 {
|
158
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
159
|
|
-// return
|
160
|
|
-// }
|
161
|
|
-// err := service.UpdateHisPrescriptionHisIDByPID(his_patient_id, patient_id, record_date, c.GetAdminUserInfo().CurrentOrgId, p_ids_arr)
|
162
|
|
-// if err == nil {
|
163
|
|
-// c.ServeSuccessJSON(map[string]interface{}{
|
164
|
|
-// "msg": "关联处方成功",
|
165
|
|
-// })
|
166
|
|
-// return
|
167
|
|
-// } else {
|
168
|
|
-// c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
169
|
|
-// return
|
170
|
|
-// }
|
171
|
|
-//}
|
|
114
|
+func (c *HisApiController) CheckHisPatient() {
|
|
115
|
+ record_date := c.GetString("record_date")
|
|
116
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
117
|
+
|
|
118
|
+ timeLayout := "2006-01-02"
|
|
119
|
+ loc, _ := time.LoadLocation("Local")
|
|
120
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
121
|
+ if err != nil {
|
|
122
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
123
|
+ return
|
|
124
|
+ }
|
|
125
|
+ recordDateTime := theTime.Unix()
|
|
126
|
+ adminInfo := c.GetAdminUserInfo()
|
|
127
|
+ patients, _ := service.GetHisPatientInfoTwo(adminInfo.CurrentOrgId, patient_id, recordDateTime)
|
|
128
|
+ if len(patients) > 1 {
|
|
129
|
+ ps, _ := service.GetHisPrescriptionByHisPatientID(recordDateTime, adminInfo.CurrentOrgId, patient_id)
|
|
130
|
+ if len(ps) > 0 {
|
|
131
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
132
|
+ "status": 1,
|
|
133
|
+ "msg": "关联",
|
|
134
|
+ "ps": ps,
|
|
135
|
+ "his_patient_id": patients[len(patients)-1].ID,
|
|
136
|
+ "patient_id": patients[len(patients)-1].PatientId,
|
|
137
|
+ })
|
|
138
|
+ } else {
|
|
139
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
140
|
+ "status": 0,
|
|
141
|
+ "msg": "无需关联",
|
|
142
|
+ })
|
|
143
|
+ }
|
|
144
|
+ } else {
|
|
145
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
146
|
+ "status": 0,
|
|
147
|
+ "msg": "无需关联",
|
|
148
|
+ })
|
|
149
|
+ return
|
|
150
|
+ }
|
|
151
|
+}
|
|
152
|
+func (c *HisApiController) AssociationHisPrescription() {
|
|
153
|
+ record_date := c.GetString("record_date")
|
|
154
|
+ his_patient_id, _ := c.GetInt64("his_patient_id")
|
|
155
|
+ patient_id, _ := c.GetInt64("patient_id")
|
|
156
|
+ p_ids := c.GetString("p_ids")
|
|
157
|
+ p_ids_arr := strings.Split(p_ids, ",")
|
|
158
|
+ timeLayout := "2006-01-02"
|
|
159
|
+ loc, _ := time.LoadLocation("Local")
|
|
160
|
+ theTime, err := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
161
|
+ if err != nil {
|
|
162
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
163
|
+ return
|
|
164
|
+ }
|
|
165
|
+ recordDateTime := theTime.Unix()
|
|
166
|
+ his_patient, _ := service.GetHisPatientByIdThree(his_patient_id)
|
|
167
|
+ if his_patient_id == 0 || his_patient.ID == 0 {
|
|
168
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
|
|
169
|
+ return
|
|
170
|
+ }
|
|
171
|
+ err = service.UpdateHisPrescriptionHisIDByPID(his_patient_id, patient_id, recordDateTime, c.GetAdminUserInfo().CurrentOrgId, p_ids_arr)
|
|
172
|
+ if err == nil {
|
|
173
|
+ c.ServeSuccessJSON(map[string]interface{}{
|
|
174
|
+ "msg": "关联处方成功",
|
|
175
|
+ })
|
|
176
|
+ return
|
|
177
|
+ } else {
|
|
178
|
+ c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
|
|
179
|
+ return
|
|
180
|
+ }
|
|
181
|
+}
|
172
|
182
|
|
173
|
183
|
//func (c *HisApiController) AssociationHisPrescription() {
|
174
|
184
|
// record_date, _ := c.GetInt64("record_date")
|