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