|
@@ -60,6 +60,22 @@ func HisProjectRouters() {
|
60
|
60
|
beego.Router("/api/doctorworkstation/gettemplatedetail", &HisProjectApiController{}, "Get:GetTemplateDetail")
|
61
|
61
|
beego.Router("/api/doctorworkstation/updaterecordtemplate", &HisProjectApiController{}, "Get:UpdateRecordTemplate")
|
62
|
62
|
beego.Router("/api/hispatient/gehispatient", &HisProjectApiController{}, "Get:GetHisPatient")
|
|
63
|
+
|
|
64
|
+ //获取处方打印单
|
|
65
|
+ beego.Router("/api/hispatient/getprescriptionprint", &HisProjectApiController{}, "Get:GetDoctorAdvicePrint")
|
|
66
|
+ //获取项目打印单
|
|
67
|
+ //beego.Router("/api/hispatient/getprojectprint",&HisApiController{},"Get:GetProjectPrint")
|
|
68
|
+
|
|
69
|
+ beego.Router("/api/hispatient/postprinthistemplate", &HisProjectApiController{}, "Get:PostPrintHisTemplate")
|
|
70
|
+ beego.Router("/api/gethisprinttemplate", &HisProjectApiController{}, "Get:GetHisPrintTemplate")
|
|
71
|
+ beego.Router("/api/hispatient/postprescriptiontemplate", &HisProjectApiController{}, "Get:PostPrescriptionTempalte")
|
|
72
|
+ beego.Router("/api/hispatient/getprescriptiontemplate", &HisProjectApiController{}, "Get:GetPrescriptionTemplate")
|
|
73
|
+ beego.Router("/api/hispatient/posttreatprinttemplate", &HisProjectApiController{}, "Get:PostTreatPrintTemplate")
|
|
74
|
+ beego.Router("/api/hispatient/gettreatprinttemplate", &HisProjectApiController{}, "Get:GetTreatPrintTemplate")
|
|
75
|
+ beego.Router("/api/hispatient/postchargeprinttemplate", &HisProjectApiController{}, "Get:PostChargePrintTemplate")
|
|
76
|
+ beego.Router("/api/hispatient/getchargeprinttemplate", &HisProjectApiController{}, "Get:GetChargePrintTemplate")
|
|
77
|
+ beego.Router("/api/hispatient/getallhispatient", &HisProjectApiController{}, "Get:GetAllHisPatient")
|
|
78
|
+ beego.Router("/api/hispatient/getchargeprint", &HisProjectApiController{}, "Get:GetChargePrint")
|
63
|
79
|
}
|
64
|
80
|
|
65
|
81
|
func (this *HisProjectApiController) SaveProject() {
|
|
@@ -997,3 +1013,304 @@ func (this *HisProjectApiController) GetHisPatient() {
|
997
|
1013
|
"patient": patient,
|
998
|
1014
|
})
|
999
|
1015
|
}
|
|
1016
|
+
|
|
1017
|
+func (this *HisProjectApiController) GetDoctorAdvicePrint() {
|
|
1018
|
+
|
|
1019
|
+ patient_id, _ := this.GetInt64("patient_id")
|
|
1020
|
+ record_date := this.GetString("record_date")
|
|
1021
|
+ timeLayout := "2006-01-02"
|
|
1022
|
+ loc, _ := time.LoadLocation("Local")
|
|
1023
|
+ theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
1024
|
+ recordDateTime := theTime.Unix()
|
|
1025
|
+ advicePrint, err := service.GetDoctorAdvicePrint(patient_id, recordDateTime)
|
|
1026
|
+ //
|
|
1027
|
+ doctorPorject, err := service.GetDoctorProjectItem(patient_id, recordDateTime)
|
|
1028
|
+ patient, err := service.GetBloodPatientByPatient(patient_id)
|
|
1029
|
+ //hisPatient, err := service.GetHisPatientById(patient_id)
|
|
1030
|
+ if err != nil {
|
|
1031
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1032
|
+ return
|
|
1033
|
+ }
|
|
1034
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1035
|
+ "advicePrint": advicePrint,
|
|
1036
|
+ //"hisPatient":hisPatient,
|
|
1037
|
+ "patient": patient,
|
|
1038
|
+ "doctorPorject": doctorPorject,
|
|
1039
|
+ })
|
|
1040
|
+}
|
|
1041
|
+
|
|
1042
|
+func (this *HisProjectApiController) GetProjectPrint() {
|
|
1043
|
+
|
|
1044
|
+ his_patient_id, _ := this.GetInt64("his_patient_id")
|
|
1045
|
+ hisPatient, _ := service.GetHisPatientById(his_patient_id)
|
|
1046
|
+ projectPrint, err := service.GetProjectPrint(his_patient_id)
|
|
1047
|
+ if err != nil {
|
|
1048
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1049
|
+ return
|
|
1050
|
+ }
|
|
1051
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1052
|
+ "hisPatient": hisPatient,
|
|
1053
|
+ "projectPrint": projectPrint,
|
|
1054
|
+ })
|
|
1055
|
+}
|
|
1056
|
+
|
|
1057
|
+func (this *HisProjectApiController) PostPrintHisTemplate() {
|
|
1058
|
+
|
|
1059
|
+ template_id, _ := this.GetInt64("template_id")
|
|
1060
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1061
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
1062
|
+ _, errcode := service.GetHisTemplateId(template_id, orgId)
|
|
1063
|
+ fmt.Println("errcode0-------", errcode)
|
|
1064
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1065
|
+ template := models.XtHisTemplate{
|
|
1066
|
+ TemplateId: template_id,
|
|
1067
|
+ UserOrgId: orgId,
|
|
1068
|
+ Status: 1,
|
|
1069
|
+ Ctime: time.Now().Unix(),
|
|
1070
|
+ }
|
|
1071
|
+ err := service.CreateHisTemplate(&template)
|
|
1072
|
+ if err != nil {
|
|
1073
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1074
|
+ return
|
|
1075
|
+ }
|
|
1076
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1077
|
+ "template": template,
|
|
1078
|
+ "template_id": template_id,
|
|
1079
|
+ })
|
|
1080
|
+ } else if errcode == nil {
|
|
1081
|
+
|
|
1082
|
+ template := models.XtHisTemplate{
|
|
1083
|
+ TemplateId: template_id,
|
|
1084
|
+ UserOrgId: orgId,
|
|
1085
|
+ Status: 1,
|
|
1086
|
+ Ctime: time.Now().Unix(),
|
|
1087
|
+ Mtime: time.Now().Unix(),
|
|
1088
|
+ }
|
|
1089
|
+ err := service.UpdateHisTemplate(&template)
|
|
1090
|
+ if err != nil {
|
|
1091
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1092
|
+ return
|
|
1093
|
+ }
|
|
1094
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1095
|
+ "template": template,
|
|
1096
|
+ "template_id": template_id,
|
|
1097
|
+ })
|
|
1098
|
+ }
|
|
1099
|
+}
|
|
1100
|
+
|
|
1101
|
+func (this *HisProjectApiController) GetHisPrintTemplate() {
|
|
1102
|
+
|
|
1103
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1104
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
1105
|
+ template, err := service.GetHisPrintTemplate(orgId)
|
|
1106
|
+ if err != nil {
|
|
1107
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1108
|
+ return
|
|
1109
|
+ }
|
|
1110
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1111
|
+ "template": template,
|
|
1112
|
+ })
|
|
1113
|
+}
|
|
1114
|
+
|
|
1115
|
+func (this *HisProjectApiController) PostPrescriptionTempalte() {
|
|
1116
|
+
|
|
1117
|
+ template_id, _ := this.GetInt64("template_id")
|
|
1118
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1119
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
1120
|
+ _, errcode := service.GetPrescriptionTemplate(template_id, orgId)
|
|
1121
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1122
|
+ template := models.XtHisAdviceTemplate{
|
|
1123
|
+ TemplateId: template_id,
|
|
1124
|
+ UserOrgId: orgId,
|
|
1125
|
+ Status: 1,
|
|
1126
|
+ Ctime: time.Now().Unix(),
|
|
1127
|
+ }
|
|
1128
|
+ err := service.CreatePrescriptionTemplate(&template)
|
|
1129
|
+ if err != nil {
|
|
1130
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1131
|
+ return
|
|
1132
|
+ }
|
|
1133
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1134
|
+ "template": template,
|
|
1135
|
+ "template_id": template_id,
|
|
1136
|
+ })
|
|
1137
|
+ } else if errcode == nil {
|
|
1138
|
+ template := models.XtHisAdviceTemplate{
|
|
1139
|
+ TemplateId: template_id,
|
|
1140
|
+ UserOrgId: orgId,
|
|
1141
|
+ Status: 1,
|
|
1142
|
+ Ctime: time.Now().Unix(),
|
|
1143
|
+ }
|
|
1144
|
+ err := service.UpdatePrescriptionTemplate(&template)
|
|
1145
|
+ if err != nil {
|
|
1146
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1147
|
+ return
|
|
1148
|
+ }
|
|
1149
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1150
|
+ "template": template,
|
|
1151
|
+ "template_id": template_id,
|
|
1152
|
+ })
|
|
1153
|
+ }
|
|
1154
|
+}
|
|
1155
|
+
|
|
1156
|
+func (this *HisProjectApiController) GetPrescriptionTemplate() {
|
|
1157
|
+
|
|
1158
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1159
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
1160
|
+ template, err := service.GetPrescriptionTemplateById(orgId)
|
|
1161
|
+ if err != nil {
|
|
1162
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1163
|
+ return
|
|
1164
|
+ }
|
|
1165
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1166
|
+ "template": template,
|
|
1167
|
+ })
|
|
1168
|
+}
|
|
1169
|
+
|
|
1170
|
+func (this *HisProjectApiController) PostTreatPrintTemplate() {
|
|
1171
|
+
|
|
1172
|
+ template_id, _ := this.GetInt64("template_id")
|
|
1173
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1174
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
1175
|
+ _, errcode := service.GetTreatPrintTemplate(template_id, orgId)
|
|
1176
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1177
|
+ template := models.XtHisTreatmentTemplate{
|
|
1178
|
+ TemplateId: template_id,
|
|
1179
|
+ UserOrgId: orgId,
|
|
1180
|
+ Status: 1,
|
|
1181
|
+ Ctime: time.Now().Unix(),
|
|
1182
|
+ }
|
|
1183
|
+ err := service.CreateTreatPrintTemplate(&template)
|
|
1184
|
+ if err != nil {
|
|
1185
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1186
|
+ return
|
|
1187
|
+ }
|
|
1188
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1189
|
+ "template": template,
|
|
1190
|
+ "template_id": template_id,
|
|
1191
|
+ })
|
|
1192
|
+ } else if errcode == nil {
|
|
1193
|
+ template := models.XtHisTreatmentTemplate{
|
|
1194
|
+ TemplateId: template_id,
|
|
1195
|
+ UserOrgId: orgId,
|
|
1196
|
+ Status: 1,
|
|
1197
|
+ Ctime: time.Now().Unix(),
|
|
1198
|
+ }
|
|
1199
|
+ err := service.UpdatedTreateTemplate(&template)
|
|
1200
|
+ if err != nil {
|
|
1201
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1202
|
+ return
|
|
1203
|
+ }
|
|
1204
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1205
|
+ "template": template,
|
|
1206
|
+ "template_id": template_id,
|
|
1207
|
+ })
|
|
1208
|
+ }
|
|
1209
|
+}
|
|
1210
|
+
|
|
1211
|
+func (this *HisProjectApiController) GetTreatPrintTemplate() {
|
|
1212
|
+
|
|
1213
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1214
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
1215
|
+ template, err := service.GetTreatTtreatPrintTemplate(orgId)
|
|
1216
|
+ if err != nil {
|
|
1217
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1218
|
+ return
|
|
1219
|
+ }
|
|
1220
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1221
|
+ "template": template,
|
|
1222
|
+ })
|
|
1223
|
+}
|
|
1224
|
+
|
|
1225
|
+func (this *HisProjectApiController) PostChargePrintTemplate() {
|
|
1226
|
+
|
|
1227
|
+ template_id, _ := this.GetInt64("template_id")
|
|
1228
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1229
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
1230
|
+ _, errcode := service.GetChargeTemplate(template_id, orgId)
|
|
1231
|
+ if errcode == gorm.ErrRecordNotFound {
|
|
1232
|
+ template := models.XtHisChargeTemplate{
|
|
1233
|
+ TemplateId: template_id,
|
|
1234
|
+ UserOrgId: orgId,
|
|
1235
|
+ Ctime: time.Now().Unix(),
|
|
1236
|
+ Status: 1,
|
|
1237
|
+ }
|
|
1238
|
+ err := service.CreateChargePrintTemplate(&template)
|
|
1239
|
+ if err != nil {
|
|
1240
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1241
|
+ return
|
|
1242
|
+ }
|
|
1243
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1244
|
+ "template": template,
|
|
1245
|
+ "template_id": template_id,
|
|
1246
|
+ })
|
|
1247
|
+ } else if errcode == nil {
|
|
1248
|
+ template := models.XtHisChargeTemplate{
|
|
1249
|
+ TemplateId: template_id,
|
|
1250
|
+ UserOrgId: orgId,
|
|
1251
|
+ Ctime: time.Now().Unix(),
|
|
1252
|
+ Status: 1,
|
|
1253
|
+ }
|
|
1254
|
+ err := service.UpdateChargePrintTemplate(&template)
|
|
1255
|
+ if err != nil {
|
|
1256
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1257
|
+ return
|
|
1258
|
+ }
|
|
1259
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1260
|
+ "template": template,
|
|
1261
|
+ "template_id": template_id,
|
|
1262
|
+ })
|
|
1263
|
+ }
|
|
1264
|
+}
|
|
1265
|
+
|
|
1266
|
+func (this *HisProjectApiController) GetChargePrintTemplate() {
|
|
1267
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1268
|
+ orgId := adminUserInfo.CurrentOrgId
|
|
1269
|
+ template, err := service.GetChargePrintTemplate(orgId)
|
|
1270
|
+ if err != nil {
|
|
1271
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1272
|
+ return
|
|
1273
|
+ }
|
|
1274
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1275
|
+ "template": template,
|
|
1276
|
+ })
|
|
1277
|
+}
|
|
1278
|
+
|
|
1279
|
+func (this *HisProjectApiController) GetAllHisPatient() {
|
|
1280
|
+ record_date := this.GetString("record_date")
|
|
1281
|
+ timeLayout := "2006-01-02"
|
|
1282
|
+ loc, _ := time.LoadLocation("Local")
|
|
1283
|
+ theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
1284
|
+ recordDateTime := theTime.Unix()
|
|
1285
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1286
|
+ patients, err := service.GetHisPatientList(adminUserInfo.CurrentOrgId, "", recordDateTime)
|
|
1287
|
+ if err != nil {
|
|
1288
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1289
|
+ return
|
|
1290
|
+ }
|
|
1291
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1292
|
+ "list": patients,
|
|
1293
|
+ })
|
|
1294
|
+
|
|
1295
|
+}
|
|
1296
|
+
|
|
1297
|
+func (this *HisProjectApiController) GetChargePrint() {
|
|
1298
|
+ record_date := this.GetString("record_date")
|
|
1299
|
+ timeLayout := "2006-01-02"
|
|
1300
|
+ loc, _ := time.LoadLocation("Local")
|
|
1301
|
+ theTime, _ := time.ParseInLocation(timeLayout+" 15:04:05", record_date+" 00:00:00", loc)
|
|
1302
|
+ recordDateTime := theTime.Unix()
|
|
1303
|
+ patient_id, _ := this.GetInt64("patient_id")
|
|
1304
|
+ prescription_id, _ := this.GetInt64("prescription_id")
|
|
1305
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
1306
|
+ chargePrint, err := service.GetChargePrint(recordDateTime, patient_id, adminUserInfo.CurrentOrgId)
|
|
1307
|
+ prescription, err := service.GetHisPrescriptionNight(adminUserInfo.CurrentOrgId, patient_id, recordDateTime, prescription_id)
|
|
1308
|
+ if err != nil {
|
|
1309
|
+ this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeUpdateConfig)
|
|
1310
|
+ return
|
|
1311
|
+ }
|
|
1312
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1313
|
+ "list": chargePrint,
|
|
1314
|
+ "prescription": prescription,
|
|
1315
|
+ })
|
|
1316
|
+}
|